Safetensors
gemma3_text
text-generation-inference
WilhelmT commited on
Commit
60ca60a
·
verified ·
1 Parent(s): 98f528c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +193 -5
README.md CHANGED
@@ -1,5 +1,193 @@
1
- ---
2
- license: other
3
- license_name: embedl-models-community-licence-1.0
4
- license_link: https://github.com/embedl/embedl-models/blob/main/LICENSE
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: embedl-models-community-licence-1.0
4
+ license_link: https://github.com/embedl/embedl-models/blob/main/LICENSE
5
+ base_model:
6
+ - google/gemma-3-1b-it
7
+ tags:
8
+ - text-generation-inference
9
+ ---
10
+
11
+
12
+ # gemma-3-1b-it-FlashHead
13
+
14
+ ![My model banner](assets/FlashHead.png)
15
+
16
+ **Optimized version of gemma-3-1b-it using FlashHead, Embedl’s efficient replacement for the language model head, reducing size while preserving accuracy.**
17
+ Designed for **low-latency inference** on **NVIDIA RTX GPUs**, leveraging:
18
+
19
+ - FlashHead
20
+ - Custom vLLM generation via `embedl-models`
21
+
22
+ FlashHead matches the gemma-3-1b-it baseline within rounding error on common benchmarks (MMLU-Pro, HellaSwag, GSM8K, etc.) and, combined with quantization, delivers SOTA on-device latency.
23
+
24
+ ---
25
+
26
+ ## Model Details
27
+ | **Field** | **Value** |
28
+ |------------|------------|
29
+ | **Base Model** | gemma-3-1b-it |
30
+ | **Input / Output** | Text → Text |
31
+ | **Release Date** | 2025-12-08 |
32
+ | **Version** | 1.0 |
33
+ | **Optimizations** | FlashHead LM Head|
34
+ | **Developers** | Embedl |
35
+ | **Licenses** | Upstream: Gemma Terms of Use. <br>Optimized components: Embedl Models Community Licence v1.0 *(no redistribution)* |
36
+ | **Intended Use** | Text generation, reasoning, assistant-style interaction, and general-purpose NLP on NVIDIA RTX GPUs |
37
+
38
+ ---
39
+
40
+ ## Optimizations
41
+
42
+ - **FlashHead LM Head** - lightweight replacement for the dense LM head, significantly improving throughput.
43
+ - **Custom Runtime Integration** - compatible with **vLLM (0.10.2)** via the `embedl-models` package.
44
+
45
+ ---
46
+
47
+ ## Performance
48
+
49
+ ### Token Generation Speed (RTX 3500 Ada, batch size = 1)
50
+
51
+ | **Precision** | **Tokens/sec** | **Speedup vs BF16** |
52
+ |----------------|----------------|----------------------|
53
+ | BF16 baseline | 148 | 1.0× |
54
+ | **FlashHead (Embedl)** | **178** | **1.20×** |
55
+ | W4A16 baseline | 243 | 1.64x× |
56
+ | **FlashHead W4A16 (Embedl)** | **336** | **2.27×** |
57
+
58
+ FlashHead improves end-to-end speed by **1.38×** over state-of-the-art, while maintaining full accuracy parity.
59
+
60
+ **Measurement setup:** vLLM 0.10.2, batch_size=1, prompt length=32, max_new_tokens=128, 10 warm-up runs, averaged over 100 runs.
61
+
62
+ ---
63
+
64
+ ## Accuracy (Parity with Baseline)
65
+
66
+ | **Method** | **MMLU-Pro** | **IFEval** | **BBH** | **TruthfulQA** | **GSM8K** |
67
+ |-------------|---------------|--------------|-------------|-------------|----------------|--------------|
68
+ | **Baseline** | 0.15 | 0.55 | 0.38 | 0.31 | 0.42 |
69
+ | **FlashHead** | 0.15 | 0.49 | 0.38 | 0.31 | 0.39 |
70
+
71
+ FlashHead closely matches baseline accuracy.
72
+
73
+ ---
74
+
75
+ ## Installation
76
+
77
+ ```bash
78
+ pip install embedl-models
79
+ ```
80
+
81
+ The `embedl-models` package is required, it provides the optimized FlashHead implementation and quantized model runtime.
82
+
83
+ ---
84
+
85
+ ## Usage Examples
86
+ **Note (vLLM context length):** `max_model_len=131072` may fail on GPUs without enough free VRAM for the KV cache. If you see a KV cache memory error, lower `max_model_len` (or increase `gpu_memory_utilization`).
87
+
88
+ ### vLLM Inference
89
+
90
+ ```python
91
+ from vllm import SamplingParams
92
+ from embedl.models.vllm import LLM
93
+
94
+ model_id = "embedl/gemma-3-1b-it-FlashHead"
95
+
96
+ if __name__ == "__main__":
97
+ sampling = SamplingParams(max_tokens=128, temperature=0.0)
98
+ llm = LLM(model=model_id, trust_remote_code=True, max_model_len=131072)
99
+
100
+ prompt = "Write a haiku about coffee."
101
+ output = llm.generate([prompt], sampling)
102
+ print(output[0].outputs[0].text)
103
+ ```
104
+
105
+ ---
106
+
107
+ ### Interactive REPL Example
108
+
109
+ The `run_repl()` coroutine launches an **interactive, streaming chat interface** using the vLLM backend with FlashHead enabled.
110
+ It maintains an in-memory chat history and supports simple commands such as `/exit` to quit and `/reset` to clear context.
111
+
112
+ ```python
113
+ import asyncio
114
+ from embedl.models.vllm.demo import run_repl
115
+
116
+ model_id = "embedl/gemma-3-1b-it-FlashHead"
117
+
118
+ if __name__ == "__main__":
119
+ asyncio.run(
120
+ run_repl(
121
+ model=model_id,
122
+ max_model_len=131072
123
+ )
124
+ )
125
+ ```
126
+ ---
127
+
128
+ ---
129
+
130
+ ## ⚠️ Important Warning: Hugging Face Transformers Support
131
+
132
+ > **FlashHead is currently not applied when using the Hugging Face `transformers` pipeline.**
133
+ > Generation through `transformers` will fall back to the standard dense LM head, **disabling FlashHead acceleration**.
134
+ >
135
+ > For now, **we strongly recommend using the vLLM integration** (`embedl.models.vllm.LLM`) to ensure FlashHead is active and optimized for low-latency inference.
136
+ >
137
+ > Full support for the Hugging Face `transformers` pipeline with FlashHead integration will be released **in the coming days**.
138
+
139
+ ---
140
+
141
+ ## Limitations
142
+
143
+ - Limited to **vLLM 0.10.2** (pinned dependency)
144
+ - **Batch size = 1** (real-time generation)
145
+ - Currently optimized for **NVIDIA RTX GPUs**
146
+
147
+ ---
148
+
149
+ ## Roadmap
150
+
151
+ Planned improvements:
152
+
153
+ - Advanced mixed precision quantization
154
+ - Huggingface transformers generation
155
+ - vLLM CLI benchmarking for detailed latency evaluation
156
+ - `lm-eval-harness` integration for detailed accuracy evaluation
157
+ - Upstream support in **Transformers** and **vLLM**
158
+ - Compatibility with **GGUF**, **MLC**, **Llama.cpp**, **Ollama**, etc.
159
+ - Broader model coverage (larger models, VLMs, VLAs)
160
+
161
+ ---
162
+
163
+ ## License
164
+
165
+ - **Upstream:** Gemma Terms of Use.
166
+ - **Optimized Components:** Embedl Models Community Licence v1.0 *(no redistribution)*
167
+
168
+ ---
169
+
170
+ ## Contact
171
+
172
+ **Enterprise & Commercial Inquiries**
173
+ [sales@embedl.com](mailto:sales@embedl.com)
174
+
175
+ **Technical Issues & Early Access**
176
+ [https://github.com/embedl/embedl-models](https://github.com/embedl/embedl-models)
177
+
178
+ **More Information & Model Releases**
179
+ [https://embedl.com](https://embedl.com)
180
+
181
+ ---
182
+
183
+ ### Partner & Developer Opportunities
184
+
185
+ If you are evaluating on-device inference, building products on SLMs, or exploring custom model optimization, reach out for:
186
+
187
+ - Embedl SDK - AI optimization tools & profiling
188
+ - Embedl HUB - benchmarking platform
189
+ - Engineering support for on-prem/edge deployments
190
+ - Migration guidance (Llama / Qwen / Gemma)
191
+ - Early access & partner co-marketing opportunities
192
+
193
+ Contact: [sales@embedl.com](mailto:sales@embedl.com)