license: apache-2.0
base_model: llmfan46/gemma-4-E4B-it-ultra-uncensored-heretic
base_model_relation: quantized
pipeline_tag: image-text-to-text
library_name: litert-lm
tags:
- gemma-4
- android
- litert-lm
- opencl
- quantized
- int2
- gsq-rco
- speculative-decoding
Gemma4 E4B-it-ultra-uncensored-heretic-GSQ-RCO-LiteRT_LM
This Gemma 4 E4B Heretic release is packaged for on-device inference on Android with LiteRT-LM. The single .litertlm file includes the MTP draft model for speculative decoding and the vision encoder and adapter for image inputs. The configured context window is 65,536 tokens (64K), shared by input and generated output.
Model provenance
- The Heretic checkpoint is from llmfan46. This build transfers its attention output-projection deltas to 17 weight tensors on the mobile template's quantization grid. Heretic checkpoint at the source revision
- The reference checkpoint used to calculate those deltas is Google Gemma 4 E4B IT. Google reference checkpoint
- The LiteRT Community Gemma 4 E4B IT bundle supplies the mobile graph, tokenizer, MTP drafter and vision components. The drafter graph was adapted to use the modified KV cache layout. LiteRT-LM template
GSQ/RCO quantization
GSQ fitted low-bit weight candidates, and RCO evaluated precision assignments within the six selected MLP projections. The release uses mixed precision with the following six matrices stored as native LiteRT blockwise signed INT2. GSQ paper · RCO paper
| Weights | Zero-based layer indices | Stored precision |
|---|---|---|
model.language_model.layers.*.mlp.up_proj.weight |
7, 12, 19, 25, 31, 36 | Signed INT2, group size 32, one FP16 scale per group |
| Other weights | All other tensors | Original mobile mixed precision, with INT4 as the primary format for language model weights |
The six INT2 matrices use 2.5 bits per weight including their scales (2 bits for each weight plus 16 scale bits per group of 32). This figure applies to the six listed matrices. The other projections within those layers keep their existing precision.
Mobile inference and validation
Use a LiteRT-LM runtime that supports the bundle's graph, blockwise INT2 weights and the requested features. In Rabillam, select the LiteRT-LM GPU/OpenCL backend and choose up to 64K context. Image inputs use the embedded vision components. LiteRT-LM runtime
The model uses a 2,048-slot circular KV cache for local attention and tiled global attention during prefill to reduce temporary memory use. The main prefill signature still processes 1,024 tokens per call.
| Test on Galaxy S22 Ultra (SM-S908N) | Observed result |
|---|---|
| Android LiteRT-LM 0.19.1, GPU/OpenCL, 64K window, MTP enabled | Correct response after 63,694 input tokens, with prefill at 221.6 tokens/s in this run |
| Separate vision run with the 64K window and MTP enabled | Correctly identified a red test image using the CPU vision backend |
| Rabillam application test | Text streaming and image recognition passed with the same model file |
File
| Artifact | Bytes |
|---|---|
| Mobile LiteRT-LM bundle | 3,631,742,976 |
SHA-256 59defe8abc8fdeef8989fc11c31d50d0d1a050b880690ad206181bcda07d2f3d
Licensed under Apache License 2.0.
한국어 요약
Android에서 LiteRT-LM으로 구동하는 Gemma 4 E4B Heretic입니다. 하나의 .litertlm 파일에 MTP 드래프트 모델과 이미지 인식용 비전 인코더·어댑터를 담았습니다. 최대 컨텍스트는 **64K(65,536토큰)**입니다. GSQ/RCO로 0부터 세는 7, 12, 19, 25, 31, 36번 레이어의 mlp.up_proj 가중치를 INT2로 양자화했습니다. Galaxy S22 Ultra의 OpenCL 백엔드에서 MTP를 켜고 63,694토큰 입력을 검증했고, 64K 설정의 이미지 인식도 별도로 확인했습니다.