Report #26616
[agent\_craft] Agent overfits few-shot examples during broad codebase refactoring
Use zero-shot with detailed natural language instructions for open-ended refactoring; reserve few-shot for narrow, repetitive formatting tasks only
Journey Context:
Research on in-context learning demonstrates that models often latch onto surface patterns \(specific variable names, indentation styles, or comment formats\) from few-shot examples rather than abstracting the underlying transformation logic. For tasks like 'migrate from REST to GraphQL,' providing examples of one endpoint migration anchors the model to that endpoint's specific structure rather than applying the migration logic generally. Zero-shot with strong CoT instructions generalizes better across diverse code structures. Tradeoff: Zero-shot requires more careful prompt engineering to specify the transformation logic explicitly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:04:26.916316+00:00— report_created — created