metalscope
metalscope lets you look inside the language models you run on your own Mac, while they answer you. It hooks into the local model server itself and records every reply: which experts each token went to, what the model was about to say at each layer, how sure it was. It can also steer a reply, adding a style such as "joyful" to the model's inner state on every token, learned from a few dozen example texts and checked in real conversations. You watch it in the Pi coding agent or from the command line.
What it looks like
The dock. Pi with the dock beside it while the model plans a lazy weekend. MAP colours each token by
confidence, LENS shows the word forming layer by layer, TOKENS the five likeliest, EXPERTS which experts fired and
RESIDUAL STREAM where a layer changed the model's state far more than usual. m swaps it for the mini dock, a
narrow column beside the chat.
Requirements
- A Mac with Apple Silicon and macOS.
- Memory for the model: Qwen3.6 35B at 4 bits is about 20 GB on disk, so a Mac with 32 GB or more. The largest models here (Qwen3.8 Flash Next, DeepSeek V4.1 Flash) need 128 GB.
- uv to install metalscope (
brew install uv). - Python 3.11 or newer (
uv tool installfetches one; macOS's ownpython3is older). - A server for the model, one of:
- oMLX 0.8.0, 0.8.2, 0.8.3 or 0.8.4 (the versions metalscope is tested with: on another, oMLX runs untraced; Inkling 2 needs 0.8.3 or newer). Open oMLX.app once and set an API key on its admin page, http://127.0.0.1:8008/admin. It serves MLX models, Qwen3.6 among them.
- ds4 at commit b3f5018, for Qwen3.8 Flash Next and DeepSeek V4.1 Flash from
GGUF files.
metalscope ds4 installfetches that commit and builds it with metalscope's patch (it needs Xcode's command line tools:xcode-select --install). Disk for its models: Qwen3.8 Flash Next Q4 is 165 GiB (about 177 GB), DeepSeek V4.1 Flash Q2 341 GiB (Q4 483 GiB). ds4'sdownload_model.shfetches them with Hugging Face'shfCLI (uv tool install huggingface_hub).
- Pi, optional but recommended: a live dock beside the chat and
the
/scope,/steer,/conceptand/jlenscommands. It needs Node.js (brew install node).
Features
What each one shows, and roughly how. Which model each runs on: What works on each model.
- Replies and probabilities. The reply with every token coloured by the probability the model gave it, the ten likeliest tokens at each step, and a map of the whole reply to jump to the unsure ones. Read from the model's own output at each step.
- Logit lens. The word the model would say if it stopped at each layer: that layer's state put through the model's own final norm and output head. Needs no setup.
- Jacobian lens. The same question answered with a matrix fitted per layer, which reads the middle layers better
and shows words the model holds but never says. One per model, fitted overnight (
/jlens learn), pulled (metalscope jlens pull) or converted from a published one. - Experts. On a mixture-of-experts model, which experts each token went to at each layer, recorded from the router as it chooses.
- Residual stream. How much each layer changed the model's running state at each token, with the spikes marked: the places a layer changed it far more than it usually does; or how much each layer changed it for its size. On hyper-connection models, each also per stream.
- Engram inspection. On a model with an n-gram lookup, a second pass over a finished reply with the lookup switched off, to see which tokens it helped.
- Word swap (experimental). Change one word of a reply and let the model carry on from there: the new word's Jacobian lens direction is pushed into the model's state at that one token.
- Steering. A concept such as "pirate" or "calm" added to the model's state at one layer on every token,
thinking included. A concept is a direction learned on your model from pairs of example sentences, then tried at
several doses in short chats the model grades itself; the best dose becomes its default. 33 concepts ship, and
/concept learn NAMEmakes a new one. - Sharing.
concept packwrites a model's concepts to a folder to upload, like a LoRA adapter;concept pullplaces one on a model you serve.
Everything shows live in Pi's dock; the same data is on the command line and over HTTP.
Quickstart: Qwen3.6 35B on oMLX
In oMLX's admin page, download lmstudio-community/Qwen3.6-35B-A3B-MLX-4bit; oMLX serves it as
Qwen3.6-35B-A3B-MLX-4bit. Then install metalscope and hook it into oMLX:
uv tool install metalscope
metalscope omlx install # the hook oMLX loads when it starts
metalscope omlx restart
metalscope doctor # checks every piece
The example steers with joyful, a concept that ships with its texts. On our Mac its best dose on Qwen3.6 was
0.5: 15 of 18 replies in test conversations were joyful and still made sense.
With Pi (npm install -g @earendil-works/pi-coding-agent and metalscope pi install, then start pi):
/model, pick Qwen3.6-35B-A3B-MLX-4bit (picking it loads it).- Chat a few messages. Pi's replies are traced, and steering sizes its doses from those traces (about 2,000 tokens of replies is enough).
- Look inside:
ctrl+\opens the dock beside the chat. Send another message: each token's confidence, lens and experts show as the reply is written. /concept learn joyful. It learns the vector from the shipped texts in a GPU job (oMLX unloads the model meanwhile), then calibrates it in conversation (chat works meanwhile): about half an hour in all on Qwen3.6. The widget above the editor shows the steps./steer joyful: every reply from now on is steered at the calibrated dose. After a reply,/steer replayshows it beside the same message answered unsteered./steer offstops it.
Without Pi, the same from the command line:
metalscope omlx Qwen3.6-35B-A3B-MLX-4bit # start oMLX with the model loaded
metalscope on # trace every request
# chat a few messages with any client: doses are sized from those traces
metalscope concept learn joyful Qwen3.6-35B-A3B-MLX-4bit # learn, then calibrate: about half an hour
metalscope steering on # let requests steer
Then any client steers a request with one header (the key is the one you set in oMLX):
curl http://127.0.0.1:8008/v1/chat/completions -H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_OMLX_API_KEY" \
-H "X-Scope-Steer: joyful" \
-d '{"model": "Qwen3.6-35B-A3B-MLX-4bit",
"messages": [{"role": "user", "content": "How was your weekend?"}]}'
concept learn ends with the chat result and the next command:
learned joyful on Qwen3.6-35B-A3B-MLX-4bit: steer layer L12
in chat: 15/18 good @0.5
next: metalscope steering on, then send the header X-Scope-Steer: joyful (in Pi: /steer joyful)
details: metalscope concept show joyful Qwen3.6-35B-A3B-MLX-4bit
How it works
On oMLX, metalscope loads into oMLX's own Python through a small hook file and records
inside the real server, with its batching, prefix cache, speculative decoding and quantisation as they are. On ds4, a
patch to ds4's C and Metal code takes the same readings inside each step, and a proxy in front of it saves them. One
backend serves a model at a time: starting one's model frees the other's. metalscope on traces every request, the
X-Scope-Trace: on header one request; traces are saved under ~/.metalscope/traces/.
Backends
Models metalscope has been run on, per backend (TESTED in models.py; a test keeps this table the same). A model
counts by its family: on oMLX the checkpoint's config.json model_type (as oMLX reads it), on ds4 its GGUF's
architecture (ds4 serves only these). Nothing gates on this list: Pi offers every chat model oMLX reports; one outside
it is marked untested in the dock's header (no in metalscope doctor's table, tested: false in
/scope/api/status) and may trace, steer or edit
less well.
| backend | run on |
|---|---|
| oMLX | Qwen3.5 2B, Qwen3.8 27B (MTP), Qwen3.6 35B, Qwen3.8 Flash Next (MTP), Inkling 2 Mini (MTP) |
| ds4 | Qwen3.8 Flash Next, DeepSeek V4.1 Flash |
Documentation
- Backends: install in detail, upgrade and uninstall, who can reach it, oMLX, MTP models, ds4, checkpoints, updating the engines.
- Front ends: the live stream, the Jacobian lens, Pi and its dock, traces and their size budget.
- Steering and concepts: Pi's
/steerand/concept, theX-Scope-Steerheader, concept profiles, sharing. - Command reference: the command line, Pi and the dock's keys.
- Measurements: Inkling 2, what tracing costs, the jobs' times, lens fits.
- Design and development: design rules, layout, development.
Acknowledgements
- ds4 by antirez (MIT): metalscope's patch modifies it and carries its code.
- oMLX (Apache-2.0): the server metalscope hooks into.
- Anthropic's Jacobian lens ("Verbalizable Representations Form a Global Workspace in Language Models", 2026, and
anthropics/jacobian-lens):
jlens/fit.pyreimplements its estimator. - Pi by earendil-works: the coding agent the front end extends.
Licence
- metalscope is MIT (LICENSE).
- The ds4 patch applies to antirez's ds4, which is MIT. The patch carries ds4's code, so ds4's licence is copied
beside it:
src/metalscope/ds4/LICENSE.ds4. metalscope's own changes in the patch are MIT. - The concept texts in
src/metalscope/data/conceptswere written by models: Claude (Fable 5.1, Opus 5.5), Qwen3.6 35B-A3B, Qwen3.8 Flash Next and DeepSeek V4.1 Flash. Each concept'sconcept.json(andwriting.json, when it has one) names its writer. They ship under metalscope's MIT licence.
Metadata
Release files for metalscope 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| metalscope-0.1.2.tar.gz | 1.5 MB | Without provenance | Details for metalscope-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| metalscope-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for metalscope-0.1.2-py3-none-any.whl |
Total release size: 2.5 MB
Release files / metalscope-0.1.2.tar.gz
| Download URL | metalscope-0.1.2.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d5736ddbfe66b9509a892a3dc038315554e39c07a914e60510c6ca52df5dc37b
|
|
BLAKE2b-256 checksum How to use checksums |
20d903e78aba1ef1df221ab5007c4d23d60b1789c11209b17e8e4226c9a74d7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / metalscope-0.1.2-py3-none-any.whl
| Download URL | metalscope-0.1.2-py3-none-any.whl |
|---|---|
| Size | 952.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
606989b4316ce068e117e5c3caab9e614309eaad253d1965254c1d36b5852cc7
|
|
BLAKE2b-256 checksum How to use checksums |
81ddf5e4bd7f798a25a9f2767e49d2a8f435b79c4b9b6d7935ea8e6a7857e9a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for metalscope 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.