| --- |
| library_name: residuals |
| base_model: google/gemma-3-4b-pt |
| base_model_relation: adapter |
| instruct_model: google/gemma-3-4b-it |
| pipeline_tag: text-generation |
| tags: |
| - residuals |
| - delta |
| - task-arithmetic |
| - finetune |
| --- |
| |
|
|
| # Instruction Residuals |
|
|
| This repository contains instruction residuals (delta weights) computed as the parameter-wise difference between `google/gemma-3-4b-it` and `google/gemma-3-4b-pt`. |
|
|
| Apply these residuals to the base model to reconstruct the instruction-tuned weights without retraining. |
|
|
|
|
| ## Usage |
|
|
| ```python |
| from transformers import AutoModelForCausalLM, AutoTokenizer |
| from residuals import Residuals |
| |
| base = AutoModelForCausalLM.from_pretrained("google/gemma-3-4b-pt") |
| tok = AutoTokenizer.from_pretrained("google/gemma-3-4b-pt") |
| |
| res = Residuals.from_pretrained("residuals/gemma-3-4b") |
| res.apply(base, base_tokenizer=tok) |
| ``` |
|
|
|
|
| ## Provenance |
| - **Created at**: 2025-10-25T18:45:30.975057+00:00 |
| - **DType**: float32 |
| - **Parameters**: 884 |
| - **Shapes hash**: 0aad859058a45de47ddd36c2e67a97e30be0a99b7da51dcfb62e4797e27328d8 |
| - **Names hash**: 22ce2085d7e0c22fd49d378204b2df3f6a4013610f03e7102733ed62b50259c3 |
| - **Base model**: `google/gemma-3-4b-pt` |
| - **Instruction model**: `google/gemma-3-4b-it` |
|
|
| ## Files |
| - **model.safetensors**: Serialized residual tensors (safetensors format). |
| - (optional) **model.safetensors.index.json** + shard files `model-00001-of-000N.safetensors`, ... for multi-part weights. |
| - **config.json**: Residuals metadata and provenance. |
| - **tokenizer files**: Saved tokenizer for compatibility. |
|
|
| ## About this format |
| These are additive residuals (task vectors). Applying them to the base model's parameters reconstructs the instruction-tuned model. |
|
|
| ## Tools |
| Generated with the `residuals` Python package. Install via: `pip install residuals`. |
| - PyPI: https://pypi.org/project/residuals/ |
| - Source: https://github.com/omarish/residuals |
|
|