DMI README

The project's README from github.com/ProjectDMX/DMI. As one markdown file: README.md.

DMI logo

DMI — Deep Model Inspection

A decoupled, asynchronous AI-native data observation backend for high-speed LLM inference.

[!IMPORTANT] Seeking Research and Dev. Collaborations. We are actively looking for research collaborators to explore downstream applications built on DMI such as interpretability, speculative decoding, hallucination analysis, distillation, activation steering, and beyond. If you're interested, please contact us.

Project Status — research preview. DMI supports HuggingFace and official vLLM integrations across 20+ dense and MoE model families, including Qwen3, Llama, Gemma, Mistral, GPT-OSS, Phi, and Granite, with early support for emerging architectures such as Qwen3.6, Llama 4, DeepSeek V4 Flash, GLM-5.2, Kimi K3, and MiniMax-M2.7, plus Megatron-LM training. SGLang support is on the way. APIs may change. Contributions, bug reports, and feature requests are welcome.

👀Technical Report Available: https://arxiv.org/abs/2605.11093


Roadmap

We are working to make DMI useful across more backends, more models, and more stages of the model lifecycle.

About

DMI is a full-feature observability layer for LLM inference and training. It gives real-time access to any internal model state — residual streams, attention patterns, MLP outputs, KV-cache slices, logits — during inference or training, with minimal overhead.

Right now, DMI supports inference through HuggingFace Transformers and vLLM, and training through Megatron-LM. It captures internal tensors through CUDA-Graph–compatible hooks and streams them off the GPU via a dedicated ring buffer to a host-side drain that pushes into a queryable store (or drops them, for transport-only profiling).

Why DMI

If you're:

you need internal visibility without rewriting your model or slowing inference 10×. That's the gap DMI fills.

Key features

Demo

Captured internals explored in a Jupyter notebook -- attention patterns, residual-stream norms, per-token confidence, and top-k alternatives over one prompt through Qwen3-0.6B.
Source under examples/visualization/.

https://github.com/user-attachments/assets/7aaf73ce-a0e4-4953-ba99-dd78dd36ca52

Performance

[!NOTE] New: DMI vs. vLLM Hidden State Extraction. vLLM recently added a native way to save hidden states. We benchmarked it against DMI on Qwen3-4B prefill: DMI captures about 13× more tensor data per token while keeping extraction overhead 15–17× lower at batch sizes 16–32 in a matched extraction-only setup. Read the full comparison: docs/dmi_vllm_ehs/dmi-vs-ehs.md.

Offline throughput — Qwen3-4B / Llama-3.1-8B / Qwen3-14B on ShareGPT and WildChat, normalized to vanilla HuggingFace (ideal, no observation = 1.0). Red × = out of memory.

Offline throughput with limited hooks

Online serving (TPOT) — same models on vLLM, plotted against request rate. DMI tracks the no-monitor baseline; synchronous hook/debug baselines saturate at much lower request rates.

Online TPOT: DMI vs vLLM Hook / TRT-LLM Debug API / vLLM no-monitor

Full setup, additional results, and how to reproduce: docs/benchmarks.md.

Configure a capture visually

DMI-configurator turns a model plus a few clicks into a validated capture configuration, and estimates what it will cost before you run anything. It needs the optional web dependencies once:

pip install -e ".[ui]"

After that, from a checkout:

make ui

That opens a browser on http://127.0.0.1:8000. Point it at your own model with make ui MODEL=./Qwen3-8B. make ui runs from the source tree without installing DMI itself, but the [ui] extra is required either way — the server raises a RuntimeError naming this command if it is missing.

With DMI installed, it is a normal command:

dmi ui ./Qwen3-8B

dmi ui accepts a model directory, a config.json, a Hugging Face model id, or a DMI descriptor YAML, and picks the descriptor out of the current directory when there is exactly one. Resolving a model directory or a bare Hugging Face model id needs transformers (pip install -e ".[hf]"); pointing at a config.json directly does not. See the configurator plan for the design.

Get started

Start with the core installation guide, then choose the HuggingFace, vLLM, or Megatron-LM path depending on the runtime you want to inspect. The project currently supports installation from source. Use a separate environment and checkout for each backend, and install only the integration you need. The snippet below shows the minimal vLLM entry point. The integration checkout connects DMI to an unmodified official vLLM installation.

import os
# Required for the current vLLM integration
os.environ["VLLM_USE_V2_MODEL_RUNNER"] = "0"

