Instant Context Optimization: Compiling Few-Shot In-Context Demonstrations into Pre-Trained Channel Magnitudes via Circuit-Bounded Sparse Optimization
Anonymous authors
ICLR 2027
Abstract. In-Context Learning (ICL) enables Large Language Models (LLMs) to perform tasks from a small set of demonstrations (e.g., ), but requires persistent Key-Value (KV) cache expansion and quadratic prefill latency on every forward pass. While compiling demonstrations directly into model weights would eliminate this runtime prompt tax, standard few-shot parameter optimization () is fundamentally ill-posed, causing severe overfitting and representation collapse. In this work, we propose \textbf{Instant Context Optimization (ICO)}, a framework that compiles demonstrations into task-specific static weights once per task offline, recovering the performance benefits of ICL without serving-time prompt costs. Formally framed as episodic prompt-to-weight internalization via circuit-bounded test-time distillation, ICO leverages three structural constraints exposed by the model's own in-context activation routing: (1)~\textit{Where to update:} Gradient-based parameter saliency localizes updates to sparse, task-relevant subcircuits (); (2)~\textit{How to update:} Updates are restricted to channel-wise gain modulation along fixed directional bases (), provably preserving the layerwise kernel nullspace (); and (3)~\textit{How to score updates:} Reasoning trajectories are supervised via Demonstration-Conditioned Teacher Reference Scoring with Group Minimum-Anchored Relative Advantage (). Across 38 benchmarks on models up to 27B parameters, ICO recovers (up to on GSM8K) few-shot headroom with a universal grand macro served gain in pure zero-shot setting, safeguarded by an empirical Risk-Monotonic AR validation gate.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
ICLR 2027
Under review · 3 reviews · OpenReview
Updated 24 Nov 2026, 17:04 UTC.
- Rating
- 1/4
- Confidence
- 1/4
- Soundness
- 1/3
- Presentation
- 1/3
- Informativeness
- 1/3
- Flag for ethics review
- Yes
Read review
Summary
The paper proposes Instant Context Optimization (ICO), which compiles in-context demonstrations into weights offline so the model can be served zero-shot. Each linear projection is reparameterized as , so only per-output-channel gains are trained (~1.4M parameters on Llama-3-8B). The authors report +11.25 points over base on a 9-task development suite (Llama-3-8B), +12.67 points macro over 38 tasks × 4 models (8B–27B), and serving-efficiency gains over ICL.
Strengths
The problem is practical and well motivated.
Weaknesses
The reported numbers are internally inconsistent, and some cannot be produced by the described procedure.
- AR (Eq. 8) either accepts the candidate or reverts to , so each "Gold SFT (+AR)" entry in Table 2 should match either the Gold SFT entry or the Base entry. 8 of 9 match neither. For example, mbpp is 39.80 (SFT) and 40.80 (base), yet 30.80 with AR.
- In Table 8, different models share identical results. Base GSM8K is 41.09 for three models, and the teacher GSM8K score is 53.68 for all four. The headline 107.8% headroom is computed against that shared teacher value.
Because of these inconsistencies, I cannot assess the empirical claims.
Questions for the authors
-
Please explain why several base and teacher numbers in Table 8 are identical across different models.
-
Please report LoRA, (IA), and all-linear gain SFT trained with the same LOO rollout-distillation objective and the same rollback gate as ICO.
Ethics concerns
Reads like AI slop. many unpolished places that show that the authors themselves probably never read the paper. for example, the figure 1 literally has "\textsc{where}" in the figure titles.
Research integrity: Several results are identical across different models (Table 8), and several entries cannot be produced by the procedure as described (Table 2, Gold SFT (+AR); Table 5, rows 5–6). These may be copy-paste or bookkeeping errors, but they affect the headline claims.
3 comments
I think these inconsistencies show the manuscript is under-polished and I recommend the authors to resubmit to other late venues.
Thank you for your suggestions. We appreciate that you have identified a critical bug in our paper and experiment post-processing.
- Rating
- 2/4
- Confidence
- 3/4
- Soundness
- 2/3
- Presentation
- 2/3
- Informativeness
- 2/3
Read review
Summary
ICO converts a small set of in-context demonstrations into channel-wise gain parameters, enabling demonstration-free inference through saliency probing, trajectory supervision, and rollback gating.
Strengths
The motivation for demonstration-free inference is practically relevant, and the paper evaluates both inference efficiency and task performance.
Weaknesses
-
All four models used in the main experiments were released in 2024–2025. Including models released in 2026 would strengthen the empirical evaluation and help establish the method’s applicability to more recent models.
-
The primary baselines, LoRA and (IA)³, both date back to 2022. For an ICLR 2027 submission, comparisons against these methods alone are insufficient to establish competitiveness with recent approaches. I recommend including methods introduced within the past two years.
-
The authors use Leave-One-Out (LOO) to generate candidate reasoning traces and assign rewards based on the difference in log probabilities with and without demonstrations. However, this reward measures the extent to which the demonstration context supports a candidate answer, rather than the correctness of the answer itself. Consequently, an incorrect reasoning trace may still receive a high weight if it is strongly supported by the demonstrations.
-
Theorem 1 establishes that scaling by a positive diagonal matrix preserves the null space of an individual linear projection. However, null-space preservation does not imply preservation of the model’s functional behavior. Even if the null space of each linear layer remains unchanged, interactions with attention, nonlinear activations, and residual connections may still lead to substantial changes in the model’s outputs.
-
The methodology section would benefit from an overview diagram illustrating the complete workflow. This would help readers understand how the individual components fit together and improve the clarity of the presentation.
Questions for the authors
-
Could the authors add at least one model released in 2026 and two to three baseline methods introduced in 2026? For an ICLR 2027 submission, evaluation on current models and comparisons against recent methods are essential to establishing the approach’s relevance and competitiveness.
-
In Appendix Table 5, adding AR decreases Raw Accuracy from 48.95% to 45.86%. Could the authors explain this degradation and clarify why AR negatively affects performance in this setting?
2 comments
Thanks for your actionable suggestions.
1. Weaknesses 1 & 2 and Question 1: Gemma-4-E4B and Recent PEFT Baselines for rebuttal revisions.
-
google/gemma-4-E4B(released in 2026;§ 4.4, Table 3 & Appendix Tables 13, 16–17): Across the 9-task 5-category suite without per-task tuning (; Appendix Table 10), ICO improves zero-shot accuracy from41.70%(Base) to48.19%Compiled48.32%Served(+6.62%,31.4%headroom over the62.81%teacher, ), including+23.53%onbbh_causal_judgementand+10.08%ongsm8k(expanding the full evaluation to 7 models / 237 runs from4Bto32B). -
Recent Baselines (
VeRA,DoRA,AlphaEdit-LoRA, plus 2-roundSimPO/GRPO/DPOandRIM-10%masking;§ 4.2,§ 4.3, Table 2, Figure 2a & Appendix Tables 6, 13): Under the identical LOO distillation + AR pipeline onMeta-Llama-3-8B(9 tasks):LoRA(, ):29.07% -> 43.22%|(IA)^3():43.01% -> 48.05%VeRA(, ):44.35% -> 44.90%AlphaEdit-LoRA(, ):44.22% -> 47.07%DoRA(, ):45.09% -> 49.09%ICO( + TIES, ):45.86% -> 50.68%(and46.16% -> 51.54%at )
Finding: Nullspace projection (
AlphaEdit-LoRA) and magnitude-direction decoupling (DoRA) recover to raw accuracy over standardLoRA, independently corroborating our subspace/magnitude hypothesis, while ICO outperforms both at – smaller BF16 footprint. Unlike prompt-hypernetwork compilers (e.g., Generative Adapters, Chen et al., 2025) that require multi-task meta-training corpora or token-level weight patches (Goldwaser et al., 2026), ICO compiles directly from an off-the-shelf model and examples (§ 5).
2. Weakness 3: Leave-One-Out Log-Probability Lift vs. Answer Correctness
We clarify in § 3.2, § 4.5, § 7, and Appendix § B.2 that measures contextual support from rather than exact correctness, because programmatic verifiers are unavailable on general NLP tasks and sparse binary rewards vanish when all rollouts miss hard problems. ICO mitigates supported-but-incorrect traces via three mechanisms: (1) anchoring every update on ground-truth with weight , (2) pruning prompt-specific sign conflicts via trimming and Vector-TIES sign consensus (§ 3.3), and (3) rejecting degraded checkpoints via held-out validation loss and logit margin (Eq. 8), with teacher lift governing rollout signal-to-noise (Figure 4b) and optional compile-time ast.parse() filtering for small code models (§ 4.5, Appendix § B.2).
3. Weaknesses 4 & 5 and Question 2: Multi-Layer Theory, Workflow Overview, and v1 Appendix Table 5
- W4 (Multi-layer functional behavior): Addressed via Theorem 1(b) (
§ 2.2, Eq. 3; Appendix § A.4, Lemmas A.1–A.4), bounding -layer non-linear hidden-state shift and output KL divergence acrossRMSNorm, attention,SwiGLU, and residual connections. - W5 (Workflow overview in Methodology): Added concise end-to-end pseudocode with explicit
[Phase 1]–[Phase 3]stages in Algorithm 1 (§ 3, page 5) alongside Figure 1 (§ 1, page 2) and Table 1 (§ 1, page 3) showing how Phase 1 (LOO saliency), Phase 2 (LOO rollout distillation +SparseAdamW), and Phase 3 (TIES merging + validation rollback + zero-overhead folding) fit together. - Q2 (Why v1 Appendix Table 5 dropped from
48.95%to45.86%Raw with AR): AR never modifies the raw checkpoint; the drop in v1 came from copy-pasting Rows 1–5 from an un-gated run (48.95%) next to Row 6 from the held-out split (45.86% -> 50.68%). In revised Appendix Table 12 (Figure 2b), Rows 5 and 6 share the exact same checkpoint (45.86%Compiled50.68%Served,+4.82%fallback gain).
Thank you for the clarifications and additional experiments. The expanded evaluation and corrected AR comparison address several of my concerns. However, two points remain: (1) please provide evidence that higher log-probability lift correlates with answer correctness, ideally with a uniform-weighting baseline; and (2) please clarify whether the new theoretical bound is informative at the gain magnitudes used in practice, as bounded output changes do not necessarily imply functional preservation.
- Rating
- 1/4
- Confidence
- 3/4
- Soundness
- 1/3
- Presentation
- 1/3
- Informativeness
- 1/3
Read review
Summary
The paper proposes a framework that compiles demonstrations into task-specific static weights once per task offline, based on the authors' observations of three structural constraints revealed by the model's in-context activation routing.
Strengths
The research question itself that the paper aims to address is meaningful.
Weaknesses
1. The paper is very hard to read, and many important concepts and claims are not sufficiently explained. I list only a few issues that I found even in the first two pages:
- There are too many mathematical notations (like D, m, r, sigma) introduced in the abstract without proper definitions. Some of these notations are still not clearly explained in the introduction.
- The term "few-shot headroom" is introduced without any explanation. As far as I know, this is not a standard metric.
- In line 43, the authors strongly claim that "classical fine-tuning under extreme data scarcity is fundamentally ill-posed" without providing a supporting citation or sufficient justification at that point.
- The text in Table 1 is too small to read comfortably, especially in a printed copy.
- What is
diff_botin line 81? The cited paper by Shao et al. (2024) does not use the term "Group Minimum-Anchored Relative Advantages." - It is difficult to understand what "Provably Bounded" means in the last entry of Table 1. What exactly is being bounded?
These are only a few examples. I found the paper difficult to follow, even after considerable effort. The presentation makes it difficult to assess the technical contributions and the validity of the claims.
2. The theoretical result in Theorem 1 is trivial and does not provide meaningful theoretical insight.
The authors parameterize the adapted weights as . This directly implies the conclusion in line 149, which follows from elementary linear algebra.
Moreover, this result is purely a consequence of the chosen parameterization and is independent of the optimization procedure. It does not establish any guarantees regarding optimization, generalization, or the prevention of representation collapse. Therefore, I find it difficult to see what meaningful theoretical contribution Theorem 1 provides.
Questions for the authors
1. Why is the problem fundamentally ill-posed under extreme data scarcity?
In line 112, the authors claim that compiling demonstrations into adapted weights is severely ill-posed when the ambient dimension vastly exceeds the sample size . Where does this number come from? More importantly, why does this condition imply that the problem is fundamentally ill-posed? Could the authors provide a high-level explanation of the underlying assumptions?
2. Why are binary masks considered brittle?
In line 125, the authors state that "rather than applying brittle binary masks, defines a continuous saliency-inverse proximal threshold." What exactly makes binary masks brittle in this setting, and why is the proposed continuous threshold preferable?
3 comments
Thanks for your actionable suggestions
1. Weakness 1: Presentation, Notation, Metrics, Citations, diff_bot, and Table 1
- Zero-symbol Abstract & defined notation: Removed all math symbols (
D, m, r, sigma) from the Abstract and defined every variable in words on first use in§ 1–§ 3. - Few-shot headroom: Defined at first mention in the Abstract ("the accuracy gap between the zero-shot base model and the few-shot prompted model") and formalized in
§ 4.1. - Citations for fine-tuning: Grounded in
§ 1–§ 2(kumar2022fine,liu2022fewshot,wainwright2019high) via the rank- empirical loss Jacobian . diff_botvs. Shao et al. (2024): Clarified in§ 1,§ 3.2, and§ 4.3thatdiff_bot() is our minimum-baseline formulation, contrasting it against Shao et al. (2024)'s mean-centered GRPO advantage, which assigns negative weights to half of a small rollout group and degrades accuracy (Figure 2c, Appendix Table 15).- Table 1 legibility & "Provably Bounded": Formatted Table 1 (page 3) at native
\footnotesizewithout\resizebox, and replaced "Provably Bounded" with the explicit quantities:ker(W_0) invariant (Prop. 1); l2 O(eta * T_max * sqrt(d_eff)), KL O(eta^2 * T_max^2 * d_eff) (Thm. 1)(with a symbol key in the caption).
2. Weakness 2: Triviality of v1 Theorem 1
We agree that is an elementary linear-algebraic property of parameterization rather than an optimization or multi-layer guarantee. We demoted it to Proposition 1 and proved a substantive two-part Theorem 1 (§ 2.2, Appendix § A.3–A.4, Lemmas A.1–A.4):
- Theorem 1(a) (Optimizer Dynamics): Under zero-mean gradient noise on inactive channels, dense AdamW normalization cancels noise scale and induces parameter drift, whereas
SparseAdamW(soft thresholding + momentum reset) keeps inactive channels with at an exact fixed point (), confining updates to (Eq. 2). - Theorem 1(b) (-Layer Non-Linear Perturbation): Composing Lipschitz bounds across pre-norm
RMSNorm, GQASoftmaxattention,SwiGLUMLPs, and residual streams bounds Layer- max-token hidden shift by (Eq. 3) and next-token KL divergence by , tightening worst-case drift by ( in KL) over dense updates.
3. Questions 1 & 2: Ill-Posedness and Soft Thresholding vs. Binary Masks
- Q1 ( & assumptions,
§ 2& Appendix § A.1): Around , demonstration losses linearize via with , leaving a nullspace of dimension where updates fit demonstrations to first order () while perturbing unseen test inputs. The rate stems from sparse linear recovery under Restricted Isometry Properties (Wainwright, 2019); we explicitly note in§ 2and Appendix § A.1 that non-linear Transformers do not satisfy RIP and use only to explain why uninformed support search fails at , motivating -shot saliency as an informed prior. - Q2 (Why binary masks underperform soft thresholding,
§ 2.1, Figure 2a & Appendix Table 6): (i) Fixing a step-0 binary top- mask (RIM-10%) permanently freezes of channels, starving secondary channels recruited during multi-step rollouts and reducing 4-task BBH accuracy by17.49points (47.10%Soft ICO vs.29.61%RIM-10%; Appendix Table 6); (ii) dynamic hard top- jumps discontinuously at rank ties, destabilizing Adam moments; (iii) weighted soft thresholding (Eq. 1) is continuous (1-Lipschitz), suppressing low-saliency noise by up to while letting strongly driven channels enter smoothly.
Thank you for the detailed response. I appreciate the authors' acknowledgment that the original Theorem 1 follows from the chosen parameterization. While the revisions are helpful, I remain unconvinced that they sufficiently address my concerns about the theoretical contribution and the overall clarity of the presentation. I therefore maintain my original score.
Thanks for your last suggestion.
Comments on the paper
1 comment
General Response
We thank Reviewers Emgs, 4bEg, and 2Y81 for their candid, detailed feedback. We take full responsibility for the dense presentation and table-assembly bugs in the initial submission. We have substantially revised the paper along four aspects:
-
Concise, finding-focused Machine Learning presentation (Reviewers Emgs, 2Y81, 4bEg):
- Rewrote the Title and Abstract without mathematical symbols, defined few-shot headroom in plain English at first mention, framed the Three-Fold Structured Inductive Bias (where to update, how to update, how to score updates;
§ 1–§ 3, Figure 1) in standard ML terms (per-channel output scaling, saliency-weighted soft thresholding, leave-one-out rollout distillation, sign-consensus merging, validation rollback), and restructured§ 4 Experiments(§ 4.1–§ 4.5) to pair two compact main-text anchor tables (Tables 2–3) with finding-focused prose and non-redundant multi-panel trend figures (Figures 2–4) while relocating granular task/scenario score tables toAppendix B–C. - Added concise end-to-end pseudocode (Algorithm 1,
§ 3, page 5), formatted Table 1 (§ 1, page 3) at native\footnotesizewithout\resizebox, moved the 228-run (4B–32B) phase-space regime analysis, threshold-free prompt-lift curve, qualitative case studies, and deployment takeaways (Figure 4,§ 4.5, pages 9–10) into the main text so§ 6 Conclusionfinishes cleanly at the bottom of page 10 (followed on page 11 by§ 7 Limitations,Ethics Statement,Reproducibility Statement, and an Appendix roadmap in Table 4), condensed the Appendix from 27 to 7 pages (Appendix A–C, Tables 5–17), and generated Figures 1–4 with Type 42 vector fonts (0LaTeX warnings or overfull boxes).
- Rewrote the Title and Abstract without mathematical symbols, defined few-shot headroom in plain English at first mention, framed the Three-Fold Structured Inductive Bias (where to update, how to update, how to score updates;
-
Fix manual copy-paste bugs and model names (Reviewer 2Y81 Ethics Flag & Q1; Reviewer 4bEg Q2): We used unsloth/gemma-* and google/gemma-* interchangeably across two machines, which caused the scripts to fall back to Llama-3-8B defaults. Every numerical inconsistency traced to the fallback or manual LaTeX copy-paste across splits/templates in the Appendix.
-
Controlled PEFT baselines and expanded model evaluation (Reviewers 4bEg, 2Y81 Q2):
- Evaluated
LoRA(),(IA)^3,VeRA(),DoRA(),AlphaEdit-LoRA(), and unregularizedAll-Linear Gain + LOO() onMeta-Llama-3-8Bunder the same leave-one-out rollout-distillation objective and rollback gate (§ 4.2, Table 2, Figure 3a, Appendix Tables 11, 13). - Evaluated
google/gemma-4-E4B(4.5B, released in 2026) alongside expanding the full 38-task suite from 4 to 6 models (4B–32B, 228 full-suite runs; 7 models / 237 evaluations total): onGemma-4-E4B, zero-shot accuracy improves from41.70%to48.19%Compiled48.32%Served(+6.62%,31.4%headroom, ;§ 4.4, Table 3, Appendix Tables 13, 16–17).
- Evaluated
-
Optimizer- and depth-aware theory replacing v1 Theorem 1 (Reviewers Emgs, 4bEg):
- Moved single-layer kernel preservation to Proposition 1 (explicitly noted as a necessary rather than sufficient condition) and proved a two-part Theorem 1 (
§ 2.2, Appendix § A.2–A.4): (a)SparseAdamWkeeps inactive channels at an exact fixed point whereas dense AdamW induces scale-invariant step noise, and (b) composing Lipschitz bounds across pre-normRMSNorm, causalSoftmaxattention, andSwiGLUblocks bounds Layer- hidden-state drift by and next-token KL divergence by .
- Moved single-layer kernel preservation to Proposition 1 (explicitly noted as a necessary rather than sufficient condition) and proved a two-part Theorem 1 (
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
Thank you for actionable suggestions.
1. Question 1: Identical Base and Teacher Numbers Across Models in v1 Table 8
As documented in Row 1 above, we used unsloth/gemma-* and google/gemma-* interchangeably across two machines, which caused the scripts to fall back to Llama-3-8B defaults (
41.09% / 53.68%on GSM8K,11.33%on MGSM,31.34% / 63.21%on BBH,69.05% / 68.62%on LongBench; note that on MBPP 0-shot,Gemma-2-9Bgenuinely scores204/500 = 40.80%, matchingLlama-3-8B, whereas its 3-shot Teacher is53.80%vs.49.80%). DividingGemma-2-9B's authentic54.66%GSM8K score byLlama-3-8B's53.68%Teacher produced the erroneous107.8%headroom. Below are the corrected GSM8K and 38-task macro numbers across the 4 core models (Table 3, Figure 3b, full 5-scenario × 7-model breakdown in Appendix Table 16):Base / TeacherICO(Headroom)Base / TeacherCompiled / ServedMeta-Llama-3-8B41.09% / 53.68%50.64%(75.9%)31.66% / 61.89%38.98% / 40.31%Gemma-2-9B21.38% / 68.61%54.66%(70.5%)38.19% / 67.78%41.64% / 47.37%Gemma-3-12B-PT40.26% / 74.07%59.74%(57.6%)40.66% / 67.31%47.92% / 50.23%Gemma-3-27B-PT63.00% / 80.82%71.57%(48.1%)48.66% / 74.74%53.02% / 55.04%2. Question 2:
LoRA,(IA)³, and All-Linear Gain SFT Under Identical LOO Rollout Distillation and Rollback GateWe trained
LoRA(r=8),(IA)^3, unregularizedAll-Linear Gain + LOO(τ0=0, no soft thresholding or TIES), and recent PEFT methods onMeta-Llama-3-8Bwith the same LOO rollout-distillation objective (S=8,diff_bot, λgold=2.0) and rollback gate (+AR) (Table 2, Figure 3a, scenario and per-task scores in Appendix Tables 11, 13):Meta-Llama-3-8B, Same LOO + AR)Compiled / +ARCompiled / +AR039.43%(Base) /62.26%(ICL)31.66%(Base) /61.89%(ICL)1.38M(2.75 MB)41.99% / 42.32%LoRA(r=8) + LOO + AR20.97M(41.94 MB)29.07% / 43.22%37.23% / 41.80%(IA)^3+ LOO + AR0.52M(1.05 MB)43.01% / 48.05%38.07% / 39.43%1.38M(2.75 MB)46.16% / 51.54%ICO(τ0=0.10 + TIES, Ours)1.38M(2.75 MB)45.86% / 50.68%38.98% / 40.31%Core Findings (
§ 4.2):LoRAand(IA)^3: Under identical LOO supervision and rollback gating, both 1D channel-gain variants (51.54%and50.68%) beatLoRA(43.22%) and(IA)^3(48.05%) on the 9-task suite, avoidingLoRA's severe raw collapse on few-shot math/code (29.07%Raw). Across all 38 tasks, ICO achieves the highest rawCompiledaccuracy (38.98%), whileLoRA + ARreaches41.80%(via rank-8 capacity on symbolic BBH tasks once collapsed runs revert toBase) at 15.2× larger adapter memory.+8.36%to+9.22%overDirect SFT 1D(41.99% -> 42.32%). When S=8 rollouts provide dense supervision, unregularized τ0=0 slightly increases multi-round plasticity (51.54%vs.50.68%), whereas τ0=0.10 curbs raw drift on boolean/cross-lingual tasks, improves S=0 compilation (+3.19%, Appendix Table 12), and confines updates to ≤10% of channels. Both are compared side-by-side in Table 2 and Appendix Table 13.