Check a model change before it ships
You fine-tuned the model your bot runs on, edited its weights, or found a cheaper one. Before it goes live, the old model and the new one answer the same messages and the gate grades every reply, so you know whether the new model got worse at anything. When it did, you see which rules and skills slipped and can read the two replies side by side.
Free in the browser. The script, API and CI step are in Rulebench Pro, $29 a month after 14 free days.
Two gates on one weight edit
We edited Qwen3-4B Instruct's weights to change how it writes, then gated the edit against the plain model as the engine behind the support bot from the Rulebench example: 16 rules and 30 messages, plus the 30 everyday-skill prompts. Both models ran on a laptop with greedy decoding, and grading each gate with claude-haiku-5.5 cost about 6 cents.
A steering vector added to the attention output of 12 of Qwen3-4B Instruct's 36 layers, about a megabyte of new numbers, to make its prose read less like a machine wrote it. The edit also puts a default style instruction in the chat template, which applies only when there is no system prompt. As a replacement for the plain model behind the support bot, it kept more of the bot's rules than the original did and lost none of the everyday skills.
Qwen3-4B, style edit in weights isn't measurably worse than Qwen3-4B Instruct on your bot's rules or on everyday skills.
- Qwen3-4B, style edit in weights kept every rule in 73% of replies, against 57% for Qwen3-4B Instruct, on the same 30 messages.
- Everyday skills: 97% of 30 prompts passed, against 93% before.
Your bot's rules
30 messages, with your bot's instructionsEveryday skills
30 fixed prompts, no instructionsReplies that got worse
0 worse · 6 betterNo message that the current model handled well got a worse reply from the changed one.
Three ways to run a gate
Models you can call
Any model on OpenRouter, OpenAI or Anthropic, your own OpenAI-compatible endpoint, or a model hosted on Weightship. Start the gate in the browser or with one API call.
Weights that stay with you
Run gate.py next to the model on a laptop, a GPU server or a Kaggle notebook. It asks the messages there and sends back only the replies, so the weights never leave, and it needs nothing but Python.
Every new checkpoint
The script exits with an error when the gate fails, so one step in GitHub Actions stops a worse checkpoint from being merged or deployed.
Your bot's rules, and the skills it already had
The first half is the messages from one of your Rulebench audits, asked with your bot's instructions and graded rule by rule. The second half is 30 prompts with known answers, asked with no instructions, because a change aimed at one behaviour often damages something nobody was looking at. They fall into eight groups:
One unlucky reply doesn't fail a gate
Both models answer the same messages, so each message is compared with itself. The gate fails if the share of replies that keep every rule drops by 5 points or more, or a single rule or skill group drops by 10 points or more, and in either case at least two more messages got worse than got better. On a 30-message audit one reply is about 3 points, so a drop has to show up in several replies before it counts. You can change all three limits from the API. For models you run yourself, use greedy decoding (temperature 0) so that running the same model twice gives the same replies.
From a terminal, a notebook or your own code
You need an API key and an audit for your bot (its id is in the report's address). Any OpenAI-compatible server works with the script: vLLM, Ollama, LM Studio, llama.cpp or TGI.
Two local endpoints
curl -O https://weightship.com/gate.py export WEIGHTSHIP_API_KEY=ws_... python gate.py --audit AUDIT_ID \ --base-url http://localhost:8000/v1 --base-model current \ --candidate-url http://localhost:8001/v1 --candidate-model edited
A model loaded in Python
# in a notebook: !curl -O https://weightship.com/gate.py
from gate import run_gate, print_result
def reply(model, messages):
ids = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True)["input_ids"].to(model.device)
out = model.generate(ids, max_new_tokens=400, do_sample=False)
return tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True)
result = run_gate(audit_id="AUDIT_ID",
base=lambda m: reply(base_model, m),
candidate=lambda m: reply(edited_model, m))
print_result(result) # result["passed"] is True or FalseModels you reach by API
curl https://api.weightship.com/v1/rulebench/gates \
-H "Authorization: Bearer $WEIGHTSHIP_API_KEY" -H "Content-Type: application/json" \
-d '{"audit_id": "AUDIT_ID",
"base": {"model": "anthropic/claude-haiku-5.5"},
"candidate": {"model": "my-finetune", "key_id": "YOUR_ENDPOINT_KEY_ID"},
"wait": 50}'
# then poll until "status" is "done"; "passed" is true or false
curl "https://api.weightship.com/v1/rulebench/gates/GATE_ID?wait=50" -H "Authorization: Bearer $WEIGHTSHIP_API_KEY"Each side is {"model": ...} (add key_id for a key or endpoint you connected under Connections), {"ref": "handle/model"} for a model on Weightship, or {"replies": {...}} with replies you made yourself from POST /v1/rulebench/gates/messages. Coding agents get the same through the MCP server's gate_model_change tool. See agents and CI.
GitHub Actions
name: Model gate
on:
pull_request:
paths: ["training/**"]
jobs:
gate:
runs-on: ubuntu-latest
steps:
- name: Check the new checkpoint against the live model
env:
WEIGHTSHIP_API_KEY: ${{ secrets.WEIGHTSHIP_API_KEY }}
MODEL_KEY: ${{ secrets.MODEL_ENDPOINT_KEY }}
run: |
curl -sO https://weightship.com/gate.py
python gate.py --audit ${{ vars.RULEBENCH_AUDIT_ID }} \
--base-url ${{ vars.LIVE_MODEL_URL }} --base-model live --base-key-env MODEL_KEY \
--candidate-url ${{ vars.STAGING_MODEL_URL }} --candidate-model candidate --candidate-key-env MODEL_KEYGates in the browser, on models you can call, with the full report and a share link.
The script for models on your own machine, the API, the CI step and the MCP tool, plus everything else in Rulebench Pro. 14 days free.
On your own key, or from credit at cost plus 30%. When you send replies from your own machine, only the judge runs here: each example above cost about 6 cents.
Is this only for weight edits?
It works for any two models that answer the same messages, such as a new fine-tune against the last one, a merged model, a quantised copy, or a cheaper provider model you want to switch to.
What leaves my machine when I use the script?
The replies, and nothing else from the model. The messages come from your audit, and the replies are graded here by code where a rule can be measured and by a judge model otherwise.
Can I use my own test messages?
Yes. The rules half uses your audit's messages, which you can edit when you make the audit. You can also turn the everyday-skills half off.
Why not just run a benchmark?
A benchmark gives each model a score, and a score on its own doesn't say which replies changed or whether the change matters for your bot. The gate compares the two models message by message on your bot's rules, decides pass or fail, and shows you the replies that changed.