Do You CARE to Generalize? Extracting Robust Concept Directions from LLMs

Sweta Karlekar, Claudia Shi, Aahlad Manas Puli, Carolina Zheng, John Bowlan, Michal Kucer, Maggie Makar, David BleiNeurIPS 2026

TL;DR

Large Language Models represent human concepts—like "toxicity" or "refusal"—as linear directions in their hidden activation space, allowing us to detect concepts and steer model behavior. Unfortunately, a compass needle calibrated in one context often points the wrong way when prompt styles or domains shift. CARE solves this by cleanly splitting a concept’s representation into a universal shared direction that generalizes everywhere, and context-specific residuals that capture genuine local nuances.

What Problem Does This Paper Address?

Imagine you want to find the "harmfulness" switch inside an LLM. According to the Linear Representation Hypothesis, high-level concepts correspond to straight lines (vectors) in the model's activation space. Usually, you gather harmless and harmful prompts, record internal activations, and draw a line separating the two groups. You can then project new activations onto this line to measure harmfulness, or nudge activations along it to intervene (e.g., forcing the model to refuse or comply).

Here is the catch: a direction extracted from direct, vanilla requests ("How do I evade taxes?") often fails miserably on adversarial roleplay prompts ("Imagine you're a sci-fi diplomat...").

The authors frame these contexts (prompt styles, syntax, demographic groups) as environments in an Out-Of-Distribution (OOD) generalization problem. Directions fail across environments for two distinct reasons:

  1. Spurious correlations: Your vector accidentally latches onto "sci-fi roleplay" artifacts rather than "harm."
  2. Genuine heterogeneity: The LLM genuinely encodes the concept slightly differently depending on the context.

Standard OOD invariance methods (like IRM or V-REx) attack the first problem by forcing a single invariant vector across all environments. However, by flattening everything into one universal vector, they throw away the context-specific structure needed to actually steer the model when representations vary.

CARE decomposes concept directions into a universal shared vector and orthogonal environment-specific residuals.

Methods

Enter Context-Aided Representation Extraction (CARE). Instead of forcing one vector to do everything, CARE decomposes a concept direction into two orthogonal pieces learned jointly via a single linear predictor:

  • A shared direction ($\hat{w}_0$) common across all environments.
  • An environment-specific residual ($\hat{w}_z^\perp$) for each context $z$, mathematically constrained to be perpendicular to $\hat{w}_0$.

While standard probing fits one pooled logistic regression, CARE trains with three loss components:

  1. Joint label prediction: Ensures the combined pieces ($\hat{w}_0 + \hat{w}_z^\perp$) accurately predict the concept within each environment.
  2. Environment signal preservation: Prevents the residuals from collapsing to zero so they retain context-specific concept structure.
  3. Optional invariance penalty: Applies classic OOD regularizers (IRM, V-REx, or GroupDRO) strictly to the shared direction to strip out spurious correlations.

At test time, this gives you two modes: CARE(S) uses $\hat{w}_0$ alone when you face an unknown environment, while CARE(C) uses $\hat{w}_0 + \hat{w}_z^\perp$ when you know the context and want maximum steering precision.

Datasets

The authors evaluate CARE across four LLMs (GPT-2, Gemma-2B-it, Qwen2.5-7B-Instruct, and Ministral-3-3B-Base) on four benchmarks—plus a clever semi-synthetic testbed:

  • Subject–Verb Agreement (Marks et al.): Detecting singular vs. plural subjects across simple vs. complex relative-clause syntax.
  • WildJailbreak: Measuring and steering harmful prompt refusal across vanilla vs. adversarial jailbreak styles.
  • ToxiGen: Detecting toxic vs. benign statements where environments are different demographic target groups (holding out 5 unseen groups for zero-shot transfer).
  • WildGuard: A completely held-out safety moderation dataset (containing vanilla and adversarial prompts) used to test cross-dataset transfer without retraining.
  • Semi-synthetic GPT-2 Activations: Real LLM noise injected with mathematically controlled concept structures to verify that CARE recovers ground-truth components.

