Instructions to use adityabhushannagar/flint-weight-edited with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use adityabhushannagar/flint-weight-edited with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="adityabhushannagar/flint-weight-edited") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("adityabhushannagar/flint-weight-edited") model = AutoModelForCausalLM.from_pretrained("adityabhushannagar/flint-weight-edited", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use adityabhushannagar/flint-weight-edited with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "adityabhushannagar/flint-weight-edited" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "adityabhushannagar/flint-weight-edited", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/adityabhushannagar/flint-weight-edited
- SGLang
How to use adityabhushannagar/flint-weight-edited with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "adityabhushannagar/flint-weight-edited" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "adityabhushannagar/flint-weight-edited", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "adityabhushannagar/flint-weight-edited" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "adityabhushannagar/flint-weight-edited", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use adityabhushannagar/flint-weight-edited with Docker Model Runner:
docker model run hf.co/adityabhushannagar/flint-weight-edited
flint-weight-edited
A training-free, weight-edited derivative of RecursiveSI/flint. No gradient updates and no new training data were used. The weights were edited directly: find a behaviour direction or component with teacher-forced reads, edit the matrices that write it, then check with dose-response, random controls and held-out generation. The edits target two problems users reported in the Flint discussions:
- Tool-schema drift. The model writes the argument and tool names it learned in pre-training instead of the
names in the supplied schema. Examples:
pathinstead of Claude Code'sfile_pathor OpenCode'sfilePath, andbashinstead ofBash(discussions #9, #11, #12). - Overthinking and runaway reasoning.
<think>blocks that keep going after the answer is known, and that hit the token budget on math and code (discussions #13, #14, #18, #26).
Current version: v3 (schema_x2.5_neg0+close_b1.0+rowp9.2, 42 edits).
Across 1,774 paired held-out generations, v3 scores 0.780 against 0.722 for the original (p < 10β»βΆ). It uses 19% fewer tokens. GSM8K goes from 62.7% to 79.7%.
Architecture, tokenizer, chat template, config and the sglang kit are identical to the original. Only the values of 2,326 bf16 tensors in shards 9, 10, 11 and 15 changed:
- 22 attention-output, shared-expert or
lm_headtensors; - the
down_projof all 256 routed experts in each of layers 37β45.
Shards 1β8 and 12β14 are byte-identical to the original, and the safetensors index is unchanged.
What was edited
| Edit | Tensors | Operation |
|---|---|---|
| Schema-copy heads Γ2.5 | self_attn.o_proj input columns of 11 heads: L45H28, L46H31, L37H8, L37H29, L33H10, L41H28, L41H14, L37H11, L43H6, L46H23, L30H15 |
columns Γ 2.5 |
| Prior heads ablated | self_attn.o_proj columns of L44H4, L33H21, L45H26 |
columns Γ 0 |
| Thinking-closure amplification | layers 37β45: self_attn.o_proj, mlp.shared_expert.down_proj, and every routed expert's down_proj (256 Γ 9) |
W β W + 1.0 Β· u_l u_lα΅ W |
Answer-mode </think> suppression |
lm_head.weight row 150007 (</think>) |
row β row + 9.2 Β· r |
Closure direction. u_l is the unit "ready to close </think>" direction at layer l. It is the mean residual
difference between positions where the model's own next token is </think> and other sentence-boundary positions in
the same reasoning trace. On held-out traces it gives dβ² β 3.5 and 100% leave-one-out sign consistency in layers
24β45. The writers in layers 37β45 put out +u mainly when reasoning is about to end. Doubling their u-component
(Ξ² = 1) makes the model close once it has reached a stopping state, without a constant push. The routed-expert part
carries most of the effect: dense-only closure at the same Ξ² gave about half the GSM8K gain (v2, below).
lm_head row edit. At closure strength 1.0 the model sometimes emitted a second </think> inside its answer.
The fix is one rank-1 change to the </think> output row: r = w/|w|, with |w| = 9.2.
w is a ridge fit on the edited model's final normed residual, using practice data only:
- target β8 logit at answer positions (after
</think>); - target 0 at the model's own closing position;
- constrained orthogonal to the mean thinking state, so the logit is not shifted while the model is still reasoning.
The exact spec is in edit/edit_spec.json and the directions are in edit/directions.pt.
The schema heads were found by direct logit attribution of each of the 49 Γ 32 attention heads to the margin
logit(schema name) β logit(prior name). It was measured at 80 decision points across Claude Code, OpenCode, Codex
and pi/omp tool schemas.
Results
Held-out generation, 887 items Γ 2 decodes = 1,774 paired items
Each item was run once greedily and once sampled (T = 1.0, top-p 0.95, top-k 20, seed 11), with at most 1,024 new
tokens. The original and the edited model ran in the same harness on 2Γ T4. Routed experts were int4 (g128) and dense
tensors bf16, so the edited experts were evaluated as their int4 quantization (edit/bake_int4.py). No item was
used to select edits.
The table reports accuracy, then items only the original got right / items only v3 got right, then an exact McNemar p-value, then the share of outputs that hit the token cap.
| Kind | n | Original | v3 | orig-only / v3-only | p | Hit cap (orig β v3) |
|---|---|---|---|---|---|---|
| GSM8K (held-out rows) | 400 | 0.627 | 0.797 | 10 / 78 | <10β»βΆ | 0.36 β 0.15 |
| HumanEval (held-out) | 268 | 0.541 | 0.619 | 26 / 47 | 0.019 | 0.44 β 0.33 |
| Agent-harness tool calls (Claude Code, Codex, pi, omp, OpenCode) | 350 | 0.551 | 0.591 | 32 / 46 | 0.14 | β |
| β³ schema-valid call | 350 | 0.79 | 0.82 | |||
| Agent-harness answer after a tool result | 100 | 0.760 | 0.750 | 12 / 11 | 1.0 | 0.00 β 0.04 |
| Custom, user-invented tool schemas | 96 | 0.875 | 0.833 | 8 / 4 | 0.39 | β |
| Generic tool selection | 240 | 0.904 | 0.912 | 4 / 6 | 0.75 | β |
| No-tool questions | 120 | 0.983 | 0.975 | 1 / 0 | 1.0 | β |
| Easy chat | 200 | 0.980 | 1.000 | 0 / 4 | 0.13 | β |
| All | 1,774 | 0.722 | 0.780 | 93 / 196 | <10β»βΆ |
Total generated tokens fell from 595.8k to 483.1k (β18.9%). Mean thinking length fell on every kind:
| Kind | Original | v3 |
|---|---|---|
| Easy chat | 685 chars | 134 chars |
| GSM8K | 2,372 chars | 1,643 chars |
| HumanEval | 2,559 chars | 2,107 chars |
The two decodes agree. Greedy goes from 0.729 to 0.777 and sampled from 0.714 to 0.782.
Honest reading:
Overall. v3 is clearly better than the original on reasoning-heavy items. Most of the gain is GSM8K and HumanEval answers that previously ran out of budget while still thinking. Tool calling is equal or slightly better.
Custom tool schemas. These lose 4 points (8 vs 4 items, not significant). Of the 5 greedy losses we inspected, 4 are changes in style rather than broken schemas:
- two parallel calls instead of one;
- an exploratory first call (
SHOW TABLES) before the requested one.
The fifth is a stray
</think>inside a URL argument.Second
</think>. 89 of the 1,774 outputs (5%) still contain a second</think>inside the answer, against 2 for the original. Most are on answer-after-tool-result, easy and GSM8K items. On those items v3 is correct as often as the original. With a reasoning parser that splits at the first</think>, the stray tag ends up in the visible content. A refit that targets these states is in progress.Answer after a tool result. A few of these answers now run long (4% hit the cap, against 0%).
Teacher-forced probes
These were run on CPU, with v3 in its evaluated int4 form, on the original model's own held-out reasoning traces and on reference solutions.
| Metric | Original | v1 | v3 |
|---|---|---|---|
log P(</think>) where the model actually stops (GSM8K traces) |
β0.136 | β0.009 | β0.002 |
P(</think>) at sentence ends in the last 40% of reasoning (GSM8K) |
0.007 | 0.047 | 0.118 |
Max P(second </think>) inside answers |
0 | 0 | 0.0001 |
| NLL of GSM8K reference solutions | 1.675 | 1.700 | 1.718 (+2.6%) |
| NLL of HumanEval canonical solutions | 0.382 | 0.392 | 0.406 (+6.3%) |
Schema-preference probes cover 190 sequences: Claude Code, OpenCode, Codex, pi and computer-use style schemas, plus
48 invented custom tools. The margins are logit(schema name) β logit(prior name) on held-out decision points.
| Probe | Original | v1 | v3 |
|---|---|---|---|
| Decisions where the schema name wins (all targets) | 34.7% | 76.4% | 73.6% |
| Invented custom tools: schema name wins | β | 100% | 100% (margin +15.3) |
Claude Code Read β file_path vs path |
β10.8 | β2.2 | β2.2 |
Claude Code Write |
β3.9 | +1.4 | +0.3 |
OpenCode read β filePath |
β2.1 | +3.5 | +3.5 |
OpenCode write |
β1.1 | +5.1 | +5.8 |
Claude Code Bash vs bash |
+0.7 | +3.3 | +3.1 |
Control: pi read β path (schema agrees with prior) |
+19.8 | +20.3 | +19.8 |
Control: Codex shell vs bash |
+12.9 | +12.9 | +12.4 |
Claude Code Read (file_path) remains the hardest case: the margin is still negative on most decision points.
Version history (same 1,774-item evaluation)
| Version | Edits | All | GSM8K | HumanEval | Tokens |
|---|---|---|---|---|---|
| Original | β | 0.722 | 0.627 | 0.541 | 595.8k |
| v2 | heads + dense-only closure Ξ² = 1 + lm_head row |
0.741 | 0.688 | 0.567 | 539.6k |
| v3 | heads + full closure Ξ² = 1 (incl. routed experts) + orthogonal lm_head row |
0.780 | 0.797 | 0.619 | 483.1k |
v1 (heads + closure Ξ² = 0.5) was published first. Its 1,774-item run was later found to have the routed-expert part missing, because of an evaluation-harness bug that has since been fixed. Without that part it scored 0.721.
Method and compute
- Probing (practice split). Directions and heads come from teacher-forced reads on the model's own traces.
- Dose sweeps. Doses were swept with random-head and random-direction controls.
- Selection. Versions were selected by generation on a separate 887-item held-out set. That set covers GSM8K and HumanEval, harness tool calls with multi-turn error recovery, invented custom tool schemas, generic tools, no-tool and easy prompts.
Generation ran on Kaggle T4s and the probes ran on a 4-core CPU box with an int4 working copy. The final edits were
applied to the original bf16 tensors. The uploaded shards were verified byte-for-byte against the spec
(edit/verify_upload.py). The ledger of logged evaluation passes is in edit/passes.jsonl.
License and credit
Apache-2.0, as for the original. All credit for the model goes to RecursiveSI. This repository only changes
weight values as described above. See LICENSE and sglang/NOTICE. Serve it exactly like the original; see
sglang/README.md.
- Downloads last month
- 105
Model tree for adityabhushannagar/flint-weight-edited
Base model
RecursiveSI/flint