mlsanityData to 7 Oct 2026

How Do Language Models Compose Functions?

arXiv 2510.01685 ↗First posted 2 Oct 2025cs.CL cs.AIcited by 7

Not on the map. Why?

Abstract (arXiv)

While large language models (LLMs) appear to be increasingly capable of solving compositional tasks, it is an open question whether they do so using compositional mechanisms. In this work, we investigate how feedforward LLMs solve two-hop factual recall tasks, which can be expressed compositionally as g(f(x)). We first confirm that modern LLMs continue to suffer from the "compositionality gap", i.e. their ability to compute both z = f(x) and y = g(z) does not entail their ability to compute the composition y = g(f(x)). We then decode residual stream representations and identify two processing mechanisms: one which solves tasks textitcompositionally, computing f(x) along the way to g(f(x)), and one which solves them textitdirectly, without any detectable signature of the intermediate variable f(x). Finally, we find that embedding space geometry is strongly related to which mechanism is employed, where the idiomatic mechanism is dominant when tasks are represented by translations from x to g(f(x)) in the embedding spaces. We fully release our data and code at: https://github.com/apoorvkh/composing-functions.

Key facts. Cited by 7 papers in the map (data through 7 Oct 2026). Builds on 34 of its 57 references that are in the map. First posted on arXiv 2 Oct 2025.

Builds on

34 of 57 references.

References · 34

  1. 2016CLEVR: A Diagnostic Dataset for Compositional Language and Elementary Visual Reasoningcited by 1,445
  2. 2022Measuring and Narrowing the Compositionality Gap in Language Modelscited by 1,054
  3. 2019BERT Rediscovers the Classical NLP Pipelinecited by 1,046
  4. 2022Transformer Feed-Forward Layers Build Predictions by Promoting Concepts in the Vocabulary Spacecited by 522
  5. 2023Faith and Fate: Limits of Transformers on Compositionalitycited by 496
  6. 2015Neural Module Networkscited by 375
  7. 2023Function Vectors in Large Language Modelscited by 292
  8. 2019Measuring Compositional Generalization: A Comprehensive Method on Realistic Datacited by 280
  9. 2019Compositionality decomposed: how do neural networks generalise?cited by 264
  10. 2020COGS: A Compositional Generalization Challenge Based on Semantic Interpretationcited by 260
  11. 2024Patchscopes: A Unifying Framework for Inspecting Hidden Representations of Language Modelscited by 225
  12. 2023Linearity of Relation Decoding in Transformer Language Modelscited by 190
22 more
  1. 2022CREPE: Can Vision-Language Foundation Models Reason Compositionally?cited by 177
  2. 2024Do Large Language Models Latently Perform Multi-Hop Reasoning?cited by 165
  3. 2020DreamCoder: Growing generalizable, interpretable knowledge with wake-sleep Bayesian program learningcited by 159
  4. 2023Language Models Implement Simple Word2Vec-style Vector Arithmeticcited by 97
  5. 2020Compositional Generalization in Semantic Parsing: Pre-training vs. Specialized Architecturescited by 95
  6. 2024Grokked Transformers are Implicit Reasoners: A Mechanistic Journey to the Edge of Generalizationcited by 78
  7. 2024Hopping Too Late: Exploring the Limitations of Large Language Models on Multi-Hop Queriescited by 78
  8. 2024Understanding and Patching Compositional Reasoning in LLMscited by 45
  9. 2023Break It Down: Evidence for Structural Compositionality in Neural Networkscited by 44
  10. 2024Do Large Language Models Perform Latent Multi-Hop Reasoning without Exploiting Shortcuts?cited by 26
  11. 2024Relational Composition in Neural Networks: A Survey and Call to Actioncited by 23
  12. 2025Back Attention: Understanding and Enhancing Multi-Hop Reasoning in Large Language Modelscited by 23
  13. 2025On Linear Representations and Pretraining Data Frequency in Language Modelscited by 23
  14. 2024Distributional reasoning in LLMs: Parallel reasoning processes in multi-hop reasoningcited by 21
  15. 2025Paths Not Taken: Understanding and Mending the Multilingual Factual Recall Pipelinecited by 20
  16. 2017Distinguishing Antonyms and Synonyms in a Pattern-based Neural Networkcited by 19
  17. 2024Racing Thoughts: Explaining Contextualization Errors in Large Language Modelscited by 11
  18. 2025Internal Chain-of-Thought: Empirical Evidence for Layer-wise Subtask Scheduling in LLMscited by 9
  19. 2025Whither symbols in the era of advanced neural networks?cited by 6
  20. 2025Behavioural vs. Representational Systematicity in End-to-End Models: An Opinionated Surveycited by 5
  21. 2024Compositional learning of functions in humans and machinescited by 2
  22. 2023Towards Zero-Shot Functional Compositionality of Language Modelscited by 1

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2026: 7.

7 papers.