Skip to content

Finetuning Lightweight LLMs for Control Flow Graph Generation

Jul 2026 · arXiv.org · Vol abs/2607.04582 · 0 citations · 31 references
Computer Science

TL;DR

The experimental results show that, through fine-tuning, lightweight LLMs achieve promising results for CFG generation, particularly when the input code is incomplete or erroneous, and cross-language generalization capability on programming language not included in the fine-tuning data is demonstrated.

Abstract

Control Flow Graph (CFG) is an important program representations for software analysis, code understanding, and software maintenance. Traditional CFG generation techniques mainly rely on bytecode or abstract syntax trees. However, these approaches usually require complete, compilable, and syntax error-free code, which limits their applicability to incomplete or erroneous code. Furthermore, they often depend on language specific tools, making it difficult to support multiple programming languages in a unified manner. To address these limitations, this paper investigates the use of fine-tuned lightweight large language models (LLMs) for CFG generation. We first design a unified CFG output format and a task-specific fine-tuning prompt for CFG generation. Then, we construct a dataset based on an existing LeetCode dataset through automatic CFG generation and error augmentation. We evaluate the proposed approach on six lightweight LLM models, including three code-specific LLMs: CodeLlama, QwenCoder, and DeepSeekCoder; and three general purpose LLMs: Llama3.2-3B, Qwen-4B, and Phi-4B. The experimental results show that, through fine-tuning, lightweight LLMs achieve promising results for CFG generation, particularly when the input code is incomplete or erroneous. It also demonstrates cross-language generalization capability on programming language not included in the fine-tuning data.

View source

Similar papers

#small language model Book Open access Sep 2026

Code Transformation Rule Synthesis using LLMs: Potential and Limits

A novel empirical study targeting three domain- specific languages for transformation rules, namely Comby, GritQL, and Ast-Grep, which shows great potential for LLMs to generate sound, correct, generalizable, and reusable rules.

Axel Allain, Aymeric Blot, D. Khelladi et al. · 1 citation
Preprint Aug 2026

Route-Align-Verify for Functional Correctness in Code Generation

The results indicate that functional correctness in code generation can be meaningfully improved without modifying the backbone architecture, by jointly optimizing how tasks are prompted, how the model is adapted, and how final outputs are selected.

Eric Zhou, Jing Meng, Ao-Fan Liu · 0 citations
Preprint Aug 2026

GraphAlignCoder: Aligning Program and Proof Graphs for Code Generation

GraphAlignCoder is introduced, a training framework that transfers explicit correctness structure into code generation and consistently outperforms the base model, code-only SFT, and CodeRL across all benchmarks.

Yue-Ke Zhang, Zihan Fang, Kevin Leach et al. · 0 citations
Conference Aug 2026

CoLSM: Collaborative Large and Small Models for Automatic Software Generation

Large language models (LLMs) support human-in-the-loop code development by rapidly generating high-quality code snippets. However, they still face prominent challenges in fast and efficient deployment on edge environments. Such challenges mainly involve heavy computation costs, poor domain accuracy, unbalanced collabor...

Quan Wen, Liu-Shun Zhao, Xiongtao Zhang et al. · 0 citations

Hunk-Constrained DPO: Segment-Level Optimization for Secure and Correct LLM Code Generation

Hunk-Constrained Direct Preference Optimization is introduced, a training framework that unifies security hardening and functional correction in large language models and demonstrates that HPO achieves substantial security improvements—up to 28 percentage points—while preserving or enhancing functional correctness.

Qian-Shuo Huang, Xin Yin, Xin-Rui Li et al. · 0 citations
#small language model Preprint Sep 2026

Towards Behavior Tree-Guided Vulnerability Detection with Lightweight LLMs

Investigating Behavior Trees (BTs) as an alternative intermediate representation for LLM-based vulnerability detection suggests that BTs can provide a compact and useful structured representation for vulnerability detection with quantized, locally deployable LLMs.

Enna Bašić, A. Giaretta · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.