Sitemap
Dlytiks

Dlytiks

Stop Staring at the Numberpile: How to X-Ray Your LLM Layers in Real Time

4 min readOct 25, 2026

A low-overhead observability tool to extract forward activations and Vector-Jacobian Products dynamically running natively inside GPU

If you’ve ever tried to debug a Large Language Model at the architectural level, you know the frustration. Traditional debugging means dumping massive, raw, dense model parameters and weights. To a network engineer or machine learning researcher, this looks less like telemetry and more like an uninterpretable numberpile.

When a model suffers from semantic drift, plateaued reasoning, or adversarial vulnerability, staring at flat matrices won’t tell you why. We need a way to look inside the machine while it thinks.

LED-ML (Layer Extraction & Diagnostics with Machine Learning) is a lightweight, plug-and-play runtime diagnostics framework that acts as a causal lens for deep layer architectures. By attaching directly to PyTorch layer operations, it exposes a live visual map of internal forward activations and backward target gradients without breaking your compute constraints or system memory footprint.

The Architecture: Why VJPs Beat Raw Jacobians

Most interpretability methods grind model inference to a halt. Computing a full Jacobian matrix across a 7-billion parameter network at runtime is computationally prohibitive.

LED-ML bypasses this bottleneck by tracking Vector-Jacobian Products (VJPs) on specific target logit scalars. Instead of calculating every single potential path, it runs an extremely efficient backward pass immediately following a prediction token to isolate the exact contributing gradient vectors.

The protocol handles two distinct execution contexts:

  • Decision Mode: Captures activations and VJPs exclusively for the first predicted token, mapping the initial consensus step that sets the tone for the generation trajectory.
  • Trajectory Mode: Sequentially hooks every operational layer across a tracking window of generated tokens, mapping how energy propagates, concentrates, or plateaus over time.

Telemetry Rendering Modes

The visualization engine translates raw matrices into two distinct graphical telemetry maps concurrently:

  • Standard View: A fixed horizontal span tracking a 10% spatial window (the first 100 features) across all layers, providing a lightweight boundary map optimized for structural telemetry comparison.
  • Extended View: A high-resolution numeric pixel matrix tracking selective feature segments — capturing the top 30% and bottom 30% activation distributions alongside peak target gradients to map precise localized resistance paths.

Production-Ready Footprint

Because it leverages native PyTorch hooks (register_forward_hook and tensor.register_hook), the tracking infrastructure introduces minimal runtime memory overhead. Empirical benchmarks show that capturing full trajectories across heavy open models remains completely safe from system memory starvation during long autoregressive runs:

  • Qwen2–7B (10 tokens, 28 layers): 1.29 MB peak RAM
  • OpenChat-3.5 (87 tokens, 32 layers): 11.82 MB peak RAM
  • Mistral-7B (111 tokens, 32 layers): 17.57 MB peak RAM

Run It in One Line of Code

The framework is packaged as a standard Python library, shifting the burden from custom data wrappers to clean execution commands. You can inject it directly into your testing architecture:

Get Dlytiks’s stories in your inbox

Join Medium for free to get updates from this writer.

pip install led-ml

import json
import led_ml
from led_ml import led_viz, led_size

# 1. Initialize the dynamic telemetry engine
led = led_ml.led_core(mode="trajectory")

# 2. Run your inference pipeline
prompt = "What is the color of chlorophyll?"
response = led.run_model(prompt, model_family="qwen2")

# 3. Extract the compiled VJP tensor diagnostic buffer
diagnostics = led.get_led()

# 4. Render a clean ASCII activation map straight to the console
led_viz.text_led(diagnostics)

# 5. Compile the layer trajectories into an animated dashboard GIF
led_viz.gif_led(diagnostics)

Reading the Telemetry: Slicing the Symmetries

Instead of dumping raw floats, LED-ML utilizes Adaptive Noise Thresholding. It automatically filters out low-variance background noise by dynamically tracking the top and bottom thresholds of layer intensities.

The console output visualizes feature coordinates across disparate terminals using clean, padded spatial string alignments:

Model: Qwen/Qwen2.5–7B | Layers: 28 | Mode: trajectory
Prompt: What is the color of chlorophyll?
Response: Chlorophyll is green in color.

Layer | Activation Map (First 10% Window)
— — — + — — — — — — — — — — — — — — — — — — — — — — — — —
L00 | ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
L01 | ░░░░░░░░░░▲░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
L02 | ░░░░░░░░░░▲░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  • ▲ indicates active positive neuron configurations in the forward pass.
  • ▼ tracks intense active negative vectors.
  • ■ maps fully stabilized, inactive background vectors.

For deeper graphic profiles, the gif_led engine compiles these frames concurrently into high-resolution, infinite-loop pixel matrices. You can watch your model's internal layers lighting up, isolating exactly where a network encounters computational plateau zones (Model Inertia) or actively suppresses counterfactual tokens during generation (Token-Level Resistance).

Open Source & Verification Registry

LED-ML is fully open-source and structured for immediate integration into automated research setups or observability tools. The mathematical formulations, latency arrays, and telemetry schemas are permanently indexed and open for validation.

@misc{vijayaraghavan2026ledml,
title={LED-ML: Causal Lens of Layer-wise Energy Dissipation in LLM},
author={Vijayaraghavan, Sudharsan},
year={2026},
howpublished={Zenodo Preprint},
doi={10.5281/zenodo.21967890}
}

Telemetry Visualisations:

Standard View -

Press enter or click to view image in full size

Extended View -

Press enter or click to view image in full size

--

--