llmviz 仅需模型的 config.json 即可生成出版级质量的 LLM 架构图,无需权重、GPU 或 transformers 库。

Stars

26

7 天增长

暂无数据

Fork 数

2

开放 Issue

0

开源协议

Apache-2.0

最近更新

2026-07-04

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

它能在毫秒级内为任意模型(包括工具创建时尚未出现的架构)准确计算参数数量并生成 Sebastian Raschka 风格的架构图。

适合谁使用

  • 记录架构的机器学习研究人员
  • 评估模型可部署性的 AI 工程师
  • 撰写模型解释的技术作家
  • 讲解 Transformer 架构的教育工作者

典型使用场景

  • 仅通过 config 可视化新模型架构
  • 并排对比两个架构并标记差异
  • 检查模型在硬件上的运行可行性(含量化内存估算)
  • 为多个模型生成社交媒体卡片或海报网格

项目优势

  • 仅依赖 config.json,无需模型权重、GPU 或 transformers 库
  • 通过逐层数学计算准确重建总/活跃参数、KV 缓存字节和显存,经实测与官方数据偏差在 0.5-3% 以内
  • 解析器具有通用性:支持多种架构(MHA、GQA、MLA、MoE、混合混合器),并能优雅降级
  • 提供丰富命令(渲染、对比、谱系、适配性分析、解释、MCP 服务器)以及 Python API 和静态画廊生成

使用前须知

  • 需要 Python 3.11+ 以及互联网连接以从 Hugging Face 或 Ollama 获取配置
  • 部分高级功能(PNG 导出、LLM 解释、MCP)需要安装可选依赖
  • 生成的图形为算法自动绘制,可能缺少手工原图附带的讲解注释

README 快速开始

llmviz

Publication-quality LLM architecture figures from config.json alone — no weights, no GPU, no transformers install.

Point it at any model — a Hugging Face id, a local GGUF file, or a model installed in Ollama — and get a hand-drawn-quality architecture figure in the visual language of Sebastian Raschka's LLM Architecture Gallery: the decoder tower with dotted-leader callouts, the MoE router inset, the SwiGLU module, and parameter counts computed from the config, not scraped from a model card.

Why

Hand-drawn galleries are wonderful and update episodically. llmviz generates the same figure in milliseconds, for any model, the day its config lands on the Hub — including architectures that didn't exist when this tool was written. The parser is generic-first (field-name synonyms, capability detection, graceful degradation), so hybrid Mamba mixers, linear attention, MLA, sandwich norms, and whatever ships next all render correctly or degrade honestly.

The numbers are the point: total and active parameters, KV-cache bytes per token, and VRAM footprints are reconstructed from per-layer math. The test suite pins them against published figures — Llama-3-8B at 8.03B, DeepSeek-V3 at 671B/37.5B, Qwen3-235B-A22B at 235B/22B — within 0.5–3%. When Kimi-Linear-48B-A3B (a model the code was never tuned for) parses to 48.9B total / 3.3B active, you know the math is doing the work.

Install

pip install llmviz                # SVG figures
pip install "llmviz[png]"         # + PNG export (cairosvg)
pip install "llmviz[explain]"     # + LLM-written notes (LiteLLM: Ollama, llama.cpp, any provider)
pip install "llmviz[mcp]"         # + MCP server for agents

Sixty seconds

llmviz render deepseek-ai/DeepSeek-V3            # the figure above → DeepSeek-V3.svg
llmviz render ollama:deepseek-r1                 # a model installed in YOUR Ollama
llmviz inspect ./model-q4.gguf                   # any local or remote .gguf (header-only read)
llmviz fit Qwen/Qwen3-235B-A22B -c 131072        # can I run it? fp16/q8/q4 + your GPU verdict
llmviz diff deepseek-ai/DeepSeek-V3 NousResearch/Meta-Llama-3-8B

Commands

| Command | What

项目描述

Publication-quality LLM architecture figures from config.json — Raschka-style towers, diffs, posters, VRAM math. No weights needed.

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

makecindy
精选
makecindy GitHub avatar

cindy

Cindy is an open-source AI agent that runs locally on your machine, integrates multiple AI harnesses and models, and provides memory, skills, and automation to perform real work in your projects and apps.

AI 与机器学习大语言模型
958
uzairansaruzi
精选
uzairansaruzi GitHub avatar

hermex

Hermex is a native SwiftUI iPhone app that lets you control a self-hosted Hermes AI agent directly from your phone, with no subscriptions, tracking, or third-party relay.

AI 与机器学习大语言模型
941
hahhforest
精选
hahhforest GitHub avatar

pi-textbook

A hands-on course that walks through building a Pi-style coding agent from scratch across 15 checkpoints, starting from an offline agent trajectory.

AI 与机器学习大语言模型
625