TL;DR
While LLMs are becoming expert coders, they still struggle to understand the "ground truth" of program execution, often failing to spot subtle bugs in low-level C code. This paper demonstrates that training models on symbolic execution traces—formal maps of every possible path a program can take—dramatically improves their ability to detect vulnerabilities, allowing an 8B parameter model to outperform models four times its size.
What Problem Does This Paper Address?
LLMs are increasingly used for software development, but their "understanding" of code is often superficial, relying on pattern matching rather than a deep grasp of program semantics. In high-level languages like Python, this might suffice, but in C, reasoning about pointer arithmetic, memory safety, and undefined behavior is critical.
The authors identify a "holds-violated asymmetry": current models are excellent at confirming that safe code is safe (achieving >90% accuracy), but they are surprisingly poor at identifying actual bugs (violations), with performance dropping sharply as programs get longer. Essentially, models are biased toward assuming code is correct, often "rationalizing away" clear bugs as benign.
Methods
The researchers propose a novel training pipeline that bridges the gap between formal methods and machine learning:
- Symbolic Execution: Instead of just running code with specific inputs (concrete execution), they use Soteria, a symbolic execution engine. This tool explores all possible execution paths simultaneously, tracking variable states and memory conditions.
- Trace Extraction: They ran Soteria on a massive corpus of open-source C code to generate detailed execution traces. They specifically filtered for "manifest bug" traces—sequences where the tool proves a violation occurs on all feasible inputs.
- Continued Pretraining (CPT): They took a base model (Qwen3-8B) and performed continued pretraining on just ~3,000 of these curated traces.
- Superadditive Reasoning: At inference time, they combined this specialized training with "thinking" (Chain-of-Thought) reasoning.
The key innovation is using symbolic traces, which make implicit program logic explicit, providing the model with a "step-by-step guide" to how bugs manifest.
Datasets
- Evaluation Benchmark: The authors introduced a new, balanced evaluation framework consisting of 500 C verification tasks derived from SV-COMP 2025 (the premier software verification competition). It covers five categories: memory safety, overflows, termination, reachability, and data races.
- Training Data: They started with the GitHub CodeParrot dataset (14M C files), filtered for self-contained files, and used Soteria to generate ~34,000 usable traces, eventually narrowing down to the most informative ~3,200 bug traces.
Key Insights and Ideas
- The Synergy of "Training + Thinking": One of the most striking findings was that CPT and Chain-of-Thought (CoT) are "superadditive." CPT alone or CoT alone provided negligible gains, but together they unlocked a massive performance boost. CPT teaches the model what to reason about, while CoT provides the "working memory" to apply that knowledge.
- Structure is a Feature: Training on HTML-formatted traces (which include tags for log levels and nested structures) worked better than plain text. The model uses these structural markers as anchors for its multi-step reasoning.
- Quality Over Quantity: The best results came from a tiny dataset of just 3,208 high-quality bug traces. Training on larger, uncurated datasets actually degraded performance, proving that semantic signal is more important than raw code volume.
- Generalization Across Properties: Even though the training traces primarily focused on memory safety and overflows, the model’s performance improved across all categories, including termination and data races. This suggests the model learned general principles of program verification rather than just memorizing specific bug patterns.
Key Results
- Violation Detection Boost: The trained Qwen3-8B model saw a 17.9 percentage point (pp) improvement in detecting violations compared to the base model.
- Outperforming Scale: The specialized 8B model outperformed the much larger Qwen3-32B base model on violation detection tasks.
- Clean Gains: On parseable responses, violation accuracy jumped by +26 pp with zero degradation in the model's ability to identify safe code (maintaining ~91% accuracy).
- Length Resilience: While all models struggle as code length increases, the CPT-trained model maintained much higher accuracy on programs in the 100–200 lines of code (LOC) range where base models typically collapse.
Limitations and Future Work
- Scope: The current study is limited to single-file C programs under 400 lines. Real-world software is multi-file and significantly more complex.
- Language: While Soteria supports Rust, the bulk of this work focused on C.
- Binary Verdicts: The model currently only provides a "Hold" or "Violated" verdict. In formal verification, tools are usually expected to produce a "witness" (a machine-checkable proof), which is a much higher bar.
- Token Budgets: The "thinking" mode is computationally expensive and frequently exhausts the output token budget on longer, more complex programs.
The authors suggest that future work could involve moving symbolic execution into a reinforcement learning (RL) loop, allowing models to "self-correct" by checking their reasoning against formal tools.
Summary updated