Introduction
In-context learning (ICL) has emerged as a powerful paradigm for Large Language Models (LLMs), enabling them to perform new tasks using only a few demonstrations. However, standard causal LLMs suffer from an "information asymmetry" during ICL. Because these models process tokens sequentially, earlier demonstrations cannot benefit from the context provided by later ones. For instance, in a 4-shot prompt, the first example is essentially processed in a zero-shot manner. This causal bottleneck hinders the model's ability to fully grasp the input-label mapping across the entire set of demonstrations.
Methods: RDSCA
To address this, researchers introduced RDSCA (Repeated Demonstration with Sliding Causal Attention). This method allows models to observe all demonstrations simultaneously without breaking the causal structure learned during pre-training.
RDSCA consists of two main components:
- Repeated Demonstration (RD): Later demonstrations are duplicated and prepended to the sequence. For a 4-shot prompt ($d_1, d_2, d_3, d_4$), the input becomes $d'_2, d'_3, d'_4, d_1, d_2, d_3, d_4, q$. This ensures that when the model processes $d_1$, it has already seen the context of subsequent examples.
- Sliding Causal Attention (SCA): To prevent the model from exploiting simple shortcuts (like label repetition), a custom attention mask is used. This mask ensures the model only attends to a sliding window of $K$ unique demonstrations while keeping the
<SOS>(Start of Sequence) token always visible as a necessary anchor. If the sliding window moves past the<SOS>token, the model loses its "anchor" and performance plummets.
Evaluation
The method was evaluated using Llama models (7B to 65B) on various benchmarks, including classification tasks (SST-2, RTE, AGNews) and general knowledge (MMLU). A key focus was "Semantically-Unrelated Label" (SUL) ICL, where labels are replaced with random words to force the model to rely strictly on the provided mapping rather than prior knowledge.
Key Results and Insights
RDSCA demonstrates significant performance improvements, particularly as model scale increases. On Llama-65B, the method achieved a 10.5% average improvement over standard ICL.
Key findings include:
- Emergent Benefits: Gains are more pronounced in larger models (30B and 65B), suggesting they are better at leveraging complex contextual mappings.
- Synergy: RDSCA is compatible with other ICL enhancements like demonstration retrieval and calibration, leading to further performance boosts.
- Efficiency: By utilizing KV-caching, the overhead of repeated demonstrations is minimized during inference.
Conclusion
RDSCA effectively breaks the causal bottleneck in ICL by allowing bidirectional-like context within a causal framework. While it increases sequence length, the substantial accuracy gains—especially in large-scale models—highlight its potential for improving LLM reasoning and task adaptation. Future work may explore its application to complex Chain-of-Thought reasoning and long-form generation.
Summary updated