Undercurrent: Production-Grade Activation Probing for Live LLM Inference
Probes trained on the internal activations of large language models (LLMs) can detect properties such as deception, harmful intent and toxicity, often before any problematic text has been emitted. Existing tooling for reading activations, however, is built for offline interpretability research and does not run inside the serving engines that host production traffic. We present Undercurrent, an open-source (Apache-2.0) Python library that runs activation probes on a model's internal state while it generates. A declarative YAML specification selects which tensors to capture, at which layers and token positions, and which probe receives them. Each extraction point runs either inline, on the generation path where a probe can abort the request before the next token, or asynchronously, on bounded per-request queues with explicit overflow policies so observation adds no latency to the response. Inline probes may be bounded by a timeout with fail-open or fail-closed fallbacks and a circuit breaker. Undercurrent ships adapters for Hugging Face Transformers and for vLLM, where a worker extension maps the rows of each continuously batched forward pass back to per-request token positions. We describe the design, the vLLM integration and its correctness checks, and report measurements from the library's own benchmark harness. Undercurrent is available at https://github.com/wrynx/undercurrent and on PyPI.