Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

wspx

Grep, edit, check, test and version-control model weights.

wspx gives an AI agent (or you) the tools to change a model's weights the way it changes code: search them, make targeted edits, check each edit, run tests against the base, and commit or revert. It runs in your own Modal account with your own provider keys.

Install

pip install wspx

Set up

Once per machine and account:

wspx login                  # link your Modal account
wspx keys set anthropic     # or openai, google, hf
wspx deploy

Keys are stored as secrets in your Modal account and shared by every project and session. wspx keys list shows which are set and checks that each works; wspx keys rm <provider> removes one.

Projects

A project is a directory with a wspx.toml. Sessions started inside it take their defaults from it, and its files (test suites, prompt sets, scripts) are uploaded to the session's lab.

mkdir loops && cd loops
wspx init --model Qwen/Qwen3-0.6B --driver anthropic:claude-opus-5-5 --gpu L4
wspx new "The model loops on 'Wait'. Find the direction responsible and remove it without hurting math."
wspx open                   # watch the session in the browser

wspx sessions lists the project's sessions (--all for every project). Each project has its own current session, which the commands below act on; pass --session to pick another.

A session's trace records everything from its start: the driver's prompt, each turn's reasoning, text and token counts, and every tool call with its full result. wspx sessions export writes it as trace.jsonl, transcript.md and session.json; the UI's Traces tab shows the same record.

Commands

Every tool the agent has is also a command:

wspx info
wspx grep 'writes(" Wait") > 0.3' --in 'L*.mlp.down' --top 5
wspx contrast data/loops.jsonl data/clean.jsonl --name loop
wspx edit project_out direction=dir:loop 'targets=["L15.mlp.down","L19.mlp.down"]' cols=@r1
wspx check
wspx test --vs base
wspx vcs commit -m "Project out the loop direction in L15/L19 down_proj"
Tool Does
info Outline of the model: blocks, layer types, residual stream
ls Addresses matching a scope
grep Ranks weight units by an expression, or by what fires on prompts
show Stats, histogram, spectrum and vocabulary of a slice
contrast A direction from two prompt sets, and its top writers
generate Samples from the current weights
trace Logit lens and top writers; diff (--vs) and attribution traces
edit Stages ablate, set, scale, project_out, bake_steer, rank_one_write or transplant (source="base" restores weights)
check Static, numeric and smoke diagnostics, each with suggested fixes
test Test suites, paired against another revision
vcs status, diff, commit, log, checkout, branch, revert, bisect, blame, merge (strategies include orthogonalize)
export Merged safetensors, PEFT adapter, GGUF or a portable bundle
run A Python script in the lab, with the SDK loaded

Weights are addressed by role, derived from the model's actual computation: L19.mlp.down[:, 8812], L7.attn.q.h3, L12.moe.e5.up, embed[" Wait"]. Raw parameter names work too. Results come back as handles (@r1, dir:loop, p_8f2a91c0) that later commands accept.

Claude Code and Codex

wspx connect claude         # or: wspx connect codex

Adds the wspx MCP server, the wspx skill, and hooks that record the agent's steps in the session trace.

Python

With a GPU (or a small model on CPU) the lab can run in your own process:

pip install "wspx[lab]"
import wspx

m = wspx.session("Qwen/Qwen3-0.6B", store="./wspx-store")
hits = m.grep('writes(" Wait") > 0.3', scope="L*.mlp.down", top=50)
d = m.contrast("data/loops.jsonl", "data/clean.jsonl", name="loop")
p = m.edit.project_out(d, ["L15.mlp.down", "L19.mlp.down"], cols=hits)
print(m.check(p).summary())
print(m.commit("Project out the loop direction"))

Tests

Suites live in wtests/, as Python or YAML:

from wspx.testing import expect, load_jsonl, suite


@suite(split="dev")
def math_finishes(model):
    for item in load_jsonl("data/math_dev.jsonl"):
        out = model.generate(item["prompt"], max_tokens=4096)
        yield expect.regex(out, item["answer_regex"])

wspx test --vs <revision> runs them item by item against another revision and reports confidence intervals. Suites with split="heldout" show the agent only aggregate scores. @suite(blind=True) does the same for a suite the agent may run as often as it likes. A check's group (say, the class) adds a pass rate per group and balanced accuracy. The built-in canary and regression suites need no data.

Tools cannot read files in the test folders, so a suite's answers stay with the suite. Prompts the agent may use go in prompts/<set>.jsonl, one per line, and are referenced as {"item": "<set>/<n>"}.

