Executive Summary
This consolidated paper unifies four previously separate works on context management in autoregressive language models, recast as a study of prompt structure. Nine experiments on Qwen 2.5-7B use 160 probes across four domains (code, science, medical, legal) and measure continuation perplexity; the central results are replicated on Mistral-7B-v0.3. The combined treatment reveals a coherent picture: prompt structure works through mode switching with minimal tokens, not information transfer or adaptive guidance.
From Ritual Shape (AI-20): priming sequences are remarkably compact. Just 15 tokens capture 98.8% of the full coordination benefit. Natural conversational format outperforms rigid Q&A by 0.475 nats. Repetition degrades performance (+0.07 nats per repeat). The best configuration is reset-then-prime, which lowers CE from 1.197 to 0.733, a 39% reduction relative to direct priming.
From Shepherd Agents (AI-21): meta-commentary about a domain is not just unnecessary but actively harmful. All bare shepherd strategies perform worse than no priming (storyteller -12.3%, provocateur -26.7%, director -37.1%). With reset prepended, all converge to reset-alone performance. Reset accounts for 22:1 of benefit over best shepherd content.
From Context Fences (AI-23): the garbage collector hypothesis is falsified on three counts. The correct mechanism is mode switching. Standard reset (18 tokens) achieves CE 0.503. Mode and domain compose independently: post-prime activation distance to the expert predicts CE (rho 0.858 on Qwen, 0.92 on Mistral). Reset benefit is constant at approximately 0.076 nats regardless of prior context length, and that null result replicates on Mistral (rho 0.10, p 0.87).
From Hop Scaling (AI-24): chain degradation is logarithmic, not exponential. CE rises from 0.503 at hop 1 to approximately 0.60 by hop 5, then plateaus through hop 10. Fence placement is irrelevant (fence-every-hop vs fence-final: 0.598 vs 0.597). Cross-domain handoffs outperform within-domain chains because domain discontinuity acts as natural mode reset.
Ritual Shape
Five structural features of priming sequences tested systematically. The first 15 tokens capture 98.8% of total benefit, establishing that coordination is a mode switch rather than information transfer. Natural multi-turn conversation outperforms rigid Q&A by 0.475 nats. Within-session repetition degrades by +0.07 nats per repeat. Artificially named patterns perform worse than natural vocabulary (+0.568 nats). The reset-then-prime protocol reduces CE from 1.20 to 0.733.
Shepherd Agents
Three adaptive shepherd strategies tested: storyteller (narrative framing), provocateur (challenge-based prompting), and director (explicit instruction). The more directive the shepherd, the worse the outcome. With reset prepended, all three strategies converge to the performance of reset alone. The ratio is decisive: reset accounts for 22:1 of benefit relative to the best shepherd content. The shepherd output is meta-commentary: it activates instruction-following mode rather than domain processing, and it moves layer-10 activations further from the expert than neutral priming does.
Context Fences
The garbage collector hypothesis is falsified on three counts: (1) reset benefit is constant at approximately 0.076 nats across 0 to 384 tokens of prior context, rather than scaling with it; (2) activation distance to neutral does not predict CE (rho 0.100); (3) the benefit is domain-dependent (medical 0.00, legal 0.56, code 0.30, science 0.54 nats). More clearing tokens also produce better results (rho -0.672), the opposite of what garbage collection predicts. The correct mechanism is mode switching. Mode and domain compose independently: across an 18-cell clearing-by-priming matrix, post-prime activation distance to the expert predicts CE (rho 0.858, p less than 10^-4).
Hop Scaling
Chain degradation saturates, not compounds. CE rises from 0.503 at hop 1 to approximately 0.60 by hop 5, then plateaus through hop 10. The shape is logarithmic. Fence-every-hop vs fence-final-only produces identical results (0.598 vs 0.597 at 10 hops). Cross-domain handoffs outperform within-domain chains (CE 0.56-0.63 vs 0.72) because domain discontinuity acts as natural mode reset. Per-hop degradation does not compound through 10 hops.
Key Findings
- Extreme compactness: 15 tokens capture 98.8% of coordination benefit
- Meta-commentary harmful: All bare shepherd strategies worse than no priming; reset dominates 22:1
- Mode switching, not garbage collection: Reset triggers processing mode transition, not state clearing
- Mode and domain separable: The stages compose independently; post-prime distance to expert predicts CE (rho 0.858 Qwen, 0.92 Mistral)
- Logarithmic chain degradation: CE plateaus by hop 5 through hop 10
- Cross-domain outperforms within-domain: Domain transitions force beneficial re-encoding
- Best protocol: Reset then prime — CE 0.733, 39% below direct priming
Superseded Papers
This paper consolidates and supersedes:
- AI-20: Ritual Shape — structural features of effective coordination sequences
- AI-21: Shepherd Agents — adaptive priming through directed intervention
- AI-23: Context Fences — two-phase coordination through mode switching and domain activation
- AI-24: Hop Scaling — multi-agent chain degradation saturates
Key References
In-context learning and induction heads. arXiv:2209.11895.
Function vectors in large language models. arXiv:2310.15213.
Rethinking the role of demonstrations: What makes in-context learning work? arXiv:2202.12837.
Language models are few-shot learners. Advances in Neural Information Processing Systems, 33.