On the Applicability of Code Language Models to Scientific Computing Programs
Scientific Computing Programming Languages (SCPLs), like MATLAB and R, are popular and widely used for computational mathematics. In recent years, pre-trained code language models (CLMs) have automated many code-related tasks, covering various general programming languages. SCPLs share many similarities with general programming languages, including similar syntactic structures and the semantics of identifiers. Despite the similarities, there exist many differences between them. For example, lots of numerical operations and dedicated libraries exist in SCPLs. However, there has been little comprehensive work analyzing CLMs’ capabilities in the understanding and generation of pragmatic scientific computing programs. To this end, we investigate the applicability of code language models for the SCPL analysis, especially focus on real-world code in open-source repositories. We first create a benchmark that contains programs and documentation from three widely used scientific computing programming languages, then perform an adequate evaluation of existing advanced code language models on both code understanding and generation tasks using the new benchmark, and study the relations of different training strategies, model types, and model sizes to the performance of different tasks and languages. Evaluation results confirm that, compared to general programming languages, SCPLs are more challenging to understand, and especially to generate, but the use of code language models is nevertheless feasible, and the knowledge obtained from the general languages can be transferred to SCPL analysis. A deeper analysis reveals additional challenges in generating code that incorporates API calls relevant to computational mathematics. We believe that our findings can provide guidance on improving tooling and analyses for the scientific programming language, and also inspire and motivate researchers to improve the robustness of existing code language models.
Authors
- Cheng‐Ru Wu (ORCID: https://orcid.org/0009-0008-0097-1313)
- Fang Liu (ORCID: https://orcid.org/0000-0002-3905-8133)
- Li Zhang (ORCID: https://orcid.org/0000-0001-8966-1451)
- Qianhui Zhao (ORCID: https://orcid.org/0009-0009-2439-0684)
- Xiao Long
Institutions
- Beihang University (CN)
Publication Details
- Journal
- IEEE Transactions on Software Engineering
- Published
- 2025-04-25
- DOI
- https://doi.org/10.1109/tse.2025.3564599
- Primary Topic
- Scientific Computing and Data Management
- Type
- article
- Field-Weighted Citation Impact
- 0.00