The automated translation of C code to Java code is a notoriously difficult task, fraught with challenges stemming from fundamental paradigm shifts (procedural vs. Object Oriented), memory models (manual pointers vs. Garbage Collection), and incompatible data types. This paper investigates the efficacy of 19 small, quantized LLMs (under 20 billion parameters) for the C to Java translation task. We use a novel, hybrid pipeline that leverages Abstract Syntax Trees (ASTs) for semantic decomposition and employs a highly constrained, rule based prompting strategy. The results are stark: a clear multi tiered performance divide emerged. The vast majority of models (Tier 3, e.g., llama3.1, gemma3, starcoder2) failed 100\% of the tests, proving incapable of generating even basic, runnable Java boilerplate. A small middle tier (Tier 2, e.g., mistral-nemo and mistral) produced runnable code but was plagued by dangerous semantic failures and wrong translations. Only three models (Tier 1: phi4, deepseek-coder-v2, codeqwen) proved viable, passing over 50\% of the test suite. Even these top models failed on the most complex C concepts, such as function pointers, sizeof, and enum logic, revealing a hard ceiling for the reasoning capabilities of current quantized models.


翻译:将C代码自动转换为Java代码是一项众所周知的艰巨任务,其挑战源于根本性的范式转换(过程式与面向对象)、内存模型(手动指针与垃圾回收)以及不兼容的数据类型。本文研究了19个小型量化大型语言模型(参数少于200亿)在C到Java翻译任务中的效能。我们采用一种新颖的混合流水线,利用抽象语法树进行语义分解,并采用高度约束的基于规则的提示策略。结果显著:出现了清晰的多层次性能分化。绝大多数模型(第三梯队,如llama3.1、gemma3、starcoder2)在100%的测试中失败,证明其甚至无法生成基本的可运行Java模板代码。一个较小的中间梯队(第二梯队,如mistral-nemo和mistral)生成了可运行代码,但受到危险的语义错误和错误翻译的困扰。仅有三个模型(第一梯队:phi4、deepseek-coder-v2、codeqwen)被证明可行,通过了超过50%的测试集。即使这些顶级模型在最复杂的C概念(如函数指针、sizeof和枚举逻辑)上也失败了,揭示了当前量化模型推理能力的硬性上限。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
【ACL2020-Facebook AI】大规模无监督跨语言表示学习
专知会员服务
34+阅读 · 2020年4月5日
将Python用于NLP:Pattern 库简介
Python程序员
15+阅读 · 2019年6月7日
在TensorFlow中对比两大生成模型:VAE与GAN
机器之心
12+阅读 · 2017年10月23日
神经网络机器翻译原理:LSTM、seq2seq到Zero-Shot
北京思腾合力科技有限公司
11+阅读 · 2017年8月10日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
VIP会员
相关资讯
将Python用于NLP:Pattern 库简介
Python程序员
15+阅读 · 2019年6月7日
在TensorFlow中对比两大生成模型:VAE与GAN
机器之心
12+阅读 · 2017年10月23日
神经网络机器翻译原理:LSTM、seq2seq到Zero-Shot
北京思腾合力科技有限公司
11+阅读 · 2017年8月10日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员