mlsanityData to 7 Oct 2026

Compositional Hardness of Code in Large Language Models -- A Probabilistic Perspective

arXiv 2409.18028 ↗First posted 26 Sep 2024cs.AI cs.CLcited by 3

Not on the map. Why?

Abstract (arXiv)

A common practice in large language model (LLM) usage for complex analytical tasks such as code generation, is to sample a solution for the entire task within the model's context window. Previous works have shown that subtask decomposition within the model's context (chain of thought), is beneficial for solving such tasks. In this work, we point a limitation of LLMs' ability to perform several sub-tasks within the same context window - an in-context hardness of composition, pointing to an advantage for distributing a decomposed problem in a multi-agent system of LLMs. The hardness of composition is quantified by a generation complexity metric, i.e., the number of LLM generations required to sample at least one correct solution. We find a gap between the generation complexity of solving a compositional problem within the same context relative to distributing it among multiple agents, that increases exponentially with the solution's length. We prove our results theoretically and demonstrate them empirically.

Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 30 of its 42 references that are in the map. First posted on arXiv 26 Sep 2024.

Builds on

30 of 42 references.

References · 30

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2024The Llama 3 Herd of Modelscited by 14,192
  4. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
  5. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  6. 2023Generative Agents: Interactive Simulacra of Human Behaviorcited by 3,500
  7. 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
  8. 2023Mistral 7Bcited by 3,065
  9. 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,579
  10. 2024Scaling LLM Test-Time Compute Optimally can be More Effective than Scaling Model Parameterscited by 1,928
  11. 2022Competition-Level Code Generation with AlphaCodecited by 1,427
  12. 2024RULER: What's the Real Context Size of Your Long-Context Language Models?cited by 1,270
18 more
  1. 2023Capabilities of GPT-4 on Medical Challenge Problemscited by 630
  2. 2024BigCodeBench: Benchmarking Code Generation with Diverse Function Calls and Complex Instructionscited by 527
  3. 2023Faith and Fate: Limits of Transformers on Compositionalitycited by 496
  4. 2024Improve Mathematical Reasoning in Language Models by Automated Process Supervisioncited by 426
  5. 2023A Dynamic LLM-Powered Agent Network for Task-Oriented Agent Collaborationcited by 281
  6. 2023Representational Strengths and Limitations of Transformerscited by 132
  7. 2024Physics of Language Models: Part 2.1, Grade-School Math and the Hidden Reasoning Processcited by 107
  8. 2024Code Generation with AlphaCodium: From Prompt Engineering to Flow Engineeringcited by 100
  9. 2023MetaAgents: Large Language Model Based Agents for Decision-Making on Teamingcited by 85
  10. 2024Self-Organized Agents: A LLM Multi-Agent Framework toward Ultra Large-Scale Code Generation and Optimizationcited by 84
  11. 2023Auto-Regressive Next-Token Predictors are Universal Learnerscited by 65
  12. 2024On Limitations of the Transformer Architecturecited by 63
  13. 2024Self-Alignment of Large Language Models via Monopolylogue-based Social Scene Simulationcited by 46
  14. 2022Sub-Task Decomposition Enables Learning in Sequence to Sequence Taskscited by 41
  15. 2024Do Large Language Models Have Compositional Ability? An Investigation into Limitations and Scalabilitycited by 39
  16. 2024On Provable Length and Compositional Generalizationcited by 22
  17. 2023Advances in apparent conceptual physics reasoning in GPT-4cited by 12
  18. 2024Your Context Is Not an Array: Unveiling Random Access Limitations in Transformerscited by 11

Built on by

Cited by year

Citing papers per year: 2025: 3.

3 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026How Generation Architecture Shapes Code Complexity in Multi-Agent LLM Systems: A Paired Study on HumanEval
  2. 2024Designing Algorithms Empowered by Language Models: An Analytical Framework, Case Studies, and Insights
  3. 2026Narrowing the Complexity Gap in the Evaluation of Large Language Models ↗
  4. 2025Guided Code Generation with LLMs: A Multi-Agent Framework for Complex Code Tasks
  5. 2025LMR-BENCH: Evaluating LLM Agent's Ability on Reproducing Language Modeling Research
  6. 2025Code Simulation as a Proxy for High-order Tasks in Large Language Models
  7. 2025BigO(Bench): Can LLMs Generate Code with Controlled Time and Space Complexity?
  8. 2026Constraint Decay: The Fragility of LLM Agents in Backend Code Generation