News

日本語 · English

【Video】I directly rewrote the weights of a local LLM to change its math accuracy and tone

To teach AI new things, it is usually necessary to present example problems for learning and update the model's weights. This time, we tested a method on our local machine that does not perform such learning, but instead has the AI itself read its weights and rewrite them directly, using Qwen3.5's 0.8B (a small model with less than 1 billion parameters).

To teach AI new things, examples are usually shown to the model and its weights are updated. This time, I tested a method on my local machine using Qwen3.5-0.8B (a small model with less than 1 billion parameters) that does not perform this learning, but instead has the AI read its own weights and directly rewrite them.

Mathematical Correctness Rate

I conducted the experiment exactly as published under the MIT license on GitHub. The accuracy rate for 100 math questions, which was initially 7.9% because the loop did not run cleanly, increased to 38%. The paper reported an improvement to around 48%; the numbers are lower here because the GPU performance used was not that high, but I confirmed that the model was able to answer correctly without learning.

Tone Rewriting

I also tried the method introduced in a blog post. The tensor of the 20th layer's MLP in the model is rewritten without calculating gradients. This involves collecting 125 answers, mixing in examples with changed sentence endings, identifying the specific locations to change, and calculating the difference between the desired input value and the desired output value. When I had both DeepSeek and Claude perform this, they were able to change the sentence endings while keeping the text connected for Zundamon-style, Samurai-style (degozaru), and Kansai dialect. The locations rewritten differed between DeepSeek (5 locations) and Claude (600 locations), suggesting there are differences in their calculation methods as well.

Although Qwen3.5-0.8B performs better with a GPU, it can also be computed on a CPU, so feel free to try it out on your end if you are interested.

References

Original experiment (MIT License / GitHub): https://github.com/RikiyaT/lm_understand-logs
Replication of Japanese rewriting into Zundamon style (Zenn): https://zenn.dev/nwn/articles/cf9fe78aa33861

Table of Contents

0:00 Method for directly rewriting weights
0:23 Differences from standard learning
0:54 Model used and experiment overview
1:48 Math accuracy rate from 9% to 38%
2:01 Open weights versus fine-tuning
3:11 Mechanism of editing by subtracting MLP columns
4:38 From 7 out of 100 questions to 38 out of 100
5:02 Experiment on changing tone
5:42 Calculating and rewriting sentence ending differences
6:52 Results for Zundamon, Samurai, and Kansai dialect
7:31 Comparison between Claude and DeepSeek
8:21 Differences in rewriting locations
9:15 Summary for trying it out locally

You can watch the video here: Watch on YouTube

This article was translated from the Japanese original. 日本語で読む

← Latest articles