File size: 7,845 Bytes
c154709
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
---

license: apache-2.0
base_model: google/gemma-4-12B-it
tags:
- multimodal
- vision
- audio
- quantization
- autoround
- vllm
- tensor_type:q4
---


# Gemma 4 12B IT - W4A16 AutoRound Quantized Variants

This repository hosts 4-bit weight, 16-bit activation (W4A16) quantized variants of **google/gemma-4-12B-it**. The models were quantized using Intel's AutoRound framework tailored specifically for the architectural requirements of the Gemma 4 family.

Available formats in the series:
* `OpenTensorLab/gemma-4-12B-it-W4A16-AutoRound` (Standard AutoRound format)
* `OpenTensorLab/gemma-4-12B-it-W4A16-AutoRound-AWQ` (AWQ format conversion)
* `OpenTensorLab/gemma-4-12B-it-W4A16-AutoRound-GPTQ` (GPTQ format conversion)

## Architectural Advantage: Gemma 4 12B Unified

The **Gemma 4 12B Unified** model features a ground-breaking **encoder-free multimodal architecture**. Unlike traditional vision-language models that rely on separate heavy visual/audio encoders (like ViT or Whisper), the 12B Unified model projects raw image patches and audio waveforms directly into the main LLM's embedding space via lightweight linear layers. 

Because text, image, and audio flow natively into a single decoder-only transformer, this model benefits dramatically from weight-only quantization, offering minimal multimodal latency and a highly streamlined memory footprint.

---

## Quantization Recipe & Environment

The models were generated using the following computational setup and tuning parameters. Notably, it leverages **RTN mode (`iters: 0`) with non-text module protection**, which is mandatory for maintaining performance stability on the Gemma 4 native multimodal layers.

### Environment Setup
* **PyTorch Version:** `2.10.0+cu128`
* **CUDA Version:** `12.8` (CUDA Available: `True`)
* **Hardware:** NVIDIA L40 (48 GB VRAM)

### Tuning Configuration
```python

TUNING_CONFIG = {

    "group_size": 128,

    "sym": True,

    "iters": 0,                      # RTN mode โ€” required for Gemma 4 stability

    "disable_opt_rtn": True,

    "nsamples": 256,

    "seqlen": 2048,

    "low_gpu_mem_usage": False,

    "quant_nontext_module": False,   # Keeps linear projection layers intact for vision/audio inputs

    "layer_config": layer_config,

}



```

---

## Deployment & Inference Guide

Due to the unique unified nature of Gemma 4's multimodal inputs, deployment requires the specialized vLLM unified image containing updated parser configurations.

### Running with Docker (vLLM)

Deploy a production-ready OpenAI-compatible API server using the custom `vllm-openai:gemma4-unified` engine:

```bash

docker run --gpus all \

    -v ~/.cache/huggingface:/root/.cache/huggingface \

    -p 8000:8000 \

    --ipc=host \

    vllm/vllm-openai:gemma4-unified \

    --model OpenTensorLab/gemma-4-12B-it-W4A16-AutoRound \

    --quantization autoround \

    --port 8000 \

    --max-model-len 4096 \

    --trust-remote-code



```

*(Note: Change `--quantization` flag to `awq` or `gptq` depending on the specific variant file path you mount).*

---


### ๐Ÿš€ Deploy on RunPod

One-click launch environments pre-configured with PyTorch, CUDA, and dependencies for fine-tuning or quantization.

> ๐ŸŽ **Need GPU compute?** Sign up via [RunPod](https://runpod.io?ref=iabrlp7z) and get **$5โ€“$500 in free credits** when you add your first $10.

#### PyTorch 2.15

| Template | CUDA Version | Docker Image | Template ID | Deploy |
| :--- | :--- | :--- | :--- | :--- |
| **PyTorch 2.15 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.15-runpod` | `0rsw686010` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=0rsw686010&ref=iabrlp7z) |
| **PyTorch 2.15 (CUDA 13.4)** | 13.4 | `vishva123/cuda-13.4-pytorch-2.15-runpod` | `0s0rhdfaqy` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=0s0rhdfaqy&ref=iabrlp7z) |

#### PyTorch 2.14

| Template | CUDA Version | Docker Image | Template ID | Deploy |
| :--- | :--- | :--- | :--- | :--- |
| **PyTorch 2.14 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.14-runpod` | `d7lxsa4w9m` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=d7lxsa4w9m&ref=iabrlp7z) |
| **PyTorch 2.14 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.14-runpod` | `yk0y6j6rpg` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=yk0y6j6rpg&ref=iabrlp7z) |
| **PyTorch 2.14 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.14-runpod` | `gsp4gwx0nw` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=gsp4gwx0nw&ref=iabrlp7z) |

#### PyTorch 2.13

| Template | CUDA Version | Docker Image | Template ID | Deploy |
| :--- | :--- | :--- | :--- | :--- |
| **PyTorch 2.13 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.13-runpod` | `gmlupxnxfk` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=gmlupxnxfk&ref=iabrlp7z) |
| **PyTorch 2.13 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.13-runpod` | `y3j8xvk4f4` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=y3j8xvk4f4&ref=iabrlp7z) |
| **PyTorch 2.13 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.13-runpod` | `vigpissn5w` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=vigpissn5w&ref=iabrlp7z) |

#### PyTorch 2.12

| Template | CUDA Version | Docker Image | Template ID | Deploy |
| :--- | :--- | :--- | :--- | :--- |
| **PyTorch 2.12 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.12-runpod` | `ctmz86zmf0` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=ctmz86zmf0&ref=iabrlp7z) |
| **PyTorch 2.12 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.12-runpod` | `qjko5yiwzi` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=qjko5yiwzi&ref=iabrlp7z) |
| **PyTorch 2.12 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.12-runpod` | `ifg6xmye0f` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=ifg6xmye0f&ref=iabrlp7z) |

---

## ๐Ÿ› ๏ธ Reproduction & Source Code

The complete script used to perform this quantization, manage the layer configurations, and optimize the memory footprint is fully open-sourced. 

You can find the step-by-step Jupyter Notebook containing the exact execution environment, dependency setups, and layer configurations in the GitHub repository:

๐Ÿ‘‰ **[AutoRound-Quantization: Gemma 4 12B RTN Notebook](https://github.com/vishvaRam/AutoRound-Quantaization/blob/main/Gemma4/auto_round_Gemma4-12B-RTN.ipynb)**

### How to Reproduce
To replicate this quantization run on your own hardware (e.g., NVIDIA L40 or similar 40GB+ VRAM instances), clone the setup and run the notebook:

```bash

git clone [https://github.com/vishvaRam/AutoRound-Quantaization.git](https://github.com/vishvaRam/AutoRound-Quantaization.git)

cd AutoRound-Quantaization/Gemma4