Developer Tools

Static Program Slicing Using Language Models With Dataflow-Aware Pretraining and Constrained Decoding

New LM approach uses dataflow-aware pretraining to eliminate hallucinated tokens

Deep Dive

Static program slicing—isolating code relevant to a specific variable—is a core software engineering task, but current LM-based approaches suffer from inaccurate dependency modeling and hallucinated statements. To solve this, researchers from multiple institutions introduce Sliceformer, a novel method that reformulates slicing as a sequence-to-sequence task using small language models like CodeT5+. Sliceformer’s first innovation is dataflow-aware pretraining: it leverages data flow graphs (DFG) to teach models data dependencies through two objectives—dataflow-preserving statement permutation and dataflow-aware span corruption. The second innovation is a constrained decoding mechanism that enforces both lexical and syntactic constraints, effectively eliminating hallucinated tokens and statements during generation.

Sliceformer was evaluated on Java and Python program slicing benchmarks, consistently outperforming existing baselines with up to a 22% gain in ExactMatch. The results demonstrate that combining domain-aware pretraining with generation constraints significantly improves the reliability of LM-based program analysis. Accepted at ACL 2026, this work highlights a practical path for integrating language models into software engineering tools, particularly where precision and trustworthiness are critical. By reducing hallucination and improving dependency modeling, Sliceformer could enable more accurate debuggers, code reviewers, and automated refactoring systems.

Key Points
  • Reformulates program slicing as seq2seq using CodeT5+, a small language model
  • Dataflow-aware pretraining uses data flow graphs for statement permutation and span corruption
  • Constrained decoding enforces lexical/syntactic rules, achieving up to 22% ExactMatch improvement
  • Accepted at ACL 2026, tested on Java and Python benchmarks

Why It Matters

Makes AI-generated code analysis more reliable by eliminating hallucinated statements in program slicing.