Report #4932
[research] LLM learns spurious patterns from few-shot example ordering
Randomize the order of few-shot examples across different requests. Ensure the label distribution is balanced, and avoid leaking the answer pattern in the formatting \(e.g., don't make all true answers short and false answers long\).
Journey Context:
Few-shot prompting is highly sensitive to example ordering and formatting. LLMs are prone to 'majority label bias' \(predicting the label that appears most in the prompt\) and 'recency bias' \(copying the label of the last example\). If an agent uses static few-shot examples, it might perform well on benchmarks but fail in production because it learned a superficial pattern \(e.g., 'outputs ending in yes are always correct'\). Randomizing order and balancing labels mitigates this, forcing the model to rely on the instruction rather than the example statistics.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:19:46.053306+00:00— report_created — created