Grafy News
Try Grafy free

Weight‑Space Programming fixes Qwen3.5 loops by editing 0.016% of its weights

A new web demo shows that tweaking only 0.016% of Qwen3.5‑0.8B's weights stops infinite loops and raises MATH‑500 accuracy.

Illustration for the news story: Weight‑Space Programming fixes Qwen3.5 loops by editing 0.016% of its weightsSource: Hacker News — front page

Weight‑space programming demonstrated that changing just 0.016%0.016\% of Qwen3.5‑0.8B’s parameters stops the model’s infinite repetition loops, and the same edit raises MATH‑500 accuracy from under 10% to nearly 50% – all without any gradient‑based training. The result matters because it shows developers can repair very specific failure modes by directly editing weight tensors rather than retraining whole models.

What is weight‑space programming?

Weight‑space programming refers to the practice of directly modifying a model’s weight tensors to achieve a desired behavioral change. Instead of using gradient descent on a loss function, a practitioner identifies a direction in weight space that corresponds to a problematic pattern – such as a loop‑generating neuron – and adds or subtracts that direction from a small subset of parameters. The technique is analogous to “model souping” where multiple fine‑tuned checkpoints are merged, but it focuses on a narrow, well‑defined symptom rather than broad benchmark performance.

How did the Weight‑Space Playground achieve the fix?

According to the Hacker News post, the TabbyML team built an interactive demo that loads Qwen3.5‑0.8B (quantised to Q4_K_M) in the browser via llama.cpp compiled to WebAssembly and accelerated with WebGPU. The demo records token streams for a batch of 500 math problems (MATH‑500) and isolates cases where the base model gets stuck in a repetition loop. By analysing neuron activations, the authors identified 64 neurons in layers 15 and 19 whose output‑weight matrices (the ffn_down tensors) were responsible for the looping behaviour.

The edit consists of subtracting a single direction from those matrices, affecting exactly 131,072131{,}072 weights out of roughly 800800 million – a change of 0.016%0.016\%. No additional training data, loss function, or optimizer is used; the edit is applied once and the model is re‑quantised for the web runtime. The visualisation on the site shows the “push” magnitude of the edit, which is 2–4× larger when the looping neurons fire, effectively steering the activation away from the pathological attractor.

What were the quantitative results?

The demo reports three key metrics before and after the edit:

  • Token‑limit hits – the base model exhausted the 32k‑token budget on 93.0% of the MATH‑500 prompts, while the edited model only hit the limit on 33.1%.
  • Looping tokens – the original model wasted a large portion of its budget on repeated text, whereas the edited version reduced wasted tokens to zero.
  • Accuracy – on the same 500‑question benchmark, the base model answered correctly on 7.9% of problems, while the edited model rose to 48.1%.

These numbers illustrate that a minute weight change can transform a model from unusable on a specific task to a functional solver, all without any additional inference cost.

Why does this matter for AI development and autonomous agents?

The authors compare weight‑space programming to model souping, noting that souping selects merge weights based on broad benchmark performance, while weight‑space programming targets a single failure mode. This granularity is attractive for autonomous agents that can propose an edit, test it on a validation case, and iterate – a loop similar to the recent coding‑agent breakthroughs where the agent edits its own code and re‑executes it.

For developers, the approach suggests a new workflow: identify a pathological pattern (e.g., endless loops, toxic generation), locate the responsible neurons, compute a corrective direction, and apply it directly. Because the edit is tiny, it can be deployed instantly to existing quantised models, sidestepping the heavy compute and data requirements of full fine‑tuning.

How can creators and developers experiment with similar techniques using Grafy?

Grafy offers several tools that map naturally onto this workflow:

  • Grafy Code – The AI‑powered coding studio lets you write and run Python or JavaScript scripts that load a model (via llama.cpp bindings) and manipulate its weight tensors. You could replicate the edit by loading the Qwen checkpoint, locating the ffn_down tensors of layers 15 and 19, and applying the subtraction vector.
  • Grafy Graph – As you iterate on edits, Graph can record each version of the model, the prompt set, and the resulting token streams, giving you a visual branching history of weight‑space experiments.
  • Grafy Chat – If you need guidance on locating the problematic neurons or constructing the edit direction, you can ask a side‑by‑side model in Chat for suggestions, pulling in multiple LLMs for diverse perspectives.

These apps are accessible at /code and /graph. While Grafy does not currently host a built‑in WebGPU weight‑space editor, you can prototype the same idea locally and then use Graph to track the outcomes.

Where can you try the demo yourself?

The Weight‑Space Playground is hosted at https://tabbyml.github.io/weight-space-playground/. After visiting the page, the browser downloads two quantised model files (about 1 GB total) and caches them. The interface provides two buttons:

  • Watch – plays a pre‑recorded token stream showing the base model looping and the edited model answering.
  • Run live – launches the models in the browser using llama.cpp compiled to WebAssembly with WebGPU acceleration. No data leaves your machine; all inference happens locally.

You can adjust engine settings such as max new tokens, temperature, seed, and n_gpu_layers to see how the edit behaves under different generation conditions. The site also offers a “download & compare” link for those who want to keep the model files for offline experimentation.

Frequently asked questions

How much of the model’s parameters were changed to stop the loops?

Only 0.016%0.016\% of the total parameters were altered – specifically 131,072131{,}072 weights in the ffn_down matrices of two layers.

Does weight‑space programming require gradient descent or training data?

No. The method identifies a direction in weight space that counteracts a failure mode and applies it directly, bypassing any gradient‑based optimization.

Can Grafy run WebGPU‑based weight edits inside the browser?

Grafy does not currently embed a WebGPU weight‑space editor, but you can use Grafy Code to script similar edits locally and Grafy Graph to visualise the results.


Source: Hacker News — front page — Show HN: Watch weight-space programming in action with WebGPU