Sightline: Calibrated Data-Flow Summaries for LLM-Integrated Applications

Zihao Xu, Yuekang Li, Ruitao Feng, Haifeng ShenarXiv 2026 · arXiv

When we integrate Large Language Models (LLMs) into traditional software, we create a "black box" at the heart of our code. Traditional program analysis tools—like those used for security auditing or data-flow tracking—rely on reading source code to understand how data moves. But LLMs don't have source code; they have weights.

This creates a massive headache for security engineers: if a user's untrusted query goes into a prompt, does it "flow" into the final output? If we can't answer that precisely, we either have to assume everything flows (leading to "label creep" where everything becomes tainted) or use expensive "LLM-as-a-judge" techniques to label every single call.

Sightline offers a middle ground: a fast, white-box method to generate data-flow summaries for LLM calls with statistical guarantees.

TL;DR

Sightline uses internal attention mechanisms to track how data flows from input placeholders to LLM outputs. It provides a calibrated summary that prunes out "spurious" flows (data that was read but not used) while guaranteeing a user-defined maximum miss rate, all in a single forward pass.

What Problem Does This Paper Address?

The authors tackle the "NL/PL boundary"—the gap between structured programming languages and natural language models. When a program fills a prompt template with variables (placeholders) and sends it to an LLM, we lose track of which variables actually influenced the result.

Existing methods struggle with this:

  1. Conservative Tainting: Assuming every input affects the output. This is safe but uselessly noisy.
  2. Sensitivity Analysis (Gradients/Fisher Information): These methods fail when a model is very confident. If the output probability is near 100%, the gradient "vanishes," making it look like the input didn't matter even if it was the sole cause of the decision.
  3. Leave-One-Out (LOO) Removal: Deleting an input to see if the output changes. This fails if the information is duplicated elsewhere in the prompt.
Figure 1: A comparison of different methods on a sample LLM call. Sightline correctly identifies that the query (A) flows to the output while the delimiter (B) is read but unused.

Methods

Sightline is built on a theoretical foundation proved and mechanized in Lean 4. The authors proved that in a transformer, information can only flow from an input to an output through the attention heads that "read" it.

The Sightline pipeline consists of four steps:

  1. Teacher-Forced Forward Pass: The model runs once on the recorded prompt and output.
  2. Feature Extraction: It records "reading features" from every attention head—specifically the mean and peak attention mass paid to each input placeholder.
  3. Pruning Readout: A lightweight logistic regression model (trained once on labeled data) scores these features to decide if a "read" constitutes a "use."
  4. Calibrated Pruning: Using conformal prediction, Sightline sets a threshold for these scores. This ensures that, on average, the tool misses no more than a chosen fraction (e.g., 1%) of true data flows.

For closed-source models where internal weights aren't accessible, the authors propose Surrogate Reading: using an open-source model (like Qwen) to "read" the transaction and estimate the data flow.

Datasets

The researchers evaluated Sightline using two primary batches of data:

  • The "Old" Batch: 8,105 placeholder-output pairs from 3,778 real-world Python call sites. This was used to train the readout model.
  • The "New" Batch: 4,918 pairs from 2,842 call sites across 2,103 unseen repository families. This served as the primary test for generalization.
  • Models: Evaluation was performed across four distinct architectures: Qwen3-8B, Granite 4.2 3B, Gemma 4 E2B, and the hybrid Nemotron 3 Nano 4B.

Key Insights and Ideas

  • Attention is the "Sound" Signal: Unlike gradients, attention weights don't vanish when the model is confident. If the model is certain about an answer, it still has to "look" at the relevant part of the prompt to arrive at that certainty.
  • The "Implicit Flow" Problem: The paper proves that a "faint" signal (low attention or low sensitivity) cannot be used to certify that data didn't flow. This is why a statistical guarantee (calibration) is necessary rather than a simple hard threshold.
  • Non-Monotonicity is Required: To accurately prune unused reads, the scoring model must be able to assign negative weights to certain attention heads. Some heads might "read" everything as a default behavior (like an "attention sink"), and the model needs to learn to ignore them.

Key Results

  • Superior Accuracy: Sightline achieved a Macro-F1 score of 81.1–86.7%, outperforming the best baseline (Replacement) by up to 6.2 points.
  • Effective Pruning: When calibrated to a 1% miss rate, Sightline pruned 43.9–65.6% of spurious flows—roughly 2x better than the best existing baseline.
  • Robustness to Confidence: As shown in Figure 4, while gradient-based methods (GIF) collapse as model confidence increases, Sightline’s performance remains steady.
  • Low Overhead: Generating a summary takes only 0.12–0.20 seconds per call, making it practical for real-time monitoring.
Figure 4: Sightline remains discriminative even on highly confident outputs where gradient-based signals (GIF) vanish.

Limitations and Future Work

  • Hybrid Architectures: While Sightline works on hybrid models like Nemotron (which uses Mamba2 state-space layers), it currently only analyzes the attention layers. Expanding the theoretical proof to cover state-space routing is a noted area for future work.
  • First-Order Limits: The proof relies on first-order effects. While the authors found that adding "two-hop" attention routes didn't improve accuracy, higher-order interactions in deeper models might eventually require more complex feature extraction.
  • Surrogate Alignment: Surrogate reading depends on the surrogate model "thinking" similarly to the target model. While it worked well in this study, very specialized or highly fine-tuned models might require more closely aligned surrogates.

Summary updated

Abstract

Programs increasingly call large language models (LLMs), filling prompt placeholders with program values and consuming the output. Such a call crosses the boundary between natural language and programming language (NL/PL). To follow data across it, an analysis needs a data-flow summary of which placeholders the output uses, but no code describes what the model does. Analyses of these LLM-integrated applications therefore taint every output with every input, creating spurious flows, or ask a second model to label each call, which is costly. We prove, and mechanize in Lean 4, that a placeholder flows to the output of a transformer, to first order, only through the attention that reads it (no reading, no flow), and that a faint reading or sensitivity cannot certify that a placeholder does not flow. Unlike reading, the log-probability gradients and Fisher signals of existing methods vanish on confident outputs, and single-span removal fails on duplicated content. Our tool, Sightline, reads a recorded call in one forward pass, learns from labels which reads are uses, and calibrates the pruning to miss at most a chosen fraction $α$ of true flows, on average over call sites, when deployment is exchangeable with calibration. On 2,103 unseen repository families and four models, Sightline is the most accurate summary against the seven closest methods and a hidden-state probe. Calibrated at $α$ = 1%, it misses about 1% of true flows and prunes 43.9-65.6% of spurious flows, 1.6 to 2.6 times as many as the best baseline, and still 43.8-60.1% when calibrated on another collection. Through an open surrogate, it reads models treated as closed about as accurately as they read themselves, without their labels. In the information-flow control of an LLM agent, it removes about half of the labels from inputs that do not flow.
BibTeX
@misc{xu2026sightline,
  author = {Zihao Xu and Yuekang Li and Ruitao Feng and Haifeng Shen},
  title = {{Sightline: Calibrated Data-Flow Summaries for LLM-Integrated Applications}},
  year = {2026},
  eprint = {2611.26221},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.26221},
}
Figure