From Bytes to Behavior: Request-Level Attribution from Live GPU Hidden States

Jonathan Pan, Yidi Yuan, Xin Wei Chia, Xinhui Su, Vincent Tan, Brenda OngarXiv 2026

This paper, recently published by researchers at Singapore’s Home Team Science and Technology Agency (HTX), introduces a novel forensic technique for "wiretapping" the internal thoughts of a running Large Language Model (LLM). By extracting transient hidden states directly from GPU memory, the authors demonstrate that we can audit the behavior of a live AI service without needing its source code, weights, or even the ability to restart it.

TL;DR

The authors present a method to extract per-layer "residual stream" activations from a live, unmodified GPU process using a non-modifying debugger. This technique allows for request-level attribution—such as detecting if a model is about to refuse a prompt—with byte-exact accuracy across 33 different model architectures, all without prior knowledge of the model's internal parameters.

What Problem Does This Paper Address?

Traditional memory forensics for machine learning usually targets "static artifacts": the model weights stored on disk or the text logs of prompts and completions. However, these don't capture the transient computational state—the "hidden states" that exist only for milliseconds while the GPU is processing a specific request.

In a forensic or compliance scenario, an examiner might need to analyze a running LLM service that cannot be modified or restarted. Because LLMs reuse memory buffers immediately after a calculation, these internal states are ephemeral. Current tools can't "see" inside this black box to understand why a model produced a specific output or to verify its internal mechanics during a live session. The challenge is identifying which of the thousands of dynamic memory allocations in VRAM actually represent the model's core "residual stream" (the running sum of information passed between layers).

Methods

The researchers developed a six-stage pipeline: Attach, Clock, Identify, Read, Validate, and Use.

Fig. 1. The pipeline. A debugger attached to an unmodified PyTorch process logs every allocation; a blind selector picks the residual-stream allocations from the log alone; the bytes are read from VRAM; probes are applied to the recovered states.
  1. Non-Modifying Attachment: They use ptrace and cuda-gdb to attach to a running process. Crucially, they do not use code injection (like LD_PRELOAD), ensuring the target's integrity is maintained for forensic validity.
  2. Clocking: To know when to look at memory, they implement two types of "clocks":
  3. Allocator Clock: Hooks into PyTorch’s caching allocator to log the birth and death of every tensor.
  4. Kernel-Launch Clock: For optimized engines like vLLM that use CUDA graphs, they break on every GPU kernel launch to track data flow.
  5. Blind Selection: This is the core innovation. The system identifies the residual stream by looking for "hand-off chains"—patterns where one tensor is freed exactly as the next one of the same size is allocated. This allows them to find the "spine" of the model's computation without knowing the model's name or architecture.
  6. VRAM Reading: They read the raw bytes from video memory exactly one allocation after a tensor's birth to ensure the GPU has finished writing the results.
  7. Downstream Analysis: Once recovered, they apply linear probes—simple classifiers trained on standard activations—to the forensic data to interpret the model's "behavioral intent."

Datasets

The method was validated across a diverse set of models and prompts:

  • Models: 33 open-source decoder-only models across nine architecture classes (including Qwen, Llama, GPT-2, and Pythia), ranging up to 7B parameters.
  • Prompt Sets:
    • Development: 228 chat-templated prompts used to refine the selection rules.
  • Evaluation (Experiment A): 142 "untouched" prompts from HarmBench (harmful behaviors) and XSTest (exaggerated safety tests) to test refusal detection.

Key Insights and Ideas

  • Structure from Shape: You can derive a model's "envelope"—its token count, hidden dimension size, and layer count—purely from the shape and timing of its memory allocations. You don't need the model's identity to map its internal structure.
  • Temporal is the new Spatial: In modern GPU computing, memory addresses are recycled so quickly that "where" a tensor is matters less than "when" it appears in the sequence of allocations.
  • Byte-Exact Fidelity: The researchers proved that a debugger-based approach can recover activations that are bit-for-bit identical to those captured by internal software hooks.
  • Refusal is Forensically Detectable: The "refusal signal" (the internal state that indicates a model is about to say "I cannot fulfill this request") is robust enough to survive this forensic extraction process.

Key Results

  • Universal Applicability: The "two-step selector" achieved byte-exact recovery on all 33 tested models.
  • Refusal Detection Performance: Using a linear probe on the recovered states, the authors achieved an AUROC of 0.88 in distinguishing refusal from compliance on the held-out test set.
  • Attribute Accuracy: As shown in the table below, the system was highly accurate in deriving structural attributes (token/layer counts) across different serving platforms.
Extracted table from page 7 of From Bytes to Behavior: Request-Level Attribution from Live GPU Hidden States
  • Performance Cost: The primary trade-off is speed. Attaching a debugger and breaking on every allocation causes a massive slowdown—ranging from 46x to 192x slower than native execution.

Limitations and Future Work

  • Intrusiveness: While the method doesn't modify code, the significant performance hit makes it "intrusive." It’s a tool for a forensic lab, not for real-time monitoring of a high-traffic production server.
  • Hardware/Software Bounds: The current implementation is specific to the PyTorch caching allocator and NVIDIA GPUs. Custom engines like TensorRT-LLM remain "untested or not testable" with the current adapters.
  • Batch Size: The study focused on batch size 1. Dynamic batching and continuous batching in production environments would significantly complicate the "blind selector" logic.
  • Future Directions: The authors suggest that future work could involve optimizing the debugger overhead and extending the technique to Mixture-of-Experts (MoE) architectures and larger-scale deployments.

Summary updated

Abstract

Existing memory forensics for machine learning systems typically targets static artifacts, such as model weights or prompt logs, rather than the transient computational states of a live inference process. This gap limits an examiner's ability to analyze the specific behavior of a running large language model (LLM) service that cannot be restarted or modified. We present a method for acquiring per-layer residual-stream activations from a live GPU process using a non-modifying debugger, without requiring prior knowledge of the model's architecture parameters or weights. The approach employs a general six-stage process with platform-specific adapters, utilizing either a PyTorch allocator clock or a kernel-launch clock to identify and read tensor allocations from video memory. We validate this acquisition on 33 open-source decoder-only models across nine architecture classes, demonstrating that the recovered bytes are byte-exact and usable for downstream analysis. As a use case, we apply linear probes trained on standard framework activations to the recovered states, successfully distinguishing refusal from compliance with an AUROC of 0.88 on held-out prompts. This work establishes that live, observational access to intermediate hidden states is feasible on named inference platforms, providing a new source of evidence for examining the operational behavior of deployed AI systems.
BibTeX
@misc{pan2026from,
  author = {Jonathan Pan and Yidi Yuan and Xin Wei Chia and Xinhui Su and Vincent Tan and Brenda Ong},
  title = {{From Bytes to Behavior: Request-Level Attribution from Live GPU Hidden States}},
  year = {2026},
  eprint = {2611.18272},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.18272},
}
Figure