A Study of LLMs’ Preferences for Libraries and Programming Languages

Read full text
Authors: Lukas Twist, Jie M. Zhang, Mark Harman, Don Syme, Joost Noppen, Helen Yannakoudakis, Detlef Nauck
Cited by: 3

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 systematic 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 highperformance project initialisation tasks where using Python may bring more security and efficiency risks, 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 taskspecific optimality; underscoring the need for targeted fine-tuning, data diversification, and evaluation benchmarks that explicitly measure language and library selection fidelity.

Fields of Study & Subjects

Software Engineering Research Scientific Computing and Data Management Artificial Intelligence in Healthcare and Education

Publication details

Journal / source
Findings of the Association for Computational Linguistics: ACL 2026
Publisher
Association for Computational Linguistics
Pages
331–351
Publication date
1 January 2026
Language
EN