NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Latent Concept Disentanglement in Transformer-based Language Models

Guan Zhe Hong, Bhavya Vasudeva, Vatsal Sharan, Cyrus Rashtchian, Prabhakar Raghavan, Rina Panigrahy

TL;DR

This paper investigates how Large Language Models (LLMs) represent and manipulate hidden rules or variables—termed "latent concepts"—during in-context learning (ICL). Using mechanistic interpretability, the authors demonstrate that transformers resolve discrete multi-hop reasoning tasks step-by-step through specialized attention heads and map continuous numerical concepts onto clean, low-dimensional geometric manifolds.

What Problem Does This Paper Address?

When an LLM learns a task from a few examples in its prompt (in-context learning), it must infer the underlying, unstated rules or variables required to solve it. For instance, if given pairs like (Toronto, Ottawa) and (Mumbai, New Delhi), the model must infer the latent concept of "Country" to correctly map the query Shanghai to Beijing.

Whether LLMs actually compute these intermediate abstract concepts or simply rely on direct surface-level shortcuts has been an open question. This paper tackles this gap by systematically exploring how both large pre-trained models and small synthetic models represent discrete and continuous latent concepts in their internal activation spaces.

Figure 1: An illustration of our main findings. We primarily focus on how decoder-only transformer- based language models disentangle and manipulate latent concepts for solving in-context learning (ICL) problems. In the discrete multi-hop setting, we discover that transformers compose latent concept representations for predicting the answer. For example, as shown in the upper half of the figure, by intervening on certain “bridge-concept” attention heads, we can push the model’s “belief” (reflected in logit and rank) in the original answer Canberra (the capital of Australia, which the city Sydney belongs to) to the “type-corrected” alternative answer Ottawa (the capital of Canada, which the landmark Niagara Falls belongs to). In the continuous-parameterization ICL setting, we discover that transformers’ hidden embeddings capture the geometry of the latent concepts for our prediction tasks. For instance, for a transformer trained to predict circular trajectories whose radius is randomly chosen from a continuous interval, not only do we obtain causal evidence for task vectors (TVs) which control the trajectory’s radius, but they also fall on a smooth 2D manifold.

Methods

The authors employ several mechanistic interpretability techniques to reverse-engineer the models' internal computations:

  • Causal Mediation Analysis (CMA) / Activation Patching: To prove that specific components represent a latent concept, the authors swap internal activations from an "alternative" prompt (e.g., a prompt dealing with China) into a "normal" prompt (e.g., a prompt dealing with the USA) to see if it predictably steers the model's final output (e.g., shifting the output from Washington to Beijing).
  • Linear Probing: Linear classifiers are trained on intermediate model states to locate exactly where task types and final outputs become disentangled.
  • Principal Component Analysis (PCA): Used to visualize the geometric structure of "task vectors" (the average embedding direction that captures a task's rule).
  • Activation Steering: Intervening during the forward pass by adding or interpolating task vectors to dynamically alter the model's mathematical or geometric reasoning.

Datasets

The study evaluates models across two distinct categories of datasets:

  1. Factuality-Based World Knowledge Datasets:
  2. Geography Dataset: 2-hop factual recall tasks mapping a source (City, University, or Landmark) to a target (Capital or Calling Code) via a latent Country bridge.
  3. Company Dataset: Mapping a source (Product or Founder) to a target (Founder or Headquarters City) via a latent Company bridge.
  4. Synthetic Numerical/Geometric Datasets:
  5. add-k: Sequences requiring integer addition with a hidden offset $k$.
  6. Circular-Trajectory: Predicting the next point of a sequence moving along a circle with a latent radius $r$.
  7. Rectangular-Trajectory: Predicting points along an axis-aligned rectangle parameterized by latent side lengths $a$ and $b$.

Key Insights and Ideas

  • Sequential Composition over Shortcuts: In multi-hop factual tasks, the model does not skip straight from the input to the answer. Instead, a sparse, highly localized circuit of attention heads first resolves the abstract "bridge" concept (e.g., the country), which deeper layers then refine into the specific target type.
  • Geometry Reflects Parameterization: For numerical tasks, the model's internal task vectors aren't randomly distributed; their spatial geometry cleanly mirrors the task's parameters. The task vectors for add-k align on a 1D line, while circular and rectangular trajectories map onto smooth 2D manifolds.
  • The Impact of Model Scale: Larger models develop highly specialized, clean circuits for concept disentanglement. When testing the smaller Gemma-2-2B variant, the authors found a much weaker, noisier version of the 27B model's circuit, explaining its lower performance.
  • More Examples Strengthen the Circuit: Increasing the number of in-context demonstrations directly correlates with tighter clustering (stronger disentanglement) of latent concepts and increases the causal importance of the bridge-resolving attention heads.
Figure 2: Accuracy of Gemma-2-27B on the two-hop “Source→Target” ICL problems.

Key Results

  • Discrete Tasks: In Gemma-2-27B, patching a single group of attention heads (layers 24, 30, and 31) successfully shifted the model's internal belief to the type-corrected alternative answer over 73% of the time, boosting it into the top 10 choices.
  • Continuous Tasks: For the add-k task, PCA revealed that more than 99.9% of the variance in task vectors is explained by the very first principal component (PC1), confirming a strict 1D linear layout.
  • Steering Success: By interpolating along the principal components of the task vectors, the authors successfully steered the model's output. For example, blending the task vectors for radius $r_1$ and radius $r_K$ caused the model to smoothly generate trajectories corresponding to intermediate radii.

Limitations and Future Work

  • Language and Culture Bias: The factual geography and company puzzles were evaluated exclusively using English queries, meaning the findings might rely on English-specific parametric knowledge structures.
  • Simplicity of Latent Concepts: The concepts tested (countries, basic shapes, simple math operations) are easily interpretable by humans. It remains uncertain if transformers represent more complex, non-human-interpretable latent concepts using similar low-dimensional geometric structures.
  • Future Outlook: The authors suggest that these insights could be used to directly compose known task vectors to achieve zero-shot generalization on entirely novel, complex tasks.

Summary updated

BibTeX
@inproceedings{hong2026latent,
  author = {Guan Zhe Hong and Bhavya Vasudeva and Vatsal Sharan and Cyrus Rashtchian and Prabhakar Raghavan and Rina Panigrahy},
  title = {{Latent Concept Disentanglement in Transformer-based Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=k3SEVOW2Dg},
}
Figure