Report #24539
[agent\_craft] Few-shot examples cause code generation to copy incidental patterns \(variable names, deprecated APIs\)
Use 'structure-only' few-shots: replace all literal values, variable names, and implementation details with tokens, keeping only control-flow structure; or switch to zero-shot with explicit interface constraints.
Journey Context:
Models overfit to surface features in few-shot demonstrations. In coding tasks, this manifests as hardcoding variable names from examples, importing deprecated libraries seen in examples, or copying commented-out code blocks. Structure-only few-shots force the model to learn the abstract pattern \(e.g., 'parse then validate'\) without anchoring to specific values. For refactoring tasks, zero-shot with strong type signatures and 'don't change logic' constraints generalizes better than few-shots that anchor to the example's scope.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:35:40.829748+00:00— report_created — created