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: v5 (schema_x2.5_neg0+close_b1.0+rowp9.2+xn3+plan3, 51 edits): v3 plus 16 individual
routed-expert neurons and 2 shared-expert neurons switched off.
Across 1,774 paired held-out generations, v5 scores 0.801 against 0.722 for the original (p < 10β»ΒΉβ΅). Agent-harness tool calls go from 55.1% (original), 59.1% (v3) and 65.4% (v4) to 69.7%. GSM8K goes from 62.7% to 78.5%, and v5 uses 17% fewer tokens than the original.
Architecture, tokenizer, chat template, config and the sglang kit are identical to the original. Only the values of bf16 tensors changed:
- 22 attention-output, shared-expert or
lm_headtensors; - the
down_projof all 256 routed experts in each of layers 37β45; - the
down_projof 7 more routed experts (v4, v5), where 16 input columns (neurons) are set to zero; - one input column (neuron) of the shared-expert
down_projin layers 40 and 47 (v5), set to zero.
The safetensors index is unchanged; edit/edit_spec.json lists every edit.
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 |
| Explore-first neurons off (v5) | mlp.shared_expert.down_proj column 967 in L47 and column 221 in L40; mlp.experts.125.down_proj column 425 in L32 |
columns Γ 0 |
| Tool-argument neurons off (v4) | mlp.experts.E.down_proj input columns: L48 E77 n64, 176, 216, 237, 245, 323, 398, 484; L19 E220 n427; L25 E174 n12; L44 E88 n202; L47 E251 n102, 368; L26 E97 n87, 269, 397 |
columns Γ 0 |
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.
Routed-expert neurons (v4). These were found with a Jacobian lens: for 2,918 single-token decisions (368 tool-argument
choices across Claude Code, OpenCode, Codex, pi/omp and 12 invented tools; 2,550 stop-or-continue choices inside the
model's own reasoning), the decision token's forward pass was recomputed in fp32 with its context frozen, and
logit(good) β logit(bad) was backpropagated to every attention head, shared neuron and routed-expert neuron
(grad Γ activation, i.e. the first-order effect of zeroing that unit through all later layers). Layer-48 expert 77
was the single most harmful unit for the schema argument name in every harness. The 15 neurons switched off are
the most harmful routed neurons for tool-argument decisions. Their experts are routed on 40β100% of tool-call
decisions but on 0β5% of positions inside math and code reasoning, so the edit is close to tool-specific. Only
practice prompts were used.
Explore-first neurons (v5). On simple requests ("Create notes/todo.txt containing β¦", "Run the tests with pytest"),
the model often restated the task and then wrote "Let me first look at the repository β¦", spending its first call on
ls instead of the requested action. A second lens run on 64 practice planning decisions (the token after
"{task restated}. Let me": the action verb vs first) found two shared-expert neurons with very large activations
exactly there: L47 n967 at about β150 and L40 n221 at about β50. Across all 2,918 corpus decisions, including math
and code reasoning, their activations stay below about 10 and their attributed effect is ~0. A routed neuron, L32
E125 n425, was also found; its expert is routed on β€5% of reasoning positions. Switching the three off moves "run"
requests from 20% to 40β60% "act now" at that token. "Create file" requests still mostly explore first.
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. No item was used to select edits.
The table reports accuracy, then items only the original got right / items only v5 got right, then an exact McNemar p-value (original vs v5), then the share of outputs that hit the token cap.
| Kind | n | Original | v3 | v4 | v5 | orig-only / v5-only | p | Hit cap (orig β v5) |
|---|---|---|---|---|---|---|---|---|
| GSM8K (held-out rows) | 400 | 0.627 | 0.797 | 0.775 | 0.785 | 10 / 73 | <10β»ΒΉβ° | 0.36 β 0.16 |
| HumanEval (held-out) | 268 | 0.541 | 0.619 | 0.649 | 0.627 | 20 / 43 | 0.005 | 0.44 β 0.32 |
| Agent-harness tool calls (Claude Code, Codex, pi, omp, OpenCode) | 350 | 0.551 | 0.591 | 0.654 | 0.697 | 18 / 69 | <10β»β· | β |
| β³ schema-valid call | 350 | 0.79 | 0.82 | 0.87 | 0.87 | |||
| Agent-harness answer after a tool result | 100 | 0.760 | 0.750 | 0.780 | 0.780 | 9 / 11 | 0.82 | 0.00 β 0.02 |
| Custom, user-invented tool schemas | 96 | 0.875 | 0.833 | 0.875 | 0.833 | 7 / 3 | 0.34 | β |
| Generic tool selection | 240 | 0.904 | 0.912 | 0.921 | 0.925 | 3 / 8 | 0.23 | β |
| No-tool questions | 120 | 0.983 | 0.975 | 0.967 | 0.958 | 3 / 0 | 0.25 | β |
| Easy chat | 200 | 0.980 | 1.000 | 1.000 | 1.000 | 0 / 4 | 0.13 | β |
| All | 1,774 | 0.722 | 0.780 | 0.796 | 0.801 | 70 / 211 | <10β»ΒΉβ΅ | 0.15 β 0.09 |
Version against version on the same 1,774 items:
- v4 against v3: 68 v3-only / 97 v4-only (p = 0.029); on agent-harness tool calls it is 6 / 28.
- v5 against v4: 72 v4-only / 81 v5-only (p = 0.52, not significant overall); on agent-harness tool calls it is 6 / 21 (p = 0.006).
Total generated tokens fell from 595.8k (original) to 483.1k (v3), 482.7k (v4) and 491.8k (v5). Mean thinking length:
| Kind | Original | v3 | v4 | v5 |
|---|---|---|---|---|
| Easy chat | 685 chars | 134 chars | 146 chars | 134 chars |
| GSM8K | 2,372 chars | 1,643 chars | 1,647 chars | 1,665 chars |
| HumanEval | 2,559 chars | 2,107 chars | 2,080 chars | 2,082 chars |
The two decodes agree. Greedy goes 0.729 (original) β 0.777 (v3) β 0.793 (v4) β 0.795 (v5), and sampled 0.714 β 0.782 β 0.799 β 0.807.
Honest reading:
- Overall. v5 is clearly better than the original. Most of the v3 gain is GSM8K and HumanEval answers that
previously ran out of budget while still thinking.
- v4 improved agent-harness tool calls by choosing the schema argument name correctly more often (pi/omp
editarguments, Codexapply_patch, Claude CodeEdit). - v5 improves them again by running the requested command instead of exploring first. 8 of the 9 harness items
v5 gained in the greedy run were "run X" requests where v4 started with
ls.
- v4 improved agent-harness tool calls by choosing the schema argument name correctly more often (pi/omp
- v5 against v4. Agent-harness tool calls are significantly better; overall the difference is +0.5 points and not
significant. Custom tool schemas (0.875 β 0.833, 6 vs 2 items) and HumanEval (0.649 β 0.627, 27 vs 21 items) are
lower, neither significantly. Two of the three greedy custom-schema losses are a stray
</think>inside an argument value. - GSM8K. v5 (0.785) and v4 (0.775) are slightly below v3 (0.797), not significantly.
- Remaining tool failures. "Create this file" requests still often start with
ls, and some harnesses still usebashinstead of the dedicated tool (Codexapply_patchfor new files, ompfind). The original model does both. - 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 for v3 (v4 and v5 change only individual neurons that are active in tool-call and tool-planning contexts). They 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 |
| v4 | v3 + 15 routed-expert neurons off (tool arguments) | 0.796 | 0.775 | 0.649 | 482.7k |
| v5 | v4 + 2 shared + 1 routed neuron off (explore-first) | 0.801 | 0.785 | 0.627 | 491.8k |
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; v4's and v5's neurons come from a Jacobian lens (fp32 recompute of each decision token, gradients to every head and neuron) over 2,918 practice decisions plus 288 practice tool-behaviour decisions.
- 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.
The editing, evaluation and verification code and the pass ledger are kept in a separate private repository; this
repository holds only the model, the edit spec and directions (edit/), and the result tables (edit/results/).
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
- 1,931
Model tree for adityabhushannagar/flint-weight-edited
Base model
RecursiveSI/flint