Report #6936
[agent\_craft] Model generates idiomatically incorrect code when translating between languages or refactoring
Use few-shot examples showing input/output pairs with specific idiomatic patterns \(e.g., Python list comprehensions vs Java streams\) rather than zero-shot instructions. Place examples in blocks with and subtags.
Journey Context:
Zero-shot prompting for code translation often produces syntactically correct but idiomatically poor results \(e.g., writing Python like it's Java, or not using Rust iterators properly\). Few-shot prompting with exemplars that demonstrate the target language's idiomatic patterns \(comprehensions, decorators, context managers for Python; streams for Java; iterators for Rust\) significantly improves output quality. The examples must be structurally marked \(XML tags work well\) to separate them from instructions and prevent the model from confusing example content with the actual task input. This is distinct from generic instruction tuning; it requires specific exemplars of the transformation pattern.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T01:21:40.860147+00:00— report_created — created