Key Insights and Ideas

  • Joint training is non-negotiable: What if you just train a normal linear probe first, and subtract out residuals afterward ("Post-hoc LR")? It fails under distribution shift. Because the first stage is greedy, the "shared" vector immediately absorbs spurious environment shortcuts. Jointly learning the shared and orthogonal pieces prevents contamination.
  • Measurement and intervention favor different tools: Under distribution shift, the clean shared vector CARE(S) is often the best detector (probe). However, when steering generation (intervention), adding the context residual via CARE(C) frequently packs a much stronger punch—even on completely new datasets like WildGuard—because nudging a model requires respecting its local geometry.
  • Decomposition beats pure invariance: Even when tested on unseen demographic groups where residuals cannot be used, CARE(S) outperforms dedicated single-direction OOD methods (IRM, V-REx). Giving context-specific quirks a "release valve" (the residuals) during training leaves a purer transferable core behind.
Figure 2: Probe accuracy on held-out ToxiGen groups. Error bars are 95% CIs over 20 seeds.

Key Results

The authors test severe distribution shifts—for example, training where environment and label correlate 95% of the time, then flipping that correlation at test time—measuring Probe Accuracy (higher is better) and Geometric Mean Likelihood Ratio / GMLR for behavioral steering (below 1 means successful counterfactual steering; lower is better).

  • Distribution-Shift Dominance: Across 30 shifted task/model/layer settings, a CARE mode achieves the statistically significant best probe accuracy in 28 out of 30 cases, and wins on behavioral steering (lowest GMLR) in 18 out of 30 cases. For instance, on Gemma-2B refusal when correlations reverse ($\rho=0.95$), standard Logistic Regression accuracy plunges to 46.5%, whereas CARE(S) holds strong at 81.5%.
  • Beats Difference-in-Means (DIM) Tradeoffs: While classic DIM occasionally steers well (winning 10/30 GMLR settings), its measurement collapses under shift—CARE beats DIM's probe accuracy by an average of 23.2 percentage points across all settings.
  • Zero-Shot Group & Dataset Transfer: CARE(S) ranks #1 on 11 of 15 completely unseen ToxiGen target groups. When transferring refusal vectors zero-shot to WildGuard (Gemma-2B), CARE(S) hits 79.7% accuracy (vs. 66.5% for the best baseline, V-REx), while CARE(C) achieves the strongest intervention GMLR (0.0102).

Limitations and Future Work

  • Reliance on environment labels: Like the OOD baselines it builds upon, CARE assumes training data comes grouped into known environments (via metadata or practitioner-defined splits), and CARE(C) requires knowing which environment a test prompt belongs to in order to apply its specific residual.
  • Linearity within environments: CARE operates within the linear representation paradigm per environment—representing a first step in bridging OOD generalization with mechanistic interpretability, leaving nonlinear or multi-layer causal abstractions as open territory for future work.

Summary updated

Abstract

Transformer-based large language models (LLMs) encode many high-level concepts as linear directions in activation space. Such concept directions support *measurement*, quantifying a concept's presence, and *intervention*, steering the model's behavior. In practice, a direction learned in one context often fails in another, such as a new prompt style, source dataset, or target group. We treat these contexts as environments and cast concept-direction extraction as a multi-environment out-of-distribution (OOD) generalization problem. This framing exposes two reasons a direction can fail to transfer: it may pick up features that merely correlate with the concept in the training environments, or the concept may genuinely be encoded differently across environments. Invariance methods from the OOD literature address the first problem but not the second, since forcing a single invariant direction discards context-specific structure that can carry the concept. We introduce Context-Aided Representation Extraction (CARE), which addresses both. CARE decomposes each concept direction into a shared direction, common to all environments and optionally regularized for invariance, plus an orthogonal environment-specific residual. We evaluate CARE on subject-verb agreement, refusal of harmful prompts, and toxicity across four LLMs. Under shifts in the environment-label relationship, CARE measures concepts more accurately than standard and OOD baselines while remaining effective for intervention. The shared direction transfers to environments and datasets never seen in training, and the residuals can improve intervention when the environment is known. In a semi-synthetic study with known concept structure, CARE's decomposition recovers the shared and context-specific components of the concept.
BibTeX
@inproceedings{karlekar2026do,
  author = {Sweta Karlekar and Claudia Shi and Aahlad Manas Puli and Carolina Zheng and John Bowlan and Michal Kucer and Maggie Makar and David Blei},
  title = {{Do You CARE to Generalize? Extracting Robust Concept Directions from LLMs}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=1wENYV50CW},
}
Figure