<p>The increasing complexity of software systems and the rise of polyglot programming-common in architectures like microservices-highlight the need for software development environments that facilitate the effective integration of diverse programming paradigms. The distinction between functional and procedural paradigms in Python code exemplifies this diversity. Although each paradigm offers distinct advantages, engineers often specialize in or prefer one paradigm over the other, underscoring the utility of tools that enable seamless translation between paradigms to improve collaboration and development efficiency. This study evaluates nine lightweight, open-source Large Language Models (LLMs)-Alpaca, Vicuna, LLaMA, Falcon, CodeGen, GPT-Neo, Dolly, DeepSeek-1.3B, and DeepSeek-7B-for automating Python code translation between functional and procedural styles. Using a benchmark of 57 functional and 48 procedural programs, we conducted 945 model-task interactions and assessed performance based on the unit test success rate of the converted code. LLaMA and DeepSeek-7B led with success rates of <InlineEquation ID="IEq1"> <EquationSource Format="TEX">\(80-84\%\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mn>80</mn> <mo>-</mo> <mn>84</mn> <mo>%</mo> </mrow> </math></EquationSource> </InlineEquation> for functional-to-procedural (f2p) conversions and <InlineEquation ID="IEq2"> <EquationSource Format="TEX">\(55-57\%\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mn>55</mn> <mo>-</mo> <mn>57</mn> <mo>%</mo> </mrow> </math></EquationSource> </InlineEquation> for procedural-to-functional (p2f) conversions, with statistically significant differences (ANOVA, <InlineEquation ID="IEq3"> <EquationSource Format="TEX">\(p &lt; 0.001\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi>p</mi> <mo /> <mn>0.001</mn> </mrow> </math></EquationSource> </InlineEquation>). A directional bias favoring f2p conversions reflects an imbalance in training data. DeepSeek-1.3B matched the performance of DeepSeek-7B, and CodeGen outperformed similar-sized models, emphasizing that training data plays a more critical role than model parameter count. Higher code complexity reduced success rates (e.g., correlation with LOC: <InlineEquation ID="IEq4"> <EquationSource Format="TEX">\(-0.42\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mo>-</mo> <mn>0.42</mn> </mrow> </math></EquationSource> </InlineEquation>, <InlineEquation ID="IEq5"> <EquationSource Format="TEX">\(p=0.001\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi>p</mi> <mo>=</mo> <mn>0.001</mn> </mrow> </math></EquationSource> </InlineEquation>). These lightweight models offer cost-effective, reliable solutions for software engineering automation, despite challenges with complex code and edge cases.</p>

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Bridging the paradigm debate: automating functional and procedural paradigm translation with lightweight open-source LLMs

  • Safwan Omari,
  • Prithu Kathet,
  • Mohammad Wardat,
  • Mohammed Shehab

摘要

The increasing complexity of software systems and the rise of polyglot programming-common in architectures like microservices-highlight the need for software development environments that facilitate the effective integration of diverse programming paradigms. The distinction between functional and procedural paradigms in Python code exemplifies this diversity. Although each paradigm offers distinct advantages, engineers often specialize in or prefer one paradigm over the other, underscoring the utility of tools that enable seamless translation between paradigms to improve collaboration and development efficiency. This study evaluates nine lightweight, open-source Large Language Models (LLMs)-Alpaca, Vicuna, LLaMA, Falcon, CodeGen, GPT-Neo, Dolly, DeepSeek-1.3B, and DeepSeek-7B-for automating Python code translation between functional and procedural styles. Using a benchmark of 57 functional and 48 procedural programs, we conducted 945 model-task interactions and assessed performance based on the unit test success rate of the converted code. LLaMA and DeepSeek-7B led with success rates of \(80-84\%\) 80 - 84 % for functional-to-procedural (f2p) conversions and \(55-57\%\) 55 - 57 % for procedural-to-functional (p2f) conversions, with statistically significant differences (ANOVA, \(p < 0.001\) p 0.001 ). A directional bias favoring f2p conversions reflects an imbalance in training data. DeepSeek-1.3B matched the performance of DeepSeek-7B, and CodeGen outperformed similar-sized models, emphasizing that training data plays a more critical role than model parameter count. Higher code complexity reduced success rates (e.g., correlation with LOC: \(-0.42\) - 0.42 , \(p=0.001\) p = 0.001 ). These lightweight models offer cost-effective, reliable solutions for software engineering automation, despite challenges with complex code and edge cases.