Text Generation
Transformers
Safetensors
English
gemma2
dystrio
sculpt
pruned
compressed
efficient
dense
runtime-agnostic
no-custom-kernels
hf-drop-in
drop-in-replacement
smaller
faster
gemma
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use dystrio/gemma-2-2b-it-sculpt-default with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dystrio/gemma-2-2b-it-sculpt-default with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="dystrio/gemma-2-2b-it-sculpt-default") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("dystrio/gemma-2-2b-it-sculpt-default") model = AutoModelForCausalLM.from_pretrained("dystrio/gemma-2-2b-it-sculpt-default", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use dystrio/gemma-2-2b-it-sculpt-default with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dystrio/gemma-2-2b-it-sculpt-default" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dystrio/gemma-2-2b-it-sculpt-default", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/dystrio/gemma-2-2b-it-sculpt-default
- SGLang
How to use dystrio/gemma-2-2b-it-sculpt-default with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "dystrio/gemma-2-2b-it-sculpt-default" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dystrio/gemma-2-2b-it-sculpt-default", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "dystrio/gemma-2-2b-it-sculpt-default" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dystrio/gemma-2-2b-it-sculpt-default", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use dystrio/gemma-2-2b-it-sculpt-default with Docker Model Runner:
docker model run hf.co/dystrio/gemma-2-2b-it-sculpt-default
Dystrio Sculpt default tier of gemma 2 2b it
Browse files- .gitattributes +1 -0
- README.md +139 -0
- chat_template.jinja +4 -0
- config.json +68 -0
- generation_config.json +11 -0
- model.safetensors +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +19 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
base_model: google/gemma-2-2b-it
|
| 8 |
+
tags:
|
| 9 |
+
- dystrio
|
| 10 |
+
- sculpt
|
| 11 |
+
- pruned
|
| 12 |
+
- compressed
|
| 13 |
+
- efficient
|
| 14 |
+
- dense
|
| 15 |
+
- runtime-agnostic
|
| 16 |
+
- no-custom-kernels
|
| 17 |
+
- hf-drop-in
|
| 18 |
+
- drop-in-replacement
|
| 19 |
+
- smaller
|
| 20 |
+
- faster
|
| 21 |
+
- gemma
|
| 22 |
+
datasets:
|
| 23 |
+
- wikitext
|
| 24 |
+
model-index:
|
| 25 |
+
- name: Dystrio Sculpt (gemma-2-2b-it Default)
|
| 26 |
+
results:
|
| 27 |
+
- task:
|
| 28 |
+
type: text-generation
|
| 29 |
+
dataset:
|
| 30 |
+
name: WikiText-103 (validation)
|
| 31 |
+
type: wikitext
|
| 32 |
+
metrics:
|
| 33 |
+
- name: perplexity
|
| 34 |
+
type: perplexity
|
| 35 |
+
value: 20.5854
|
| 36 |
+
- name: ppl_ratio
|
| 37 |
+
type: ppl_ratio
|
| 38 |
+
value: 0.7985
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
# dystrio/gemma-2-2b-it-sculpt-default
|
| 42 |
+
|
| 43 |
+
> **9% smaller, quality improved (0.7985x PPL), drop-in replacement. No custom kernels. No runtime changes.**
|
| 44 |
+
|
| 45 |
+
Dystrio Sculpt structurally compresses transformer models, producing dense models that load with standard `transformers` — no custom code, no new ops, no deployment friction.
|
| 46 |
+
|
| 47 |
+
This is the **Default** tier of [gemma 2 2b it](https://huggingface.co/google/gemma-2-2b-it).
|
| 48 |
+
|
| 49 |
+
## Quick Start
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 53 |
+
|
| 54 |
+
model = AutoModelForCausalLM.from_pretrained("dystrio/gemma-2-2b-it-sculpt-default", torch_dtype="bfloat16", device_map="auto")
|
| 55 |
+
tokenizer = AutoTokenizer.from_pretrained("dystrio/gemma-2-2b-it-sculpt-default")
|
| 56 |
+
|
| 57 |
+
inputs = tokenizer("The future of AI inference is", return_tensors="pt").to(model.device)
|
| 58 |
+
outputs = model.generate(**inputs, max_new_tokens=100)
|
| 59 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
## Benchmark Results
|
| 63 |
+
|
| 64 |
+
All tiers compiled from [gemma 2 2b it](https://huggingface.co/google/gemma-2-2b-it) on A100 80GB, bf16:
|
| 65 |
+
|
| 66 |
+
| Model | PPL | PPL Ratio | Weights (GB) | Chat Prefill TPS | RAG TTFT p95 (ms) | Decode TPS |
|
| 67 |
+
|-------|-----|-----------|-------------|------------------|-------------------|------------|
|
| 68 |
+
| **Baseline** | 25.7807 | 1.0 | 4.869591 | 21611.9 | 70.251 | 59.6 |
|
| 69 |
+
| **sculpt-default** | 20.5854 | 0.7985 | 4.441124 | 23065.3 | 69.007 | 60.0 |
|
| 70 |
+
| **sculpt-production** | 22.4118 | 0.8693 | 4.226891 | 23404.0 | 66.554 | 60.7 |
|
| 71 |
+
| **sculpt-throughput** | 29.8372 | 1.1573 | 3.969811 | 24330.1 | 64.529 | 59.3 |
|
| 72 |
+
| **sculpt-experimental** | 48.9699 | 1.8995 | 3.412804 | 26496.2 | 60.97 | 59.5 |
|
| 73 |
+
|
| 74 |
+
### Key Metrics (this model)
|
| 75 |
+
|
| 76 |
+
| Metric | Value |
|
| 77 |
+
|--------|-------|
|
| 78 |
+
| **Weights memory** | 4.441124 GB (9% smaller) |
|
| 79 |
+
| **PPL ratio** | 0.7985 |
|
| 80 |
+
| **Chat prefill TPS** | 23065.3 (+7%) |
|
| 81 |
+
| **RAG TTFT p95** | 69.007 ms (-2%) |
|
| 82 |
+
| **Decode TPS** | 60.0 (flat) |
|
| 83 |
+
| **Parameters** | 2.38B |
|
| 84 |
+
|
| 85 |
+
## All Sculpt Tiers
|
| 86 |
+
|
| 87 |
+
| Tier | HuggingFace | Size | PPL Ratio | Use Case |
|
| 88 |
+
|------|-------------|------|-----------|----------|
|
| 89 |
+
| default | [dystrio/gemma-2-2b-it-sculpt-default](https://huggingface.co/dystrio/gemma-2-2b-it-sculpt-default) 👈 **this model** | 4.441124 GB | 0.7985 | Zero-regret: quality preserved, smaller footprint |
|
| 90 |
+
| production | [dystrio/gemma-2-2b-it-sculpt-production](https://huggingface.co/dystrio/gemma-2-2b-it-sculpt-production) | 4.226891 GB | 0.8693 | Practical savings with modest quality tradeoff |
|
| 91 |
+
| throughput | [dystrio/gemma-2-2b-it-sculpt-throughput](https://huggingface.co/dystrio/gemma-2-2b-it-sculpt-throughput) | 3.969811 GB | 1.1573 | Maximum usable compression for speed/edge |
|
| 92 |
+
| experimental | [dystrio/gemma-2-2b-it-sculpt-experimental](https://huggingface.co/dystrio/gemma-2-2b-it-sculpt-experimental) | 3.412804 GB | 1.8995 | Boundary exploration, maximum structural compression |
|
| 93 |
+
|
| 94 |
+
## What is Dystrio Sculpt?
|
| 95 |
+
|
| 96 |
+
Dystrio Sculpt compiles transformer models into smaller, faster variants. Output models:
|
| 97 |
+
|
| 98 |
+
- Are **dense** (not sparse) — standard architecture, fewer parameters
|
| 99 |
+
- Load with **standard HuggingFace Transformers** — no custom code needed
|
| 100 |
+
- Require **no custom kernels** and **no runtime changes**
|
| 101 |
+
- Work as a one-step compile before deployment
|
| 102 |
+
- Stack with quantization (AWQ, GPTQ, GGUF) for compound savings
|
| 103 |
+
|
| 104 |
+
## Compatibility
|
| 105 |
+
|
| 106 |
+
- ✅ HuggingFace Transformers
|
| 107 |
+
- ✅ vLLM
|
| 108 |
+
- ✅ TGI (Text Generation Inference)
|
| 109 |
+
- ✅ llama.cpp / GGUF conversion
|
| 110 |
+
- ✅ AWQ / GPTQ quantization
|
| 111 |
+
- ✅ Any framework that loads standard safetensors
|
| 112 |
+
|
| 113 |
+
## Benchmark Environment
|
| 114 |
+
|
| 115 |
+
- **GPU**: NVIDIA A100-SXM4-80GB
|
| 116 |
+
- **dtype**: bf16
|
| 117 |
+
- **Torch**: 2.10.0+cu128
|
| 118 |
+
- **Transformers**: 5.3.0
|
| 119 |
+
- **Deterministic**: True
|
| 120 |
+
- Single-GPU, standard HuggingFace Transformers, no custom kernels.
|
| 121 |
+
|
| 122 |
+
## Metric Definitions
|
| 123 |
+
|
| 124 |
+
- **PPL ratio**: WikiText-103 perplexity relative to baseline. <1.0 = quality improved.
|
| 125 |
+
- **Prefill TPS**: Tokens per second during prompt encoding (higher = faster).
|
| 126 |
+
- **TTFT p95**: Time to first token at 95th percentile (lower = faster).
|
| 127 |
+
- **Decode TPS**: Tokens per second during generation (higher = faster).
|
| 128 |
+
- **Weights (GB)**: Model parameter memory (deterministic, runtime-independent).
|
| 129 |
+
|
| 130 |
+
## Citation
|
| 131 |
+
|
| 132 |
+
```bibtex
|
| 133 |
+
@misc{dystrio_sculpt_2026,
|
| 134 |
+
title={Dystrio Sculpt: Structural Compilation for Transformer LLMs},
|
| 135 |
+
author={Dystrio},
|
| 136 |
+
year={2026},
|
| 137 |
+
url={https://huggingface.co/dystrio}
|
| 138 |
+
}
|
| 139 |
+
```
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{ bos_token }}{% if messages[0]['role'] == 'system' %}{{ raise_exception('System role not supported') }}{% endif %}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if (message['role'] == 'assistant') %}{% set role = 'model' %}{% else %}{% set role = message['role'] %}{% endif %}{{ '<start_of_turn>' + role + '
|
| 2 |
+
' + message['content'] | trim + '<end_of_turn>
|
| 3 |
+
' }}{% endfor %}{% if add_generation_prompt %}{{'<start_of_turn>model
|
| 4 |
+
'}}{% endif %}
|
config.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Gemma2ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"attn_logit_softcapping": 50.0,
|
| 8 |
+
"bos_token_id": 2,
|
| 9 |
+
"cache_implementation": "hybrid",
|
| 10 |
+
"dtype": "bfloat16",
|
| 11 |
+
"eos_token_id": [
|
| 12 |
+
1,
|
| 13 |
+
107
|
| 14 |
+
],
|
| 15 |
+
"final_logit_softcapping": 30.0,
|
| 16 |
+
"head_dim": 256,
|
| 17 |
+
"hidden_act": "gelu_pytorch_tanh",
|
| 18 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 19 |
+
"hidden_size": 2304,
|
| 20 |
+
"initializer_range": 0.02,
|
| 21 |
+
"intermediate_size": 7936,
|
| 22 |
+
"layer_types": [
|
| 23 |
+
"sliding_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"sliding_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"sliding_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"sliding_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"sliding_attention",
|
| 32 |
+
"full_attention",
|
| 33 |
+
"sliding_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"sliding_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"sliding_attention",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"sliding_attention",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"sliding_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"sliding_attention",
|
| 44 |
+
"full_attention",
|
| 45 |
+
"sliding_attention",
|
| 46 |
+
"full_attention",
|
| 47 |
+
"sliding_attention",
|
| 48 |
+
"full_attention"
|
| 49 |
+
],
|
| 50 |
+
"max_position_embeddings": 8192,
|
| 51 |
+
"model_type": "gemma2",
|
| 52 |
+
"num_attention_heads": 8,
|
| 53 |
+
"num_hidden_layers": 26,
|
| 54 |
+
"num_key_value_heads": 4,
|
| 55 |
+
"pad_token_id": 0,
|
| 56 |
+
"query_pre_attn_scalar": 256,
|
| 57 |
+
"rms_norm_eps": 1e-06,
|
| 58 |
+
"rope_parameters": {
|
| 59 |
+
"rope_theta": 10000.0,
|
| 60 |
+
"rope_type": "default"
|
| 61 |
+
},
|
| 62 |
+
"sliding_window": 4096,
|
| 63 |
+
"tie_word_embeddings": true,
|
| 64 |
+
"transformers_version": "5.3.0",
|
| 65 |
+
"use_bidirectional_attention": null,
|
| 66 |
+
"use_cache": true,
|
| 67 |
+
"vocab_size": 256000
|
| 68 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 2,
|
| 4 |
+
"cache_implementation": "hybrid",
|
| 5 |
+
"eos_token_id": [
|
| 6 |
+
1,
|
| 7 |
+
107
|
| 8 |
+
],
|
| 9 |
+
"pad_token_id": 0,
|
| 10 |
+
"transformers_version": "5.3.0"
|
| 11 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:76baecdc7f408517381ba65508f9b9577bf2f23d3d41a7301d2ad641105b4242
|
| 3 |
+
size 4768654792
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6994501c3d2c96eda15f5cb4d75ffd2cb41fa8e53e9cafc73db6adae158bf147
|
| 3 |
+
size 34362970
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"bos_token": "<bos>",
|
| 4 |
+
"clean_up_tokenization_spaces": false,
|
| 5 |
+
"eos_token": "<eos>",
|
| 6 |
+
"extra_special_tokens": [
|
| 7 |
+
"<start_of_turn>",
|
| 8 |
+
"<end_of_turn>"
|
| 9 |
+
],
|
| 10 |
+
"is_local": false,
|
| 11 |
+
"mask_token": "<mask>",
|
| 12 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 13 |
+
"pad_token": "<pad>",
|
| 14 |
+
"sp_model_kwargs": {},
|
| 15 |
+
"spaces_between_special_tokens": false,
|
| 16 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 17 |
+
"unk_token": "<unk>",
|
| 18 |
+
"use_default_system_prompt": false
|
| 19 |
+
}
|