arXiv:2604.12913cs.SEcs.AI2026-04中稿 · IJCNN 2026

用大模型修复反编译代码,让生成的代码能跑通。

CoDe-R: Refining Decompiler Output with LLMs via Rationale Guidance and Adaptive Inference

  • 通过推理引导恢复算法意图,提升语义准确性
  • 1.3B模型在基准上实现50%以上可重执行率,创轻量级新纪录
  • 适合做高效反编译或安全分析的研究者和工程师

二进制反编译是关键的逆向工程任务,旨在从剥离符号的可执行文件中重构高级源代码。尽管大语言模型(LLMs)近期展现出潜力,但因编译过程导致的不可逆语义丢失,常出现“逻辑幻觉”和“语义错位”,使得生成代码无法重执行。本文提出轻量级两阶段代码优化框架CoDe-R。第一阶段引入语义认知增强(SCE),通过推理引导的语义注入策略,使模型同时恢复高阶算法意图与代码结构;第二阶段设计动态双路径回退(DDPF)机制,在推理时通过混合验证策略自适应平衡语义恢复与语法稳定性。在HumanEval-Decompile基准上的评估表明,使用1.3B模型的CoDe-R在轻量级场景下达到新SOTA,首次实现1.3B模型平均重执行率超过50.00%,显著优于基线,有效缩小了高效模型与专家级性能之间的差距。代码已开源:https://github.com/Theaoi/CoDe-R。

原文摘要 · Abstract (English)

Binary decompilation is a critical reverse engineering task aimed at reconstructing high-level source code from stripped executables. Although Large Language Models (LLMs) have recently shown promise, they often suffer from "logical hallucinations" and "semantic misalignment" due to the irreversible semantic loss during compilation, resulting in generated code that fails to re-execute. In this study, we propose Cognitive Decompiler Refinement with Robustness (CoDe-R), a lightweight two-stage code refinement framework. The first stage introduces Semantic Cognitive Enhancement (SCE), a Rationale-Guided Semantic Injection strategy that trains the model to recover high-level algorithmic intent alongside code. The second stage introduces a Dynamic Dual-Path Fallback (DDPF) mechanism during inference, which adaptively balances semantic recovery and syntactic stability via a hybrid verification strategy. Evaluation on the HumanEval-Decompile benchmark demonstrates that CoDe-R (using a 1.3B backbone) establishes a new State-of-the-Art (SOTA) in the lightweight regime. Notably, it is the first 1.3B model to exceed an Average Re-executability Rate of 50.00%, significantly outperforming the baseline and effectively bridging the gap between efficient models and expert-level performance. Our code is available at https://github.com/Theaoi/CoDe-R.

反编译大模型代码生成安全分析

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。