mlsanityData to 7 Oct 2026

AI Chain on Large Language Model for Unsupervised Control Flow Graph Generation for Statically-Typed Partial Code

arXiv 2306.00757 ↗First posted 1 Jun 2023cs.SEcited by 3

Not on the map. Why?

Abstract (arXiv)

Control Flow Graphs (CFGs) are essential for visualizing, understanding and analyzing program behavior. For statically-typed programming language like Java, developers obtain CFGs by using bytecode-based methods for compilable code and Abstract Syntax Tree (AST)-based methods for partially uncompilable code. However, explicit syntax errors during AST construction and implicit semantic errors caused by bad coding practices can lead to behavioral loss and deviation of CFGs.To address the issue, we propose a novel approach that leverages the error-tolerant and understanding ability of pre-trained Large Language Models (LLMs) to generate CFGs. Our approach involves a Chain of Thought (CoT) with four steps: structure hierarchy extraction, nested code block extraction, CFG generation of nested code blocks, and fusion of all nested code blocks' CFGs. To address the limitations of the original CoT's single-prompt approach (i.e., completing all steps in a single generative pass), which can result in an ``epic'' prompt with hard-to-control behavior and error accumulation, we break down the CoT into an AI chain with explicit sub-steps. Each sub-step corresponds to a separate AI-unit, with an effective prompt assigned to each unit for interacting with LLMs to accomplish a specific purpose.Our experiments confirmed that our method outperforms existing CFG tools in terms of node and edge coverage, especially for incomplete or erroneous code. We also conducted an ablation experiment and confirmed the effectiveness of AI chain design principles: Hierarchical Task Breakdown, Unit Composition, and Mix of AI Units and Non-AI Units.Our work opens up new possibilities for building foundational software engineering tools based on LLMs, as opposed to traditional program analysis methods.

Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). First posted on arXiv 1 Jun 2023.

Builds on

No reference list yet.

Built on by

Cited by year

Citing papers per year: 2023: 2; 2024: 1.

3 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2024VisualCoder: Guiding Large Language Models in Code Execution with Fine-grained Multimodal Chain-of-Thought Reasoning
  2. 2025Flow2Code: Evaluating Large Language Models for Flowchart-based Code Generation Capability
  3. 2026Analyzing Chain of Thought (CoT) Approaches in Control Flow Code Deobfuscation Tasks
  4. 2023Bridging Code Semantic and LLMs: Semantic Chain-of-Thought Prompting for Code Generation
  5. 2023Chain-of-Thought in Neural Code Generation: From and For Lightweight Language Models
  6. 2025Chain of Execution Supervision Promotes General Reasoning in Large Language Models
  7. 2024Assessing Code Generation with Intermediate Languages
  8. 2025Execution Guided Line-by-Line Code Generation