from vllm import LLM, SamplingParams

llm = LLM(
    model="Qwen/Qwen3-0.6B",
    worker_cls="dmi_vllm_integration.worker.DMXGPUWorker",
    additional_config={
        "dmx_hook_selection": "vllm-full",
        "dmx_null_mode": False,
        "dmx_db_host": "",       # active capture + transport; no persistence
    },
)

for o in llm.generate(["The answer is"], SamplingParams(max_tokens=16)):
    print(o.outputs[0].text)
# Internal states for every layer have traversed Ring² during the run.
# Configure a sink to persist them. Setting "dmx_null_mode": True
# disables DMI planning, metadata, and payload copying.
Core installation Install DMI from source and build the native backend
HuggingFace Run HF generation, monitored generation, and offline benchmark scripts
vLLM Run DMI through the vLLM offline API or vllm serve
Megatron-LM Run DMI during Megatron-LM training

Contribute

DMI is an early research system from FrootLab at the University of Maryland, and we welcome contributions from users, researchers, and systems builders. Useful contributions include bug reports, documentation fixes, benchmark reproduction notes, new model integrations, and backend-specific improvements for HuggingFace, vLLM, or Megatron-LM.

Citation

@misc{yu2026enablingperformantflexiblemodelinternal,
      title={Enabling Performant and Flexible Model-Internal Observability for LLM Inference}, 
      author={Nengneng Yu and Sixian Xiong and Yibo Zhao and Wei Wang and Zaoxing Liu},
      year={2026},
      eprint={2605.11093},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2605.11093}, 
}

License

DMI is licensed under the Apache License 2.0. See the LICENSE file for details.

DMI (ProjectDMX/DMI)

Searching Database…

65 ·GitHub
这是什么?DMI 是一个解耦的异步可观测性技术栈,能在推理或训练过程中以极小的开销实时读取运行中 LLM 的内部状态——残差流、注意力模式、MLP 输出、KV 缓存分片和 logits。
这是独立应用,还是要集成进我自己代码的东西?它是一个需要集成到现有模型中的 Python 工具集:把 HookPoint 原语放进 PyTorch 模型(或使用轻量的 HF/vLLM 封装或 Megatron-LM 训练集成),另有可选的可视化配置器和 CLI 用于构建采集配置。
怎么让它跑起来?DMI 目前只能从源码安装。为每个想用的后端(core、HuggingFace、vLLM 或 Megatron-LM)单独准备一个环境和检出,只安装你需要的那个集成。
DMI 能接入哪些推理或训练后端?推理方面它集成 HuggingFace Transformers 和 vLLM,训练方面集成 Megatron-LM;SGLang 支持已在计划中但尚未提供。
它准备好用于生产环境了吗?没有——它被明确标注为研究预览版,API 仍可能变动,SGLang 支持也还在路线图上。
这是为谁打造的?面向在生产环境调试幻觉问题、研究可解释性或激活导向、构建投机解码草稿模型、挖掘蒸馏数据,或监控长文本生成中注意力坍缩的研究人员和工程师。
DMI 支持哪些模型?支持 20 多个稠密和 MoE 模型系列,包括 Qwen3、Llama、Gemma、Mistral、GPT-OSS、Phi 和 Granite,并对 Llama 4、DeepSeek V4 Flash、GLM-5.2 等较新的架构提供早期支持。
Ring2 是什么?为什么重要?Ring2 是 DMI 的 GPU↔CPU 协同设计中转机制:GPU 侧的负载环形缓冲让捕获的张量与 KV 缓存内存池隔离开来,主机侧的元数据环形缓冲则以异步方式把张量排走,避免拖慢推理。
与 vLLM 自带的隐藏状态提取相比,DMI 表现如何?在 Qwen3-4B 预填充、批量大小 16-32 的条件下,DMI 每个 token 捕获的张量数据约多 13 倍,而提取开销比 vLLM 原生的隐藏状态保存低 15-17 倍。
DMI-configurator 是什么?它是一个可选的 Web 界面(dmi ui),选好模型再点几下就能生成经过校验的采集配置,并在你实际运行之前估算成本;它需要可选的 [ui] extra,若要解析裸模型目录或 Hugging Face ID,还需要 [hf] extra。
Creator
ProjectDMX
Size
169.2 MB
Stars
65
Updated
CommitOct 14
Age
1y
Commits · 90 Days