Downloads · 30 days
13
7% of all-time downloads
ToastyPigeon/Gemma4-E4B-TIES-3mask-r64
Gemma4-E4B-TIES-3mask-r64 is a image-text-to-text model from ToastyPigeon. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as gemma.
This is a TIES merge of three independently-trained LoRA adapters for google/gemma-4-E4B-it, all of which were trained with an instruct-subspace gradient mask designed to prevent the fine-tune from overwriting the dir…
Downloads · 30 days
13
7% of all-time downloads
All-time downloads
174
Public
Parameters
7.9B
15.9 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors15.9 GB · 100%
From the Hugging Face model README
This is a TIES merge of three independently-trained LoRA adapters for google/gemma-4-E4B-it, all of which were trained with an instruct-subspace gradient mask designed to prevent the fine-tune from overwriting the directions in weight space that carry instruction-following behavior.
The point of the merge is to combine multiple style/domain signals (conversational marvin SFT + marvin CPT + spring-dragon adventure CPT) into a single adapter-on-base that retains instruct-following performance.
All three adapters were trained on google/gemma-4-E4B-it at LoRA r=64, α=16 with the instruct-subspace mask at rank 64 (mask rank = LoRA rank).
| Slot | Adapter | Source corpus | Samples | Tokens (1 ep) | Recipe |
|---|---|---|---|---|---|
| 1 | T2 INSTRUCT r=64 | marvin (instruct form) — back-translated instruct pairs over the marvin corpus: a synthetic "write a passage about X" instruction generated for each real marvin passage, then paired as instruction → passage | 4439 | 22.27M | 1k ctx, 2 ep, lr 5e-5 |
| 2 | T2 CPT-marvin r=64 | marvin (raw) — a curated collection of genre-fiction novel prose, used as continued-pretraining (no chat template) | 5701 | 33.83M | 1k ctx, 2 ep, lr 5e-5 |
| 3 | SD CPT r=64 | Spring Dragon — old AI-Dungeon-era text-adventure transcripts (> you do x second-person interactive fiction), as CPT | 2325 | 5.68M | 6k ctx, 2 ep, lr 5e-5 |
Total tokens seen across all three components (counting 2 epochs each): ~123M.
Standard TIES merge via PEFT's add_weighted_adapter with:
combination_type = "ties"
density = 0.2 # keep top 20% magnitude per parameter, zero the rest
weights = [1.0, 1.0, 1.0] # equal weighting
TIES (Yadav et al., 2023) reduces destructive interference between adapters by:
density% magnitude weights per parameter, zero the restThe merged adapter was applied to base with merge_and_unload() and the result is the full safetensors model published here.
Each component adapter was trained with a per-step gradient projection that strips out the directions of weight movement that overlap with the instruct-vs-base subspace. The subspace is computed once per linear weight matrix W via SVD:
U_k, V_k = top-k SVD of (W_instruct − W_pretrained)
g_safe = g − U_k (U_k.ᵀ g) − (g V_k.ᵀ) V_k # for each parameter gradient g
This is applied as a post_accumulate_grad_hook on every LoRA target weight before the optimizer step. The intuition: directions that distinguish E4B-it from E4B-pt carry instruction-following behavior; gradient components along those directions are dropped, so the fine-tune is constrained to learn style in the orthogonal complement of the instruct subspace.
Across all three components, the mask preserves a large fraction of base-it IFEval performance that the unmasked recipe would have lost:
| Recipe | Unmasked drop (pp) | Masked drop (pp) | Recovery |
|---|---|---|---|
| T2 INSTRUCT r=64 | -14.97 | -7.76 | 48% |
| T2 CPT-marvin r=64 | -14.42 | -8.50 | 41% |
| SD CPT r=64 | -12.20 | -6.84 | 44% |
Base google/gemma-4-E4B-it strict-prompt IFEval = 83.36.
| Variant | IFEval Δpp ↓ | V3 humanness h_delta ↑* | Δh_delta vs base ↑ | q_prob ↑ | dialogue_frac ↑ | slop/1k ↓ | rep3g/1k ↓ |
|---|---|---|---|---|---|---|---|
| base-it | 0.00 (anchor) | -16.74 | 0.00 (anchor) | 0.098 | 0.42 | 19.94 | 7.39 |
| SD masked r=64 | -6.84 | -14.69 | +2.05 | 0.121 | 0.42 | 17.77 | 12.17 |
| SD masked r=256 | -2.03 | -15.46 | +1.28 | 0.098 | 0.31 | 16.38 | 11.18 |
| T2 INSTRUCT masked r=64 | -7.76 | -12.83 | +3.91 | 0.112 | 0.41 | 13.96 | 21.05 |
| TIES (this model) | -0.92 | -13.10 | +3.64 | 0.343 | 0.51 | 16.12 | 11.58 |
These come from the GRPO-prototype eval pipeline (grpo_prototype_v12d.py), run over 10 short-story writing prompts at temp=1, then averaged per variant:
E4B-it. Positive = the fine-tune is shifting outputs further from gemma's default and toward marvin-like prose.* The V3 humanness classifier is trained to discriminate real marvin passages (the curated genre-fiction corpus, see Components) from gemma's best attempt to emulate those passages given the same writing prompt. The "gemma side" was specifically generated with Gemma 4 31B-it (Q4_K_M GGUF, temp=1, no top-p/k/rep-pen). This model (E4B) is a different size than the classifier's reference gemma, but E4B is gemma-family and behaves similarly enough that V3 is still measuring the right axis — a prior version of the classifier built against a non-gemma AI side gave weirdly uninformative scores on gemma fine-tunes; V3 fixes that. So h_delta reads as: "is this output more like an actual book passage from the marvin corpus, or more like gemma's slop version of one?" Higher = more book-like. The single-adapter components score around -12 to -15. The TIES merge scoring -13.10 is in the same range as the singles, which means it is not just averaging back toward base; it is preserving the style signal of the components.
Most striking single number: TIES q_prob = 0.343 vs ~0.10 for any single adapter and base — the V3 classifier's "marvin-style" head fires ~3× more strongly on TIES outputs than on any constituent. Combined with dialogue_frac jumping to 0.51 (vs base 0.42, singles 0.41-0.44) this suggests genuine emergent style mixing rather than cancellation.
h_delta only tells you the model's output looks more like a real book passage than gemma's default style — it does not generalize to "more human." Direction-of-movement from base is the load-bearing signal.| Path | Size | Description |
|---|---|---|
model.safetensors | 15.9 GB | Full bf16 merged weights (base + applied TIES adapter) |
config.json | — | HF config |
tokenizer.json, tokenizer_config.json, chat_template.jinja | — | Gemma 4 tokenizer + chat template |
A bf16.gguf is also published at ToastyPigeon/Gemma4-Test-GGUFs/Gemma4-E4B-TIES-3mask-r64.bf16.gguf for llama.cpp use.
Standard AutoModelForCausalLM.from_pretrained(...) works; this is a normal merged Gemma 4 E4B-it model. Use the same chat template as base google/gemma-4-E4B-it. Sampling: temperature=1.0, no top-p / top-k / rep-penalty (gemma-4 defaults).
gemma-4-E4B-it − gemma-4-E4B-pt at rank 64/256If you use this technique:
@misc{toastypigeon2026instructmask,
author = {ToastyPigeon},
title = {Instruct-subspace gradient mask for style fine-tunes of instruction-tuned models},
year = {2026},
note = {Method: per-parameter gradient projection orthogonal to the top-k SVD of (W_instruct - W_pretrained)}
}
TIES reference:
@article{yadav2023ties,
title = {TIES-Merging: Resolving Interference When Merging Models},
author = {Yadav, Prateek and Tam, Derek and Choshen, Leshem and Raffel, Colin and Bansal, Mohit},
journal = {NeurIPS},
year = {2023}
}