Benchmarking and Explaining Large Language Model-based Code Generation: A Causality-Centric Approach
Not on the map. Why?
Abstract (arXiv)
While code generation has been widely used in various software development scenarios, the quality of the generated code is not guaranteed. This has been a particular concern in the era of large language models (LLMs)- based code generation, where LLMs, deemed a complex and powerful black-box model, is instructed by a high-level natural language specification, namely a prompt, to generate code. Nevertheless, effectively evaluating and explaining the code generation capability of LLMs is inherently challenging, given the complexity of LLMs and the lack of transparency. Inspired by the recent progress in causality analysis and its application in software engineering, this paper launches a causality analysis-based approach to systematically analyze the causal relations between the LLM input prompts and the generated code. To handle various technical challenges in this study, we first propose a novel causal graph-based representation of the prompt and the generated code, which is established over the fine-grained, human-understandable concepts in the input prompts. The formed causal graph is then used to identify the causal relations between the prompt and the derived code. We illustrate the insights that our framework can provide by studying over 3 popular LLMs with over 12 prompt adjustment strategies. The results of these studies illustrate the potential of our technique to provide insights into LLM effectiveness, and aid end-users in understanding predictions. Additionally, we demonstrate that our approach provides actionable insights to improve the quality of the LLM-generated code by properly calibrating the prompt.
Key facts. Cited by 15 papers in the map (data through 7 Oct 2026). Builds on 55 of its 86 references that are in the map. First posted on arXiv 10 Oct 2023.
Builds on
55 of 86 references.
References · 55
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023GPT-4 Technical Reportcited by 18,132
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2023Tree of Thoughts: Deliberate Problem Solving with Large Language Modelscited by 3,155
- 2022Emergent Abilities of Large Language Modelscited by 2,483
- 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,222
- 2019Fine-Tuning Language Models from Human Preferencescited by 2,124
- 2022Large Language Models Encode Clinical Knowledgecited by 1,807
38 more
- 2018A Call for Clarity in Reporting BLEU Scorescited by 1,790
- 2023Improving Factuality and Reasoning in Language Models through Multiagent Debatecited by 1,739
- 2021Multitask Prompted Training Enables Zero-Shot Task Generalizationcited by 1,462
- 2022Competition-Level Code Generation with AlphaCodecited by 1,427
- 2022Large Language Models Are Human-Level Prompt Engineerscited by 1,020
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2021Measuring Coding Challenge Competence With APPScited by 879
- 2023Large Language Models as Optimizerscited by 830
- 2023Semantic Uncertainty: Linguistic Invariances for Uncertainty Estimation in Natural Language Generationcited by 795
- 2018DAGs with NO TEARS: Continuous Optimization for Structure Learningcited by 745
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2023Automatic Prompt Optimization with "Gradient Descent" and Beam Searchcited by 628
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
- 2022CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learningcited by 342
- 2019DAG-GNN: DAG Structure Learning with Graph Neural Networkscited by 329
- 2013Learning Bayesian Networks: The Combination of Knowledge and Statistical Datacited by 185
- 2023An Empirical Study of the Non-determinism of ChatGPT in Code Generationcited by 134
- 2021DiBS: Differentiable Bayesian Structure Learningcited by 105
- 2022Uncertainty Quantification with Pre-trained Language Models: A Large-Scale Empirical Analysiscited by 104
- 2023Cumulative Reasoning with Large Language Modelscited by 94
- 2013Learning Equivalence Classes of Bayesian Networks Structurescited by 75
- 2022Automated Repair of Programs from Large Language Modelscited by 71
- 2019Code Generation as a Dual Task of Code Summarizationcited by 62
- 2019Text Readability Assessment for Second Language Learnerscited by 54
- 2022Causality-based Neural Network Repaircited by 44
- 2016Double/Debiased Machine Learning for Treatment and Causal Parameterscited by 41
- 2022No More Fine-Tuning? An Experimental Evaluation of Prompt Tuning in Code Intelligencecited by 41
- 2021Pushing on Text Readability Assessment: A Transformer Meets Handcrafted Linguistic Featurescited by 36
- 2022CCTEST: Testing and Repairing Code Completion Systemscited by 35
- 2018A Grammar-Based Structural CNN Decoder for Code Generationcited by 29
- 2018Causal Testing: Finding Defects' Root Causescited by 22
- 2023LFTK: Handcrafted Features in Computational Linguisticscited by 19
- 2023Evaluating the Robustness of Discrete Promptscited by 18
- 2022Adaptive Fairness Improvement Based on Causality Analysiscited by 17
- 2022Membership Inference Attacks and Generalization: A Causal Perspectivecited by 17
- 2022Causality in Configurable Software Systemscited by 13
50 most cited of 55 All 55 (JSON)
Built on by
Citing papers per year: 2024: 11; 2025: 3; 2026: 1.
15 papers.
Sort:
By area:
- 2024Bugs in Large Language Models Generated Code: An Empirical Studycited by 59
- 2024Large Language Models and Causal Inference in Collaboration: A Surveycited by 26
- 2024Cause and Effect: Can Large Language Models Truly Understand Causality?cited by 23
- 2024Testing and Understanding Erroneous Planning in LLM Agents through Synthesized User Inputscited by 22
- 2024Position: Leverage Foundational Models for Black-Box Optimizationcited by 21
- 2024From Text to Transformation: A Comprehensive Review of Large Language Models' Versatilitycited by 19
- 2024Causal Evaluation of Language Modelscited by 18
- 2024API-guided Dataset Synthesis to Finetune Large Code Modelscited by 11
- 2024When Fuzzing Meets LLMs: Challenges and Opportunitiescited by 8
- 2025A Survey on Enhancing Causal Reasoning Ability of Large Language Modelscited by 8
- 2024Scalable Differentiable Causal Discovery in the Presence of Latent Confounders with Skeleton Posterior (Extended Version)cited by 6
- 2025RAG or Fine-tuning? A Comparative Study on LCMs-based Code Completion in Industrycited by 4
3 more
- 2024An Empirical Study on Large Language Models in Accuracy and Robustness under Chinese Industrial Scenarioscited by 3
- 2025Evaluating Large Language Models in Code Generation: INFINITE Methodology for Defining the Inference Indexcited by 0
- 2026PCodeTrans: Translate Decompiled Pseudocode to Compilable and Executable Equivalentcited by 0
- 2026PCodeTrans: Translate Decompiled Pseudocode to Compilable and Executable Equivalent16 Mar 2026
- 2025RAG or Fine-tuning? A Comparative Study on LCMs-based Code Completion in Industry21 May 2025
- 2025A Survey on Enhancing Causal Reasoning Ability of Large Language Models12 Mar 2025
- 2025Evaluating Large Language Models in Code Generation: INFINITE Methodology for Defining the Inference Index7 Mar 2025
- 2024API-guided Dataset Synthesis to Finetune Large Code Models15 Aug 2024
- 2024Scalable Differentiable Causal Discovery in the Presence of Latent Confounders with Skeleton Posterior (Extended Version)15 Jun 2024
- 2024Position: Leverage Foundational Models for Black-Box Optimization6 May 2024
- 2024Causal Evaluation of Language Models1 May 2024
- 2024Testing and Understanding Erroneous Planning in LLM Agents through Synthesized User Inputs27 Apr 2024
- 2024When Fuzzing Meets LLMs: Challenges and Opportunities25 Apr 2024
- 2024Large Language Models and Causal Inference in Collaboration: A Survey14 Mar 2024
- 2024Bugs in Large Language Models Generated Code: An Empirical Study13 Mar 2024
3 more
- 2024Cause and Effect: Can Large Language Models Truly Understand Causality?28 Feb 2024
- 2024From Text to Transformation: A Comprehensive Review of Large Language Models' Versatility25 Feb 2024
- 2024An Empirical Study on Large Language Models in Accuracy and Robustness under Chinese Industrial Scenarios27 Jan 2024
- 2024Causal Evaluation of Language Modelscited by 18
- 2025A Survey on Enhancing Causal Reasoning Ability of Large Language Modelscited by 8
- 2025A Survey on Enhancing Causal Reasoning Ability of Large Language Models12 Mar 2025
- 2024Causal Evaluation of Language Models1 May 2024
- 2024Bugs in Large Language Models Generated Code: An Empirical Studycited by 59
- 2024Large Language Models and Causal Inference in Collaboration: A Surveycited by 26
- 2024Cause and Effect: Can Large Language Models Truly Understand Causality?cited by 23
- 2024Position: Leverage Foundational Models for Black-Box Optimizationcited by 21
- 2024From Text to Transformation: A Comprehensive Review of Large Language Models' Versatilitycited by 19
- 2024API-guided Dataset Synthesis to Finetune Large Code Modelscited by 11
- 2024When Fuzzing Meets LLMs: Challenges and Opportunitiescited by 8
- 2024Scalable Differentiable Causal Discovery in the Presence of Latent Confounders with Skeleton Posterior (Extended Version)cited by 6
- 2024An Empirical Study on Large Language Models in Accuracy and Robustness under Chinese Industrial Scenarioscited by 3
- 2025Evaluating Large Language Models in Code Generation: INFINITE Methodology for Defining the Inference Indexcited by 0
- 2026PCodeTrans: Translate Decompiled Pseudocode to Compilable and Executable Equivalentcited by 0
- 2026PCodeTrans: Translate Decompiled Pseudocode to Compilable and Executable Equivalent16 Mar 2026
- 2025Evaluating Large Language Models in Code Generation: INFINITE Methodology for Defining the Inference Index7 Mar 2025
- 2024API-guided Dataset Synthesis to Finetune Large Code Models15 Aug 2024
- 2024Scalable Differentiable Causal Discovery in the Presence of Latent Confounders with Skeleton Posterior (Extended Version)15 Jun 2024
- 2024Position: Leverage Foundational Models for Black-Box Optimization6 May 2024
- 2024When Fuzzing Meets LLMs: Challenges and Opportunities25 Apr 2024
- 2024Large Language Models and Causal Inference in Collaboration: A Survey14 Mar 2024
- 2024Bugs in Large Language Models Generated Code: An Empirical Study13 Mar 2024
- 2024Cause and Effect: Can Large Language Models Truly Understand Causality?28 Feb 2024
- 2024From Text to Transformation: A Comprehensive Review of Large Language Models' Versatility25 Feb 2024
- 2024An Empirical Study on Large Language Models in Accuracy and Robustness under Chinese Industrial Scenarios27 Jan 2024