Bridging the paradigm debate: automating functional and procedural paradigm translation with lightweight open-source LLMs
摘要
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