Static structural analysis of Grok-family open-weight checkpoints.
xai-dissect is a read-only checkpoint dissector. It parses raw xAI shard
files, builds a normalized tensor inventory, and emits structural reports for
experts, routing, and future SAAQ-oriented profiling. It does not run the
model, mutate weights, or act as an inference runtime.
Current release target:
- Grok-1: supported now
- Grok-2: not supported yet; tracked as a future follow-on only if public weights are released under a compatible license
Only open/public weights are in scope. This repo analyzes weights you already have lawful access to and does not redistribute them.
- Parses raw Grok shard files without a Python unpickler
- Builds a stable tensor inventory with dtype, shape, role, offsets, and shard provenance
- Maps MoE expert structure and block-to-expert organization
- Identifies likely routing tensors and routing-critical regions
- Profiles offline tensor statistics for future SAAQ experimentation
- Writes predictable Markdown, JSON, and manifest artifacts for downstream tooling
- No forward pass, logits, decode loop, or runtime inference
- No quantization runtime, checkpoint mutation, or format conversion
- No projector logic, dashboard UI, or orchestration layer
- No redistribution of model weights
See docs/non_goals.md for the full non-goals list.
cargo build --release
cargo test
# Show the available commands
./target/release/xai-dissect --helpMain commands:
dissect: raw per-shard byte-table view (parser output only; no classification or grouping)inventory: full checkpoint inventory and architecture-oriented summaryexperts: expert atlas for MoE block structurerouting-report: routing/gating structure inspectionstats: offline tensor-statistics profilingsaaq-readiness: candidate scouting for future SAAQ workpilot-plan: planning-side Grok-1 representative block pilot selection artifactroute-preservation: planning-side Grok-1 route-preservation gate reportquant-plan: deterministic Grok-1 conversion and policy-planning artifactsdocs/GO_NO_GO.md: explicit Grok-1 quantization decision gate checklist
All examples assume a checkpoint directory such as
/path/to/grok-1/ckpt-0.
./target/release/xai-dissect inventory /path/to/grok-1/ckpt-0 \
--json out/inventory.json \
--md out/inventory.md./target/release/xai-dissect experts /path/to/grok-1/ckpt-0 \
--json out/experts.json \
--md out/experts.md./target/release/xai-dissect routing-report /path/to/grok-1/ckpt-0 \
--json out/routing-report.json \
--md out/routing-report.md./target/release/xai-dissect stats /path/to/grok-1/ckpt-0 \
--sample-values 65536 \
--json out/stats.json \
--md out/stats.md./target/release/xai-dissect saaq-readiness /path/to/grok-1/ckpt-0 \
--sample-values 65536 \
--json out/saaq-readiness.json \
--md out/saaq-readiness.md \
--manifest out/candidate-saaq-targets.json./target/release/xai-dissect quant-plan /path/to/grok-1/ckpt-0 \
--sample-values 65536 \
--json out/quant-plan.json \
--md out/quant-plan.md \
--conversion-manifest out/conversion-manifest.jsonThis command requires the clean Grok-1 structural baseline and emits:
- a named baseline gate via
grok1-coverage.jsonwith profilegrok1-map-v1-clean - a per-tensor
conversion-manifest.jsonfor downstream conversion / packing work - a family-level
quant-plan.jsonfor pilot quantization policy selection
./target/release/xai-dissect routing-report /path/to/grok-1/ckpt-0 \
--output-root outThat produces a predictable artifact layout such as:
out/
reports/<checkpoint_slug>/
exports/<checkpoint_slug>/
manifests/<checkpoint_slug>/
See docs/output-conventions.md for the full artifact naming convention, and docs/export-contracts.md for the stable schema types behind those files.
The repo writes three artifact families:
reports/: human-readable Markdown for inspection and reviewexports/: full JSON plus compact findings summariesmanifests/: focused machine-readable lists for downstream selection and orchestration
Examples:
inventorywrites a checkpoint inventory plus an inventory snapshot manifestrouting-reportwrites a routing report plus a routing-critical tensor listsaaq-readinesswrites a grouped readiness report plus a ranked candidate manifestquant-planwrites a conversion manifest plus a deterministic family-level quant plan
This milestone is intended to feel like a coherent tool, not a runtime:
- CLI-first workflow
- parser/analysis orientation
- stable export schema favored over a broad in-process Rust API
- current checkpoint support centered on Grok-1
f32andint8shard layouts
Release notes live in CHANGELOG.md.
Pull requests and main run fmt, tests, clippy (-D warnings), and CLI help
smokes. Optional Codecov, Qodana, and Sentry hooks are documented in
docs/ci.md.
Grok-2 is not yet in scope for implementation, but the repo now includes a future-support checklist and issue template to keep that work bounded when the time comes:
corinth-canal owns orchestration and hybrid-runtime glue: it wires models,
projectors, and downstream consumers together. xai-dissect is strictly
upstream of that: it produces structural descriptions of a frozen checkpoint.
If corinth-canal needs "what is the shape of expert 3's down-projection in
layer 17", it consumes an xai-dissect export. It does not call into this
repo at runtime.
snn-projector owns projector logic, including any spiking / neuromorphic
projection of activations. xai-dissect does not implement, test, or depend
on projector math. It may describe the shape of tensors that a projector would
later consume (e.g. embedding width, expert output dimension), but it never
projects anything itself.
SAAQ-latent owns SAAQ latent calibration and latent-space analysis.
xai-dissect does not compute SAAQ scores and does not calibrate latents. Its
role is upstream reconnaissance: sampled tensor statistics, routing-risk flags,
and candidate-target manifests that help decide where future SAAQ work should
focus.
grok-ozempic is where compression, packing, and runtime ideas actually get
applied once the checkpoint structure is understood. xai-dissect stays
upstream of that work: it tells you what you are touching before any
compression-oriented repo starts changing representation or execution.
grok-ozempic is still under construction for further upgrades, and the
"ozempic" part of the name is meant to make that repo's purpose obvious.
The current Grok-1 downstream handoff contract is documented in
docs/export-contracts.md and intentionally keeps
the required ingest surface smaller than the full export tree.
Surrogate_Viz.jl owns visualization and dashboarding. xai-dissect emits
structured, exportable findings (JSON / CSV / Markdown). It does not render
plots, does not ship a UI, and does not embed a plotting stack.
Surrogate_Viz.jl is a downstream consumer of xai-dissect exports.
See:
- Analyze only weights you have lawful access to under the original license
- This repository does not contain or mirror model weights
- This repository is not a circumvention or scraping tool
GPL-3.0-only. See LICENSE.
Grok model weights remain the property of their respective rights holders and are not covered by this repository's license.