anaksor-ocr
Sokheng · Kit
Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…
Google's Gemma 4 E4B-it with 0.002% of its weights edited directly, no training, to fix stalls in thinking mode with tool calls and multi-step math. Also ships as a small patch file.
gemma-4-E4B-it-weight-space-programming is a kit in the Developer category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page, a zip of its files. Nothing in it runs by itself.
pip install -U huggingface_hub hf download jstarks/gemma-4-E4B-it-weight-space-programming
This repository holds Gemma 4 E4B-it with a direct edit to 64 columns in MLP layers 38 to 41, about 163,840 parameters or 0.00205% of the model. No gradient descent, backpropagation or fine-tuning was used.
The edit targets two problems the author describes in thinking mode. The model either rambles in long outlines instead of calling a tool, or burns its token budget on meta-commentary before it does the math.
People who run Gemma 4 E4B-it with thinking mode on and want it to call tools more reliably, and researchers curious about editing weights directly instead of training.
| Industry | Who uses it | How they use it | Example |
|---|---|---|---|
| Software | Agent builders | Make a small local model call tools in thinking mode | A web-search helper on a desktop GPU |
| Education | Math tutoring developers | Get multi-step solutions inside a short token budget | A homework helper that starts the algebra directly |
| Research | Interpretability researchers | Study weight-space edits | Reading the card's layer-by-layer findings |
You can skip it if you do not use thinking mode, since the card's tests are about that mode, or if you need results from large benchmark suites.
It loads through the transformers library, and a loader script handles smaller GPUs. The author tested on an RTX 4070 Ti with 12 GB.
| Use case | Who | What they get back |
|---|---|---|
| Tool calling with thinking on | Agent builders | More valid tool calls in the card's 8-query test |
| Short-budget math | Developers | More problems solved within 420 tokens |
| Quick patching | Hobbyists | An edit applied to a local checkpoint in under a second |
You need Python and either the full 16 GB model or an existing Gemma 4 E4B-it checkpoint plus the 641 KB patch file. The card gives two ways in.
pip install -U huggingface_hub hf download jstarks/gemma-4-E4B-it-weight-space-programming
Option A loads the whole edited model with transformers. Option B patches a base checkpoint in memory.
from transformers import AutoProcessor, AutoModelForMultimodalLM
import torch
model_id = "jstarks/gemma-4-E4B-it-weight-space-programming"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForMultimodalLM.from_pretrained(
model_id, device_map="auto", torch_dtype=torch.bfloat16
)On a 12 GB GPU, the included loader keeps the 42 active layers on the GPU and moves the large per-layer embedding table to the CPU.
from model_loader import load_gemma4_e4b_text
model, tokenizer = load_gemma4_e4b_text("jstarks/gemma-4-E4B-it-weight-space-programming")from apply_patch import apply_gemma4_weight_space_patch
from model_loader import load_gemma4_e4b_text
# 1. Load your existing Gemma-4-E4B-it checkpoint
model, tokenizer = load_gemma4_e4b_text("unsloth/gemma-4-E4B-it")
# 2. Apply the 64-column weight-space patch (163,840 parameters across Layers 38-41)
apply_gemma4_weight_space_patch(model, "gemma4_e4b_weight_space_patch.safetensors")You already have unsloth's gemma-4-E4B-it on disk. You load it with the loader, apply the 641 KB patch, and the card says the edited model is ready in under a second without a 16 GB download.
If you are new, this is a slightly modified Gemma. Load it with Option A, switch thinking on, give it a tool such as web search, and see whether it calls the tool.
If you know the field, the edit changes RMSNorm-preconditioned columns in layers 38 to 41 and was inspired by a paper on weight-space programming. The card also describes layer 23 as a boundary hub where key-value states start to be shared.
The test suites are small, with 8 queries, 6 math problems and 3 end-to-end runs, so treat the numbers as a demo. The card reports these before and after results.
Google's Gemma 4 E4B-it with 0.002% of its weights edited directly, no training, to fix stalls in thinking mode with tool calls and multi-step math. Also ships as a small patch file.
Made by jstarks on Hugging Face. These notes are Mindket's, written from its model page and model card; the model's own files and license are on Hugging Face.
What it is: This repository holds Gemma 4 E4B-it with a direct edit to 64 columns in MLP layers 38 to 41, about 163,840 parameters or 0.00205% of the model. No gradient descent, backpropagation or fine-tuning was used.
The edit targets two problems the author describes in thinking mode. The model either rambles in long outlines instead of calling a tool, or burns its token budget on meta-commentary before it does the math.
Who it suits: People who run Gemma 4 E4B-it with thinking mode on and want it to call tools more reliably, and researchers curious about editing weights directly instead of training.
Industry | Who uses it | How they use it | Example
Software | Agent builders | Make a small local model call tools in thinking mode | A web-search helper on a desktop GPU
Education | Math tutoring developers | Get multi-step solutions inside a short token budget | A homework helper that starts the algebra directly
Research | Interpretability researchers | Study weight-space edits | Reading the card's layer-by-layer findings
You can skip it if you do not use thinking mode, since the card's tests are about that mode, or if you need results from large benchmark suites.
Where to use it: It loads through the transformers library, and a loader script handles smaller GPUs. The author tested on an RTX 4070 Ti with 12 GB.
Use case | Who | What they get back
Tool calling with thinking on | Agent builders | More valid tool calls in the card's 8-query test
Short-budget math | Developers | More problems solved within 420 tokens
Quick patching | Hobbyists | An edit applied to a local checkpoint in under a second
How to set it up: You need Python and either the full 16 GB model or an existing Gemma 4 E4B-it checkpoint plus the 641 KB patch file. The card gives two ways in.
pip install -U huggingface_hub
hf download jstarks/gemma-4-E4B-it-weight-space-programming
How to use it: Option A loads the whole edited model with transformers. Option B patches a base checkpoint in memory.
from transformers import AutoProcessor, AutoModelForMultimodalLM
import torch
model_id = "jstarks/gemma-4-E4B-it-weight-space-programming"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForMultimodalLM.from_pretrained(
model_id, device_map="auto", torch_dtype=torch.bfloat16
)
On a 12 GB GPU, the included loader keeps the 42 active layers on the GPU and moves the large per-layer embedding table to the CPU.
from model_loader import load_gemma4_e4b_text
model, tokenizer = load_gemma4_e4b_text("jstarks/gemma-4-E4B-it-weight-space-programming")
from apply_patch import apply_gemma4_weight_space_patch
from model_loader import load_gemma4_e4b_text
# 1. Load your existing Gemma-4-E4B-it checkpoint
model, tokenizer = load_gemma4_e4b_text("unsloth/gemma-4-E4B-it")
# 2. Apply the 64-column weight-space patch (163,840 parameters across Layers 38-41)
apply_gemma4_weight_space_patch(model, "gemma4_e4b_weight_space_patch.safetensors")
Example: You already have unsloth's gemma-4-E4B-it on disk. You load it with the loader, apply the 641 KB patch, and the card says the edited model is ready in under a second without a 16 GB download.
For newcomers and experts: If you are new, this is a slightly modified Gemma. Load it with Option A, switch thinking on, give it a tool such as web search, and see whether it calls the tool.
If you know the field, the edit changes RMSNorm-preconditioned columns in layers 38 to 41 and was inspired by a paper on weight-space programming. The card also describes layer 23 as a boundary hub where key-value states start to be shared.
Start from gemma-4-E4B-it
Edit 64 MLP columns in layers 38 to 41
Save as a full model or a 641 KB patch
Load in transformers or patch in memory
Good to know: The test suites are small, with 8 queries, 6 math problems and 3 end-to-end runs, so treat the numbers as a demo. The card reports these before and after results.
Title: Success rate before and after the edit, percent
Tool calls before: 0.0 percent
Tool calls after: 75.0 percent
Math solved before: 33.3 percent
Math solved after: 66.7 percent
Live agent runs before: 0.0 percent
Live agent runs after: 66.7 percent
Download its files with Hugging Face's command line:
pip install -U huggingface_hub
hf download jstarks/gemma-4-E4B-it-weight-space-programming
Then follow the usage in its model card. Nothing in this kit runs by itself.
README.md 6 KB
Listed Hugging Face models in the same category that share the most tags with this one.
| Product | Downloads, last 30 days | Likes | Parameters | License | Last change |
|---|---|---|---|---|---|
| gemma-4-E4B-it-weight-space-programming This page | 125 | 3 | 8B | gemma | |
| BotPsy-0.8BShares agentic · tool-calling · image-text-to-text | 215 | 14 | 853M | apache-2.0 | |
| MiMo-V2.6-Flash-RL-NVFP4Shares agentic · tool-calling · transformers | 298 | 4 | 159B | mit | |
| Gemma4-12B v2 Coding + Agentic EditionShares agentic · gemma4 · conversational | 92,024 | 1,773 | 11.9B | apache-2.0 | |
| Qwen3.5-0.8B Astra Weight EditShares weight-space-programming · image-text-to-text · transformers | 3,029 | 27 | 873M | apache-2.0 | |
| Qwen3.5-0.8B-weight-space-programming-GGUFShares weight-space-programming · image-text-to-text · conversational | 4,807 | 10 | 752M | apache-2.0 |
Sokheng · Kit
Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…
Qwen · Kit
Qwen2.5-7B-Instruct as GGUF files in eight quantization sizes, to chat with locally through llama.cpp. For people who want a capable 7.6B model on their own co…
ACE-Step · Kit
Generates music from text with a 4B diffusion decoder, 50 steps and guidance control, aiming for higher audio quality than the base. For creators with a GPU of…
alirezarezvani · Skill
Adds 411 ready-made skills for Claude Code and other coding agents, grouped by role from engineering and product to marketing, finance and compliance. Installs…
block · Kit
Self-hostable workspace where people and AI agents share the same rooms, built on a Nostr relay that logs every action as a signed event. For teams that want t…
backnotprop · Kit
Opens your AI coding agent's plans, specs and code changes in a browser so you can annotate or comment on them and send the feedback straight back to the agent.