Research map / Large language models / Retrieval and knowledge
Linearity of Relation Decoding in Transformer Language Models
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Shows that for a subset of relations, LM relation decoding from subject representations is well approximated by an affine map (Linear Relational Embedding) estimated via the LM Jacobian, validated by faithfulness and causal editing across GPT-J, GPT2-XL and LLaMA-13B.
Problem
How transformer language models compute relations between subjects and objects, i.e., whether the mapping from subject representation to decoded attribute can be described simply.
Approach
Approximates the LM's relation decoding function F(s, c) with a first-order Taylor expansion, estimating an affine map (Linear Relational Embedding) from the mean Jacobian and bias over n in-context examples, scaled by a constant beta; the LRE is validated for faithfulness and used for causal subject editing via a low-rank pseudoinverse.
Key results
- LRE achieves over 60% faithfulness on almost half of the 47 relations in GPT-J, i.e., 48% of relations have robust LREs.
- Faithfulness correlates strongly with causality (R=0.84) when hyperparameters are selected for causal influence in GPT-J with beta=2.25.
- Company CEO shows near-random faithfulness: no method reaches over 6% on that relation despite GPT-J accurately predicting 69 CEOs.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| Use the Jacobian-derived affine LRE instead of Identity, Translation, or linear regression | GPT-J relation decoding · 47 relations | faithfulness | Helped |
| Apply LRE to the enriched subject representation rather than the subject embedding (ablation) | GPT-J relation decoding · 47 relations | faithfulness | Helped |
| Replace LRE with Translation(s) = s + b (ablation) | GPT-J relation decoding · 47 relations | faithfulness | Hurt |
| Replace LRE with Identity decoding (ablation) | GPT-J relation decoding · 47 relations | faithfulness | Hurt |
| Use LRE for Company CEO | GPT-J · Company CEO | faithfulness: no method reaches over 6% | Hurt |
| Use LRE with β=2.25 instead of β=0.00 (ablation) | GPT-J relation decoding · 47 relations | faithfulness: 0.17 ± 0.20 -> 0.59 ± 0.25 | Helped |
| Vary the prompt template for the same relation (ablation) | LRE · country capital city, plays pro sport, person occupation, adjective superlative | faithfulness | No clear effect |
| Increase low-rank inverse rank up to the optimum, then beyond rank=2^8 (ablation) | LRE causal editing · GPT-J relations | causality: after rank=2^8 causality starts declining | Mixed |
| Remove relation-specific prompt context (ablation) | LRE · GPT-J relation decoding | faithfulness | Helped |
| Increase the number of estimation examples beyond n=5 (ablation) | LRE · Most relations | faithfulness: n=5 | No clear effect |
| Apply the attribute lens instead of relying on the distracted prompt's output | GPT-J · Repetition-distracted prompts | R@1: 0.02 -> 0.54 | Helped |
| Apply the attribute lens instead of relying on the distracted prompt's output | GPT-J · Instruction-distracted prompts | R@1: 0.03 -> 0.63 | Helped |
Surprising findings
- Some relations accurately predicted by the LM (e.g., company CEO) are not linearly decodable from subject representations by any tested method.
- Faithfulness of LREs keeps improving in later layers when the object immediately follows the subject in the prompt, suggesting a mode switch when relational context is present.
Limitations
- Only about 48% of relations admit a robust LRE; many relations are not linearly decodable.
- Evaluation considers only the first token of the object for faithfulness and causality.
- Requires a scaling constant beta selected per LM and per-relation hyperparameters (layer, rank) via grid search.
Experimental setup
Datasets: CounterFact Wikidata
Benchmarks: LRE relations dataset (47 relations)
Metrics: faithfulness causality Spearman correlation
Baselines: Logit Lens (identity) Translation Linear regression LRE on word embedding e_s random guess
Builds on: linear relational embedding logit lens CounterFact linear shortcut probes
Closest papers by meaning
- The Structure of Relation Decoding Linear Operators in Large Language Models (NeurIPS 2025 · similarity 0.93)
- Linear Decoding of Morphology Relations in Language Models (Student Abstract) (AAAI 2025 · similarity 0.89)
- Relation Also Knows: Rethinking the Recall and Editing of Factual Associations in Auto-Regressive Transformer Language Models (AAAI 2025 · similarity 0.89)
- Geometric Factual Recall in Transformers (NeurIPS 2026 · similarity 0.87)
- Do LLMs dream of elephants (when told not to)? Latent concept association and associative memory in transformers (NeurIPS 2024 · similarity 0.86)
- Transformers need glasses! Information over-squashing in language tasks (NeurIPS 2024 · similarity 0.86)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