On vision-language models, prompts can carry images and video as chat messages:

q = {
    "messages": [
        {
            "role": "user",
            "content": [
                {"type": "image", "image": "prompts/frame.png"},
                {"type": "text", "text": "Is the cup on the plate?"},
            ],
        }
    ]
}
out = model.generate(q, max_tokens=64)
answers = model.generate_many([q] * 8, max_tokens=64, watch=["yes", "no"])

A video is {"type": "video", "video": "clip.mp4"} or a list of frame files. generate_many batches greedy answers and records the log-probability of the watched tokens at each step.

Configuration

wspx.toml, all sections optional:

[project]
name = "loops"
exclude = ["data/raw"]      # kept out of the upload, on top of .git, venvs, caches and weights

[model]
id = "Qwen/Qwen3-0.6B"
dtype = "bfloat16"

[driver]
model = "anthropic:claude-opus-5-5"
deny_tools = ["run"]        # tools the agent is not offered

[lab]
gpu = "L4"
grace = "15m"               # keep the lab warm this long after the session goes idle
max_gpu_time = "2h"         # then the session's agent and lab stop

[check]
max_rel_norm = 0.05
max_canary_kl = 0.10

[tests]
paths = ["wtests/"]
prompts = "prompts/"

[policy]
protected_branches = ["main"]

Spend and safety

wspx sets no spend limits unless you ask for them. Every model call goes through a gateway in your deployment, which meters it and enforces the limits you set:

wspx limits set day dollars 50
wspx limits set session calls 400
wspx usage

Sessions that repeat themselves are nudged, then paused. Idle labs are shut down. To stop everything:

wspx kill --all             # stop all sessions and halt model calls
wspx kill --hard            # with only your Modal token, even if the deployment is down
wspx resume

Labs run in Modal sandboxes with no network access and no secrets; each lab checks this when it starts and the result is in the session's trace. The gateway refuses model calls that ask for the provider's own tools (web search, web fetch, code execution, MCP connectors), so an agent only has wspx's tools. wspx new --deny-tool run --max-gpu-time 2h --grace 5m turns tools off and caps GPU time for one session.

Supported models

Any PyTorch model whose forward pass runs. Tested against Llama, Mistral, Qwen3, Qwen3-MoE, Qwen3.5, Gemma 3, Gemma 4, Phi-3/Phi-4, OLMo 2, GPT-2, Falcon, Mixtral, gpt-oss, DeepSeek-V3, Jamba, Bamba, Mamba, ViT and ResNet, and plain MLPs, CNNs, LSTMs and GRUs.

Vision-language checkpoints (Qwen3-VL, GLM-4.1V, Qwen3.5, Gemma 3) load with their vision tower and processor, and take text, image and video prompts.

Development

uv sync --extra all --group dev
uv run pytest
uv run ruff check && uv run ruff format --check
uv run mypy
cd ui && npm install && npm run build

wspx deploy run from a source checkout deploys that checkout.

License

Apache-2.0

Metadata

Release files for wspx 0.1.0.dev6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wspx 0.1.0.dev6
File Size Uploaded Provenance Actions
wspx-0.1.0.dev6.tar.gz 355.0 kB With provenance Details for wspx-0.1.0.dev6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wspx 0.1.0.dev6
File Interpreter ABI Platform Actions
wspx-0.1.0.dev6-py3-none-any.whl Python 3 none any Details for wspx-0.1.0.dev6-py3-none-any.whl

Total release size: 702.8 kB

Release files / wspx-0.1.0.dev6.tar.gz

Download URL wspx-0.1.0.dev6.tar.gz
Size 355.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6d79d489d5c42318e111086607dfb134251ad044d0dd4a3689b1ad00ea1d53d5
BLAKE2b-256 checksum
How to use checksums
b94bf28ce2019a0c64b504581588de43dc588a0ec3c3079e8cc26288bd69e662
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / wspx-0.1.0.dev6-py3-none-any.whl

Download URL wspx-0.1.0.dev6-py3-none-any.whl
Size 347.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b80c584147a02458f63b08aa73d37bf1791f0cc3cbe4068429a2ecc9df9dac86
BLAKE2b-256 checksum
How to use checksums
b0c686bd320b4c771af0aa341f06dc835dbfcebe1257a2f4deaaf716cda80126
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for wspx 0.1.0.dev6

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for wspx-0.1.0.dev6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page