Downloads · 30 days
0
mohammad-mozaffari/gemma_3_1b-MaskLLM-50Sparse
gemma_3_1b-MaskLLM-50Sparse is a text generation model from mohammad-mozaffari. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as gemma.
<div align="center" <img src="./PATCH-Logo.png" alt="PATCH" width="360" </div
Downloads · 30 days
0
Access
Public
Updated Jul 24, 2026
Repo size
60.6 MB
Likes
1
Public
Click a slice to open those files.
.npz59.2 MB · 97%
From the Hugging Face model README
This checkpoint (Gemma-3 1B, MaskLLM, 50% sparsity): 41.84% average zero-shot accuracy, 12.82 WikiText2 perplexity.
This repository hosts a mask only release for the paper PATCH: Learnable Tile-level Hybrid Sparsity for LLMs. This is a MaskLLM 2:4 baseline, trained with our re-implementation of MaskLLM (learnable semi-structured 2:4 sparsity via Gumbel-Softmax over frozen weights). It is released as a baseline for the PATCH paper.
Because PATCH/MaskLLM keep the base weights frozen, we distribute only the
binary keep/prune mask (bit-packed in mask.npz) - no weight values. You
recover the sparse model by downloading the original base model and applying the
mask.
google/gemma-3-1b-pt| Sparsity | Method | Pattern | Avg Acc (% ↑) | WikiText2 PPL (↓) |
|---|---|---|---|---|
| 0% | Dense | - | 47.01 | 11.67 |
| 50% | Magnitude | 2:4 | 31.66 | 5005.56 |
| 50% | Wanda | 2:4 | 34.16 | 69.41 |
| 50% | SparseGPT | 2:4 | 35.58 | 44.59 |
| 50% | Thanos | 2:4 | 35.09 | 62.63 |
| 50% | ProxSparse | 2:4 | 36.63 | 90.50 |
| 50% | MaskLLM ⭐ | 2:4 | 41.84 | 12.82 |
| 45% | PATCH-Joint | Dense/2:4 | 42.80 | 11.96 |
| 35% | PATCH-Joint | Dense/2:4 | 43.30 | 11.48 |
| 25% | PATCH-Joint | Dense/2:4 | 44.07 | 11.17 |
Per-task zero-shot accuracy (%) for this checkpoint:
| MMLU | PIQA | ARC-E | ARC-C | WinoG. | OBQA | RACE | HellaS. | Average |
|---|---|---|---|---|---|---|---|---|
| 25.03 | 69.91 | 60.27 | 27.65 | 56.27 | 21.20 | 34.55 | 39.84 | 41.84 |
All numbers are from the PATCH paper (arXiv:2509.23410); accuracy is the average over MMLU, PIQA, ARC-Easy, ARC-Challenge, Winogrande, OpenBookQA, RACE and HellaSwag, evaluated with the LM-Evaluation-Harness. PPL is WikiText2.
| Hyper-parameter | Value |
|---|---|
| Fine-tuning dataset | SlimPajama (2B tokens) |
| Training steps | 2000 |
| Global batch size | 256 |
| Sequence length | 4096 |
| Mask tile size | 128 x 128 (hardware tiles: 128x128 / 128x64 / 64x128 / 64x64) |
| Logits init. | N(0, 0.014) |
| Tile-logit prior | SparseGPT (strength 3) |
| Regularization scope | Global (single target density) |
| Evaluation | LM-Eval-Harness (8 zero-shot tasks) + WikiText2 PPL @ seqlen 4096 |
| Hardware | 1 node x 4 GPUs, data parallel (HuggingFace Trainer) |
| Optimizer | Adam |
| Learning rate | 1e-4 (2:4 logits, MaskLLM config) |
| Gumbel scaling (kappa) | 100 -> 500 |
| Gumbel temp (tau) | 4 -> 0.05 |
| Sparsity pattern | 2:4 (fixed 50%) |
from huggingface_hub import hf_hub_download
from transformers import AutoModelForCausalLM
import torch
from load_patch_mask import apply_patch_mask # shipped in this repo
npz = hf_hub_download(repo_id="mohammad-mozaffari/gemma_3_1b-MaskLLM-50Sparse", filename="mask.npz")
model = AutoModelForCausalLM.from_pretrained("google/gemma-3-1b-pt", torch_dtype=torch.bfloat16)
apply_patch_mask(model, npz) # zeroes the pruned weights in place
Or from the command line:
python load_patch_mask.py --base_model google/gemma-3-1b-pt --mask_repo mohammad-mozaffari/gemma_3_1b-MaskLLM-50Sparse
Speedup on real hardware requires a 2:4-aware / hybrid sparse kernel; see the GitHub repository and STOICC.
The released mask is a derivative of the base model and is distributed under the
base model's license (gemma). You must comply with that license and
obtain access to the base model separately.
Gemma is provided under and subject to the Gemma Terms of Use.
The mask-generation code is released under the MIT license (see the PATCH repository).
@article{hourri2025patch,
title = {PATCH: Learnable Tile-level Hybrid Sparsity for LLMs},
author = {Hourri, Younes and Mozaffari, Mohammad and Mehri Dehnavi, Maryam},
year = 2025,
journal = {arXiv preprint arXiv:2509.23410}
}
This checkpoint is a MaskLLM baseline; please also cite MaskLLM:
@inproceedings{fang2024maskllm,
title = {MaskLLM: Learnable Semi-Structured Sparsity for Large Language Models},
author = {Fang, Gongfan and Yin, Hongxu and Muralidharan, Saurav and Heinrich, Greg and Pool, Jeff and Kautz, Jan and Molchanov, Pavlo and Wang, Xinchao},
booktitle = {NeurIPS},
year = {2024}
}