mlboydaisuke commited on
Commit
fbcff6e
·
verified ·
1 Parent(s): a2b6d71

Add the Mixed INT4 (fp16 GPU activations) and int8 LiteRT-LM files of p-e-w/Oc-e-Non-v1, the model card and the measurements

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ 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
+ oc_e_non_v1_int8_ekv4096.litertlm filter=lfs diff=lfs merge=lfs -text
37
+ oc_e_non_v1_mixed_int4b32_fp16act_ekv4096.litertlm filter=lfs diff=lfs merge=lfs -text
MEASUREMENTS.md ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Oc-e-Non-v1 LiteRT-LM: measurements
2
+
3
+ The runs behind the numbers on the [model card](README.md), 2026-11-14 and 2026-11-15.
4
+
5
+ ## Files
6
+
7
+ | File | Bytes | sha256 |
8
+ |---|---:|---|
9
+ | `oc_e_non_v1_mixed_int4b32_fp16act_ekv4096.litertlm` | 3,051,929,936 | `0dac09e4d6d298216444caf4a0ad0b9a29e71d31953d9568cd0e58de01d7a854` |
10
+ | `oc_e_non_v1_int8_ekv4096.litertlm` | 4,060,193,936 | `9cba203de52dc34d772660c95b7629536c44916604d84fa45dee43e1cf514b4a` |
11
+
12
+ The conversion first wrote the Mixed INT4 file with fp32 GPU activations declared (sha256 `1a403a97e57f816cae457b5744cd01d9048c97bb39552617eb19fe8fa6928b84`, the same size). The file in this repository is that file with the declaration changed to fp16 in the file header: every section (weights, metadata, tokenizer) is byte-identical. Rows marked "fp32-declared copy" ran that first file.
13
+
14
+ ## Mac checks
15
+
16
+ Apple M4 Max (128 GB, macOS 27.0), litert-lm 0.19.2 from PyPI through its Python API: an engine with `max_num_tokens=4096` and no cache directory, a new conversation per question, greedy decoding (top-k 1). A run that stopped partway went on in a new process from its first unanswered question. CPU = XNNPACK, GPU = WebGPU.
17
+
18
+ The reference is the original model in Transformers 5.22.1 (the bf16 weights computed in float32 on the Mac CPU), with the checkpoint's chat template, greedy decoding, stopping at token 151645 or 151643.
19
+
20
+ | File | Backend | 12 questions: same verdict as the reference | 3-turn recall | GSM8K, first 100 (b / c) |
21
+ |---|---|---:|---|---:|
22
+ | Original model | Transformers | (12 / 12 right) | pass | 83 |
23
+ | Mixed INT4 | GPU | 11 / 12 | pass | 75 (14 / 6) |
24
+ | Mixed INT4 | CPU | 11 / 12 | pass | — |
25
+ | Mixed INT4, fp32-declared copy | GPU | 11 / 12 | pass | 83 (6 / 6) |
26
+ | Mixed INT4, fp32-declared copy | GPU, fp16 activations set in the engine | 11 / 12 | pass | 83 (8 / 8) |
27
+ | Mixed INT4, fp32-declared copy | CPU | 11 / 12 | pass | — |
28
+ | int8 | GPU | 12 / 12 | pass | 84 (4 / 5) |
29
+ | int8 | CPU | 12 / 12 | pass | — |
30
+
31
+ - **12 questions.** Each is sent as the question followed by " Answer briefly." in one user turn, with up to 1,024 new tokens, and judged by a regular expression: 1 What is 17 + 25? (42) · 2 What is the capital of Japan? (Tokyo) · 3 What is the opposite of "hot"? (cold) · 4 How many days are in a week? (7) · 5 How do you say "thank you" in French? (merci) · 6 What is 8 times 7? (56) · 7 Which is larger: 0.9 or 0.11? (0.9) · 8 Complete the rhyme: "Roses are red, violets are ___" (blue) · 9 a farmer's three fields of potatoes sold at 2 dollars per kg (1100) · 10 Write a Python function fib(n) that returns the n-th Fibonacci number, with fib(0) = 0 and fib(1) = 1. Show the function, then give the value of fib(10). (a `def fib(n` line and 55) · 11 the eight planets in order from the Sun · 12 Translate this Japanese sentence into English: 私は毎朝コーヒーを飲みます。 (coffee, morning).
32
+ - **The Mixed INT4 miss** is question 10 on both backends: the file writes a correct function and then gives the value of fib(10) as 10. The reference and the int8 file write the function and then 55.
33
+ - **3-turn recall.** Turn 1: "My name is Kaito and my lucky number is 37. Please greet me using my name and my lucky number." Turn 2: "What is the capital of Australia? Answer briefly." Turn 3: "What is my lucky number? Answer briefly." Pass = turn 3 says 37 and no turn reaches the token cap. In every row turn 2 answered "Canberra" and turn 3 "37"; turn 1 answered "Kaito, 37", except the int8 file on the CPU ("Hello, Kaito. 37.").
34
+ - **GSM8K.** The first 100 questions of the test split with a chain-of-thought prompt, up to 512 new tokens, on the GPU only. b = right in the reference and wrong in the file, c = the reverse; a file passes when b − c ≤ 2√(b + c).
35
+
36
+ ## Phones
37
+
38
+ `litert_lm_advanced_main` built for Android from LiteRT-LM v0.19.0 (commit `771b06e1`, 2026-10-28). Every run is a new process.
39
+
40
+ ### The 8 questions
41
+
42
+ The first 8 of the 12 questions above, each in its own process: `--max_num_tokens=1024 --max_output_tokens=256`, no sampler flags.
43
+
44
+ | Phone | File | Backend | Right |
45
+ |---|---|---|---:|
46
+ | Pixel 11 Pro (Android 17) | Mixed INT4 | GPU | 8 / 8 |
47
+ | Pixel 11 Pro | Mixed INT4 | CPU | 8 / 8 |
48
+ | Pixel 11 Pro | int8 | GPU | 8 / 8 |
49
+ | Pixel 11 Pro | int8 | CPU | 8 / 8 |
50
+ | Pixel 11 Pro | Mixed INT4, fp32-declared copy | GPU | 8 / 8 |
51
+ | Pixel 11 Pro | Mixed INT4, fp32-declared copy | CPU | 8 / 8 |
52
+ | Galaxy S26 (Android 16) | Mixed INT4 | GPU | 8 / 8 |
53
+
54
+ The Galaxy S26's answers, in order: 42 · Tokyo · cold · 7 days · "Merci" · 56 · 0.9 · Violets are blue.
55
+
56
+ ### Galaxy S26 timing
57
+
58
+ Samsung Galaxy S26 (SM-S942Q), `--benchmark --benchmark_prefill_tokens=1024 --benchmark_decode_tokens=256 --num_iterations=3 --max_num_tokens=2048`. A run's value is the mean of its iterations 2 and 3, and the card shows the mean of the runs of each file and backend. Each run started after the phone had rested 244–307 s since the previous process; its Android thermal status at the start is given. Peak = the process's `VmHWM`. GPU memory = how far the phone's GPU allocation counter (`kgsl_page_alloc`) rose during the run, memory that `VmHWM` does not count.
59
+
60
+ | File | Backend | Run | Thermal status at start | Prefill, iterations 1 / 2 / 3 (tok/s) | Decode, iterations 1 / 2 / 3 (tok/s) | Value: prefill / decode | Time to first token | Peak | GPU memory |
61
+ |---|---|---|---:|---|---|---|---:|---:|---:|
62
+ | Mixed INT4 | GPU | 1 | 1 | 273.41 / 250.23 / 197.15 | 18.32 / 18.13 / 17.80 | 223.69 / 17.96 | 4.70 s | 1.73 GB | 4.86 GB |
63
+ | Mixed INT4 | GPU | 2 | 1 | 261.68 / 234.38 / 206.69 | 18.38 / 18.33 / 18.16 | 220.53 / 18.24 | 4.715 s | 1.73 GB | 4.86 GB |
64
+ | int8 | GPU | 1 | 1 | 163.06 / 127.65 / 113.27 | 12.80 / 12.82 / 12.63 | 120.46 / 12.73 | 8.61 s | 1.14 GB | 5.91 GB |
65
+ | int8 | GPU | 2 | 1 | 162.56 / 130.87 / 106.22 | 13.00 / 12.93 / 12.70 | 118.55 / 12.81 | 8.81 s | 1.13 GB | 5.97 GB |
66
+ | Mixed INT4, fp32-declared copy | GPU | 1 | 0 | 52.16 / 47.61 / 41.59 | 14.48 / 14.57 / 14.41 | 44.60 / 14.49 | 23.135 s | 2.23 GB | 6.12 GB |
67
+ | Mixed INT4, fp32-declared copy | GPU | 2 | 0 | 81.98 / 74.29 / 65.06 | 14.92 / 14.97 / 14.77 | 69.68 / 14.87 | 14.83 s | 2.23 GB | 6.12 GB |
68
+ | Mixed INT4, fp32-declared copy | CPU | 1 | 1 | 38.10 / 30.21 / 36.09 | 9.60 / 9.43 / 9.46 | 33.15 / 9.45 | 31.24 s | 5.23 GB | — |
69
+ | int8 | CPU | 1 | 1 | 112.07 / 75.98 / 86.78 | 8.10 / 7.64 / 7.30 | 81.38 / 7.47 | 12.775 s | 6.82 GB | — |
70
+ | int8 | CPU | 2 | 1 | 117.84 / 68.62 / 86.56 | 8.10 / 7.60 / 7.25 | 77.59 / 7.42 | 13.515 s | 7.16 GB | — |
71
+ | Mixed INT4 | CPU | 1 | 1 | 39.88 / 36.04 / 36.09 | 9.68 / 9.35 / 8.90 | 36.06 / 9.12 | 28.505 s | 6.23 GB | — |
72
+
73
+ Within each GPU process, prefill drops from iteration 1 to iteration 3, while decode moves by 1–3 %. Within the CPU processes of the two files in this repository, decode drops 8–11 % from iteration 1 to iteration 3. The runtime printed `number_of_threads: 4` for every CPU run.
README.md ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ license_link: https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507/blob/main/LICENSE
6
+ pipeline_tag: text-generation
7
+ base_model: p-e-w/Oc-e-Non-v1
8
+ base_model_relation: quantized
9
+ library_name: litert-lm
10
+ tags:
11
+ - litert-lm
12
+ - litertlm
13
+ - qwen3
14
+ - terse
15
+ ---
16
+ # Oc-e-Non-v1 LiteRT-LM
17
+
18
+ This repository is a conversion of [p-e-w/Oc-e-Non-v1](https://huggingface.co/p-e-w/Oc-e-Non-v1) to LiteRT-LM, made with litert-torch 0.10.0 and ai-edge-quantizer 0.10.1 for LiteRT-LM 0.19: on a Galaxy S26 GPU the Mixed INT4 file decodes 18.1 tokens/s and prefills 1,024 tokens at 222 tokens/s (LiteRT-LM v0.19.0, 2026-11-15). Speed still being tuned (updates follow).
19
+
20
+ ```bash
21
+ pip install litert-lm
22
+ litert-lm run --from-huggingface-repo mlboydaisuke/Oc-e-Non-v1-LiteRT oc_e_non_v1_mixed_int4b32_fp16act_ekv4096.litertlm --backend gpu --prompt "What is the capital of Japan?"
23
+ ```
24
+
25
+ Use LiteRT-LM 0.19.0 or newer: the files were checked on 0.19.0 (Android) and 0.19.2 (Mac), and earlier releases were not tried. They were not tried on phones with 8 GB of memory.
26
+
27
+ If `run` stops right after the download with no error message from the CLI (a bus error; exit status 138 on a Mac) or with an error log that contains `too large for file size`, the downloaded file may be incomplete. The litert-lm CLI (tested on 0.19.2 and litert-lm-nightly 0.20.0.dev20261112; 0.14.0 to 0.19.1 have the same download code) can keep an incomplete download in `~/.litert-lm/cache/huggingface/mlboydaisuke/Oc-e-Non-v1-LiteRT/` and uses it again on later runs without checking its size. Delete that file and run the command again.
28
+
29
+ [p-e-w/Oc-e-Non-v1](https://huggingface.co/p-e-w/Oc-e-Non-v1) is [Qwen/Qwen3-4B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507) made to answer in fewer words with [Heretic](https://heretic-project.org); its card reports about half the mean response length. It has no thinking mode.
30
+
31
+ ## Files
32
+
33
+ | File | Weights | GPU activations | Size | Use |
34
+ |---|---|---|---:|---|
35
+ | `oc_e_non_v1_mixed_int4b32_fp16act_ekv4096.litertlm` | int4 (blocks of 32) for the linear layers; int8 token table and output layer | fp16 | 3.05 GB | The faster file: on a Galaxy S26 GPU it decodes 1.4 times as fast as the int8 file |
36
+ | `oc_e_non_v1_int8_ekv4096.litertlm` | int8 per channel for every linear layer and the token table | fp32 | 4.06 GB | Answers closer to the original model: the same verdict on 12 of 12 Mac questions, against 11 of 12 |
37
+
38
+ Both files hold 4,096 tokens of context: the prompt, the reply and earlier turns together.
39
+
40
+ ## Accuracy
41
+
42
+ Greedy decoding against the original model in Transformers (float32, Mac CPU), LiteRT-LM 0.19.2 on an Apple M4 Max:
43
+
44
+ | File | Backend | 12 questions: same verdict | 3-turn recall | GSM8K, first 100 |
45
+ |---|---|---:|---|---:|
46
+ | Original model (Transformers) | — | — | pass | 83 |
47
+ | Mixed INT4 | GPU | 11 / 12 | pass | 75 |
48
+ | Mixed INT4 | CPU | 11 / 12 | pass | — |
49
+ | int8 | GPU | 12 / 12 | pass | 84 |
50
+ | int8 | CPU | 12 / 12 | pass | — |
51
+
52
+ The Mixed INT4 file differs from the original model on question 10 on both backends: it writes a correct Python function and then gives fib(10) as 10, where the original model gives 55. On phones (`litert_lm_advanced_main` built from LiteRT-LM v0.19.0), the first 8 of the 12 questions: 8 / 8 for each file on a Pixel 11 Pro GPU and CPU, and 8 / 8 for the Mixed INT4 file on a Galaxy S26 GPU. The questions, prompts and every run: [MEASUREMENTS.md](MEASUREMENTS.md).
53
+
54
+ ## Performance
55
+
56
+ Galaxy S26, 1,024 prefill tokens and 256 decode tokens:
57
+
58
+ | File | Backend | Prefill (tok/s) | Decode (tok/s) | Time to first token | Peak (`VmHWM`) |
59
+ |---|---|---:|---:|---:|---:|
60
+ | Mixed INT4 | GPU | 222.1 | **18.1** | 4.7 s | 1.73 GB |
61
+ | int8 | GPU | 119.5 | 12.8 | 8.7 s | 1.14 GB |
62
+ | Mixed INT4 | CPU | 36.1 | 9.1 | 28.5 s | 6.23 GB |
63
+ | int8 | CPU | 79.5 | 7.4 | 13.1 s | 7.16 GB |
64
+
65
+ Samsung Galaxy S26 (SM-S942Q, Android 16), `litert_lm_advanced_main` built from LiteRT-LM v0.19.0 (`771b06e1`), `--benchmark --benchmark_prefill_tokens=1024 --benchmark_decode_tokens=256 --num_iterations=3 --max_num_tokens=2048`; each value is the mean of iterations 2 and 3, averaged over 2 runs (1 run for the Mixed INT4 file on the CPU), each a new process, 2026-11-15. The CPU runs used 4 threads. `VmHWM` does not count the memory the GPU driver holds. Every run: [MEASUREMENTS.md](MEASUREMENTS.md).
66
+
67
+ ## Conversion
68
+
69
+ - From the bf16 checkpoint at revision `dbf4e269` with litert-torch 0.10.0's `export_hf` and its GPU composites; int8 per-channel and int4 blockwise-32 weights from ai-edge-quantizer 0.10.1.
70
+ - Metadata: LiteRT-LM 0.19.1's Qwen3 configuration with three changes: the checkpoint's sampler (top-k 20, top-p 0.8, temperature 0.7), `<|endoftext|>` as a second stop token, and no thought channel. Tokenizer: the checkpoint's `tokenizer.json`, byte for byte.
71
+
72
+ ## License
73
+
74
+ Apache License 2.0, the license of [p-e-w/Oc-e-Non-v1](https://huggingface.co/p-e-w/Oc-e-Non-v1) and [Qwen/Qwen3-4B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507/blob/main/LICENSE).
oc_e_non_v1_int8_ekv4096.litertlm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9cba203de52dc34d772660c95b7629536c44916604d84fa45dee43e1cf514b4a
3
+ size 4060193936
oc_e_non_v1_mixed_int4b32_fp16act_ekv4096.litertlm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0dac09e4d6d298216444caf4a0ad0b9a29e71d31953d9568cd0e58de01d7a854
3
+ size 3051929936