Skip to content

ICML papers

Search ICML papers by title, author, or track. Open a paper’s abstract to read more.

Explore the ICML analysis

Search results

2,741–2,760 of 2,958

  • ICML · Workshop · 2nd Workshop on Compositional Learning: Safety, Interpretability, and Agents

    Reasoning as State Transition: A Representational Analysis of Reasoning Evolution in Large Language Models

    Siyuan Zhang, Jialian Li, Yichi Zhang, Xiao Yang, Yinpeng Dong, Hang Su

    Abstract

    Large Language Models have achieved remarkable performance on reasoning tasks, motivating research into how this ability evolves during training. Prior work has primarily analyzed this evolution via explicit generation outcomes, treating the reasoning process as a black box and obscuring internal changes. To address this opacity, we introduce a representational perspective to investigate the dynamics of the model's internal states. Through comprehensive experiments across models at various training stages, we discover that post-training yields only limited improvement in static initial representation quality. Furthermore, we reveal that, distinct from non-reasoning tasks, reasoning involves a significant continuous distributional shift in representations during generation. Comparative analysis indicates that post-training empowers models to drive this transition toward a better distribution for task solving. To clarify the relationship between internal states and external outputs, statistical analysis confirms a high correlation between generation correctness and the final representations; while counterfactual experiments identify the semantics of the generated tokens, rather than additional computation during inference or intrinsic parameter differences, as the key driver of the transition. Collectively, we offer a novel understanding of the reasoning process and the effect of training on reasoning enhancement, providing valuable insights for future model analysis and optimization.

    Abstract source
  • ICML · Workshop · 2nd Workshop on Compositional Learning: Safety, Interpretability, and Agents

    Separable Representations of Task Complexity and Deliberation in Reasoning Language Models.

    Xuan-Quang Nguyen, Hieu Vu, Dung Viet Nguyen, Hai T Luu, Linh D Tran, Tan Nguyen

    Abstract

    Reasoning-capable large language models (LLMs) produce explicit chain-of-thought (CoT) traces that scale with problem difficulty. While essential for complex reasoning, this behavior introduces unnecessary latency on simpler tasks. Traditional methods for shortening CoT, such as "think fast" prompting, often degrade accuracy on difficult problems. This paper investigates whether a targeted intervention is possible by examining how models internally represent task complexity and allocate reasoning length before generation begins. We demonstrate that task complexity is encoded with non-linear ordinal structure in pre-reasoning residual-stream activations. PCA visualizations reveal a U-shaped ordinal structure consistent with a continuous complexity gradient, which a non-linear probe can classify above chance. We then extract a "deliberation-associated" direction via contrastive prompting and apply a nullspace projection against confound directions to remove components like instruction compliance and style framing. Using a geometric alignment test, we find no evidence of geometric entanglement between the purified direction and the non-linear structure of complexity assessment. Finally, we test this separation through activation steering: negative steering along the purified direction reduces reasoning tokens by up to 22% on MATH-500 and GPQA-Diamond, with smaller effects on code generation and accuracy preserved within ~1% on most settings. Our results indicate that deliberation extent and task complexity occupy separable representational subspaces, enabling targeted modulation of LLM deliberation.

    Abstract source
  • ICML · Workshop · 2nd Workshop on Compositional Learning: Safety, Interpretability, and Agents

    Spatial Compositional Counterfactuals in Concept Bottleneck Models

    Ran Eisenberg, Ofir Lindenbaum

    Abstract

    Concept Bottleneck Models (CBMs) decompose images into semantic concepts to make predictions interpretable, but in doing so, they collapse the images' spatial structure. Counterfactual CBMs identify which concepts must change to alter the model's prediction, but they do not explain their spatial attribution. We introduce the Would-Have-Expected Concept Bottleneck Model (WHE-CBM), a spatial CBM that represents concepts and learns a counterfactual editor over those maps. Given a target object and desired class, the editor predicts a sparse continuous concept-logit delta whose sign, magnitude, and spatial support specify which semantic components must increase or decrease, and where, to flip the prediction. Across concept-controlled, label-free, and object-centric benchmarks, WHE-CBM improves counterfactual validity and sparsity over CF-CBM, localizes edit mass to the target object, and preserves non-target RoIs in multi-object scenes.

    Abstract source
  • ICML · Workshop · 2nd Workshop on Compositional Learning: Safety, Interpretability, and Agents

    Mitigating Over-Personalization in Language Models via Structured Memory

    Abdal Hakeem Hannoon, Andrew Zhao, Mihir Narayan, Sharvin Goyal, Ivaxi Sheth

    Abstract

    Conversational language models now ship with persistent user memory, prepended to the system prompt as a flat textual list. Recent work has shown this format induces cross-domain leakage and memory-induced sycophancy. We investigate representation-level mitigations: reorganizing the same memory set at inference time into modular, domain-structured representations -- fixed-domain partitions, dynamic partitions, or a two-level memory tree -- without changing the underlying model or memory content. On PersistBench across seven frontier models, fixed partitioning reduces cross-domain leakage in six of seven models, while dynamic partitioning improves all seven and lowers leakage by $~8.8\%$ on average relative to the flat baseline, while preserving desired personalization. These transformations also stack on top of some prompt-based defenses. Our results indicate that imposing compositional structure on the memory block is a useful inductive bias for how models integrate persistent context, and motivate further work on structured memory representations.

    Abstract source
  • ICML · Workshop · 2nd Workshop on Compositional Learning: Safety, Interpretability, and Agents

    Language Elicits Emergent Symbol Processing in Vision Foundation Models

    Jung-Chun Liu, Naihao Deng, Joyce Chai

    Abstract

    Compositional reasoning requires a model to combine linguistic constituents and visual entities into task-relevant intermediate structures. A common assumption holds that reasoning resides in language models, while vision foundation models (VFMs) are treated as feature extractors. We ask whether symbolic mechanisms can emerge inside the visual stream. We train a language-conditioned vision transformer and introduce predicates as labels to measure whether layer-wise visual geometry tracks question-derived semantic conditions. We find that the visual stream develops a three-stage mechanism: 1) feature binding segregates scenes containing the referenced entity at the middle layer, 2) object grounding resolves the binding cluster into object-level substructure at the later layer, and 3) answer matching repartitions representations into answer-aligned groups at the final layer. Representational similarity analysis (RSA) and activation patching support this hierarchy, suggesting that language-conditioned vision encoders can instantiate symbol-like processing as query-dependent geometric organization.

    Abstract source
  • ICML · Workshop · 2nd Workshop on Compositional Learning: Safety, Interpretability, and Agents

    CLIP Models Generalize Less Than Compositional Benchmarks Suggest

    Shuman Peng, Arnas Uselis, Darina Koishigarina, Martin Ester, Seong Joon Oh

    Abstract

    Compositional benchmarks track progress on CLIP-based compositional reasoning. Each new method reports higher scores than the last, but it is unclear whether the improvements reflect generalization to novel bindings or memorization of bindings already seen during training. To find out, we run two analyses: a synthetic ground-truth study with curated fully-seen, partially-unseen, and fully-unseen binding splits; and extension to three real compositional benchmarks (ARO VG-A, BiVLC, VisMin) using binding-overlap with COCO as a proxy for the alignment-training distribution. On the synthetic dataset, accuracy drops monotonically from fully-seen to fully-unseen across nine CLIP backbones. On ARO VG-A, positive captions overlap COCO bindings nearly twice as often as their attribute-swapped negatives ($79.8\%$ vs.\ $41.8\%$); only $1.2\%$ of samples have no COCO-overlapping bindings. Restricting evaluation to the splits where this asymmetry vanishes by construction (those where all or none of the bindings overlap COCO) reorders the leaderboard and produces a rank-flip among models. The accuracy drop from seen to unseen bindings broadly replicates on BiVLC and VisMin, though with greater noise. Compositional benchmarks should report performance on these shortcut-free splits; otherwise reported improvements overstate how much CLIP has learned to bind.

    Abstract source
  • ICML · Workshop · 2nd Workshop on Compositional Learning: Safety, Interpretability, and Agents

    How Many Features Can a Language Model Store Under the Linear Representation Hypothesis?

    Nikhil Garg, Jon Kleinberg, Kenny Peng

    Abstract

    We introduce a mathematical framework for the linear representation hypothesis (LRH), which asserts that intermediate layers of language models store features linearly. We separate the hypothesis into two claims: linear representation (features are linearly embedded in neuron activations) and linear accessibility (features can be linearly decoded). We then ask: How many neurons $d$ suffice to both linearly represent and linearly access $m$ features? Classical results in compressed sensing imply that for $k$-sparse inputs, $d = O(k\log (m/k))$ suffices if we allow non-linear decoding algorithms (Candes and Tao, 2006; Candes et al., 2006; Donoho, 2006). However, the additional requirement of linear decoding takes the problem out of the classical compressed sensing, into linear compressed sensing. Our main theoretical result establishes nearly-matching upper and lower bounds for linear compressed sensing. We prove that $d = \Omega_\epsilon(\frac{k^2}{\log k}\log (m/k))$ is required while $d = O_\epsilon(k^2\log m)$ suffices. The lower bound establishes a quantitative gap between classical and linear compressed setting, illustrating how linear accessibility is a meaningfully stronger hypothesis than linear representation alone. The upper bound confirms that neurons can store an exponential number of features under the LRH, giving theoretical evidence for the ``superposition hypothesis'' (Elhage, 2022). The upper bound proof uses standard random constructions of matrices with approximately orthogonal columns. The lower bound proof uses rank bounds for near-identity matrices (Alon, 2023) together with Tur\'an's theorem (bounding the number of edges in clique-free graphs). We also show how our results do and do not constrain the geometry of feature representations and extend our results to allow decoders with an activation function and bias.

    Abstract source
  • ICML · Workshop · 2nd Workshop on Compositional Learning: Safety, Interpretability, and Agents

    Count Me If You Can: Geometric Failure Modes in Language Model Counting

    Nicholas Bai, Ayushi Mehrotra

    Abstract

    Large language models often count accurately at small magnitudes but fail systematically as the target count grows. We study this failure mode in two 30B-scale models and find that high-count errors are not explained by missing information: count remains linearly recoverable from internal activations even when the model predicts incorrectly. Instead, counting failure coincides with a geometric transition in the residual stream. Small counts form clean, well-separated trajectories, while large counts become compressed, higher-dimensional, and unstable near readout -- we observe adjacent high-count centroids are $3$--$6\times$ closer than low-count centroids. This exposes a gap between internal recoverability and native decodability. Causal ablations further implicate late-layer MLP sub-blocks as a source of high-count degradation: suppressing these components improves high-count accuracy by up to $20\%$ while preserving low-count performance. These results reframe symbolic counting failures as failures of representational geometry and readout compatibility.

    Abstract source
  • ICML · Workshop · 2nd Workshop on Compositional Learning: Safety, Interpretability, and Agents

    Fixed-Point Reasoning: Stable and Adaptive Deep Looped Models

    Sajad Movahedi, Shlomo L Feigin, Vera Milovanović, Alexander Theus, Thomas Hofmann, Valentina Boeva, T. Konstantin Rusch, Antonio Orvieto

    Abstract

    Looped-in-depth architectures provide an inductive bias toward learning step-by-step procedures for tasks that require compositional reasoning. The effective depth reached by looping determines the quality of the solution. Similar to deep architectures, looped architectures are prone to signal propagation issues as the halting decision is postponed. In this paper, we address these signal propagation issues by using pre-norm layers and residual scaling. Furthermore, we propose FPRM: a Fixed-Point Reasoning Model that uses fixed-point convergence as an end-to-end halting mechanism in a looped architecture. We show that fixed-point halting allows FPRM to adapt its compute to the difficulty of the task. FPRM proves effective on common reasoning benchmarks, namely Sudoku, Maze, and state tracking.

    Abstract source
  • ICML · Workshop · Statistical Frameworks for Uncertainty in Agentic Systems

    NEXUS: A Multi-Agent Agentic Workflow for Valid SysML v2 Model Generation from Unstructured Industrial Documentation

    Oscar Berg, Christoph Klaassen

    Abstract

    The increasing complexity of modern cyber-physical systems necessitates Model-Based Systems Engineering, yet the practical adoption of SysML v2 remains hindered by high manual effort and steep linguistic learning curves. Existing AI-assisted approaches address only clean natural-language prompts or fragmented model fragments rather than the unstructured multi- page technical PDFs prevalent in industrial practice. This paper presents NEXUS (Neural EXtraction for Unified Systems engineering), a multi-agent agentic workflow for the semi-automated generation of formally valid SysML v2 models directly from unstructured technical documentation. The architecture decomposes the modeling process into three specialized agents: an Extraction Agent that transforms legacy PDFs into structured JSON representations of system hierarchy, connectivity, and behavior; a Building Agent that incrementally constructs SysML v2 code across three distinct phases with compiler-in-the-loop validation; and a Verification Agent that ensures semantic and structural integrity. Evaluation on a corpus of eight industrial-grade documents demonstrates that NEXUS achieves 100 % syntactic validity across all configurations, compared to 38 % for a state-of-the-art one-shot baseline, while reducing hallucination by a factor of 2.4. The proposed approach generalizes robustly across open-weight and proprietary backbone models, and incorporates human-in-the-loop oversight at every pipeline stage, providing a scalable and verifiable pathway for industrial MBSE adoption.

    Abstract source
  • ICML · Workshop · Statistical Frameworks for Uncertainty in Agentic Systems

    Goal-Optimal Agents Necessarily Learn Predictive World Models in POMDPs with episodic resets

    Keshav Goyal, suraj yadav

    Abstract

    We extend the recent "General agents contain world models" result of Richens et al.\ (2025) from fully observable MDPs to partially observable settings under the assumption of episodic resets. Using resets to regenerate histories and enable repeated probing, we show that any agent optimal on a sufficiently rich class of goals must implicitly encode a predictive model of its environment's observation dynamics. This extraction is robust to imperfect resets: accepting approximate neighborhoods of a target belief state rather than regenerating histories exactly introduces only a small, bounded error while yielding an exponential reduction in sample complexity.

    Abstract source
  • ICML · Workshop · Statistical Frameworks for Uncertainty in Agentic Systems

    Trace Length is a Simple Uncertainty Signal in Reasoning Models

    Siddartha Devic, Charlotte Peale, Arwen Bradley, Sinead Williamson, Preetum Nakkiran, Aravind Gollakota

    Abstract

    Uncertainty quantification for LLMs is a key research direction towards addressing hallucination and other issues that limit their reliable deployment. In this work, we show that \emph{reasoning trace length} is a simple and useful confidence estimator in large reasoning models. Through comprehensive experiments across multiple models, datasets, and prompts, we show that trace length performs in comparable but complementary ways to other zero-shot confidence estimators such as verbalized confidence. Our work reveals that reasoning post-training fundamentally alters the relationship between trace length and accuracy, going beyond prior work that had shown that post-training causes traces to grow longer in general (e.g., "overthinking’’). We investigate the mechanisms behind trace length's performance as a confidence signal, observing that the effect remains even after adjusting for confounders such as problem difficulty and GRPO-induced length bias. We identify high-entropy or ``forking’’ tokens as playing a key role in the mechanism. Our findings demonstrate that reasoning post-training enhances uncertainty quantification beyond verbal expressions, and establish trace length as a practical confidence measure for large reasoning models.

    Abstract source
  • ICML · Workshop · Statistical Frameworks for Uncertainty in Agentic Systems

    Harmfulness Propagation Dynamics: Layer-wise Trajectories of Adversarial Intent in Large Language Models

    Noor I Mohammad

    Abstract

    We identify Harmfulness Propagation Dynamics (HPD). For harmful prompts, the projection of the last-token hidden state onto a learned harm direction rises monotonically with transformer depth, whereas benign prompts remain flat or oscillatory. This cross-layer signature reflects harmful intent as a progressively resolved semantic property: surface form appears early, while pragmatic intent consolidates later, making the trajectory shape more informative than any single-layer snapshot. Moreover, LDA-based harm directions, learned per layer, remain stable across random splits (pairwise cosine similarity $>0.97$), supporting the projection sequence as a reproducible structured signal. Building on HPD, we introduce HERALD (Harmful Encoding Recognition via Activation Layer Dynamics). This lightweight input moderator extracts a seven-dimensional feature record, slope, curvature, monotonicity, onset layer, and related statistics from the cross-layer projection sequence and classifies it with a 288-parameter MLP. \herald{} stores one $d$-dimensional direction per layer ($262$\,KB for a 32-layer, $d{=}4096$ model), requires no gradient computation during training, and adds only $2.6{\times}10^{-6}$ prefill FLOPs at inference. Across eight prompt-harmfulness benchmarks and four model families, HERALD achieves an average F1 score of $89.3$ on OLMo2-7B, surpassing all tested guard models on adversarial jailbreak detection ($98.4$ vs. $96.9$ F1) and outperforming prior latent-based methods by $2.3$-$4.1$ F1 points across all backbones. Per-instance trajectories provide machine-readable audit records that reveal when and how harmfulness emerges, offering an interpretability advantage over single-layer approaches. Code will be released at https://HERALD.github.io.

    Abstract source
  • ICML · Workshop · Statistical Frameworks for Uncertainty in Agentic Systems

    ReflectiChain: Epistemic Grounding in LLM-Driven World Models for Supply Chain Resilience

    Jia Luo

    Abstract

    Global supply chains operating under geopolitical volatility expose both the semantic deficits of traditional Operations Research and Reinforcement Learning (OR/RL) and the physical ungroundedness of pure Large Language Models (LLMs). To address these limitations, we introduce ReflectiChain, an agentic framework that utilizes a Generative Supply Chain World Model (SC-WM) for resilience planning, formulated within a Constrained Partially Observable Markov Decision Process (C-POMDP) framework. By leveraging a topology-aware latent dynamics model, the agent performs multi-step "mental rehearsals" to evaluate candidate strategies. Crucially, the framework incorporates a Double-Loop Learning mechanism that couples test-time reflection-in-action with retrospective reflection-on-action via LoRA updates, enabling autonomous self-evolution of the policy. Validated on the multi-agent Semi-Sim benchmark under adversarial policy shocks, ReflectiChain achieves a Pareto-optimal balance across compliance, resilience, and profitability. The system maintains an 82.3% operability ratio under extreme pressure, demonstrating that latent rehearsal is fundamental for approximating Nash Equilibria in complex, non-stationary networks.

    Abstract source
  • ICML · Workshop · Statistical Frameworks for Uncertainty in Agentic Systems

    Don't Always Pick the Highest-Performing Model: An Information Theoretic View of LLM Ensemble Selection

    Yigit Turkmen, Baturalp (Batu) Buyukates, Melih Bastopcu

    Abstract

    Large language models (LLMs) are often ensembled together to improve overall reliability and robustness, but in practice models are strongly correlated. This raises a fundamental question: which models should be selected when forming an LLM ensemble? We formulate budgeted ensemble selection as maximizing the mutual information between the true label and predictions of the selected models. Furthermore, to explain why performance can saturate even with many models, we model the correlated errors of the models using Gaussian-copula and show an information-theoretic error floor for the performance of the ensemble. Motivated by these, we propose a simple greedy mutual-information selection algorithm that estimates the required information terms directly from data and iteratively builds an ensemble under a query budget. We test our approach in two question answering datasets and one binary sentiment classification dataset: MEDMCQA, MMLU, and IMDB movie reviews. Across all datasets, we observe that our method consistently outperforms strong baselines under the same query budget.

    Abstract source
  • ICML · Workshop · Statistical Frameworks for Uncertainty in Agentic Systems

    AgentRouter: Heterogeneous Model Routing for Cost-Optimal Multi-Step Agentic Workflows

    Rudrendu Kumar Paul, Sourav Nandy

    Abstract

    Enterprise agent systems that route every LLM call to a frontier model waste 60–80% of their inference budget on subtasks that smaller models handle equally well. Existing routing solutions optimize single-turn query assignment but ignore a property unique to agentic workflows: subtask complexity varies dramatically within a single trajectory. A planning step may require frontier-class reasoning while a subsequent formatting step needs only a 7B model. We formalize step-level model routing as a sequential assignment problem over agent trajectories and propose AgentRouter, a lightweight classifier (12M parameters, under 5ms overhead per step) that maps each trajectory step to one of four model tiers using five features extractable at routing time. Trained on 50,000 annotated agent trajectory steps spanning planning, coding, research, and data analysis tasks, AgentRouter achieves 72% cost reduction relative to frontier-only baselines with less than 3% degradation in end-to-end task completion. Per-step routing accuracy reaches 91% on minimal-complexity steps and 85% on efficient-tier steps, with 76–82% on the harder mid-range and frontier tiers. On the same benchmarks, RouteLLM and FrugalGPT (applied per-step) achieve only 31% and 44% cost reduction respectively, because their single-turn training signal misses trajectory-level quality dependencies.

    Abstract source
  • ICML · Workshop · Statistical Frameworks for Uncertainty in Agentic Systems

    Confidence Calibration in Vision-Language-Action Models

    Tom Zollo, Richard Zemel

    Abstract

    Trustworthy robot behavior requires not only high levels of task success but also that the robot can reliably quantify how likely it is to succeed. To this end, we present a first-of-its-kind study of confidence calibration in vision-language-action (VLA) foundation models, which map visual observations and natural language instructions to low-level robot motor commands. We establish a confidence estimation baseline for VLAs, examine how task success relates to calibration error and how calibration evolves over time, and introduce two lightweight techniques to remedy the miscalibration we observe: prompt ensembles and action-wise Platt scaling. Our aim in this study is to begin to develop the tools and conceptual understanding necessary to render VLAs trustworthy via reliable uncertainty quantification.

    Abstract source
  • ICML · Workshop · Statistical Frameworks for Uncertainty in Agentic Systems

    Model-Free Assessment of Simulator Fidelity via Quantile Curves

    Yu-Shiou Willy Lin, Kaizheng Wang, Garud Iyengar

    Abstract

    As generative AI models are increasingly used to simulate real-world systems, quantifying the “sim-to-real” gap is critical. For each input setting of interest—which we call a scenario, such as a survey question or operating condition—the real and simulated systems are associated with unobserved latent population parameters, and their discrepancy varies across scenarios. A fundamental challenge is that, for any given scenario, this discrepancy cannot be observed directly, since both systems are accessible only through finite samples, often of heterogeneous sizes across scenarios. Standard predictive inference methods are therefore ill-suited, as they quantify uncertainty in observable outputs rather than latent population parameters. To address this, we construct confidence sets for these latent parameters and use them to derive a robust proxy for the sim-to-real discrepancy. We then estimate the quantile function of this proxy to obtain a distribution-level risk profile of the simulator, which supports a broad range of statistical summaries, including statistical inference for the real output distribution in a new scenario, the calculation of risk measures like Conditional Value-at-Risk (CVaR), and principled comparisons across simulators. Our method is model-agnostic and handles general output spaces, such as categorical survey responses and continuous multi-dimensional data. We demonstrate the practical utility of this method by evaluating the alignment of four major LLMs with human populations on the WorldValueBench dataset.

    Abstract source
  • ICML · Workshop · Statistical Frameworks for Uncertainty in Agentic Systems

    Distributional Energy-Based Models for Uncertainty-Aware Structured LLM Reasoning

    Shireen Kudukkil Manchingal, Abhey Kalia, Fernanda G Abrantes, Shebin Rawther

    Abstract

    When Large Language Models produce structured outputs such as travel plans, code solutions, or multi-step proofs, individual reasoning steps may appear correct while the output as a whole violates budgets, fails test cases, or contradicts earlier deductions. We propose a decomposed energy function that combines a learned quality scorer with deterministic analytical constraint penalties for verifying structured LLM outputs. The quality scorer is a heterogeneous ensemble of low-rank adapters on a single frozen encoder (3% train- able parameters); the ensemble mean ranks candidates while the standard deviation quantifies epistemic uncertainty, driving a two-pass inference loop that triggers targeted regeneration or abstention. Across five benchmarks (GSM8K, MuSR, TravelPlanner, TACO, Knights & Knaves), reranking 32 candidates from cheap 7B-class models matches Sonnet 4.6 on MuSR (67.7% vs. 68.0%) and reduces constraint violations by 53% relative to Opus 4.6 on TravelPlanner. A cross-dataset confounding analysis confirms genuine quality discrimination on four reasoning tasks and identifies a model-identity shortcut on code, mitigated via last-layer retraining. Scorers trained on difficult data transfer zero-shot: a MuSR-trained scorer achieves 93.9% on GSM8K without seeing a math problem.

    Abstract source
  • ICML · Workshop · Statistical Frameworks for Uncertainty in Agentic Systems

    Controlling the Risk of Corrupted Contexts for Language Models via Early-Exiting

    Andrea Wynn, Metod Jazbec, Charith Peris, Rinat Khaziev, Anqi Liu, Daniel Khashabi, Eric Nalisnick

    Abstract

    Large language models (LLMs) can be influenced by harmful or irrelevant context, which can significantly harm model performance on downstream tasks. This motivates principled designs in which LLM systems include built-in mechanisms to guard against such garbage in, garbage out'' scenarios. We propose a novel approach to limit the degree to which harmful context can degrade model performance. First, we define a baselinesafe'' behavior for the model -- the model's performance given no context at all (zero-shot). Next, we apply distribution-free risk control (DFRC) to control the extent to which the user-provided context can decay performance below this safe zero-shot baseline. We achieve this by leveraging dynamic early exit prediction, ignoring later attention heads that attend the most to the unsafe inputs. Finally, we propose modifications to DFRC that allow it to both control risk for harmful inputs \textit{and} leverage performance and efficiency gains on helpful inputs. We present both theoretical and empirical results across 9 tasks spanning in-context learning and open-ended question answering, showing that our approach can effectively control risk for harmful context and simultaneously achieve substantial computational efficiency gains with helpful context.

    Abstract source