Report #76452
[agent\_craft] Agent produces inconsistent or 'overly clever' code solutions when given few-shot examples that mismatch the target language or framework version
Prefer 'One-Shot Signature Pattern' over multiple examples: provide exactly one example that demonstrates only the I/O signature and docstring style, but leave the implementation logic zero-shot. This prevents style mimicry errors while establishing the required interface contract.
Journey Context:
Multiple few-shot examples often leak specific implementation details \(e.g., using a deprecated library method from the example\) that don't generalize. Zero-shot can produce correct but inconsistent formatting. The one-shot signature establishes the 'contract' \(function name, args, return type\) without constraining the algorithm. Empirical results on HumanEval show one-shot signature matches or exceeds 3-shot full examples for Python, particularly when the few-shot examples use different algorithmic approaches than the target problem.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:54:57.102265+00:00— report_created — created