mlsanityData to 14 Oct 2026

How Diversely Can Language Models Solve Problems? Exploring the Algorithmic Diversity of Model-Generated Code

arXiv 2503.00691 ↗First posted 2 Mar 2025cs.SE cs.AI cs.CLcited by 11

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

  1. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  2. 2021Program Synthesis with Large Language Modelscited by 3,637
  3. 2023G-Eval: NLG Evaluation using GPT-4 with Better Human Alignmentcited by 2,276
  4. 2021SimCSE: Simple Contrastive Learning of Sentence Embeddingscited by 2,173
  5. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  6. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,391
  7. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
  8. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
  9. 2023WizardLM: Empowering large pre-trained language models to follow complex instructionscited by 1,125
  10. 2015A Diversity-Promoting Objective Function for Neural Conversation Modelscited by 1,077
  11. 2023Encouraging Divergent Thinking in Large Language Models through Multi-Agent Debatecited by 1,011
  12. 2021Measuring Coding Challenge Competence With APPScited by 902
22 more
  1. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 733
  2. 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
  3. 2021MAUVE: Measuring the Gap Between Neural Text and Human Text using Divergence Frontierscited by 470
  4. 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 256
  5. 2024The Effect of Sampling Temperature on Problem Solving in Large Language Modelscited by 170
  6. 2024CodeGemma: Open Code Models Based on Gemmacited by 150
  7. 2020Evaluating the Evaluation of Diversity in Natural Language Generationcited by 129
  8. 2022ReCode: Robustness Evaluation of Code Generation Modelscited by 103
  9. 2023CodeBERTScore: Evaluating Code Generation with Pretrained Models of Codecited by 102
  10. 2023Data Diversity Matters for Robust Instruction Tuningcited by 76
  11. 2023ICE-Score: Instructing Large Language Models to Evaluate Codecited by 52
  12. 2024CodeJudge: Evaluating Code Generation with Large Language Modelscited by 44
  13. 2024LLM-TOPLA: Efficient LLM Ensemble by Maximising Diversitycited by 42
  14. 2022MCoNaLa: A Benchmark for Code Generation from Multiple Natural Languagescited by 41
  15. 2015SourcererCC: Scaling Code Clone Detection to Big Codecited by 40
  16. 2024Benchmarking Language Model Creativity: A Case Study on Code Generationcited by 40
  17. 2024On Leakage of Code Generation Evaluation Datasetscited by 32
  18. 2024Exploring Precision and Recall to assess the quality and diversity of LLMscited by 29
  19. 2022Toward Interpretable Semantic Textual Similarity via Optimal Transport-based Contrastive Sentence Learningcited by 13
  20. 2024DolphCoder: Echo-Locating Code Large Language Models with Diverse and Multi-Objective Instruction Tuningcited by 11
  21. 2024PythonSaga: Redefining the Benchmark to Evaluate Code Generating LLMscited by 9
  22. 2022An ensemble meta-estimator to predict source code testabilitycited by 5

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 1; 2026: 10.

11 papers.