model-runtime 0.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- model_runtime-0.5.0.dist-info/METADATA +618 -0
- model_runtime-0.5.0.dist-info/RECORD +36 -0
- model_runtime-0.5.0.dist-info/WHEEL +4 -0
- model_runtime-0.5.0.dist-info/entry_points.txt +2 -0
- model_runtime-0.5.0.dist-info/licenses/LICENSE +202 -0
- model_runtime-0.5.0.dist-info/licenses/NOTICE +6 -0
- saturn/__init__.py +28 -0
- saturn/adapters/__init__.py +63 -0
- saturn/adapters/_residency.py +196 -0
- saturn/adapters/decoder.py +1679 -0
- saturn/adapters/diffusion.py +438 -0
- saturn/adapters/flux1.py +661 -0
- saturn/adapters/flux2.py +630 -0
- saturn/adapters/mamba.py +620 -0
- saturn/adapters/qwen.py +637 -0
- saturn/causal.py +260 -0
- saturn/cli.py +382 -0
- saturn/contracts.py +175 -0
- saturn/core.py +1979 -0
- saturn/dependencies.py +61 -0
- saturn/interop/__init__.py +37 -0
- saturn/interop/circuit_tracer.py +1198 -0
- saturn/investigation.py +109 -0
- saturn/numerics.py +213 -0
- saturn/observers.py +289 -0
- saturn/paths.py +324 -0
- saturn/program.py +364 -0
- saturn/route.py +774 -0
- saturn/shared_store.py +257 -0
- saturn/store.py +835 -0
- saturn/symbols.py +398 -0
- saturn/training/__init__.py +61 -0
- saturn/training/_checkpoint.py +1618 -0
- saturn/trial.py +514 -0
- saturn/values.py +223 -0
- saturn/writers.py +82 -0
|
@@ -0,0 +1,618 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: model-runtime
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Inspect, branch, intervene, replay, and train native models as software.
|
|
5
|
+
Project-URL: Homepage, https://github.com/JHollenb/saturn
|
|
6
|
+
Project-URL: Repository, https://github.com/JHollenb/saturn
|
|
7
|
+
Project-URL: Issues, https://github.com/JHollenb/saturn/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/JHollenb/saturn/blob/main/CHANGELOG.md
|
|
9
|
+
Author: Jake Holl
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Provides-Extra: ar
|
|
15
|
+
Requires-Dist: numpy<3,>=2; extra == 'ar'
|
|
16
|
+
Requires-Dist: safetensors<1,>=0.5; extra == 'ar'
|
|
17
|
+
Requires-Dist: torch<3,>=2.8; extra == 'ar'
|
|
18
|
+
Requires-Dist: transformers==5.14.1; extra == 'ar'
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
21
|
+
Requires-Dist: pytest<10,>=8; extra == 'dev'
|
|
22
|
+
Requires-Dist: ruff>=0.12; extra == 'dev'
|
|
23
|
+
Provides-Extra: diffusion
|
|
24
|
+
Requires-Dist: accelerate<2,>=1.14; extra == 'diffusion'
|
|
25
|
+
Requires-Dist: diffusers==0.39.0; extra == 'diffusion'
|
|
26
|
+
Requires-Dist: numpy<3,>=2; extra == 'diffusion'
|
|
27
|
+
Requires-Dist: pillow>=10; extra == 'diffusion'
|
|
28
|
+
Requires-Dist: safetensors<1,>=0.5; extra == 'diffusion'
|
|
29
|
+
Requires-Dist: torch<3,>=2.8; extra == 'diffusion'
|
|
30
|
+
Requires-Dist: transformers==5.14.1; extra == 'diffusion'
|
|
31
|
+
Provides-Extra: interop
|
|
32
|
+
Requires-Dist: numpy<3,>=2; extra == 'interop'
|
|
33
|
+
Requires-Dist: sae-lens==6.51.3; extra == 'interop'
|
|
34
|
+
Requires-Dist: safetensors<1,>=0.5; extra == 'interop'
|
|
35
|
+
Requires-Dist: torch<3,>=2.8; extra == 'interop'
|
|
36
|
+
Requires-Dist: transformer-lens==3.9.0; extra == 'interop'
|
|
37
|
+
Requires-Dist: transformers==5.14.1; extra == 'interop'
|
|
38
|
+
Provides-Extra: notebooks
|
|
39
|
+
Requires-Dist: ipykernel<8,>=6; extra == 'notebooks'
|
|
40
|
+
Requires-Dist: jupyterlab<5,>=4; extra == 'notebooks'
|
|
41
|
+
Requires-Dist: nbclient<1,>=0.10; extra == 'notebooks'
|
|
42
|
+
Provides-Extra: torch
|
|
43
|
+
Requires-Dist: numpy<3,>=2; extra == 'torch'
|
|
44
|
+
Requires-Dist: safetensors<1,>=0.5; extra == 'torch'
|
|
45
|
+
Requires-Dist: torch<3,>=2.8; extra == 'torch'
|
|
46
|
+
Provides-Extra: train
|
|
47
|
+
Requires-Dist: numpy<3,>=2; extra == 'train'
|
|
48
|
+
Requires-Dist: safetensors<1,>=0.5; extra == 'train'
|
|
49
|
+
Requires-Dist: torch<3,>=2.8; extra == 'train'
|
|
50
|
+
Description-Content-Type: text/markdown
|
|
51
|
+
|
|
52
|
+
# Saturn
|
|
53
|
+
|
|
54
|
+
This repository holds two Python packages for taking apart a neural network while it runs:
|
|
55
|
+
|
|
56
|
+
- **Saturn** (`model-runtime`, import `saturn`) is a reverse-engineering toolkit for neural
|
|
57
|
+
networks. It loads a model through an adapter and exposes it as a program you can address and
|
|
58
|
+
execute step by step: named state at each stop, a declared map of that state, symbols, watches,
|
|
59
|
+
declared interventions, and execution you can snapshot, branch, replay and restore.
|
|
60
|
+
- **mdb** (`model-debugger`, import `mdb`) is an interactive debugger built on Saturn. It attaches to
|
|
61
|
+
a Hugging Face decoder (Qwen2, Qwen3, Llama or Mistral) and lets you step through each layer one
|
|
62
|
+
native operation at a time, set breakpoints and watches, edit values, checkpoint and rewind.
|
|
63
|
+
|
|
64
|
+
If you know reverse-engineering tools: Saturn plays roughly the role Ghidra plays for compiled
|
|
65
|
+
binaries, and mdb the role gdb plays for a running process. The comparison is loose. Saturn does
|
|
66
|
+
not decompile weights into readable code, and it does not find circuits or features on its own.
|
|
67
|
+
Its analysis is dynamic: every result comes from running the model's own code, and it needs an
|
|
68
|
+
adapter for each model family. mdb has no source lines; the place where it stops is a named
|
|
69
|
+
intermediate value inside a layer, and it runs one prompt at a time.
|
|
70
|
+
|
|
71
|
+
The repository is named `saturn` (`github.com/JHollenb/saturn`). The Python distribution at the
|
|
72
|
+
root is `model-runtime`, with import name `saturn` and command `saturn`; mdb's distribution is
|
|
73
|
+
`model-debugger`, with import name and command `mdb`. Until 0.5.0 / 0.4.0 they were
|
|
74
|
+
`saturn-pub` (import `saturn_pub`, command `saturn-pub`) and `mdb-runtime`; see the
|
|
75
|
+
[changelog](https://github.com/JHollenb/saturn/blob/main/CHANGELOG.md) for the migration.
|
|
76
|
+
|
|
77
|
+
## Terms
|
|
78
|
+
|
|
79
|
+
- **Session**: one execution of a model under Saturn's control (`saturn.Session`).
|
|
80
|
+
- **Slot**: a named piece of model state at a stop, such as `hidden` or `tokens`. Each adapter
|
|
81
|
+
declares its slots.
|
|
82
|
+
- **Port**: a named intermediate value inside a decoder layer, such as the attention weights.
|
|
83
|
+
mdb addresses ports as `L<layer>.<name>`, for example `L1.p`.
|
|
84
|
+
- **Cut** (`StateCut`): a fingerprinted snapshot of all state needed to continue execution. You
|
|
85
|
+
can fork, restore or replay from a cut, including in a fresh process.
|
|
86
|
+
- **Receipt**: a fingerprinted record of one operation (a step, an edit, a restore).
|
|
87
|
+
- **Native**: the model's own code and weights, run unmodified. Saturn and mdb measure effects by
|
|
88
|
+
running the native model, not a copy or approximation of it.
|
|
89
|
+
|
|
90
|
+
## Packages
|
|
91
|
+
|
|
92
|
+
| Package (PyPI) | Import | Command | Location | Version |
|
|
93
|
+
| --- | --- | --- | --- | --- |
|
|
94
|
+
| [`model-runtime`](https://pypi.org/project/model-runtime/) | `saturn` | `saturn` | repository root | 0.5.0 |
|
|
95
|
+
| [`model-debugger`](https://pypi.org/project/model-debugger/) | `mdb` | `mdb` | [`packages/mdb`](https://github.com/JHollenb/saturn/blob/main/packages/mdb/README.md) | 0.4.0 |
|
|
96
|
+
|
|
97
|
+
mdb depends on `model-runtime` (`>=0.5.0,<0.6`). Its stepper drives a `saturn.Session` over
|
|
98
|
+
Saturn's decoder adapter, and it reuses Saturn's sessions, cuts and value digests. Saturn does not
|
|
99
|
+
import mdb and installs without it.
|
|
100
|
+
|
|
101
|
+
Which to install:
|
|
102
|
+
|
|
103
|
+
- To debug a Qwen2, Qwen3, Llama or Mistral model interactively, port by port, install **mdb**.
|
|
104
|
+
It brings `model-runtime` with it.
|
|
105
|
+
- To script interventions, branches and replay in Python, to work with other families (GPT-2,
|
|
106
|
+
Pythia, Gemma-2, Mamba, FLUX), or to use reversible training or the circuit-tracer integration,
|
|
107
|
+
install **Saturn**.
|
|
108
|
+
|
|
109
|
+
## Install
|
|
110
|
+
|
|
111
|
+
Python 3.10 or newer; CPU is supported. Both packages are available on PyPI, `model-runtime`
|
|
112
|
+
from 0.5.0 and `model-debugger` from 0.4.0:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pip install "model-runtime[ar]" # Saturn with language-model support
|
|
116
|
+
pip install "model-debugger[autoregressive]" # mdb; brings model-runtime with it
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Saturn's extras: `ar` for language models, `diffusion` for FLUX, `train` for reversible training,
|
|
120
|
+
`interop` for the SAELens / TransformerLens example. A bare `pip install model-runtime` has no
|
|
121
|
+
PyTorch and supports metadata inspection and JSON-only custom adapters.
|
|
122
|
+
|
|
123
|
+
Saturn, from a checkout:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
git clone https://github.com/JHollenb/saturn
|
|
127
|
+
cd saturn
|
|
128
|
+
python -m venv .venv
|
|
129
|
+
source .venv/bin/activate
|
|
130
|
+
pip install -e '.[ar,diffusion,train,dev]'
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
With uv: `uv sync --extra ar --extra diffusion --extra train --extra dev` (the checkout selects
|
|
134
|
+
Python 3.12 for uv). Install only the extras you need.
|
|
135
|
+
|
|
136
|
+
mdb, from the same checkout:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
pip install . "./packages/mdb[autoregressive]"
|
|
140
|
+
# or, to edit the code:
|
|
141
|
+
pip install -e . -e "./packages/mdb[autoregressive]"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
mdb's `autoregressive` extra brings torch, transformers and accelerate; `serve` adds the web
|
|
145
|
+
viewer, `interop` adds TransformerLens and nnsight, `s3` adds an S3 checkpoint store, `diffusion`
|
|
146
|
+
adds diffusers. The [mrun-pub](https://github.com/JHollenb/mrun-pub) job-scheduler client is not
|
|
147
|
+
an extra (PyPI does not accept Git dependencies); the debugger itself does not need it, and
|
|
148
|
+
`pip install "mrun-pub @ git+https://github.com/JHollenb/mrun-pub"` installs it. The wheel on
|
|
149
|
+
PyPI carries the built web viewer; in a checkout it is not checked in and must be built with npm
|
|
150
|
+
before `mdb serve` can show it. Details: [mdb installation](https://github.com/JHollenb/saturn/blob/main/packages/mdb/docs/INSTALL.md).
|
|
151
|
+
|
|
152
|
+
## Quick start
|
|
153
|
+
|
|
154
|
+
Both steps run on a laptop CPU with random tiny models. Nothing is downloaded beyond the pip
|
|
155
|
+
packages, and the numbers mean nothing; they show the mechanics.
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
pip install "model-debugger[autoregressive]" # installs mdb and Saturn (model-runtime)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
1. Debug interactively with mdb. Start a session on four token ids, run to the attention weights
|
|
162
|
+
of layer 1, print them, checkpoint, step on, and rewind:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
$ mdb engine tiny:qwen2 --tokens "1 5 9 3"
|
|
166
|
+
(mdb) until L1.p
|
|
167
|
+
(mdb) print top=2
|
|
168
|
+
(mdb) checkpoint pre
|
|
169
|
+
(mdb) step
|
|
170
|
+
(mdb) restart pre
|
|
171
|
+
(mdb) quit
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
A longer session with its output is in the [mdb example](#mdb-example) below, and the
|
|
175
|
+
command list is in the [mdb README](https://github.com/JHollenb/saturn/blob/main/packages/mdb/README.md#verbs).
|
|
176
|
+
|
|
177
|
+
2. Script the same kind of experiment with Saturn. Save the [Saturn example](#saturn-example)
|
|
178
|
+
below as `demo.py` and run `python demo.py`: it stops a tiny Qwen2 after layer 0, snapshots
|
|
179
|
+
the state, zeroes the hidden state on one branch, runs both branches forward with the model's
|
|
180
|
+
own code, and compares them.
|
|
181
|
+
|
|
182
|
+
To use a real model, pass a checkpoint directory or the name of a model already in your local
|
|
183
|
+
Hugging Face cache: `mdb engine <model> "your prompt"`, or `saturn.adapters.load(<path>)` in
|
|
184
|
+
Python. The families that work are listed under [Supported models](#supported-models-saturn).
|
|
185
|
+
|
|
186
|
+
## Saturn features
|
|
187
|
+
|
|
188
|
+
Each item names the code that implements it. Paths are under `src/saturn/`.
|
|
189
|
+
|
|
190
|
+
**Load a model**
|
|
191
|
+
|
|
192
|
+
- `adapters.load(path_or_model)` picks an adapter from the checkpoint's `model_type`;
|
|
193
|
+
`adapters.supported_families()` lists them.
|
|
194
|
+
- Adapters: `DecoderAdapter` (`adapters/decoder.py`: gpt2, gpt_neox, phi, llama, mistral, mixtral,
|
|
195
|
+
gemma, gemma2, qwen2, qwen3), `QwenAdapter` (`adapters/qwen.py`), `MambaAdapter`
|
|
196
|
+
(`adapters/mamba.py`), `Flux2KleinAdapter` and `Flux1Adapter` (`adapters/flux2.py`,
|
|
197
|
+
`adapters/flux1.py`). Each has a `tiny()` constructor that builds a random model offline. An
|
|
198
|
+
adapter refuses a model config outside its rules and names the rule.
|
|
199
|
+
- Write your own adapter by subclassing `Adapter` (`core.py`); `GenericJSONAdapter`
|
|
200
|
+
(`program.py`) runs JSON-only state without PyTorch. Guide: [docs/adapters.md](https://github.com/JHollenb/saturn/blob/main/docs/adapters.md).
|
|
201
|
+
- Block-streamed residency (`residency="streamed"`, `adapters/_residency.py`) keeps weights in
|
|
202
|
+
host memory and copies one block at a time to the GPU, so a model larger than the card can be
|
|
203
|
+
stepped. See [below](#block-streamed-residency).
|
|
204
|
+
|
|
205
|
+
**Address the program**
|
|
206
|
+
|
|
207
|
+
- `ExecutionPoint` (`contracts.py`): where execution is stopped (family, step, phase, operator,
|
|
208
|
+
before/after).
|
|
209
|
+
- `SurfaceManifest` and `SlotSpec`: the declared map of state at a stop, with each slot's role,
|
|
210
|
+
whether it is writable, its producer and consumer, and what a write invalidates.
|
|
211
|
+
- `TransitionSpec`: the declared reads and writes of the next native operation.
|
|
212
|
+
- `StateAddress`: a slot plus an optional index into it.
|
|
213
|
+
- `NumericalContract`: what "exact" means for this adapter (same-program exact, bounded numeric,
|
|
214
|
+
or behavior observed).
|
|
215
|
+
- `numerics.py`: the PyTorch settings that can change results bit for bit (TF32, thread count,
|
|
216
|
+
deterministic algorithms, float32 matmul precision, reduced-precision reductions) are bound
|
|
217
|
+
into the execution contract that each cut's fingerprint covers. If a live setting drifts,
|
|
218
|
+
Saturn refuses to run and names the field.
|
|
219
|
+
|
|
220
|
+
**Run, stop and branch**
|
|
221
|
+
|
|
222
|
+
- `Session.continue_(steps)` and `Session.step(granularity="transition"|"token"|"denoise")`
|
|
223
|
+
advance native execution; `Session.probe(controller)` runs a read-only probe that stops at a
|
|
224
|
+
declared port (`PortStop`).
|
|
225
|
+
- `Session.inspect()` returns a `Frame`; `Session.read(slot)` and `Session.read_port(address)`
|
|
226
|
+
read values.
|
|
227
|
+
- `Session.capture()` returns a `StateCut`; `fork`, `from_cut`, `replay`, `restore`, `commit`,
|
|
228
|
+
`abort` and `compare` branch from it, return to it and compare branches.
|
|
229
|
+
- `store.LocalStore` saves cuts and receipts to disk, loads them in another process, and
|
|
230
|
+
exports and imports the cut graph. `program.ReplayBundle` seals a measured program, its cuts,
|
|
231
|
+
receipts, environment and adapter provenance so a fresh process can verify and restore it.
|
|
232
|
+
- `shared_store.SharedStore` shares immutable tensor files across stores by hardlink.
|
|
233
|
+
|
|
234
|
+
**Intervene**
|
|
235
|
+
|
|
236
|
+
- `Act.replace`, `Act.add` (with a dose), `Act.zero`, `Act.patch` and `Act.register_operation`
|
|
237
|
+
for custom operations (`core.py`). `Session.apply(act)` returns a `Receipt`.
|
|
238
|
+
- `program.Program` replays measured interventions on a new recipient within declared support.
|
|
239
|
+
- `route.MetadataDeltaRoute`, `DeltaCard` and `apply_delta`: a catalog of candidate deltas you
|
|
240
|
+
select by tag before loading any tensor bytes, then apply, compare with native and roll back
|
|
241
|
+
exactly. Command: `saturn route validate|select|show`. Guide: [docs/route.md](https://github.com/JHollenb/saturn/blob/main/docs/route.md).
|
|
242
|
+
- `writers.fit_low_rank_writer`: fits a small low-rank state writer from paired cuts
|
|
243
|
+
(supervised fitting; its effect on the model has to be measured separately).
|
|
244
|
+
|
|
245
|
+
**Observe and analyze**
|
|
246
|
+
|
|
247
|
+
- `observers.Observer`, `Watchpoint` and `WatchEvent`: per-branch watches on a slot (`change`,
|
|
248
|
+
`gt`, `lt`, `nonfinite`) that keep a cut at each hit.
|
|
249
|
+
- `symbols.SymbolBinding` and `SymbolTable`: names you bind to state locations, qualified by
|
|
250
|
+
model, execution point and context, with evidence and a status; saved as a sidecar tied to a
|
|
251
|
+
cut. `structural_symbols` lists the adapter-declared slots; `backtrace` walks recorded reads
|
|
252
|
+
and writes back from a slot. Symbols are declared, not inferred.
|
|
253
|
+
- `causal.CausalPath` and `PortObservation`: route-and-effect records with first divergence,
|
|
254
|
+
repair and collateral.
|
|
255
|
+
- `paths.Trajectory`, `PathSchedule` and `compare_trajectories`: timed interventions over a run
|
|
256
|
+
and the first recorded divergence between two runs.
|
|
257
|
+
- `investigation.Investigation`: causal panels, several intervention arms from one parent.
|
|
258
|
+
- `dependencies.DependencyGraph`: the exact set of cells a change dirties, and reuse of the rest.
|
|
259
|
+
- `trial.arbitrate` (Instrument Trial): grades a reading from another method (patching, probe,
|
|
260
|
+
cosine, SAE) against the native continuation as agree / invert / inconclusive under a frozen
|
|
261
|
+
`DecisionRule`. Guide: [docs/trial.md](https://github.com/JHollenb/saturn/blob/main/docs/trial.md).
|
|
262
|
+
- `interop.circuit_tracer`: takes a circuit-tracer attribution graph and re-runs each selected
|
|
263
|
+
edge (`native_edge_test`) and feature group (`native_group_intervention`) as a native
|
|
264
|
+
intervention on the real weights, then seals an `EdgeVerdictTable` that `verify_edge_bundle`
|
|
265
|
+
can re-check offline. Guide: [docs/circuit-tracer.md](https://github.com/JHollenb/saturn/blob/main/docs/circuit-tracer.md).
|
|
266
|
+
- SAELens and TransformerLens: an example, not a library module
|
|
267
|
+
([`examples/interop_saelens.py`](https://github.com/JHollenb/saturn/blob/main/examples/interop_saelens.py), [docs/interop.md](https://github.com/JHollenb/saturn/blob/main/docs/interop.md)).
|
|
268
|
+
|
|
269
|
+
**Train reversibly**
|
|
270
|
+
|
|
271
|
+
- `training.TrainingTransaction`: run an update interval, score it, and promote or restore the
|
|
272
|
+
registered state (model, optimizer, sampler cursor and caller-registered caches) under a
|
|
273
|
+
`PromotionPolicy`, with a chain of decision receipts. Guide: [docs/training.md](https://github.com/JHollenb/saturn/blob/main/docs/training.md).
|
|
274
|
+
|
|
275
|
+
**Command line**
|
|
276
|
+
|
|
277
|
+
- `saturn debug [--family ar|diffusion] [--script FILE]` (`cli.py`): a small REPL with
|
|
278
|
+
step, next, continue, break, watch, read, capture, fork, zero/add/replace, compare, restore,
|
|
279
|
+
commit, replay, save and load. It runs only on the built-in random tiny models; use the Python
|
|
280
|
+
API or mdb for real weights.
|
|
281
|
+
- `saturn inspect DIR DIGEST`: verify a saved descriptor without PyTorch.
|
|
282
|
+
|
|
283
|
+
### Saturn example
|
|
284
|
+
|
|
285
|
+
Runs offline on a random tiny Qwen2 that is built in memory:
|
|
286
|
+
|
|
287
|
+
```python
|
|
288
|
+
from saturn import Act
|
|
289
|
+
from saturn.adapters.qwen import QwenAdapter
|
|
290
|
+
|
|
291
|
+
adapter = QwenAdapter.tiny() # offline, random native Qwen2; no download
|
|
292
|
+
session = adapter.session([5, 7, 11])
|
|
293
|
+
session.continue_() # token embedding boundary
|
|
294
|
+
session.continue_() # native decoder layer 0
|
|
295
|
+
parent = session.capture()
|
|
296
|
+
candidate = session.fork(parent)
|
|
297
|
+
candidate.apply(Act.zero("hidden"))
|
|
298
|
+
adapter.generate(candidate, tokens=2)
|
|
299
|
+
native = session.fork(parent)
|
|
300
|
+
adapter.generate(native, tokens=2)
|
|
301
|
+
comparison = native.compare(candidate)
|
|
302
|
+
session.commit(candidate) # explicit decision; no automatic scientific verdict
|
|
303
|
+
session.restore(parent) # verified restoration; retained futures stay intact
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
A step is one adapter transition; `adapter.generate` is a helper that runs a token budget.
|
|
307
|
+
A cut holds the model identity, the execution contract and all declared continuation state.
|
|
308
|
+
"Exact" means a named state boundary and numerical program, not agreement across all kernels.
|
|
309
|
+
|
|
310
|
+
More offline examples are in [examples/](https://github.com/JHollenb/saturn/blob/main/examples/README.md) (for instance `ar_debug.py`,
|
|
311
|
+
`debugger_replay.py`, `software_debugger.py`, `debugging_repair.py`, `diffusion_debug.py`,
|
|
312
|
+
`instrument_trial.py`, `reversible_training.py`) and [notebooks/](https://github.com/JHollenb/saturn/blob/main/notebooks/README.md). They run
|
|
313
|
+
random tiny models and show mechanics only, not pretrained behavior. Output goes to `outputs/`.
|
|
314
|
+
|
|
315
|
+
## mdb features
|
|
316
|
+
|
|
317
|
+
Each item names the code that implements it. Paths are under `packages/mdb/src/mdb/`. The full
|
|
318
|
+
reference, with real output for every verb, is the [mdb README](https://github.com/JHollenb/saturn/blob/main/packages/mdb/README.md).
|
|
319
|
+
|
|
320
|
+
**Attach**
|
|
321
|
+
|
|
322
|
+
- `mdb engine MODEL [PROMPT]` (`cli.py`, `repl/`): the REPL. `MODEL` is a checkpoint directory,
|
|
323
|
+
the name of a model in the local Hugging Face cache, `tiny:qwen2|qwen3|llama|mistral`, or the
|
|
324
|
+
address of a running `mdb serve`. Nothing is downloaded.
|
|
325
|
+
- Python: `mdb.attach(model, tokenizer)` and `mdb.open_tiny(family)` return a `Debugger`
|
|
326
|
+
(`ops/debugger.py`); `Debugger.run(tokens)` starts a run. Every REPL verb is also an op in one
|
|
327
|
+
registry (`ops/registry.py`) that takes and returns JSON; `--json` prints those results.
|
|
328
|
+
- Port programs for Qwen2, Qwen3, Llama and Mistral (`engine/ports.py`, `FAMILIES`). Each layer
|
|
329
|
+
is split into named ports (layer input `h`, `q`, `k`, `v`, scores `s`, attention weights `p`,
|
|
330
|
+
attention output `o`, MLP output `m`, layer output `h_out`, and others), plus key/value cache
|
|
331
|
+
cells `cache.L<l>.k|v`. A config the port program does not match is refused at attach.
|
|
332
|
+
- Limits: one prompt at a time (batch 1), eager attention, eval mode, CPU or CUDA.
|
|
333
|
+
|
|
334
|
+
**Move**
|
|
335
|
+
|
|
336
|
+
- `step [N] [port|sublayer|layer|token]`, `next`, `finish`, `until ADDR`, `advance`,
|
|
337
|
+
`continue`, `feed` (force token ids), `seek` (`ops/builtin.py`, `ops/inspect.py`).
|
|
338
|
+
- `reverse-step`, `reverse-next`, `reverse-finish`, `reverse-continue`.
|
|
339
|
+
- `checkpoint NAME` and `restart NAME` (about 1 KB per checkpoint).
|
|
340
|
+
|
|
341
|
+
**Stop**
|
|
342
|
+
|
|
343
|
+
- `break PATTERN [if CONDITION]`, `tbreak`, `condition`, `ignore`, `enable`, `disable`,
|
|
344
|
+
`delete`. Patterns match port addresses such as `L*.p` or `t5.L1.o`.
|
|
345
|
+
- `watch ADDR [change|level|edge] [if PREDICATE]`; `display ADDR` shows a value after every stop.
|
|
346
|
+
|
|
347
|
+
**Inspect**
|
|
348
|
+
|
|
349
|
+
- `print`, `x` (raw slice), `where`, `list` (the layer's operator text with the cursor marked),
|
|
350
|
+
`backtrace` (producer chain of a port), `up`, `down`, `frame`, `info`.
|
|
351
|
+
- Every number carries an authority label (`measured`, `derived-exact`, `derived-local`,
|
|
352
|
+
`bound`, `supplied`) that says how it was obtained.
|
|
353
|
+
|
|
354
|
+
**Edit**
|
|
355
|
+
|
|
356
|
+
- `set ADDR = VALUE|ADDR|RUN:ADDR [replace|add|scale|mix DOSE]` stages an edit at a port or a
|
|
357
|
+
cache cell, including a value taken from another run; `commit` and `abort` (`ops/builtin.py`).
|
|
358
|
+
- `Run.hold(...)` (`engine/run.py`, `engine/holds.py`) keeps attention weights, norm scales or
|
|
359
|
+
cells at a reference run's values.
|
|
360
|
+
|
|
361
|
+
**Predict and measure**
|
|
362
|
+
|
|
363
|
+
- `forecast` seals a prediction of a later value before native code runs; `verify` compares it
|
|
364
|
+
with what the model computed (`ops/predict.py`, `analysis/predict/`).
|
|
365
|
+
- `whatif ADDR = VALUE --consumer C` predicts, then measures natively, the change an edit causes
|
|
366
|
+
in a consumer, and leaves the session where it was.
|
|
367
|
+
- `compare A B` measures base, A, B and A+B and their interaction. `sweep PORT = RUN --consumer C`
|
|
368
|
+
patches a port from another run at every (row, layer) and tabulates the effect (activation
|
|
369
|
+
patching, `ops/sweep.py`).
|
|
370
|
+
- `explain M[a,b]` splits a logit difference exactly into contributions, with a measured
|
|
371
|
+
remainder.
|
|
372
|
+
- `reads SOURCE` lists which attention reads carry a row into a consumer, with a causal verdict.
|
|
373
|
+
- `circuit CONSUMER` builds a circuit record from the exact decomposition; `circuit test`
|
|
374
|
+
measures it by native patching from a reference run.
|
|
375
|
+
- `symbols`, `symbol` and `candidates`: a symbol table at the cursor (bindings, definition sites,
|
|
376
|
+
lifetimes, readers) and named symbols declared from a transplant (`ops/inspect.py`,
|
|
377
|
+
`analysis/symbols/`).
|
|
378
|
+
- `each SET: OP` runs any verb over a prompt set, one run per prompt, with a summary
|
|
379
|
+
(`ops/sets.py`).
|
|
380
|
+
- `Debugger.branches` (`analysis/measure/branches.py`) and `Debugger.pool`
|
|
381
|
+
(`analysis/measure/pools.py`): several arms from one checkpoint with a shared noise floor and
|
|
382
|
+
built-in null arms; sealed sets of donor values.
|
|
383
|
+
|
|
384
|
+
**SAE features**
|
|
385
|
+
|
|
386
|
+
- `sae load`, `features ADDR`, `feature ID` (`ops/features.py`, `analysis/features/`): read
|
|
387
|
+
residual SAEs and transcoders from local files, split a value into features plus an error term
|
|
388
|
+
that is always shown, and edit by feature. Feature tables can link to Neuronpedia
|
|
389
|
+
(`core/neuronpedia.py`). mdb does not train SAEs.
|
|
390
|
+
|
|
391
|
+
**Save, share and record**
|
|
392
|
+
|
|
393
|
+
- Projects (`--project DIR`) make checkpoints durable: `Debugger.checkpoint`,
|
|
394
|
+
`Debugger.run_from`, and `export NAME to=DIR` / `Debugger.export_bundle` to move a checkpoint
|
|
395
|
+
and its records to another project. Stores can be a directory or `s3://` (`core/checkpoint_store.py`).
|
|
396
|
+
- Sealed records (schema `mdb-record-v3`) with custody (`Debugger.custody`, `Debugger.records_to`,
|
|
397
|
+
`core/custody.py`); `mdb records migrate|verify PATH` (`core/migrate.py`).
|
|
398
|
+
|
|
399
|
+
**Passive capture**
|
|
400
|
+
|
|
401
|
+
- `mdb.trace(model, ports=[...])` (`engine/trace.py`) records ports during a forward pass your own
|
|
402
|
+
code runs (any batch size, sdpa, `generate`), without changing the logits. It cannot step or
|
|
403
|
+
edit.
|
|
404
|
+
|
|
405
|
+
**Interop**
|
|
406
|
+
|
|
407
|
+
- `mdb.interop` (`interop/`, extra `interop`): maps ports to TransformerLens hook names and
|
|
408
|
+
nnsight paths, imports a TransformerLens cache as another run, runs mdb edits batched through
|
|
409
|
+
nnsight, and re-measures another tool's claimed effect natively (`interop.verify`).
|
|
410
|
+
|
|
411
|
+
**Web viewer and remote sessions**
|
|
412
|
+
|
|
413
|
+
- `mdb serve --project DIR` (`serve/`, extra `serve`) serves a recorded project in the browser
|
|
414
|
+
(timeline, graph, symbols, records). With `--tiny` or `--model` it also holds a live debugger
|
|
415
|
+
that the page and `mdb engine http://HOST:PORT` drive through a JSON API. It has no
|
|
416
|
+
authentication and binds to loopback by default.
|
|
417
|
+
|
|
418
|
+
**Configuration and checks**
|
|
419
|
+
|
|
420
|
+
- `mdb config show|explain|init|check` (`repl/config.py`): defaults in a user or project TOML file.
|
|
421
|
+
- `python -m mdb.engine.selfcheck` (`engine/selfcheck.py`): exactness, probe-consistency and
|
|
422
|
+
rewind checks of port stepping on a tiny or real model, with per-operation timings.
|
|
423
|
+
|
|
424
|
+
**Experimental**
|
|
425
|
+
|
|
426
|
+
- `mdb.machines.x86` (`machines/x86/`): the same debugger verbs over an x86-64 binary executed by
|
|
427
|
+
torchx86. It needs external tools that are not part of this repository.
|
|
428
|
+
- The older lane-era commands (`mdb lanes VERB`) come from a separate `mdb-lanes` plug-in that
|
|
429
|
+
lives in the maintainers' research repository and is not published. Without it, `mdb lanes`
|
|
430
|
+
says so and exits with status 2.
|
|
431
|
+
|
|
432
|
+
### mdb example
|
|
433
|
+
|
|
434
|
+
A REPL session on a random 2-layer Qwen2 built in memory (CPU, nothing downloaded; its numbers
|
|
435
|
+
mean nothing). It stops inside layer 1, checkpoints, stages an edit, runs to the logits, and
|
|
436
|
+
rewinds:
|
|
437
|
+
|
|
438
|
+
```
|
|
439
|
+
$ mdb engine tiny:qwen2
|
|
440
|
+
(mdb) start 1 5 9 3
|
|
441
|
+
t3.L0.h h = layer input (residual stream) {P01}
|
|
442
|
+
(mdb) until L1.p
|
|
443
|
+
t3.L1.p p = softmax(s, float32).to(dtype) (native attention weights) {P05 P06 P07 P08 P09}
|
|
444
|
+
(mdb) checkpoint pre
|
|
445
|
+
checkpoint pre at t3.L1.p (750 bytes)
|
|
446
|
+
(mdb) set L1.m = 0 scale
|
|
447
|
+
staged at t3.L1.m: m scale 0 [supplied] (not fired yet) (1 staged)
|
|
448
|
+
(mdb) until logits
|
|
449
|
+
t3.logits logits = lm_head(fn)
|
|
450
|
+
(mdb) print logits top=3
|
|
451
|
+
t3.logits bfloat16 [1, 32] (batch, vocab)
|
|
452
|
+
norm 0.39659 min -0.16699 max 0.13477 mean -0.0077629 abs_max 0.16699 [measured, under edit t3.L1.m]
|
|
453
|
+
top: [0,20] 0.13477, [0,22] 0.10352, [0,10] 0.10156 [measured, under edit t3.L1.m]
|
|
454
|
+
pointer occurrence ~stepped sha256 88df038247cb2036 cut 8e2b0ef987d2
|
|
455
|
+
(mdb) restart pre
|
|
456
|
+
t3.L1.p p = softmax(s, float32).to(dtype) (native attention weights) {P05 P06 P07 P08 P09}
|
|
457
|
+
(mdb) info edits
|
|
458
|
+
staged at t3.L1.p: none
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
The `cut` fingerprint changes from run to run. The same in Python:
|
|
462
|
+
|
|
463
|
+
```python
|
|
464
|
+
import mdb
|
|
465
|
+
|
|
466
|
+
dbg = mdb.open_tiny("qwen2") # or mdb.attach(model, tokenizer)
|
|
467
|
+
run = dbg.run([1, 5, 9, 3]) # prefill 3 tokens; cursor at t3.L0.h
|
|
468
|
+
run.until("L1.p") # stop inside layer 1 at the attention weights
|
|
469
|
+
saved = run.checkpoint("pre")
|
|
470
|
+
run.set("L1.m", 0.0, "scale") # stage an edit further down the same layer
|
|
471
|
+
print(run.until("logits"), run.read()[0, :3])
|
|
472
|
+
print(run.restore(saved), run.edits) # back at t3.L1.p, nothing staged
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
Timings and results on real models (Qwen2.5-1.5B, SmolLM2-360M) are in the mdb README under
|
|
476
|
+
[Measured on a real model](https://github.com/JHollenb/saturn/blob/main/packages/mdb/README.md#measured-on-a-real-model).
|
|
477
|
+
|
|
478
|
+
## Supported models (Saturn)
|
|
479
|
+
|
|
480
|
+
mdb supports Qwen2, Qwen3, Llama and Mistral, as listed above. The rest of this section is about
|
|
481
|
+
Saturn's adapters.
|
|
482
|
+
|
|
483
|
+
### Language models
|
|
484
|
+
|
|
485
|
+
`saturn.adapters.load(path_or_model)` dispatches by `model_type`. Autoregressive decoder
|
|
486
|
+
families run through `adapters/decoder.py` (Qwen2 also through the dedicated `adapters/qwen.py`);
|
|
487
|
+
Mamba-1 runs through `adapters/mamba.py`. Every adapter uses eager attention, batch one, and greedy
|
|
488
|
+
decoding, and refuses an out-of-rule config by naming the rule. Real-weight rows below were
|
|
489
|
+
measured fp32, `tf32` off; each reproduced the native 16-token greedy decode exactly and replayed a
|
|
490
|
+
mid-layer cut exactly in a fresh interpreter. These numbers were measured by the maintainers; the
|
|
491
|
+
research repository that holds the result files is not published. The gemma2 row is the adapter
|
|
492
|
+
validation of the circuit-tracer run described [below](#circuit-tracer-on-gemma-2-2b).
|
|
493
|
+
|
|
494
|
+
| Family | Adapter | Real-weight checkpoints (max abs logit Δ vs native) | Parity | Limits |
|
|
495
|
+
| --- | --- | --- | --- | --- |
|
|
496
|
+
| gpt2 | Decoder | gpt2 — macOS arm64 CPU (1.8e-4) | 16/16 greedy exact, fresh-process replay exact | learned absolute positions; gelu_new; eager |
|
|
497
|
+
| gpt_neox (Pythia) | Decoder | pythia-70m/160m/410m (1.6e-5 / 1.7e-6 / 3.8e-6) | 16/16 greedy exact, replay exact | MHA, parallel residual, partial rotary; untied |
|
|
498
|
+
| llama | Decoder | SmolLM2-360M (2.2e-5); Llama-3.2-1B (1.1444e-5; bf16 0.15625) | 16/16 greedy exact, replay exact; Llama-3.2-1B bf16 16/16 greedy exact | `pretraining_tp==1`; default or `llama3`-scaled RoPE (other scaled types refused) |
|
|
499
|
+
| qwen2 | Qwen / Decoder | Qwen2.5-0.5B (1.8e-5) | 16/16 greedy exact, replay exact | full attention only, no sliding window |
|
|
500
|
+
| qwen3 | Decoder | Qwen3-0.6B (1.4e-5) | 16/16 greedy exact, replay exact | attention qk-norm required |
|
|
501
|
+
| mamba (Mamba-1) | Mamba | mamba-130m/370m-hf (1.0e-4 / 9.4e-5) | 16/16 greedy exact, replay exact; single-token zero-state step bit-exact | no attention/positions; numeric (not bit-exact) parity |
|
|
502
|
+
| phi | Decoder | tiny fixture only | tiny-fixture parity | no cached checkpoint available |
|
|
503
|
+
| mistral | Decoder | tiny fixture only | tiny-fixture parity | only Mistral-7B cached (exceeds the 4080 VRAM guardrail); accepted only while context <= `sliding_window` |
|
|
504
|
+
| mixtral | Decoder | tiny fixture only | bounded MoE parity | no cached checkpoint available |
|
|
505
|
+
| gemma (Gemma-1) | Decoder | tiny fixture only | tiny-fixture parity | no cached checkpoint available |
|
|
506
|
+
| gemma2 (Gemma-2) | Decoder | gemma-2-2b — CPU, circuit-tracer run (1.6e-5) | 16/16 greedy exact, replay exact | soft-capped attention/logits; alternating local/global sliding-window (context ≤ `sliding_window`); GeGLU; pre+post norms; tied, scaled embeddings |
|
|
507
|
+
|
|
508
|
+
Real-weight runs used cached checkpoints on an RTX 4080 (16 GB) machine via one batched job plus a
|
|
509
|
+
supplementary pythia job; gpt2 was measured on macOS arm64 CPU because it was not cached on that
|
|
510
|
+
machine, and gemma-2-2b fp32 on CPU in the circuit-tracer run. phi, gemma, mixtral, and mistral have
|
|
511
|
+
no usable cached checkpoint (mistral only as a 7B that exceeds the VRAM budget), so they are
|
|
512
|
+
exercised by the tiny-fixture suite only.
|
|
513
|
+
|
|
514
|
+
Llama-3.2-1B (`rope_type: llama3`, factor 32) was measured later, in one job on the same RTX 4080
|
|
515
|
+
host: torch 2.13.0+cu130, transformers 5.13.1, eager attention, `tf32` off. The weights came from
|
|
516
|
+
the ungated mirror `unsloth/Llama-3.2-1B` at revision `9535bd9b1d1dea6acafbdc4813b728796aeb28da`
|
|
517
|
+
(`model.safetensors` sha256 `68a2e4be76fa709455a60272fba8e512c02d81c46e6c671cc9449e374fd6809a`,
|
|
518
|
+
checked in the job). On an 11-token prompt the fp32 max abs logit Δ was 1.1444091796875e-5, the
|
|
519
|
+
16-token greedy decode matched native, and a mid-layer cut replayed exactly in a fresh
|
|
520
|
+
interpreter. The checkpoint dtype, bf16 on CUDA, gave a Δ of 0.15625 and the 16-token greedy
|
|
521
|
+
decode also matched native. The model's `inv_freq` buffer equals transformers'
|
|
522
|
+
`_compute_llama3_parameters` bitwise, and the scaling moves 17 of its 32 frequencies. In the same
|
|
523
|
+
job mdb's port selfcheck passed in fp32 and in bf16: 288 stop probes, 0 mismatches, observed
|
|
524
|
+
stepping byte-identical to plain stepping.
|
|
525
|
+
|
|
526
|
+
### Diffusion (FLUX)
|
|
527
|
+
|
|
528
|
+
Diffusion adapters step the native FLUX transformer one projection / joint block / single block /
|
|
529
|
+
readout at a time with the native flow Euler update and VAE. Rows below were measured by the
|
|
530
|
+
maintainers, bf16, 512×512, 4 steps on an RTX 4080 (16 GB); "exact" means every per-step latent
|
|
531
|
+
digest is equal.
|
|
532
|
+
|
|
533
|
+
| Family | Adapter | Real-weight checkpoint | Stepped = native | Streamed = resident | Fresh-process replay | Streamed peak VRAM |
|
|
534
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
535
|
+
| FLUX.2 Klein-4B | `Flux2KleinAdapter` | real weights | exact | exact | exact | 0.65 GB |
|
|
536
|
+
| FLUX.2 Klein-9B | `Flux2KleinAdapter` | real weights | exact | — (does not fit resident) | exact | 1.07 GB |
|
|
537
|
+
| FLUX.1-schnell | `Flux1Adapter` | real weights | exact | — (does not fit resident) | exact | 0.81 GB |
|
|
538
|
+
| FLUX.1-dev | `Flux1Adapter` | tiny fixture only | tiny-fixture parity | — | — | no real checkpoint available |
|
|
539
|
+
| FLUX.2 Klein 9B-KV | — | refused with a reason | — | — | — | reference-KV trajectory ABI |
|
|
540
|
+
|
|
541
|
+
Text-only, batch one; no reference images, CFG, or LoRA. See
|
|
542
|
+
[FLUX diffusion families](https://github.com/JHollenb/saturn/blob/main/docs/diffusion-families.md).
|
|
543
|
+
|
|
544
|
+
### Block-streamed residency
|
|
545
|
+
|
|
546
|
+
Every language-model adapter and both FLUX adapters accept `residency="streamed"`: frozen weights
|
|
547
|
+
stay in host memory and one native block at a time is copied to the GPU, so a model larger than
|
|
548
|
+
the card can be stepped and debugged. Streamed output equals resident output bitwise on the same
|
|
549
|
+
device wherever the model fits resident. Measured by the maintainers on an RTX 4080 (16 GB), a
|
|
550
|
+
Qwen3-8B bf16 decode peaks at 1.21 GB streamed and reproduces the 16-token greedy decode exactly.
|
|
551
|
+
It is slow (0.5 tok/s for the streamed 8 B) and meant for debugging, not serving. Details, the
|
|
552
|
+
measured table and the transport options (`pin_host`, `prefetch`, `host_embedding`):
|
|
553
|
+
[docs/block-streamed-residency.md](https://github.com/JHollenb/saturn/blob/main/docs/block-streamed-residency.md).
|
|
554
|
+
|
|
555
|
+
### circuit-tracer on gemma-2-2b
|
|
556
|
+
|
|
557
|
+
The circuit-tracer integration was run by the maintainers on real `google/gemma-2-2b` weights
|
|
558
|
+
with the Gemma Scope transcoders, against a panel preregistered before the run (56 candidates /
|
|
559
|
+
7 task families; admission = native greedy top-1 equals the target; `top_k = 20`; thresholds
|
|
560
|
+
frozen). **50 of 56 prompts admitted**. Steering the graph's top-20 features to −2× flips the
|
|
561
|
+
native top-1 on **45 of 50** prompts, and zero-ablating them flips **15 of 50** (every multi-hop
|
|
562
|
+
prompt); a matched-random set of 20 features flips 20 and 5. On **1000 single-feature edges**
|
|
563
|
+
native effects agree with circuit-tracer's own predicted drop **84.6 % of the time (95 % CI
|
|
564
|
+
82.4–86.8 %)** with a single inversion; agreement is near-total on direct-recall families and
|
|
565
|
+
lowest on compositional ones (multi-hop 58.1 %, translation 68.6 %). Where the graph's group
|
|
566
|
+
predictions miss, they mostly *under*-predict the real model, worst on multi-hop prompts;
|
|
567
|
+
circuit-tracer's unconstrained intervention mode is the most accurate and its direct-effects mode
|
|
568
|
+
the least. Transcoder **error nodes** carry 11–19 % of node influence the feature circuit never
|
|
569
|
+
exposes. A first run mis-dosed the native interventions (an activation-indexing bug, now fixed
|
|
570
|
+
and regression-tested) and its group conclusions were withdrawn. Limits: single-GPU, greedy,
|
|
571
|
+
batch-one, fp32 native vs bf16 replacement; agreement is measured against circuit-tracer's *own*
|
|
572
|
+
predicted drop, not ground-truth causal necessity. The adapter's block-streamed path reproduces
|
|
573
|
+
the resident forward **bitwise** on these weights (max logit Δ 0.0, 2.4 GB vs 10.6 GB peak VRAM).
|
|
574
|
+
The research repository with the per-edge results is not published.
|
|
575
|
+
|
|
576
|
+
## Guides
|
|
577
|
+
|
|
578
|
+
Start with the [documentation index](https://github.com/JHollenb/saturn/blob/main/docs/README.md).
|
|
579
|
+
|
|
580
|
+
mdb:
|
|
581
|
+
|
|
582
|
+
- [mdb README](https://github.com/JHollenb/saturn/blob/main/packages/mdb/README.md): every verb, ports, addresses, predictions, known limits
|
|
583
|
+
- [Installation and extras](https://github.com/JHollenb/saturn/blob/main/packages/mdb/docs/INSTALL.md), [configuration](https://github.com/JHollenb/saturn/blob/main/packages/mdb/docs/CONFIG.md),
|
|
584
|
+
[releases](https://github.com/JHollenb/saturn/blob/main/packages/mdb/docs/RELEASING.md)
|
|
585
|
+
- [Branches, pools, holds and checkpoints](https://github.com/JHollenb/saturn/blob/main/packages/mdb/docs/BRANCHES-POOLS-HOLDS.md),
|
|
586
|
+
[records](https://github.com/JHollenb/saturn/blob/main/packages/mdb/docs/RECORDS.md), [interop](https://github.com/JHollenb/saturn/blob/main/packages/mdb/docs/INTEROP.md),
|
|
587
|
+
[performance](https://github.com/JHollenb/saturn/blob/main/packages/mdb/docs/PERFORMANCE.md)
|
|
588
|
+
- [A real model on CPU](https://github.com/JHollenb/saturn/blob/main/packages/mdb/docs/REAL-MODEL-CPU.md) and [examples](https://github.com/JHollenb/saturn/blob/main/packages/mdb/examples/README.md)
|
|
589
|
+
|
|
590
|
+
Saturn:
|
|
591
|
+
|
|
592
|
+
- [When to use each capability](https://github.com/JHollenb/saturn/blob/main/docs/usage.md), [examples](https://github.com/JHollenb/saturn/blob/main/examples/README.md),
|
|
593
|
+
[notebooks](https://github.com/JHollenb/saturn/blob/main/notebooks/README.md)
|
|
594
|
+
- [Architecture and scope](https://github.com/JHollenb/saturn/blob/main/docs/architecture.md), [capabilities and numerical contracts](https://github.com/JHollenb/saturn/blob/main/docs/capabilities.md),
|
|
595
|
+
[runtime and memory scope](https://github.com/JHollenb/saturn/blob/main/docs/runtime-memory-scope.md)
|
|
596
|
+
- [Debugger](https://github.com/JHollenb/saturn/blob/main/docs/debugging.md), [symbols, provenance and debugging repair](https://github.com/JHollenb/saturn/blob/main/docs/debug-symbols-paths.md)
|
|
597
|
+
- [Experiments and programs](https://github.com/JHollenb/saturn/blob/main/docs/experiments.md), [reversible training](https://github.com/JHollenb/saturn/blob/main/docs/training.md)
|
|
598
|
+
- [Write an adapter](https://github.com/JHollenb/saturn/blob/main/docs/adapters.md), [pretrained model recipes](https://github.com/JHollenb/saturn/blob/main/docs/pretrained.md),
|
|
599
|
+
[FLUX diffusion families](https://github.com/JHollenb/saturn/blob/main/docs/diffusion-families.md), [block-streamed residency](https://github.com/JHollenb/saturn/blob/main/docs/block-streamed-residency.md)
|
|
600
|
+
- [SAELens and TransformerLens](https://github.com/JHollenb/saturn/blob/main/docs/interop.md), [circuit-tracer](https://github.com/JHollenb/saturn/blob/main/docs/circuit-tracer.md),
|
|
601
|
+
[Instrument Trial](https://github.com/JHollenb/saturn/blob/main/docs/trial.md), [metadata-delta route](https://github.com/JHollenb/saturn/blob/main/docs/route.md),
|
|
602
|
+
[writer demonstration](https://github.com/JHollenb/saturn/blob/main/docs/writer-demo.md)
|
|
603
|
+
- [Repository layout and independent builds](https://github.com/JHollenb/saturn/blob/main/docs/monorepo.md), [release validation](https://github.com/JHollenb/saturn/blob/main/docs/validation.md),
|
|
604
|
+
[extraction provenance](https://github.com/JHollenb/saturn/blob/main/PROVENANCE.md)
|
|
605
|
+
|
|
606
|
+
## Development
|
|
607
|
+
|
|
608
|
+
```bash
|
|
609
|
+
pytest -q
|
|
610
|
+
ruff check .
|
|
611
|
+
python -m build
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
mdb has its own test suite under `packages/mdb` ([mdb installation](https://github.com/JHollenb/saturn/blob/main/packages/mdb/docs/INSTALL.md#tests-and-building)).
|
|
615
|
+
Before changing code, read [CONTRIBUTING.md](https://github.com/JHollenb/saturn/blob/main/CONTRIBUTING.md): layout, setup, versioning and
|
|
616
|
+
releases, testing and bit-identity rules, adding a model family, and where to file issues.
|
|
617
|
+
|
|
618
|
+
Apache 2.0. Model weights and upstream libraries keep their own licenses.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
saturn/__init__.py,sha256=c4AUlnO3c7MOH6ju7TEeUa9OVWbhUTgodgRzUSkTpt4,569
|
|
2
|
+
saturn/causal.py,sha256=KjXpwPzUUfSwjXEHVResdCs1hww4pYfNI50cX5ySwxs,9093
|
|
3
|
+
saturn/cli.py,sha256=pQ3Z092PJ0vUhFtdeKopFKrM0y0KK_Csm5xGWIteiwA,17116
|
|
4
|
+
saturn/contracts.py,sha256=qLV5BmYtkH1ogbk2VykBgY-gTpULfkM4bYh50_7Yof8,6000
|
|
5
|
+
saturn/core.py,sha256=Ah-KvOj13G0vxJRnePIB41TpeusQImYDWvlEVrG-xHA,83816
|
|
6
|
+
saturn/dependencies.py,sha256=plKHgTQxqB9O_Bb4iTPb70kmcj4tmFmjAbBciEPwzhk,2336
|
|
7
|
+
saturn/investigation.py,sha256=km21WcgUfIGnmaCKcNSGfpcUx9ouK5xak1SzEXQ2MCw,3605
|
|
8
|
+
saturn/numerics.py,sha256=4KN4cu14VMk4e9yd9nIDrAiriuBhZuPPMtwdI8l02OU,9352
|
|
9
|
+
saturn/observers.py,sha256=F0vNGa-8Er084-Kn5xpbsY7WCpnR_BTT-jpBZaTza-0,10807
|
|
10
|
+
saturn/paths.py,sha256=cjaMjvjrjky6flZSZDj7XYn0fEtaKjFQ3XD0kexhLcE,13347
|
|
11
|
+
saturn/program.py,sha256=CXLWukP_mwHM1BJnDNd4HhWozcsFvAfl_SO_dPRXwJo,15142
|
|
12
|
+
saturn/route.py,sha256=HCWC4a0glj-d1Q5lNEq9YE5rrGgjWbOYYmemnTdznJE,32234
|
|
13
|
+
saturn/shared_store.py,sha256=BsG643HQLRE1m8fRRis6Hsvh-uZHl8BX-gEa3jUM46U,9876
|
|
14
|
+
saturn/store.py,sha256=BmJKVCtRbc9pt2BoXDI6AtGO3oE2kEc-XV1XPR5SkSE,36063
|
|
15
|
+
saturn/symbols.py,sha256=qnnWoVjWoenkVaMCDSKx4Q1AGYjmZFm019mXv-i7xg8,15909
|
|
16
|
+
saturn/trial.py,sha256=OIN_ekfI7uijxMWGsClHGohsBiCvL5VCxrBuJ603Jdk,21419
|
|
17
|
+
saturn/values.py,sha256=ymT9AQDW39J-ZyIxH2jkpphVssqKplvYdHrBsa2K67Y,8951
|
|
18
|
+
saturn/writers.py,sha256=6txt6CWLcOqKUFYHxvAahu6HQCMmYL7of9fw3dsL26s,3422
|
|
19
|
+
saturn/adapters/__init__.py,sha256=6ziL_YgBvhSgXpxEQKeeF_cdr4OLGq7Uy_ldTEIUaVE,2315
|
|
20
|
+
saturn/adapters/_residency.py,sha256=wyIqrcc1kDq4vVSwPNeCBwY15pDoFNWJIIJjgoPzCtA,8994
|
|
21
|
+
saturn/adapters/decoder.py,sha256=XbLAD3FYFb1hjeSUqLE14jMn5_xoyGwesADXde-JnVA,73523
|
|
22
|
+
saturn/adapters/diffusion.py,sha256=IPRZf6oS_Oc165DGz9PZY4smDa1vmSXEtduzD832hWE,18448
|
|
23
|
+
saturn/adapters/flux1.py,sha256=0D6_d8SztL2Suj_Yd_sAES2OH7EmJDnIbzjhzzwPd-c,28109
|
|
24
|
+
saturn/adapters/flux2.py,sha256=uP8yAV-LHFTsN7COb-Feu4uiO0BkuvGRZKRanGjHStk,27420
|
|
25
|
+
saturn/adapters/mamba.py,sha256=Q8gVuF1TeKox3EyFIbYAs-XCaedzXJ81SlvwJcDmz0Q,26551
|
|
26
|
+
saturn/adapters/qwen.py,sha256=6XetUb49MqRgJR75vTpAnpRgZnLW7mAEKsUlxjV3zlI,26236
|
|
27
|
+
saturn/interop/__init__.py,sha256=U9pUQ4vVlzfCEKmlLsRm7EU8-rC4WATkGqB0-ZDtI4o,1118
|
|
28
|
+
saturn/interop/circuit_tracer.py,sha256=vASXx4PoKwa9LF_gYWPZHtZBA9h_QA-cbqon3minoT8,49251
|
|
29
|
+
saturn/training/__init__.py,sha256=PnHsi9FzZrqZa0a362rXrB3IJLXtnVv7Ysz_eCPR5e8,1817
|
|
30
|
+
saturn/training/_checkpoint.py,sha256=Bdk5fw7DAAFSFyuazTMyV86erjb66thp1_bZ0OrN8Z4,67661
|
|
31
|
+
model_runtime-0.5.0.dist-info/METADATA,sha256=gs4M5hlEkHdRrs0Z1h091IcC0SQwtv-YvsPxR_2tRaI,36807
|
|
32
|
+
model_runtime-0.5.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
33
|
+
model_runtime-0.5.0.dist-info/entry_points.txt,sha256=rSF_YAe0OY83YlOqkmY5FFcQ2zFxwLrSNAIcqwPwcWU,43
|
|
34
|
+
model_runtime-0.5.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
35
|
+
model_runtime-0.5.0.dist-info/licenses/NOTICE,sha256=s6lvkbz4qSCRrS0P9NJxS3_XW6WRO6-Zs5elQt8Wc0g,251
|
|
36
|
+
model_runtime-0.5.0.dist-info/RECORD,,
|