HackerPapers

arXiv:2503.17181cs.SE

A Study of LLMs' Preferences for Libraries and Programming Languages

Lukas Twist, Mark Harman, Don Syme, Joost Noppen, Helen Yannakoudakis, Detlef Nauck, Jie M. Zhang

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

Abstract

Despite the rapid progress of large language models (LLMs) in code generation, existing evaluations focus on functional correctness or syntactic validity, overlooking how LLMs make critical design choices such as which library or programming language to use. To fill this gap, we perform the first empirical study of LLMs' preferences for libraries and programming languages when generating code, covering eight diverse LLMs. We observe a strong tendency to overuse widely adopted libraries such as NumPy; in up to 45% of cases, this usage is not required and deviates from the ground-truth solutions. The LLMs we study also show a significant preference toward Python as their default language. For high-performance project initialisation tasks where Python is not the optimal language, it remains the dominant choice in 58% of cases, and Rust is not used once. These results highlight how LLMs prioritise familiarity and popularity over suitability and task-specific optimality; underscoring the need for targeted fine-tuning, data diversification, and evaluation benchmarks that explicitly measure language and library selection fidelity.

arXiv comments
21 pages, 10 tables, 3 figures. Accepted to Findings of ACL 2026
Journal reference
Findings of the Association for Computational Linguistics: ACL 2026
DOI
doi:10.18653/v1/2026.findings-acl.15
Subjects
cs.SESoftware Engineering cs.AIArtificial Intelligence cs.CLComputation and Language

On Hacker News

Linked by 1 identifiable commenter in 1 comment across 1 thread, from Jul 2026 to Jul 2026. Found in 1 HN submission from Oct 2026 to Oct 2026. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments1 thread

    • Do you have citations? Everything I’ve read have said they have an overwhelming bias to Python; eg https://arxiv.org/html/2503.17181v1 and https://arxiv.org/html/2505.13004v1

      seanmcdirmidView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.