How Diversely Can Language Models Solve Problems? Exploring the Algorithmic Diversity of Model-Generated Code
Not on the map. Why?
Abstract (arXiv)
Language models (LMs) have exhibited impressive abilities in generating code from natural language requirements. In this work, we highlight the diversity of code generated by LMs as a critical criterion for evaluating their code generation capabilities. There is a lack of studies focused on assessing the diversity of generated code, which overlooks its importance in code LMs. Therefore, we propose a systematic approach to evaluate code diversity, introducing various metrics with inter-code similarity. Specifically, we introduce code clustering methods that leverages LMs' capabilities in code understanding and reasoning, resulting in a set of metrics that represent the number of algorithms in model-generated solutions. We extensively investigate the property of model-generated solutions by contrasting them with human-written ones and quantifying the impact of various factors on code diversity: model size, temperature, instruction tuning, and problem complexity. Our analysis demonstrates that model-generated solutions exhibit low algorithmic diversity, which was neglected by the research community. Moreover, we explore methods to increase code diversity by combining solutions from different models and increasing sampling temperatures. Our findings highlight that code diversity can be enhanced with the help of heterogeneous models and setting temperature beyond 1.0 that has not been fully explored due to the functional correctness degradation. To facilitate our research direction, we publicly share our code and datasets through open-source repositories.
Key facts. Cited by 11 papers in the map (data through 14 Oct 2026). Builds on 34 of its 46 references that are in the map. First posted on arXiv 2 Mar 2025.
Builds on
34 of 46 references.
References · 34
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2023G-Eval: NLG Evaluation using GPT-4 with Better Human Alignmentcited by 2,276
- 2021SimCSE: Simple Contrastive Learning of Sentence Embeddingscited by 2,173
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,391
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
- 2023WizardLM: Empowering large pre-trained language models to follow complex instructionscited by 1,125
- 2015A Diversity-Promoting Objective Function for Neural Conversation Modelscited by 1,077
- 2023Encouraging Divergent Thinking in Large Language Models through Multi-Agent Debatecited by 1,011
- 2021Measuring Coding Challenge Competence With APPScited by 902
22 more
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 733
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
- 2021MAUVE: Measuring the Gap Between Neural Text and Human Text using Divergence Frontierscited by 470
- 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 256
- 2024The Effect of Sampling Temperature on Problem Solving in Large Language Modelscited by 170
- 2024CodeGemma: Open Code Models Based on Gemmacited by 150
- 2020Evaluating the Evaluation of Diversity in Natural Language Generationcited by 129
- 2022ReCode: Robustness Evaluation of Code Generation Modelscited by 103
- 2023CodeBERTScore: Evaluating Code Generation with Pretrained Models of Codecited by 102
- 2023Data Diversity Matters for Robust Instruction Tuningcited by 76
- 2023ICE-Score: Instructing Large Language Models to Evaluate Codecited by 52
- 2024CodeJudge: Evaluating Code Generation with Large Language Modelscited by 44
- 2024LLM-TOPLA: Efficient LLM Ensemble by Maximising Diversitycited by 42
- 2022MCoNaLa: A Benchmark for Code Generation from Multiple Natural Languagescited by 41
- 2015SourcererCC: Scaling Code Clone Detection to Big Codecited by 40
- 2024Benchmarking Language Model Creativity: A Case Study on Code Generationcited by 40
- 2024On Leakage of Code Generation Evaluation Datasetscited by 32
- 2024Exploring Precision and Recall to assess the quality and diversity of LLMscited by 29
- 2022Toward Interpretable Semantic Textual Similarity via Optimal Transport-based Contrastive Sentence Learningcited by 13
- 2024DolphCoder: Echo-Locating Code Large Language Models with Diverse and Multi-Objective Instruction Tuningcited by 11
- 2024PythonSaga: Redefining the Benchmark to Evaluate Code Generating LLMscited by 9
- 2022An ensemble meta-estimator to predict source code testabilitycited by 5
Built on by
Citing papers per year: 2025: 1; 2026: 10.
11 papers.
- 2025Exploring Multi-Temperature Strategies for Token- and Rollout-Level Control in RLVRcited by 8
- 2026MARTI-MARS2: Scaling Multi-Agent Self-Search via Reinforcement Learning for Code Generationcited by 3
- 2026FrontierSmith: Synthesizing Open-Ended Coding Problems at Scalecited by 3
- 2026MARS2: Scaling Multi-Agent Tree Search via Reinforcement Learning for Code Generationcited by 1
- 2026Beyond pass@k: Redundancy-Aware RLVR for Multi-Sample Code Generationcited by 1
- 2026The Invisible Lottery: How Subtle Cues Steer Algorithm Choice in LLM Code Generationcited by 1
- 2026Effectiveness of LLM-based Software Diversity for Reliability Improvement -- an Empirical Studycited by 1
- 2026Evaluating Multiple LLM Generations with Validated Task Coveragecited by 0
- 2026Improving the Diversity of LLM Outputs without a Trade-offcited by 0
- 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrievalcited by 0
- 2026DivAlgo: A systematic evaluation of algorithmic diversity for code generation modelscited by 0
- 2026DivAlgo: A systematic evaluation of algorithmic diversity for code generation models13 Oct 2026
- 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval1 Oct 2026
- 2026Improving the Diversity of LLM Outputs without a Trade-off27 Sep 2026
- 2026Evaluating Multiple LLM Generations with Validated Task Coverage25 Aug 2026
- 2026Effectiveness of LLM-based Software Diversity for Reliability Improvement -- an Empirical Study3 Jul 2026
- 2026The Invisible Lottery: How Subtle Cues Steer Algorithm Choice in LLM Code Generation2 Jun 2026
- 2026Beyond pass@k: Redundancy-Aware RLVR for Multi-Sample Code Generation27 May 2026
- 2026FrontierSmith: Synthesizing Open-Ended Coding Problems at Scale14 May 2026
- 2026MARS2: Scaling Multi-Agent Tree Search via Reinforcement Learning for Code Generation16 Apr 2026
- 2026MARTI-MARS2: Scaling Multi-Agent Self-Search via Reinforcement Learning for Code Generation8 Feb 2026
- 2025Exploring Multi-Temperature Strategies for Token- and Rollout-Level Control in RLVR10 Oct 2025