What was measured, and what it established
Numbers for litetune. The first sections are functiongemma-270m-it
LoRA-tuned on google/mobile-actions, scored on 640 held-out single-call
examples; exact match means the tool name and every argument value. Each
section after them is another family: gemma-3-270m-it with the second scorer,
gemma-4-E2B-it, converted from its base weights and then fine-tuned,
Qwen3-0.6B, the first that is not a Gemma, gemma-3-1b-it, the other size one export rule claims, and
Qwen2.5-0.5B-Instruct, the one checkpoint here on which channelwise four bits
produced a score. Then functiongemma-270m-it again, measured through the
runtime's tool path the way an application calls it, and last
gemma-3-270m-it trained to choose one of an application's options rather
than to write an answer.
This file exists so the README can be a usage guide. It is the longer story: what reproduced, what did not, and which published claims were withdrawn.
Which runtime a number was taken on
Every litetune from 0.1.0a1 to 0.1.9 pins the same toolchain:
litert-lm==0.16.1 for the candidate, litert-torch-nightly==0.10.0.dev20260826
for conversion (with litert-lm-builder==0.16.1 from 0.1.4), and torch==2.5.1,
transformers==5.16.1, peft==0.20.0 for training and the float reference. The
sections below name the runtime they ran on where they record one; the phone
sections ran a runtime of their own.
litetune 0.2.0 – 0.3.0 pin litert-lm==0.17.1, and that runtime does not give
0.16.1's answers. Nor does one CPU give another's. Measured 2026-09-27 on
Linux x86-64, CPU backend, through litetune's own driver scripts, each version
in its own environment and each run on its own copy of the bundles, with no
weight cache from another run beside it. The bundles were litert-community's
gemma3-270m-it-q8 and gemma3-1b-it-int4 and a FunctionGemma bundle this
project converted and keyed fp32; each of twelve prompts was prefilled and
one fixed sentence scored after it with run_text_scoring, which no sampler or
detokenizer touches -- the model's arithmetic and nothing else.
| Per-token scores identical, of 36 prompt-bundle scorings | same runtime | 0.16.1 against 0.17.1 |
|---|---|---|
| same CPU model, another run or machine | 36 | 1 |
| Intel Xeon @ 2.20GHz against AMD EPYC 7B12 | 0 | 0 |
Six builds took part, each on a machine drawn from a pool of 32-vCPU ones: four
landed on the Intel model and two on the AMD one. The two that recorded their
CPU features showed AVX2 and FMA and none of AVX-512 or AMX. Two builds did not
record their CPU and are placed with a model because their scores equal that
model's recorded builds' to the bit -- an inference, not a record. Within a CPU
model every run reproduced every
score to the bit, across machines and, on 0.17.1 on the Intel model, with 1, 4,
8, 16 or 32 threads alike; across the two models not one scoring did, by as much
as 1.52 nats on a single token, and across the two runtimes one did, by as much
as 1.33.
So a litert-lm number belongs to a runtime version and a CPU, and two compare
only when both match. The model name is not enough to say two CPUs match: the
machine the tool-path section's 0.17.1 runs used reports the same
Intel(R) Xeon(R) CPU @ 2.20GHz as the Intel builds above but has AVX-512,
which the one Intel build that recorded its features did not, so a CPU is its
name and its features together. From 0.2.0 a verify manifest records
the CPU its candidate ran on beside the runtime, wherever the driver could read
it. The sections below
name their runtime and, apart from the 0.17.1 runs, not
their CPU, and those taken on machines drawn from a pool may have landed on
different CPU models.
The same holds for what litetune scores. litetune's driver scripts on one machine -- twelve prompts in both prompt modes on the three bundles, and forty held-out tool-path rows with the grammar off and on -- gave the same output on 152 of 152 when 0.16.1 ran twice, and on 47 of 152 between 0.16.1 and 0.17.1. That pair was taken on the AMD model, by the same inference; a second 0.17.1 run, whose scores place it with the Intel model, matched the first on 43 of 152, which is the CPU and not nondeterminism. What in the runtime changed the arithmetic is not isolated. Between the tags LiteRT-LM moves its LiteRT dependency three times, across two XNNPACK updates and changes to int8 and dynamically quantised fully-connected kernels; its own call parser, prompt rendering and the binding calls litetune makes read the same, apart from integers the parser now returns as integers.
Neither version is shown to be the more accurate: that needs both scored against the float model on one CPU, and it is not done here -- the banking77 re-measurement below scores eight bundles against it on both, but not on a CPU the two runs are shown to share. The FunctionGemma bundle in these runs is an early conversion that answers most tool-path rows with several calls, so its exact match says nothing about quality and is not quoted. On the Intel model a scoring process, three bundles in turn, peaked at 1.07 to 1.14 GiB resident, whatever the thread count.
One behaviour changed that a number can hide. Where a bundle carries no
SentencePiece tokenizer, v0.16.1 refused to create a conversation with the
grammar on; v0.17.1 logs a warning and decodes without the grammar
(gemma3_data_processor.cc, function_gemma_data_processor.cc). litetune reads
the bundle's tokenizer sections first and refuses that mode itself, so a
grammar-on number is never unconstrained output.
So two numbers compare only when they name the same runtime. The sections below keep their 0.16.1 numbers; one taken on 0.17.1 goes beside them and never in place of them.
Re-measured on 0.17.1 so far: the four banking77 eight-bit pairs, below; the
four-bit recipes on the same four checkpoints, in Four bits on litert-lm
0.17.1; the tuned Gemma 4 E2B's two eight-bit bundles, in Gemma 4 E2B on
litert-lm 0.17.1; and FunctionGemma's tool path, in The same checkpoint on
litert-lm 0.17.1. Each of those was taken again on litert-lm 0.18.0, the runtime
0.4.0 – 0.7.2 pin, in The 0.17.1 re-measurements again on litert-lm 0.18.0, after the
banking77 sections. The rest has not been; among it the headline FunctionGemma
runs, the conversions of Gemma 4's base weights and the runs on untuned bases
are verify numbers taken on 0.16.1, and the phone runs ran on the device.
The banking77 sections on litert-lm 0.17.1
The four banking77 eight-bit pairs were verified again on 2026-09-28 with
litetune at commit 0744a1e (unreleased; it reports itself as 0.1.9) on
litert-lm 0.17.1. Nothing was retrained or re-converted: each bundle's SHA-256
equals the one convert recorded when 0.1.6, 0.1.7 or 0.1.8 built it, and the
reference checkpoint, the 600 held-out rows of split 0c7505b2b6f69ab1, the
scorer, the prompt mode and the declared decoding are each section's. main's
convert pins a newer conversion stack, and a bundle it builds is not measured
here. The candidate's CPU is recorded, Intel(R) Xeon(R) CPU @ 2.20GHz with
AVX-512 and 12 vCPU, and the reference ran on cuda.
Three things changed between each section's two runs, not one: the runtime; the
transport, which is now litert-lm's Python API in one process per split rather
than litert-lm run per prompt (#50), and which gave byte-identical text in 36
of 36 comparisons on 0.16.1; and possibly the CPU, which the 0.16.1 runs did
not record. So a difference between the two runs is not attributed to the
runtime.
Cost of conversion, float minus candidate, with its discordant rows:
dynamic_wi8_afp32, 0.16.1 |
dynamic_wi8_afp32, 0.17.1 |
weight_only_wi8_afp32, 0.16.1 |
weight_only_wi8_afp32, 0.17.1 |
|
|---|---|---|---|---|
| gemma-3-270m | +0.0000 (34) | −0.0067 (30) | +0.0033 (16) | −0.0033 (12) |
| Qwen3-0.6B | +0.0067 (20) | +0.0000 (10) | +0.0167 (12, resolved) | +0.0050 (5) |
| gemma-3-1b | +0.0083 (23) | +0.0100 (12) | +0.0167 (14, resolved) | +0.0000 (4) |
| Qwen2.5-0.5B | +0.0100 (16) | +0.0000 (8) | +0.0100 (10) | −0.0017 (3) |
Two costs resolved on 0.16.1 and none does on 0.17.1. That is two runs' verdicts, not a measured change in a cost, and neither run is withdrawn: litetune computes no interval between two runs, and the manifests keep scores, not rows, so the paired test between the two candidates cannot be computed. Every candidate is discordant with its reference on fewer rows on 0.17.1, eight of eight; that too is an observation without an interval, and the reference was re-run as well. Each section has its pair in full. The tuned Gemma 4 E2B's pair, on the same split, was re-measured separately, in Gemma 4 E2B on litert-lm 0.17.1.
The 0.17.1 re-measurements again on litert-lm 0.18.0
Verified again from 2026-10-08 to 2026-10-09 on litert-lm 0.18.0 with the code of pull
request #67 before it was merged: commit c7ee2da (the runs recorded 5ddb043, the same
tree before a rebase), and for the Qwen bundles converted again and verified, 02844df,
which includes the packaged Qwen templates (both report 0.3.0). They ran on the machine
type the 0.17.1 runs used: every manifest that measured a candidate records it on
Intel(R) Xeon(R) CPU @ 2.20GHz with AVX-512 and 12 vCPU, and the reference on cuda.
Nothing was retrained.
Two kinds of bundle were run. The bundles the 0.17.1 runs measured, unchanged -- each
that has a manifest on both runtimes carries the SHA-256 the 0.17.1 manifest records --
so the runtime is the one thing that moved. And, for FunctionGemma and the two Qwen
sections, bundles converted again from the same checkpoints by that code (c7ee2da, and
02844df for the Qwen bundles), with
litert-torch-nightly 0.10.0.dev20260926, ai-edge-quantizer-nightly
0.10.0.dev20260926 and litert-lm-builder 0.18.0, where the bundles they are compared
with were converted in September with 0.10.0.dev20260826, 0.10.0.dev20260914 and 0.16.1:
for those the conversion stack moved as well as the runtime, and for Qwen the template.
Every number that reached the quality tier is the 0.17.1 number again: the same candidate and reference exact match and the same cost with the same count of discordant rows, to four places. The manifests keep scores, not rows, so the rows themselves are not shown to be the same; equal totals and equal discordant counts on 600 or 640 rows are what is claimed.
| model, recipe | reference | 0.17.1 | 0.18.0, the same bundle | 0.18.0, converted again |
|---|---|---|---|---|
gemma-3-270m, weight_only_wi8_afp32 |
0.6717 | 0.6750, −0.0033 (12) | 0.6750, −0.0033 (12) | |
gemma-3-270m, dynamic_wi8_afp32 |
0.6717 | 0.6783, −0.0067 (30) | 0.6783, −0.0067 (30) | |
gemma-3-1b, weight_only_wi8_afp32 |
0.7533 | 0.7533, 0.0000 (4) | 0.7533, 0.0000 (4) | |
gemma-3-1b, dynamic_wi8_afp32 |
0.7533 | 0.7433, +0.0100 (12) | 0.7433, +0.0100 (12) | |
qwen2.5-0.5b, weight_only_wi8_afp32 |
0.7700 | 0.7717, −0.0017 (3) | not verified: the first send raised | 0.7717, −0.0017 (3) |
qwen2.5-0.5b, dynamic_wi8_afp32 |
0.7700 | 0.7700, 0.0000 (8) | not verified: the first send raised | 0.7700, 0.0000 (8) |
qwen3-0.6b, weight_only_wi8_afp32 |
0.6983 | 0.6933, +0.0050 (5) | refused: the render check failed | 0.6933, +0.0050 (5) |
qwen3-0.6b, dynamic_wi8_afp32 |
0.6983 | 0.6983, 0.0000 (10) | refused: the render check failed | 0.6983, 0.0000 (10) |
gemma-3-270m, dynamic_wi4b32_emb8_afp32 |
0.6717 | 0.2650, +0.4067 (262, resolved) | 0.2650, +0.4067 (262, resolved) | |
gemma-3-270m, dynamic_wi4b32_afp32 |
0.6717 | 0.3067, +0.3650 (251, resolved) | 0.3067, +0.3650 (251, resolved) | |
gemma-3-1b, dynamic_wi4b32_emb8_afp32 |
0.7533 | 0.6750, +0.0783 (75, resolved) | 0.6750, +0.0783 (75, resolved) | |
gemma-3-1b, dynamic_wi4b32_afp32 |
0.7533 | 0.6700, +0.0833 (82, resolved) | 0.6700, +0.0833 (82, resolved) | |
qwen2.5-0.5b, dynamic_wi4b32_emb8_afp32 |
0.7700 | 0.6867, +0.0833 (62, resolved) | not verified: the first send raised | 0.6867, +0.0833 (62, resolved) |
qwen2.5-0.5b, dynamic_wi4b32_afp32 |
0.7700 | 0.6933, +0.0767 (60, resolved) | not verified: the first send raised | 0.6933, +0.0767 (60, resolved) |
qwen2.5-0.5b, weight_only_wi4_afp32 |
0.7700 | 0.5200, +0.2500 (174, resolved) | not verified: the first send raised | 0.5200, +0.2500 (174, resolved) |
qwen2.5-0.5b, dynamic_wi4_afp32 |
0.7700 | 0.5017, +0.2683 (191, resolved) | not verified: the first send raised | 0.5017, +0.2683 (191, resolved) |
qwen3-0.6b, dynamic_wi4b32_emb8_afp32 |
0.6983 | 0.6483, +0.0500 (56, resolved) | refused: the render check failed | 0.6483, +0.0500 (56, resolved) |
qwen3-0.6b, dynamic_wi4b32_afp32 |
0.6983 | 0.6700, +0.0283 (55, resolved) | refused: the render check failed | 0.6700, +0.0283 (55, resolved) |
gemma-4-e2b, weight_only_wi8_afp32 |
0.7883 | 0.7833, +0.0050 (3) | 0.7833, +0.0050 (3) | |
gemma-4-e2b, dynamic_wi8_afp32 |
0.7883 | 0.7800, +0.0083 (11) | 0.7800, +0.0083 (11) |
Each cell is the candidate's exact match on banking77's 600 test rows and the
conversion cost, with the count of discordant rows. The four-bit recipes refused on
0.17.1 were refused on 0.18.0 for the same reason and with the same counts. At the
five-prompt gate: gemma-3-270m dynamic_wi4_afp32 (repeated itself on 5 of 5), Qwen3
dynamic_wi4_afp32, converted again (2 of 5), and weight_only_wi4_afp32 on
gemma-3-270m, gemma-3-1b and Qwen3, converted again (five prompts not done in 900 s).
Past the gate: gemma-3-1b dynamic_wi4_afp32 (repeated itself on 65 of 600).
The old Qwen bundles do not survive 0.18.0, and the two fail differently. From
v0.18.0 the runtime hands a bundle's template every message's content as a list of parts
(LiteRT-LM #3544); both Qwen checkpoints' templates read it as a string. verify
refused every Qwen3 bundle -- converted in September by litetune a few unreleased
commits after 0.1.6, with litert-lm-builder 0.16.1 -- at its rendering check, the
eight-bit ones on all 600 prompts (600 of 600 prompts differ; prompt 0: the runtime
renders 8 tokens and the reference 43) and the four-bit ones on all five prompts of
their gate. The runtime's rendering it recorded ends
<|im_start|>user\n<|im_end|>\n<|im_start|>assistant\n -- the user's text gone, and no
error -- where on 0.17.1 the same bundles rendered the reference's ids for all 600
prompts. Through each Qwen2.5 bundle, eight-bit and four-bit, verify stopped at the
same check: the runtime's first send raised litert_lm_conversation_send_message failed. The bundles converted again carry the checkpoint's own template behind a
block that turns a list of text parts back into the string: templates/qwen3-0.6b.jinja
and qwen2.5-0.5b-instruct.jinja as 02844df packaged them, which differ from the two
files litetune 0.4.0 packaged in Jinja comments only. Every one of those
verified in full rendered the same token ids as the reference for all 600 prompts and
scored what the 0.17.1 bundle scored. Up to 0.3.0 neither Qwen rule adds a template
(models.py at v0.3.0), so a bundle litetune 0.3.0 or earlier converted without a
template passed by the caller carries the checkpoint's template alone, as these did. A
Qwen3 0.6B or Qwen2.5 0.5B Instruct bundle converted by litetune 0.3.0 or earlier
without a template of the caller's has to be converted again for an application on
LiteRT-LM 0.18.0, as do some litetune 0.4.0 converted (the README's From LiteRT-LM
0.18.0 a template is handed a list of parts says which); what was measured is the
checkpoints at the revisions the templates name. litetune after 0.4.0 no longer
packages those two files: at export it puts the same block in front of whatever chat
template the converted checkpoint's own tokenizer carries. On 2026-10-11 the four
eight-bit bundles converted from the two tuned checkpoints by the litetune that does
this -- its code before it was rebased onto the stage-environment change (#70) --
each carried that composed file as their jinja_prompt_template, read back from the
bundle by convert itself, and the template convert read from each checkpoint had
the sha256 of the checkpoint template inside 02844df's file for it (a55ee1b1… for
Qwen3, cd8e9439… for Qwen2.5). Against 02844df's bundles their template differs only
in Jinja comments, and the rest of their metadata only in the order of the stop
tokens, which the exporter builds from a Python set (litert_lm_builder.py:216-254)
and which already differed between two bundles 02844df converted. Verified on
litert-lm 0.18.0, each rendered the reference's token ids for all 600 prompts and
scored what 02844df's bundle of the same recipe scored: Qwen2.5 0.7700, 0.0000 (8)
and 0.7717, −0.0017 (3), Qwen3 0.6983, 0.0000 (10) and 0.6933, +0.0050 (5), for
dynamic_wi8_afp32 and weight_only_wi8_afp32; the same four results came back at
each of the branch's five commits.
Which checkpoints get the block is the qwen-3 and qwen-2.5 patterns' to say
(models.py); one they do not claim gets none, and whether its template reads a list
is what verify's rendering check shows. From 0.4.3 the qwen-3 pattern hands a checkpoint
LiteRT-LM's own Qwen 3 template instead, where it is offered (below).
Every Qwen3 bundle up to 0.4.2 answers one message of a LiteRT-LM conversation. LiteRT-LM
renders the whole history on every message and requires the new rendering to start with the
previous one (Conversation::GetSingleTurnTextFromFullHistory; LiteRT-LM #3443). Qwen3's own
template renders the last assistant turn with an empty <think> pair and drops the pair once
the next user message arrives, so the second message fails with INTERNAL: The new rendered template string does not start with the previous rendered template string. Up to 0.3.0 a Qwen3
bundle carries that template alone (models.py at v0.3.0), and from 0.4.0 behind the block.
Measured on 2026-10-13 on Linux x86_64 on litert-lm 0.18.0's CPU backend, dynamic_wi8_afp32:
the tuned Qwen3 checkpoint converted by litetune 0.4.2 answered the first message and failed the
second, in both conversations tried; Qwen/Qwen3-0.6B as published, converted by the main branch
after #77, did the same with a reply cut at 64 tokens and with one of 512. Converted by #78's code,
both carry LiteRT-LM v0.18.0's models/qwen3/chat_template.jinja and answered every message sent
(three in one conversation; "Paris", then "Berlin" for the base model at 512 tokens, its reasoning
in the thought channel). The tuned bundle verified at 0.6983 for candidate and reference, cost
0.0000 (10), as before, with the reference's token ids for all 600 prompts. The Qwen2.5 and
Gemma 3 bundles of the same run held a three-message conversation. litetune 0.4.3 checks each
bundle's template for this after export and says in the report when one answers one message.
FunctionGemma's tool path, both grammar modes, 640 rows: the bundle converted on
2026-09-19 and the same checkpoint converted again at c7ee2da -- litert-lm-builder
0.18.0, the GPU activation key written, a relative --output-dir on Python 3.11 --
both score 0.9109 ±0.0221 against 0.9250 for the float reference, cost +0.0141
±0.0092 (resolved, 9 discordant), as on 0.17.1.
litert-lm-builder 0.18.0 reads and writes back a bundle the 0.17.1 runs measured.
The gemma-3-270m dynamic_wi8_afp32 bundle converted on 2026-09-15, unpacked and
packed again by builder 0.18.0, came out at the same 455,759,152 bytes. litert-lm-peek
lists every section of it at the same offsets with the same metadata; what differs is
the uuid and creation timestamp, which pack writes new, and the file's LiteRT-LM
version, 1.6.0 before and 1.7.0 after. Verified on 0.18.0, the repacked bundle scores
0.6783, −0.0067 (30), the original's numbers.
On a phone the GPU key is still needed. The September probe again on a Galaxy S24
(SC-51E) through Firebase Test Lab with litertlm-android 0.18.0, the same 20
native-tool-path FunctionGemma prompts and the same two bundles:
| bundle, backend | runtime | <pad> in the text |
no text and no call | right tool | first call exact |
|---|---|---|---|---|---|
| without the key, GPU | 0.16.1 (2026-09-05) | 14 of 20 | 0 | 3 | 2 |
| without the key, GPU | 0.18.0 | 0 | 8 of 20 | 9 | 6 |
fp32 key, GPU |
0.16.1 | 0 | 0 | 20 | 15 |
fp32 key, GPU |
0.18.0 | 0 | 0 | 20 | 15 |
fp32 key, CPU |
0.16.1 | 0 | 0 | 20 | 14 |
fp32 key, CPU |
0.18.0 | 0 | 0 | 20 | 14 |
Without the key the F16 failure no longer prints <pad>: eight rows come back with no
text and no call after 6.4 to 7.2 s each, where 13 of September's 14 flood rows took
14.5 to 19.1 s. Why the rows now come back empty is not established. Both runs without
the key also end two rows in a send error, where the runtime could not parse the call
the model wrote; no column of the table counts them. With the key the totals are
September's on both backends, though 4 of 20 GPU rows and 5 of 20 CPU rows return
different calls. First call exact compares a reply's first call only; comparing every
call, the fp32 GPU rows are 13 of 20 exact on 0.18.0 and 14 in September.
On LiteRT-LM 0.20.0
Measured 2026-11-26 on Linux x86-64 as On LiteRT-LM 0.19.1 below was, with the same data
and flags (Intel(R) Xeon(R) CPU @ 2.20GHz, every reference on an NVIDIA
A100-SXM4-40GB): one checkpoint per row, tuned once by the change that moves verify to
litert-lm 0.20.0, then converted and verified twice -- by litetune 0.9.1 (verify on
litert-lm 0.19.1) and by that change (verify on 0.20.0). Both export with the same set,
litert-torch-nightly 0.10.0.dev20260926 and litert-lm-builder 0.18.0.
| model | 0.19.1 (litetune 0.9.1) | 0.20.0 |
|---|---|---|
| gemma-3-270m-it | 0.6567 vs 0.6733, +0.0167 (30) | the same |
| Qwen2.5-0.5B-Instruct | 0.7683 vs 0.7717, +0.0033 (14) | the same |
| Qwen3-0.6B | 0.7000 vs 0.7000, 0.0000 (20) | the same |
| Qwen3.5-0.8B | 0.7867 vs 0.7833, −0.0033 (10) | the same |
| granite-4.1-3b | 0.7933 vs 0.7917, −0.0017 (9) | the same |
| MiniCPM5-1B | 0.7183 vs 0.7233, +0.0050 (17) | the same |
| functiongemma-270m-it, tool path | 0.9125 vs 0.9250, +0.0125 (10) | the same |
| gemma-3-270m-it, decision | mode plain: mean KL 4.48e-04, twin 4.20e-05 nats |
mode plain: the same |
| Qwen3-0.6B, decision | mode plain: mean KL 1.17e-03, twin 1.49e-04 nats |
mode plain: the same |
The cells read as in the 0.19.1 table. Every run passed on both runtimes, and every value
the two manifests of a row report under quality, cost, gates, decision and
liveness was equal -- 101 to 105 per row. On 0.20.0 the decision self-check says not dropped and picks mode plain, as on 0.19.1. The rows are the same numbers as on 0.19.1
for each model; that the 0.18.0 and 0.17.1 rows above them hold for these checkpoints too
is an inference from that, not a run. Text generation, the tool path and decisions were
re-measured, on the CPU; Gemma 4 pictures and the GPU were not.
EmbeddingGemma 2 pictures differ. One int8 file of the three-question fine-tune of
EmbeddingGemma 2 on images: several questions, verified on the steer question's 3,386
held-out pictures on a Mac mini's CPU (Apple M5 Pro, --threads 4): the 10-shot decider
scored 0.8682 on 0.19.1 and 0.8621 on 0.20.0, against 0.8719 for the float32 fine-tune
(cost +0.0037 and +0.0098, both inconclusive against the 0.0100 gate). On 0.20.0 every
one of the five draws resolved a cost above zero (+0.0077 to +0.0133, each ±0.0069 to
±0.0076); on 0.19.1 none did. On
200 of those pictures and 20 texts the same file's text vectors were bit-identical on the
two runtimes and its picture vectors were not (mean cosine 0.978, lowest 0.652). The
difference is the runtime's resize: both runtimes resize a 600×180 picture to 720×192 (540
patches, their own log line), and pictures given already at 768×192, which neither resizes,
came out bit-identical on 60 of 60. LiteRT-LM 0.20.0 calls the same stbir_resize of the
same stb commit with the same filter, but from a private copy (stb_resize.cc,
STB_IMAGE_RESIZE_STATIC, LiteRT-LM commit 72695230), so that it "neither exports nor clashes with
the stbir_* symbols of other stb_image_resize (v1 or v2) implementations linked into the
same binary"; 0.19.1's macOS library carries a stb_image_resize v1 symbol,
_stbir__resize_arbitrary. Which copy ran in 0.19.1 is not established, nor which resize
is the closer to the processor the fine-tune trained with. Picture vectors from 0.19.1 and
0.20.0 are not interchangeable.
The direction is not the same on every CPU. The same file on the same 3,386 pictures on Linux
x86-64 (Intel(R) Xeon(R) CPU @ 2.20GHz, --threads 4, reference on an NVIDIA A100) scored
0.8652 on 0.19.1 and 0.8667 on 0.20.0 against the same 0.8719 (cost +0.0067 and +0.0051,
inconclusive both times). On that machine, a fine-tune with the same recipe on pictures
resized once to 768×192, which neither the processor nor the runtime resizes again, lowered
the cost on one question and not the other, each against its own float32 fine-tune: on
steer 0.8538 against 0.8647 (+0.0109, inconclusive), on near's 7,687 held-out pictures
0.9611 against 0.9627 (+0.0016, passed), where the file trained on the raw pictures scored
0.9563 against 0.9626 (+0.0063, inconclusive).
On LiteRT-LM 0.19.1
Measured 2026-11-08 and 2026-11-09 on Linux x86-64: one checkpoint per row, tuned once by the
change that moves verify to litert-lm 0.19.1, then converted and verified twice -- by
litetune 0.8.1 (export on litert-torch-nightly 0.10.0.dev20260926 with litert-lm-builder
0.18.0, verify on litert-lm 0.18.0) and by that change (the same export set, verify on
0.19.1). Every candidate but the picture row's GPU cell ran on the CPU backend; the
banking77, tool-path and decision candidates on an Intel(R) Xeon(R) CPU @ 2.20GHz, every
reference on cuda. Banking77: the 600 held-out rows of split 0c7505b2b6f69ab1, LoRA
rank 16, alpha 32, one epoch at learning rate 2e-4, batch 8, sequences of 256, --scorer exact-text. The tool path: FunctionGemma's 640 mobile-actions rows. The decisions: the
emotion decision of Every family on emotion (two epochs for Gemma 3, one for Qwen3, 300
engine rows, dynamic_wi8_afp32 with a none float twin). Every bundle is
dynamic_wi8_afp32.
| model | 0.18.0 (litetune 0.8.1) | 0.19.1 |
|---|---|---|
| gemma-3-270m-it | 0.6567 vs 0.6733, +0.0167 (30) | the same |
| Qwen2.5-0.5B-Instruct | 0.7683 vs 0.7717, +0.0033 (14) | the same |
| Qwen3-0.6B | 0.7000 vs 0.7000, 0.0000 (20) | the same |
| Qwen3.5-0.8B | 0.7867 vs 0.7833, −0.0033 (10) | the same |
| granite-4.1-3b | 0.7933 vs 0.7917, −0.0017 (9) | the same |
| MiniCPM5-1B | 0.7183 vs 0.7233, +0.0050 (17) | the same |
| functiongemma-270m-it, tool path | 0.9125 vs 0.9250, +0.0125 (10); both grammar modes alike on 640 of 640 | the same |
| gemma-3-270m-it, decision | mode once: top option 0.9933, answer 0.9800, mean KL 4.48e-04, twin 4.20e-05 nats |
mode plain: the same four numbers |
| Qwen3-0.6B, decision | mode once: 0.9933, 0.9867, 1.17e-03, twin 1.49e-04 nats |
mode plain: the same four numbers |
| gemma-4-E2B-it tuned on pictures, 300 beans pictures | 0.8867 vs 0.8800, −0.0067 (4) | the same; on the GPU, text and vision, 0.8800, 0.0000 (4) |
Each banking77, tool-path and picture cell is the candidate's exact match against the reference's, then the conversion cost with the count of discordant rows. Every run passed, and every one rendered the reference's prompt token ids for all its prompts on both runtimes. The picture row is the seed-0 checkpoint of Gemma 4 E2B tuned on pictures: beans, converted by each side on another host, with an NVIDIA A100-SXM4-40GB; its 0.18.0 side was verified by 0.8.1 with the header probe's script renamed (#123), since 0.8.1's own CPU picture verify stops on that probe. On 0.19.1's GPU the runtime named the A100 (Vulkan) as its adapter, and the vision encoder was given the GPU.
- On 0.19.1 the decision self-check says
not droppedand picks modeplain, which scores right after the prefill (LiteRT-LM #3561 is fixed there); on 0.18.0 it picksonce. The 0.18.0 decision bundles carry--prefill_lengths=8,128and the 0.19.1 ones--prefill_lengths=128only: the same scores, to the digits shown. The decision verify took 137 s against 167 s for Gemma 3 and 415 s against 583 s for Qwen3; every banking77 and tool-path verify took between 0.6 % and 7.3 % less time on 0.19.1, one run each. - A first pass exported with
litert-torch-nightly0.11.0.dev20261107 and litert-lm-builder 0.19.1 instead. Its Qwen3.5 bundle did not load on 0.19.1 (Failed to allocate tensorswhen the engine was created). On an Apple M5 Pro, 2026-11-08 to 2026-11-10,Qwen/Qwen3.5-0.8Bas published,dynamic_wi8_afp32, one prompt on the CPU: exported bylitert-torch-nightly0.11.0.dev20261101 and 0.11.0.dev20261103 with--externalize_embedder, and by 0.11.0.dev20261107 three ways (--externalize_embedderwith and without--litert_lm_llm_metadata_override=none, and no flags), every bundle failed the same way on 0.19.1; onlitert-lm-nightly0.20.0.dev20261107 each loaded, the three exported without the exporter's own metadata override answered "Paris" and the two with it returned empty text. Exported by 0.10.0.dev20260926 with builder 0.18.0, it answered "Paris" on both. That version also gives the Qwen and MiniCPM5 families a metadata override fetched from LiteRT-LM'smainbranch at export time, which put another template into a Qwen2.5 bundle than the one handed over. So the export set stays where it was and only the runtime moved.
The headline numbers
| float | dynamic_wi8_afp32 |
weight_only_wi8_afp32 |
|
|---|---|---|---|
| Base model | 0.7266 ±0.0345 | — | — |
| Fine-tuned | 0.9172 ±0.0214 | 0.9016 ±0.0231 | 0.9047 ±0.0228 |
| Cost of conversion | — | +0.0156 ±0.0162 (unresolved) | +0.0125 ±0.0123 |
Fine-tuning gained +0.1906 ±0.0357, measured paired: only the examples where the two models disagree carry signal, and 136 of 640 did.
Pairing is not a refinement for its own sake. weight_only_wi8_afp32 costs
+0.0125, and the estimate is the same either way — what changes is what can
be said about it. Paired, the interval is ±0.0123, just clear of zero, so
the effect is resolved. Unpaired it is ±0.0312, which straddles zero and
would be reported as noise. Both sides answered the same 640 prompts; treating
them as independent samples throws away exactly the information that settles the
question.
The base figure is measured under a rendering the base did not learn
Read the base column with this in mind. The declaration properties in every
prompt above are rendered in declaration order, which is what the reference
consumer (flutter_gemma) emits. The jinja template inside the .litertlm we
ship renders them with dictsort — measured, eight occurrences, including on
declaration properties. On this dataset the two orders disagree for 100% of
rows, so one bundle presents two different prompts depending on which path a
consumer takes.
Which path this applies to. Everything in this section is about prompts an
application renders itself — prerendered, the path these runs took. Through
the runtime's tool path the runtime renders the declarations from JSON in the
order it is handed, and litetune hands it the file sorted the way the template's
dictsort sorts — the dictsort column below. There the rendering check found
the training prompt and the runtime's identical by token ids on all 640 prompts
of the run below.
Which order the weights prefer was argued rather than measured until it was measured. Same greedy decode, same parser, one variable:
| n | declaration order | dictsort |
paired difference | discordant pairs | |
|---|---|---|---|---|---|
| Base, held-out | 640 | 0.7266 | 0.7625 | −0.0359 ±0.0219 | 51 |
| Base, disjoint sample | 1280 | 0.7602 | 0.7789 | −0.0187 ±0.0099 | 42 |
| Fine-tuned, held-out | 640 | 0.9109 | 0.9141 | −0.0031 ±0.0087 (unresolved) | 8 |
The base cares and the fine-tuned model does not. For the base both runs
resolve, both favour dictsort, the intervals overlap at [−0.0286, −0.0140],
and the discordant pairs run three to one. After fine-tuning the same comparison
collapses: 51 discordant pairs become 8, and the difference is 0.0031 against an
interval of ±0.0087 — unresolved not for want of data but for want of an effect.
The mechanism is visible in the failures. It is not a parsing artifact — argument
dicts compare without regard to key order, so a reordered call scores the same.
What moves is which argument the model extracts: given a declaration in the
order it did not learn, the base returns email where the target wanted
phone_number. It had learned "the Nth property is X". Fine-tuning teaches it to
read the name instead, and the position stops mattering.
Two consequences for the headline table:
- The base column is understated, because it was measured in declaration order. Under the order the weights prefer it is 0.7625.
- The fine-tuning gain depends on which base you compare against, and both
are now measured rather than inferred: +0.1843 entirely in declaration
order, +0.1516 entirely in
dictsort. The published +0.19 sits above both because it pairs a tuned model measured at its best against a base measured at its worst.
contract.json records which convention a bundle was built under, so a consumer
is not guessing. On the evidence above that matters for a base or lightly-tuned
checkpoint and is close to free for a fully fine-tuned one — but "close to free"
is a measurement on one model and one dataset, not a property of the method.
What three runs of the same thing disagree about
The same recipe sweep, run three times on the same data with the same code. B and C are the identical shipping configuration; A differs only in the bundle's declared model type, which the text-parsing measurement cannot observe:
| run A | run B | run C | |
|---|---|---|---|
| Base, float | 0.7266 | 0.7266 | 0.7266 |
| Fine-tuned, float | 0.9094 | 0.9172 | 0.9062 |
dynamic_wi8_afp32 |
0.8906 — resolved | 0.9016 — unresolved | 0.8969 — unresolved |
weight_only_wi8_afp32 |
0.9141 — unresolved | 0.9047 — resolved | 0.9000 — unresolved |
| Gap between recipes | 0.0235 | 0.0031 | 0.0031 |
On a phone. The run-A dynamic_wi8_afp32 bundle, repacked with
prefer_activation_type = fp32 (see README, Limitations), on one Snapdragon
Galaxy S24 (SC-51E, Android 16), native tool path, greedy, 640 rows:
| device CPU | reference (run A) | |
|---|---|---|
| exact match | 0.8703 ±0.0260 | 0.8906 |
| tool name | 0.9812 | — |
| produced a call | 634/640 | — |
| per prompt, median | 3.3 s (2.3 s cold, 3.2 s warm: the phone throttles) | — |
Difference −0.020 against run A, inside the device interval; −0.031 and −0.027
against runs B and C, just outside it. The same bundle on the device's GPU,
20 rows: 20/20 tool names and 15/20 exact with the key, 3/20 and 2/20 without
it (<pad> floods; the engine reports success either way). GPU per prompt
1.4 s with the key against 2.5 s on the device CPU for the same file.
The recipes swap places, and which cost resolves moves with them. An earlier draft of this file read "the two recipes differ by 0.0234 on the same weights at the same bit width" and drew a conclusion from it. Two further runs put that gap at 0.0031 and 0.0031. The gap was noise, and a single run had presented it as a finding.
Across all three, the conversion cost resolves in 2 of 6 recipe-runs -- and
B and C, which are the same configuration end to end, still disagree about
weight_only.
So what is actually established is narrower than one run suggests, and worth separating:
- The base figure is 0.7266, identical to four decimal places in all three,
and reproduced across a rebuilt container image, a
transformersmajor version change, new batching code and a rewritten parser. - Fine-tuning gains about +0.18, resolved in every run, on 132-136 discordant pairs. The spread across runs is 0.0109 — an order below the effect.
- Conversion costs something small — 0.0063 to 0.0187 across runs — and whether 640 examples resolve it is close to a coin flip. At this effect size the method is at its limit, and one run's verdict should not be quoted as the answer.
That last line is the tool working, not failing. A single accuracy number would
have shown none of this; three points and a paired interval show exactly where
the evidence stops. If you need to separate two recipes this close, you need
more held-out examples than 640 — and verify will keep saying "unresolved"
until you have them, rather than picking a winner.
Nothing in the file size, the exit code, or the logs separates those two artifacts: they are 455,759,152 and 455,939,600 bytes, 0.04% apart. Running both against held-out data is the only thing that does.
Which CPU each run's candidate ran on was not recorded, and "the same configuration end to end" did not include it. On litert-lm the CPU model changes the arithmetic about as much as the runtime version does (see Which runtime a number was taken on). The fine-tuned float scores differ between the three runs as well, so the spread above is not the CPU's alone; how much of the converted numbers' spread is the CPU's cannot be separated after the fact.
Three points rather than two, because only the differences mean anything. A single accuracy figure for a converted model cannot distinguish a good conversion of a bad model from a bad conversion of a good one.
One verify run measures two of them, not three. It compares the converted
model against one reference, and which reference you name decides which
difference you get:
--reference-role |
reference is | you get | you do not get |
|---|---|---|---|
float_twin (default) |
the checkpoint the artifact was converted from | conversion cost | training gain |
untuned_base |
the model before you trained it | neither — the difference confounds them | both |
The headline table therefore comes from two runs, not one. verify reports the
missing figure as unavailable with the reason, rather than deriving it from
the two points it has — deriving it is the mistake the third point exists to
prevent. Composing the three into a single command is the first thing on the
list after this alpha; the README's Limitations records what is not wired.
The same model on an NPU
functiongemma-270m-it with its base weights (the fine-tuned checkpoint has
not been through this yet), through litert-torch's npu_export stages — the
dynamic_wi8_afp32 export, calibration on 64 tool prompts disjoint from the
20 scored, static int8, Qualcomm compile with ai-edge-litert-sdk-qualcomm
2.2.0 (QAIRT 2.47), litert-torch-nightly 0.10.0.dev20260826 — for SM8750,
run on a Galaxy S25 (Android 16) through the LiteRT-LM C API of the
native-v0.16.0 runtime tarball (a LiteRT-LM v0.16.1 tree) on the NPU,
greedy, 20 rows per set, 2026-09-08. Each median is the upper of the two
middle values at n=20.
| prompt set | tokens | prefill chunks | cache_length 1024 (earlier builds, similar sets) |
cache_length 896 |
|---|---|---|---|---|
| plain question | 17–73 | 1 | coherent | 20/20 coherent, median 389 ms |
| filler, question last | 208–250 | 2 | garbage | 20/20 address it, median 465 ms |
| tools + request | 579–635 | 5 | 0/20 parsed | parsed 13/20, tool name 12/20, exact 3/20, median 441 ms |
Same 20 tool prompts, CPU interpreter: the dynamic_wi8_afp32 stage-1 graph
20/20 parsed, 19/20 name, 12/20 exact; the static-int8 stage-3 graph 20/20,
18/20, 12/20. So at 20 rows quantization shows no cost beyond one tool-name
row, and the nine exact rows the NPU loses are its own decode: one to syntax
the runtime's parser rejects (a stray }), one to a prose reply instead of a
call, one to the wrong tool named first of two calls, six to a wrong or
missing argument in an otherwise well-formed call. On
SM8750 the 1024→896 difference tracks the compiled prefill graph's attention
mask crossing ~1.0 MiB (litert-torch#1184; the rule is stated under Known to
be broken in the README); LiteRT-LM#3508 has the full table across two SoCs,
Google's bundles included, and one published bundle that works above the
line. One SoC, base weights, 20 rows: a status, not a figure.
A second family, and the second scorer
Everything above is one model and one scorer. This section is the first run of
anything else: google/gemma-3-270m-it @ ac82b4e8, LoRA r16/α32, lr 2e-4,
one epoch over 2,400 rows of mteb/banking77 — 77-way intent classification,
target is label_text — scored on 600 held-out rows (split
0c7505b2b6f69ab1) with --scorer exact-text and a 256-token limit, prompt
mode runtime_rendered, litert-lm 0.16.1's CPU backend against a float twin on
one A100-SXM4-40GB. Training ran in bfloat16 on that GPU. Everything not named
here was left at its default.
The prompt mode is what changed. An earlier version of this section measured
the same checkpoint prerendered — the runtime told not to apply the model's
chat template, to prompts that are bare user text — and reported 0.6933, 0.6767
and 0.6917. Those numbers are withdrawn, not adjusted: they describe a model
answering a prompt no caller sends. Here tune was given no --prompt-mode,
inferred runtime_rendered because 0% of the 2,400 training prompts carry a
control token, and recorded that beside the checkpoint; verify read the mode
back from that record rather than inferring it again. Before generating
anything it rendered all 600 held-out prompts through the runtime's own
conversation path and through the reference's chat template: identical token
ids on all 600, and the runtime's prefill count equal to the reference's on the
eight it also sent.
| float | dynamic_wi8_afp32 |
weight_only_wi8_afp32 |
|
|---|---|---|---|
| Base model | refused | — | — |
| Fine-tuned | 0.6717 ±0.0376 | 0.6717 ±0.0376 | 0.6683 ±0.0377 |
| Cost of conversion | — | +0.0000 ±0.0190 (unresolved, 34 discordant) | +0.0033 ±0.0131 (unresolved, 16 discordant) |
On litert-lm 0.16.1. The same bundles on 0.17.1 are at the end of this section.
Both costs are unresolved, and that is the finding. At n=600 each interval contains zero, so this run establishes only that neither quantisation moved accuracy far — the dynamic estimate's own interval reaches +0.0190, so "far" here is up to about two points, not that either recipe is free. That recipe also shows why a score is not an answer: it lands on the same 0.6717 as the float twin and still disagrees with it on 34 of 600 prompts, in both directions. What resolves a paired difference is neither the row count nor the number of disagreements but the imbalance between the two directions of disagreement, set against the square root of how many there are: more disagreement widens the interval as well as feeding the estimate. The FunctionGemma conversion cost above clears its own interval at n=640 on 16 discordant pairs, and by a hair — +0.0125 against ±0.0123. Here there are 34 and 16, and neither imbalance is large enough for the interval it has to buy.
What the run established that the table does not show
The family rule was tested on the case it exists for. gemma-3-270m-it and
functiongemma-270m-it both declare model_type: gemma3_text; the export
needs different overrides for each. convert resolved this checkpoint to
gemma-3-text and added --litert_lm_model_type_override=gemma3 — the first
time that disambiguation ran on a real export rather than in a unit test.
The exact-text scorer was wrong before this pair was first measured, and this
pair is what found it. The transformers reference backend decodes with
skip_special_tokens=False so the liveness tier can see leakage, and every
generation it returns ends in a terminator. Under exact-text — whitespace
forgiven, nothing else — that scored the fine-tuned float reference at
0.0000 on all 600 rows while the runtime side scored 0.6767, and verify
reported a resolved "conversion cost" of −0.6767 across 406 discordant
pairs — the imbalance the section above describes, at its limit. It did flag
the reference-at-zero as not being evidence; the number was still wrong, and
tool-call had hidden the asymmetry on every earlier run because its parser
ignores trailing markers. Fixed in 0.1.5, though not the way the first attempt
tried: trimming both sides scored a model that dropped a closing tag on every
row at 1.0000, so the rule became "the generation must still contain every
terminator the target ends with, counting repeats and in that order, and any
terminator beyond that is ignored". That 0.6767 belongs to the withdrawn
prerendered run; the table above is from the re-measurement under the fixed
scorer, and the rule that replaced it changes neither — these targets are bare
labels carrying no marker, the case in which the two rules are the same
function.
What the terminator actually is, measured rather than assumed. Two different markers are in play here, and an earlier draft of this branch confused them.
The base checkpoint stops on its chat template's own close: run on 20 of
these held-out prompts at max_new_tokens=64, all 20 closed their turn and all
20 ended in <end_of_turn> alone, for an unterminated share of 0.000.
generation_config.eos_token_id is [1, 106] — <eos> and <end_of_turn> —
so generation halts at the close and never reaches the tokenizer's eos.
functiongemma-270m-it has the same shape, with <start_function_response>
added to the set.
The tuned model ends on whichever marker the mode it trained under put
there, and that is the second thing the re-measurement changed. In
runtime_rendered, tune renders the chat template around every prompt and
takes the terminator from that template: metrics.json records
turn_terminator: {ids: [106, 107], source: "chat_template", text: "<end_of_turn>\n"}, training appended exactly that to every completion, and
contract.json carries it into stop_tokens. The earlier prerendered run of
the same checkpoint took the tokenizer's eos instead — {ids: [1], source: "tokenizer_eos", text: "<eos>"} — because a prerendered prompt is not
templated, so there is no template close to read. Both markers are in the
scorer's vocabulary, recorded verbatim at harness.terminators in every verify
manifest, which is why neither run was mis-scored — but they are not the same
marker, and which one a given artifact emits depends on how it was trained, not
on its family.
An earlier draft asserted instead that Gemma emits <end_of_turn>\n<eos> — two
markers, newline between — in its docstrings, its tests and its commit message.
It does not, for either supported family. The stacked shape belongs to a family whose
eos set excludes its own template close, which is why the trimmer strips
whitespace between removals; that case is constructed in the tests and labelled
as such.
What it did not establish. No untuned-base score, and not for want of
running it: the base was converted and measured in this same mode, and refused
at the liveness tier — asked for one intent label it returned nothing at all on
53 of 600 prompts, so verify stopped before scoring either side, as The base
model could not be scored at all below describes. Training gain is therefore
unattributed, and prepare could not identify slices where the base already
scores at ceiling. The candidate ran on CPU only — no GPU or NPU figure for this
family. Training ran in bfloat16 on the A100; the single-core bfloat16 behaviour
that made an earlier run of this pair train in float32 is a property of that
Mac's CPU and says nothing about this one.
Limitations carried by these manifests
Four, paraphrased:
- The candidate ran on litert-lm's CPU backend. The wording these manifests carry is the
corrected one: litert-lm's GPU backend is a different executor and this number
does not predict it, pointing at README's limitations section rather than
quoting figures. The earlier wording, which this run predates, said published
reports put the GPU backend materially below CPU on identical artifacts. That
was true of bundles without the GPU activation key and not of bundles with it:
on the one device measured, a repacked bundle at
prefer_activation_type = fp32scored 15/20 against the CPU's 14/20 at 1.8× the speed, which at n=20 is not a resolved difference — see the table inexport.py.convertattempts that repack on every bundle, and names the ones where it could not, or where a different value was already declared; one already declaringfp32needs no warning and gets none. Figures belong in the documents, where the conditions that make them readable sit beside them, and not in a per-run limitation that would carry another run's numbers into every manifest. - The candidate ran on CPU and the reference on CUDA, so the difference carries a hardware difference as well as a conversion one. Training ran in bfloat16 on that same A100; export passes no dtype and the float reference loads at float32, so the dtype mismatches neither side — the device does, and this is the limitation that records it.
- Decoding parameters were passed to transformers but not to litert-lm, which
used the pinned runtime's defaults; both are greedy, and the token limit is
unverified on the runtime side. In the withdrawn
prerenderedrun that limit is what the base model ran into; in the re-measurement it returned nothing at all instead — see the subsection after this one. - The sample does not resolve the difference: +0.0000 lies inside ±0.0190 at n=600, on 34 of 600 discordant examples.
The base model could not be scored at all
The untuned gemma-3-270m-it was converted and run over the same 600 prompts in
both prompt modes, and verify refused to score it both times — for different
reasons, which is itself worth recording. prerendered: 571 of 600 generations
repeat themselves above the 0.50 threshold, the worst at 0.9995, running on
until the token limit. runtime_rendered, the re-measurement: 53 of 600
generations are empty after decoding, a share of 0.0883 against a threshold of
0.0000. Either way the run ends at failed_smoke, before the quality tier:
asked to answer with one intent label, the base does not emit a label and
stop.
That refusal is the point. An exact-match score against those generations would have been a number — near zero — and it would have read as "the base is bad at this task". What actually happened is that the base never answered the question in the shape the task requires, which is a different claim, and the one that explains why fine-tuning moved so much. A liveness tier that scored it anyway would have turned "this model does not do the task" into "this model does the task badly".
It also means the training gain here is unattributable in principle, not just
unmeasured: there is no base figure to subtract, and manufacturing one from a
degenerate run would be the mistake attribution exists to refuse.
gemma-3-270m on litert-lm 0.17.1
The same bundles and rows, verified again as The banking77 sections on litert-lm 0.17.1 describes. The two runs differ in runtime, transport and possibly CPU, so a difference between the rows is not attributed to the runtime.
| float | dynamic_wi8_afp32 |
weight_only_wi8_afp32 |
|
|---|---|---|---|
| 0.16.1 run | 0.6717 ±0.0376 | 0.6717 ±0.0376 | 0.6683 ±0.0377 |
| 0.17.1 run | 0.6717 ±0.0376 | 0.6783 ±0.0374 | 0.6750 ±0.0375 |
| Cost of conversion, 0.17.1 run | — | −0.0067 ±0.0179 (unresolved, 30 discordant) | −0.0033 ±0.0113 (unresolved, 12 discordant) |
Neither cost resolves in either run. The float reference is the same to four places; the discordant rows are 30 and 12, against 34 and 16.
A third family, and the marker the vocabulary did not know
The two sections above measure models this project fine-tuned. This one opens
with neither: it compares two conversions of the same base weights --
google/gemma-4-E2B-it, untouched -- because models.py records that a Google
engineer recommends two recipes "to remain the model quality" and, in the same
sentence, that litetune had measured neither. The two subsections after it do
fine-tune that checkpoint, and the second converts and verifies one of those
runs.
600 held-out rows of mteb/banking77 with all 77 labels listed in the prompt,
--scorer exact-text, 256-token limit, prompt mode runtime_rendered,
reference role float_twin. The labels are in the prompt because these are base
weights that never saw this task and cannot guess a snake_case label out of 77;
without them the reference sits on the floor and nothing can be attributed. The
reference is google/gemma-4-E2B-it at float32 on one A100-SXM4-40GB, greedy;
both candidates run on litert-lm 0.16.1's CPU backend in the same container, 12
vCPU. Export environment transformers==5.17.0, numpy==2.0.2.
| exact match | cost of conversion | discordant | |
|---|---|---|---|
| float reference | 0.5983 | — | — |
Google's published gemma-4-E2B-it.litertlm |
0.5717 | +0.0267 ±0.0277 (unresolved) | 72 of 600 |
dynamic_wi4b32_afp32, exported here |
0.5483 | +0.0500 ±0.0244 (resolved) | 56 of 600 |
What it establishes. An export made here cost something measurable on this task. Google's published artifact's cost did not resolve at this sample size.
What it does not. That either is worse than the other. Each was measured
against the float reference and not against the other, and the intervals
overlap: [-0.001, 0.054] against [0.026, 0.074]. Nor are the two the same kind
of object -- Google's comes from a quantized-safetensors path litert-torch does
not support, so float_twin is exact for the export here and looser for
theirs. One run.
The resolved difference rests on fewer disagreements than the unresolved one -- 56 against 72 -- which is the arithmetic the second family's section describes, seen from the other side.
What this run established that the table does not show
One of the two recommended recipes does not build at all.
dynamic_wi4c_hr_afp32, the first one named, fails inside the quantizer:
hadamard_rotation.py calls ndarray.reshape(..., copy=False), a keyword that
arrives in NumPy 2.1, while the export environment pins numpy==2.0.2 because
the toolchain requires it. convert exits 1 and reports export: failed. The
recipe is unreachable on this pin -- not measured and found wanting.
The static terminator vocabulary refused this family, exactly as README said
it would. Gemma 4 closes a turn with <turn|>; the vocabulary knew
<end_of_turn>. All 600 reference generations ended in a marker scoring did not
recognise, so verify stopped before scoring either side. That is the safe
direction and it is also useless until the vocabulary learns the marker. It has
since: terminators_trimmed then read 600 of 600, one marker each. The table
above is from the re-run.
What the projection set is worth, on this family
Scoping says where a LoRA run may adapt. It does not say which projections,
and there models.py made a choice it could not defend with a number: litetune
names seven, while peft 0.20.0's own mapping for gemma4 is
.*language_model\..*\.(q_proj|v_proj) -- two -- and Google's fine-tuning guide
passes no target_modules at all so that default applies. So both were run.
google/gemma-4-E2B-it fine-tuned on 2,400 rows of mteb/banking77, scored on
the 600 held-out rows of split 0c7505b2b6f69ab1 with --scorer exact-text,
prompt mode runtime_rendered, greedy, on one A100-SXM4-40GB. One base, one
split, one set of hyper-parameters; the projection set is the only difference,
and everything not named here was left at litetune's default.
The run passed no --revision, so it took whatever main pointed at that day:
3e22461f65e89153144f8adb70e3b8c2cc9845a7, read back afterwards from the
snapshot directory and refs/main in the cache rather than recorded by the run
itself. Both arms downloaded once into the same cache, so they share it; a
later run on this family should pin it.
Both arms ran on the branch that added lora_container, not on a release. No
released litetune could have produced arm A: up to 0.1.8 tune hands peft the
bare projection list, and on this checkpoint that stops in get_peft_model --
the vision and audio projections are Gemma4ClippableLinear wrappers and peft
0.20.0 dispatches on a bare nn.Linear. Arm B reproduces peft's own gemma4
default, which is a container regex for the same reason.
| exact match | trainable parameters | |
|---|---|---|
| seven projections, as shipped | 0.7883 ±0.0327 | 24,158,208 |
q_proj and v_proj, peft's own default |
0.5483 ±0.0398 | 2,678,784 |
Paired, the difference is +0.2400 ±0.0457, resolved, on 196 of 600 discordant. The interval would have to be more than five times wider to contain zero.
What it establishes. On this task the projection set matters more than the model does. The seven checkpoints measured on this split span 0.6717 to 0.7883 -- 11.7 points between the smallest checkpoint and the largest -- and changing which projections a LoRA run adapts moved one checkpoint 24. Taking peft's default would have left 5.1 billion parameters scoring 0.5483, below every other family here.
What it does not. That seven is the right number, that a third set would not do better, or that any of this holds on another task or another family. It is two points on one task.
Not the kind of number the table above carries. Those are converted artifacts against a float twin. These are two float checkpoints against each other with no conversion between them, so the difference is training and nothing else. Arm A's checkpoint was then converted and verified, which is the section below.
End to end, on the seven-projection checkpoint
Arm A is google/gemma-4-E2B-it at 3e22461f65e89153144f8adb70e3b8c2cc9845a7
-- the commit read back from the cache after the run rather than pinned by it,
as the section above records. Its tuned weights through convert and verify:
two eight-bit recipes, the same 600 held-out rows of split 0c7505b2b6f69ab1, --scorer exact-text,
prompt mode runtime_rendered, greedy. Candidate on litert-lm's CPU backend in
the same container as the tuning run, 12 vCPU; reference on the A100 through
transformers.
litetune 0.1.8; runtime litert-lm==0.16.1, numpy==2.0.2; reference
torch==2.5.1, transformers==5.16.1, peft==0.20.0,
sentencepiece==0.2.0.
| float | dynamic_wi8_afp32 |
weight_only_wi8_afp32 |
|
|---|---|---|---|
| Fine-tuned, seven projections | 0.7883 ±0.0327 | 0.7667 ±0.0338 | 0.7700 ±0.0337 |
| Cost of conversion | — | +0.0217 ±0.0142 (resolved, 19 discordant) | +0.0183 ±0.0108 (resolved, 11 discordant) |
On litert-lm 0.16.1. The same bundles on 0.17.1 are at the end of this section. Sizes are 5,071,853,520 and 5,072,115,888 bytes.
On 0.16.1 both eight-bit costs resolve, which no earlier section here has had
happen together. Each recipe has resolved before on its own:
dynamic_wi8_afp32 in run A of the FunctionGemma triple, on both phone backends
for Qwen3-0.6B, and on the tool path; weight_only_wi8_afp32 in FunctionGemma's
run B, on Qwen3-0.6B and on gemma-3-1b (on 0.16.1; on 0.17.1 neither does). What
has not happened before is both in one run -- the closest is the FunctionGemma
triple, where run A resolved one recipe and run B the other.
What that does not establish. This checkpoint is roughly five times the
largest measured before it, and it is tempting to read the resolution off the
size. Nothing here separates size from the rest: one run, a different family,
a different litetune version. dynamic_wi8_afp32 resolved on a 0.6B bundle on
a phone, so resolution is not gated on size -- and what buys an interval is
the imbalance among the discordant pairs, which this file says three times
over.
Limitations carried by these two numbers. The candidate ran on
litert-lm's CPU backend and the reference on cuda, so each cost carries a
hardware difference as well as a conversion one; verify reports that rather
than refusing it. Decoding was passed explicitly to transformers and not to
litert-lm, which used the pinned runtime's defaults; both are greedy. And
weight_only_wi8_afp32 shipped with no prefer_activation_type -- its repack
did not finish inside the repack ceiling (REPACK_TIMEOUT_S, 300 s, or less if
the recipe's export timeout had less left), and the original was kept. That
ceiling is documented as a bound on a stalled tool rather than a budget,
chosen when a real repack of a 455 MB bundle finished in seconds; a 5 GB
bundle is the case it was not sized against. That does not
touch the number above, whose candidate ran on CPU, but the bundle as shipped
is not the one to hand a GPU.
Gemma 4 E2B on litert-lm 0.17.1
The two bundles above, each SHA-256 equal to the one convert recorded on
2026-09-22, verified again on 2026-09-29 with litetune 0.2.0 (commit dfb4544) on
litert-lm 0.17.1, against the same checkpoint on the same 600 rows, and
otherwise as The banking77 sections on litert-lm
0.17.1 describes. Both manifests
record the candidate on Intel(R) Xeon(R) CPU @ 2.20GHz with AVX-512 and 12
vCPU, and the reference on cuda. The two runs differ in runtime, transport and
possibly CPU, so a difference between them is not attributed to the runtime.
| float | dynamic_wi8_afp32 |
weight_only_wi8_afp32 |
|
|---|---|---|---|
| 0.16.1 run | 0.7883 ±0.0327 | 0.7667 ±0.0338 | 0.7700 ±0.0337 |
| 0.17.1 run | 0.7883 ±0.0327 | 0.7800 ±0.0331 | 0.7833 ±0.0330 |
| Cost of conversion, 0.17.1 run | — | +0.0083 ±0.0108 (unresolved, 11 discordant) | +0.0050 ±0.0057 (unresolved, 3 discordant) |
Both costs resolved on 0.16.1 and neither does here: +0.0217 on 19 discordant rows, sixteen one way, and +0.0183 on 11, all eleven one way, there; +0.0083 on 11, eight one way, and +0.0050 on 3, all three one way, here. That is two runs' verdicts, not a measured change in a cost, and neither run is withdrawn. The float reference is the same to four places. The conversions of the base weights in this family's first table were not re-measured.
Gemma 4 E2B without its towers
Google's gemma-4-E2B-it.litertlm (litert-community/gemma-4-E2B-it-litert-lm
at b3ca0d2f, sha256 181938105e0eefd1…), measured with litert-lm 0.18.0's
Python API on the CPU backend, on an AMD EPYC 7B12. Nothing here is
a tuned model or a litetune export; it is the bundle Google ships, and the
question is only what dropping its towers changes.
Its six tower sections -- audio_encoder_hw, audio_adapter, end_of_audio,
vision_encoder, vision_adapter, end_of_vision -- are 332,387,932 of its
2,588,147,712 bytes, 12.8 %. litetune towers --drop vision --drop audio, with pull
request #68's code at its commit Answer the full review of litetune towers
(2026-10-10; f14542a before a rebase that left towers.py unchanged), wrote
2,255,690,576 bytes with every kept section byte for byte, LlmMetadata included, in
22.5 s; litert-lm describe lists text as its only input modality, on CPU and GPU,
and still reports the metadata's Max Vision Token Budget: 280. A first measurement
on 2026-10-09 used a script of its own that compared the metadata in the text form
unpack writes, which had lost 2 bytes of it (gemma4 field 13, which 0.18.0's
proto reserves); its file had the same length and gave the same answers.
Eight prompts, greedy, at most 128 output tokens, a fresh conversation each, each bundle in its own process:
| answers equal to the full bundle's | engine load | peak RSS | |
|---|---|---|---|
| full bundle | — | 3.88 s | 1,620.5 MB |
what towers --drop wrote |
8 of 8 | 3.89 s | 1,620.8 MB |
On this CPU backend the saving is download and storage, not memory.
An image (a red 256×256 PNG, "What colour is this image? Answer in one word.") and an audio clip (one second of a 440 Hz tone, "Describe this sound in one sentence."), engine opened without and with the matching backend:
| bundle | input | backend | result |
|---|---|---|---|
| full (2026-10-09) | image | — | the send raises litert_lm_conversation_send_message failed |
| full (2026-10-09) | image | vision | "Red" |
| full (2026-10-09) | audio | — | the send raises the same error |
| full (2026-10-09) | audio | audio | "The sound is a high-pitched, sustained tone with a slightly wavering quality." |
towers --drop output |
image | — | the send raises the same error |
towers --drop output |
image | vision | the engine is not created: Failed to create LiteRT-LM engine |
towers --drop output |
audio | — | the send raises the same error |
towers --drop output |
audio | audio | the engine is created, the conversation is not: Failed to create conversation |
The full bundle answering both is the control. Without its towers every media input raised an error and none produced text; where it raised depends on the modality and on how the engine was opened -- an application that opens the engine with a vision backend cannot load the bundle at all, even for text. Only the Python binding on one x86-64 CPU was observed -- not the Kotlin, Swift or C bindings, and not a phone.
Towers grafted into an SM8850 NPU bundle
A text-only Gemma 4 E2B build compiled for the SM8850 NPU, not published in
litert-community/gemma-4-E2B-it-litert-lm, carries an aux section, the
embedders, an NPU prefill_decode, a tokenizer, and LlmMetadata that names no
model type and no media token. Its tokenizer gives every text, image and audio
token the same id as the CPU/GPU bundle's, and differs from id 258,884 on, where
the CPU/GPU one has <|video|>.
litetune towers --add vision --add audio --metadata-from-donor, with pull request
#68's code at its commit Answer the full review of litetune towers (2026-10-10;
f14542a before a rebase that left towers.py unchanged), with the CPU/GPU bundle
above as the donor, wrote the build's own sections, the donor's LlmMetadata (all
12,192 bytes) and its six tower sections, each byte for byte, in 24.7 s. Each added
adapter writes 1,536 values per token, as the build's embedder does; the 8 token
strings and ids the donor's metadata names as tokens are the same pieces at the same
ids in both tokenizers; and the report lists the fields the donor's metadata changes
as the builder's text form shows them, 21 of them: the channels, the Jinja prompt
template and the older prompt_templates, the gemma4 model type and its fields,
the stop tokens. Without --metadata-from-donor it refused, because the build's own
metadata names no model type.
Run on 2026-10-10 on a Galaxy S26 (Build.SOC_MODEL SM8850) through Firebase Test
Lab, through LiteRT-LM v0.18.0's C API (the libLiteRtLm.so of flutter_gemma's
native-v0.18.0-a release), its prefill_decode graph on the NPU and the
embedders, the aux graphs and the towers on the CPU, greedy. The route is
flutter_gemma's: its libLiteRtLm.so and Qualcomm dispatch library, with QNN
2.51.0; the Maven litertlm-android AAR's Backend.NPU was not tried. The harness
on the phone records the model file's length, not its hash. Engine load below is
timed to the end of the first prompt's reply, as the harness times it:
| input | result | engine load and first reply |
|---|---|---|
| eight text prompts, engine opened without media backends | 8 of 8 identical to the build's own, as received (2026-10-09) | 1.33 s |
| the red PNG, "What colour is this image? Answer in one word." | "Red" | 8.25 s, the first reply being this one, one engine with both media backends |
| the 440 Hz tone, "Describe this sound in one sentence." | "The sound is a high-pitched, sustained tone that fades slowly." | |
| "What is the capital of Portugal? Answer in one sentence." | "The capital of Portugal is Lisbon." | |
| the red PNG and the tone in one turn, "What colour is the image, and what does the sound sound like? Answer in one sentence." | "The image is red, and the sound is not audible." | 8.36 s |
The turn with both inputs is answered for the image and not the tone, as Google's own bundles answer it through the same runtime and harness: Google's unmodified CPU/GPU bundle on the same phone model, text and towers on the CPU, answered it word for word the same, from the same 314 prefill tokens, and Google's own SM8750 NPU bundle on a Galaxy S25 answered "The image is red, and there is no sound in the image."
In each run's logcat the Qualcomm dispatch library is loaded, the QNN backend is
Htp(2), libQnnHtpV81Skel.so is opened over FastRPC, four Found qnn graph lines
name the compiled graphs, and LiteRT-LM logs Detected NPU prefill size and runs
LiteRT NPU Compiled Model; the towers' XNNPACK caches appear only in the media
runs. LiteRT-LM logs no error. Every run also logs 292 error-priority lines that
stop nothing: QNN logs 280, memory handles it could not deregister, while the engine
is deleted after the last reply -- as Google's own SM8750 bundle does on its phone
-- and FastRPC logs 12 while it opens the DSP session, before the skel loads. The
same composition built on 2026-10-09 with litert-lm-builder 0.18.0 directly, and one
with the towers of Google's own SM8750 NPU bundle instead, gave the same three media
answers word for word. One image, one tone and eight text prompts on one phone: this
shows the grafted bundle loads and answers both modalities on the device it was
built for, and that its text answers did not change. It is not a measurement of
image or audio quality. It ran with Qualcomm's QNN runtime 2.51.0
(com.qualcomm.qti:qnn-runtime on Maven Central), with a logcat warning, Qnn backend library version 5.51.0 is used. The version LiteRT using is 5.50.0.; with
the QAIRT 2.47.0 libraries the engine was not created on the same phone, though the
bundle's context binary is 2.47.0.
Gemma 4 E2B tuned on pictures: beans
Measured 2026-11-05 with litetune's own stages at the commit that added them
(unreleased): tune → convert --recipe dynamic_wi8_afp32 → verify --scorer exact-text, on one A100 40GB (tune and the reference) and the same machine's 12-vCPU
Intel Xeon @ 2.20GHz (the candidate, litert-lm 0.18.0, CPU text and vision backends).
google/gemma-4-E2B-it at 3e22461f; rows from AI-Lab-Makerere/beans at 27aa014c,
the 1,165 pictures of EmbeddingGemma 2 on images: beans (500×500 JPEG), one question
per picture asking for its label, the label as the answer. LoRA r16/α32 on the seven
projections, lr 2e-4, 2 epochs, batch 8; each picture took 256 soft tokens.
| split | float reference | dynamic_wi8_afp32 bundle |
cost of conversion (paired) |
|---|---|---|---|
| prepare's own split (865 / 300) | 0.8633 | 0.8667 | −0.0033 ±0.0065, 1 of 300 discordant, unresolved |
| the EmbeddingGemma 2 beans split (865 / 300) | 0.8800 | 0.8867 | −0.0067 ±0.0131, 4 of 300 discordant, unresolved |
- On the second split, before tuning, the checkpoint answered 0.4833 of the held-out
pictures exactly through transformers and Google's own
gemma-4-E2B-it.litertlm(atb3ca0d2f) 0.4967 through litert-lm 0.18.0, measured by scripts outside litetune, as are the three runs in the next point. - The same rows tuned by a script outside litetune scored 0.9367 in float32; that
script with another seed and shuffle order, 0.9167; with litetune's token-weighted
loss, 0.9067. Its inputs were byte for byte litetune's (the rendered prompt,
input_ids, pixel values, image positions and completion ids of 20 rows compared). Each run's weakest label was one of the two diseases: bean_rust in the three runs outside litetune (88, 77 and 81 of 99 right), angular_leaf_spot in an earlier tune by litetune on the same split, before the review fixes, which scored the same 0.8800 (71 of 99, 26 of its 36 errors answered as bean_rust). One run per setting does not separate the loss weighting from the seed. - On the second split tune took 1,393 s and peaked at 11.44 GB of CUDA memory, and convert took 853 s. Every tensor of the vision and audio towers and the token embeddings hashed the same after the merge.
- The bundle declares TOP_P, top_k 64, temperature 1.0; verify sent top_k 1 in its place, so these numbers are for an app that passes top_k 1. Its vision encoder and adapter are constrained to the CPU (as convert wrote them up to 0.8.0).
- Not measured: a phone and flutter_edge_ai. Seeds, int4 and the GPU follow.
Two more seeds, int4, and the GPU
Measured 2026-11-07 on the same A100 machine and the second split (the
EmbeddingGemma 2 beans split, 865 / 300). The two seeds ran litetune 0.8.0 from
PyPI, tune --seed 1 and --seed 2 with the recipe above, then convert --recipe dynamic_wi8_afp32 and verify --scorer exact-text, the candidate on the CPU. The
seed 0 row is the run above (at the commit that added the stages).
| run | float reference | bundle | cost of conversion (paired) |
|---|---|---|---|
seed 0, dynamic_wi8_afp32 (above) |
0.8800 | 0.8867 | −0.0067 ±0.0131, 4 of 300 discordant, unresolved |
seed 1, dynamic_wi8_afp32 |
0.9600 | 0.9533 | +0.0067 ±0.0131, 4 of 300 discordant, unresolved |
seed 2, dynamic_wi8_afp32 |
0.9500 | 0.9433 | +0.0067 ±0.0092, 2 of 300 discordant, unresolved |
seed 0, dynamic_wi4b32_emb8_afp32 |
0.8800 | 0.7900 | +0.0900 ±0.0364, 31 of 300 discordant, resolved |
- Three runs gave references of 0.8800, 0.9600 and 0.9500 on the same 300 pictures: seed 0 at the earlier implementation commit, and seeds 1 and 2 with litetune 0.8.0 from PyPI. With n=3 they show that these runs differed; they do not establish a distribution or attribute the difference to the recipe. The scripts outside litetune scored 0.9067 to 0.9367, as listed in the earlier bullet of this section beginning “The same rows tuned by a script outside litetune”.
- Four bits (int4 weights in blocks of 32, int8 embeddings) cost 0.0900 on seed 0's checkpoint, resolved.
- Seed 1 tuned in 1,575 s and seed 2 in 1,324 s (wall clock of the stage).
On the GPU, seed 0's bundle on its 300 pictures, greedy as verify sends it, through
litert-lm 0.18.0 from PyPI; the copy with the vision sections unconstrained is the
bundle with its two backend_constraint = "cpu" lines removed and nothing else
changed. A script outside litetune sent each picture as verify does
(evaluate.picture_message); verify --backend gpu at e0bbf41 (a wheel built from
that commit; its sha256 is with the run) ran the unconstrained copy.
| host | text / vision | bundle | replies unlike the same host's CPU |
|---|---|---|---|
| NVIDIA A100, Linux (Vulkan) | CPU / CPU | 0.8867 | |
| NVIDIA A100 | GPU / CPU | 0.8800 | 6 |
| NVIDIA A100 | GPU / GPU (unconstrained copy) | 0.8800 | 6 |
NVIDIA A100, verify --backend gpu at e0bbf41 (a wheel built from that commit; its sha256 is with the run) |
GPU / GPU (unconstrained copy) | 0.8800, reference 0.8800, 0.0000 ±0.0131, 4 discordant | |
NVIDIA A100, verify --backend gpu at e633e3c (a wheel built from that commit; its sha256 is with the run), the bundle as convert wrote it |
GPU / CPU (the bundle's constraint, recorded) | 0.8800, reference 0.8800, 0.0000 ±0.0131, 4 discordant | |
| Apple M5 Pro (Metal) | CPU / CPU, 8 threads (unconstrained copy) | 0.8833 | |
| Apple M5 Pro | GPU / GPU (unconstrained copy) | 0.8733 | 4 |
- On the bundle as convert wrote it,
verify --backend gpugave the vision encoder and adapter the CPU, recorded both sections'cpuconstraint and the reason, and passed. These are the backends litetune gave the engine; nothing it reads shows which device the vision encoder itself ran on. An earlier attempt of that run read a GPU weight cache an llvmpipe run had left beside the file and answered every picture with one repeated word; the numbers here are from after those cache files were deleted (A GPU cache built on a software adapter, which litetune's GPU runs now avoid). - No reply on any GPU fell outside the three labels. Of the A100's six GPU/GPU replies unlike its CPU's, the CPU was right on three and the GPU on one; on the Mac the CPU was right on three of four, the GPU on none.
- The Mac's CPU and the Xeon's gave 8 different replies of 300 (0.8833 against 0.8867).
The Mac's CPU ran at 8 threads; on a CPU with SME2 LiteRT-LM's results depend on
the thread count, which is why
verifyholds it to one there (README, Which runtime each version measures on). - On the Mac the GPU took a median 493 ms per picture and the CPU 1,287 ms, one run after the other. The A100's times are not given: a tune ran on the same GPU.
A fourth family, and the first that is not Gemma
Every section above measures a Gemma: FunctionGemma and Gemma 3 fine-tuned
here, Gemma 4 converted from its base weights. This one is Qwen/Qwen3-0.6B
@ c1899de2, the first model measured here that litetune had no per-model
rule for — convert said "no per-model rules for this checkpoint" on the
tuned checkpoint and on the base.
The task, the rows and the scorer are the second family's: LoRA r16/α32, lr
2e-4, one epoch, batch 8, over the same 2,400 rows of mteb/banking77, scored
on the same 600 held-out rows — both runs' verify manifests record split
0c7505b2b6f69ab1, and their prepare reports the same heldout.content_sha256
— with --scorer exact-text, a 256-token limit and prompt mode
runtime_rendered. tune was given no --prompt-mode and inferred it: 0% of
the 2,400 training prompts carry a control token, so they are bare text and
training renders the model's own chat template around them the way the runtime
will. verify read that record back from beside the checkpoint, and before
generating anything it found the runtime and the reference rendering identical
token ids on all 600 prompts. What differs from the second family is recorded:
max_seq_length 256 rather than 160. Training and the float reference ran on
one A100-SXM4-40GB in bfloat16, and both candidates on litert-lm 0.16.1's CPU
backend in the same container, 12 vCPU. litetune 0.1.6; training environment torch==2.5.1,
transformers==5.16.1, peft==0.20.0; export environment
litert-torch-nightly==0.10.0.dev20260826, litert-lm==0.16.1,
litert-lm-builder==0.16.1, numpy==2.0.2.
| float | dynamic_wi8_afp32 |
weight_only_wi8_afp32 |
|
|---|---|---|---|
| Base model | not scored | — | — |
| Fine-tuned | 0.6983 ±0.0367 | 0.6917 ±0.0370 | 0.6817 ±0.0373 |
| Cost of conversion | — | +0.0067 ±0.0146 (unresolved, 20 discordant) | +0.0167 ±0.0113 (resolved, 12 discordant) |
On litert-lm 0.16.1. The same bundles on 0.17.1 are at the end of this section.
On 0.16.1 one cost is resolved and one is not, where both of the second
family's were unresolved — and the resolved one rests on fewer disagreements,
not more. weight_only_wi8_afp32 costs +0.0167 with an interval of ±0.0113 on
12 disagreements out of 600, eleven of which fall the same way;
dynamic_wi8_afp32 costs +0.0067 inside ±0.0146 on 20, split twelve against
eight. That is the arithmetic the headline section describes, seen once more:
what buys an interval is the imbalance between the two directions, not the
count.
Across the two families the manifests support one observation and no ranking. The fine-tuned Qwen3 scores higher on these rows than the fine-tuned Gemma 3 did, 0.6983 against 0.6717, and its conversions disagree with their float model on 20 and 12 rows against Gemma 3's 34 and 16. litetune computes no interval for a difference between two models, so that is not a resolved difference, and the conversion costs are not ranked across families: both runs' references ran on a different device from their candidates, so both carry that difference.
What this run established that the table does not show
The exporter needs no flag for the family. Both recipes exported with no flag
from litetune, and the tuned checkpoint's config.json names model_type: qwen3.
That is the model-type trap models.py describes, seen from the other side: qwen3
is on the exporter's own list, so the config's model_type selects the right type
with no override. models.py records it as qwen-3, scoped then to 0.6B, the one size
run (it has also claimed 1.7B since its template was found to be 0.6B's byte for byte); from LiteRT-LM 0.18.0 that rule puts a block in front of the checkpoint's own
template, for the runtime rather than the exporter (The 0.17.1 re-measurements again on
litert-lm 0.18.0).
The terminator is the template's close, and it is also the tokenizer's
eos. generation_config.eos_token_id is [151645, 151643] — <|im_end|>
and <|endoftext|> — and <|im_end|> closes a turn in the chat template.
Training in runtime_rendered takes the terminator from that template, so
tune recorded turn_terminator: {ids: [151645, 198], source: "chat_template", text: "<|im_end|>\n"} — the marker and the newline the template writes after
it — and contract.json carries that into stop_tokens. On the reference,
terminators_trimmed read 600 of 600, one marker each. The second family's
section describes Gemma 3, where the tokenizer's eos and the template's close
are two different markers; here they are the same one.
The runtime side returns no terminator. On litert-lm terminators_trimmed
read 0 of 600 and the manifest records "600 of 600 litert-lm generations end
without a terminator", for both recipes, while liveness found no empty,
leaking or degenerate generation among the 600 and every one exited zero. The
generations stopped; the runtime hands back the text without its stop token.
The unterminated-share check reads only the transformers reference, whose
decoder is asked to keep special tokens.
Measuring the second recipe took several times as long. Timed in the
earlier run of these same bundles and not re-timed here: the first time each
bundle ran, litert-lm wrote an XNNPACK cache beside it, 601,946,856 bytes
for dynamic_wi8_afp32 and 2,385,932,008 for weight_only_wi8_afp32, three
times that bundle's 771,404,928. On the same machine the 600-prompt verify,
float reference included and a five-prompt verify run before it, took 27
minutes for dynamic_wi8_afp32 and 2 hours 10 minutes for
weight_only_wi8_afp32. Nothing measured whether the cache is the reason.
What it did not establish. No untuned-base score. This run never reached
the base step: the guard ahead of it stopped the container and recorded
"untuned Qwen3-0.6B reasons without a token limit on the CLI candidate". The
earlier run met the same thing from the other side: a five-prompt verify
given 900 seconds that did not finish. So training gain is unattributed here
too. One run.
The converted candidates ran on CPU in this run. The same artifacts were later run on a
phone, on both its CPU and its GPU — see What four bits cost. No NPU figure
for this family.
Limitations carried by these manifests
Four on dynamic_wi8_afp32, three on weight_only_wi8_afp32: the last is
absent there because that cost resolves on 0.16.1.
- The candidate ran on litert-lm's CPU backend; its GPU backend is a different executor and this number does not predict it.
- The candidate ran on CPU and the reference on CUDA, so the difference carries a hardware difference as well as a conversion one. Reported rather than refused: litetune cannot pin the runtime side to a device, and a refusal would leave such a machine unable to verify at all.
- Decoding was passed to transformers (
max_tokens256, greedy) but not to litert-lm, which uses the pinned runtime's defaults; both are greedy, and the token limit is unverified on the runtime side. 600 of 600 runtime generations end without a terminator, which the subsection above accounts for. - On
dynamic_wi8_afp32only: the sample does not resolve that difference.weight_only_wi8_afp32carries no such line, and its table entry above says why — +0.0167 ±0.0113, resolved on 12 discordant.
Qwen3-0.6B on litert-lm 0.17.1
The same bundles and rows, verified again as The banking77 sections on litert-lm 0.17.1 describes. The two runs differ in runtime, transport and possibly CPU, so a difference between the rows is not attributed to the runtime.
| float | dynamic_wi8_afp32 |
weight_only_wi8_afp32 |
|
|---|---|---|---|
| 0.16.1 run | 0.6983 ±0.0367 | 0.6917 ±0.0370 | 0.6817 ±0.0373 |
| 0.17.1 run | 0.6983 ±0.0367 | 0.6983 ±0.0367 | 0.6933 ±0.0369 |
| Cost of conversion, 0.17.1 run | — | +0.0000 ±0.0103 (unresolved, 10 discordant) | +0.0050 ±0.0073 (unresolved, 5 discordant) |
The weight_only_wi8_afp32 cost resolved on 0.16.1 and does not here: +0.0167
on 12 discordant rows, eleven one way, there; +0.0050 on 5, four one way, here.
That is two runs' verdicts, not a measured change in the cost, and neither run
is withdrawn. dynamic_wi8_afp32 is unresolved in both, on 10 discordant rows
against 20.
The same family, four times the size
google/gemma-3-1b-it @ dcc83ea8, the other size models.py scopes the
gemma-3-text family to, and until this run the one of the two that had never
been measured. The rule already required
--litert_lm_model_type_override=gemma3 for it, on the strength of the 270M;
this run is the first time the flag was exercised on the 1B, and convert
added it for the same reason — config.json declares model_type: gemma3_text, which the exporter does not recognise.
The task, the rows and the scorer are the second family's, and so is
max_seq_length 160: LoRA α32, lr 2e-4, one epoch, batch 8, bfloat16 over the
same 2,400 rows of mteb/banking77, scored on the same 600 held-out rows of
split 0c7505b2b6f69ab1, --scorer exact-text, a 256-token decode limit,
prompt mode runtime_rendered. tune was given no --prompt-mode and
inferred it: 0% of the 2,400 training prompts carry a control token. verify
read that record back from beside the checkpoint and, before generating
anything, found the runtime and the reference rendering identical token ids on
all 600 prompts, with the runtime's prefill count equal to the reference's on
the 8 it was sent. 13,045,760 of 999,885,952 parameters trained, final loss
0.3985, the loss computed on 0.1605 of tokens. The model is gated, so it ran
offline from a local copy of that revision. Training and the float reference
ran on one A100-SXM4-40GB, both candidates on litert-lm 0.16.1's CPU backend
in the same container, 12 vCPU. litetune 0.1.7; training environment
torch==2.5.1, transformers==5.16.1, peft==0.20.0,
sentencepiece==0.2.0; runtime litert-lm==0.16.1, numpy==2.0.2.
| float | dynamic_wi8_afp32 |
weight_only_wi8_afp32 |
|
|---|---|---|---|
| Base model | 0.0000 | 0.0000 | — |
| Fine-tuned | 0.7533 ±0.0345 | 0.7450 ±0.0349 | 0.7367 ±0.0352 |
| Cost of conversion | — | +0.0083 ±0.0157 (unresolved, 23 discordant) | +0.0167 ±0.0122 (resolved, 14 discordant) |
On litert-lm 0.16.1. The same bundles on 0.17.1 are at the end of this section.
The two costs fall the same way as the fourth family's and for the same
arithmetic: on 0.16.1 weight_only_wi8_afp32 resolves on 14 disagreements while
dynamic_wi8_afp32 does not on 23. Sizes are 1,331,074,352 and 1,331,336,720
bytes.
What this run established that the table does not show
The untuned base answers nothing, and this time it was scored rather than
refused. Both sides of the base comparison — the converted base and the
untuned float it came from — score 0.0000 on all 600 rows. verify reports
unmeasured and exits 3, and the reason its manifest gives is not the zero: the
comparison names the untuned base as its reference, so conversion and training
are confounded in it and both attribution fields are unavailable. The zero is
what is left when that is said — two scores of nothing to subtract from each
other. The second family reached the same dead end from the other
side, where the base never reached the quality tier — refused for empty output
in the run of record, and for repetition in the withdrawn prerendered one. Two
sizes of one family, two ways of establishing nothing about training gain.
The terminator is the template's close, as it is for the 270M.
tune recorded turn_terminator: {ids: [106, 107], source: "chat_template", text: "<end_of_turn>\n"}, and on the reference terminators_trimmed read 600
of 600, one marker each. On litert-lm it read 0 of 600, which is what the
fourth family's section describes: the runtime hands back the text without its
stop token.
It scores higher than either model measured before it on these rows — 0.7533 against Qwen3-0.6B's 0.6983 and gemma-3-270m's 0.6717 — and that is an observation, not a resolved difference: litetune computes no interval for a difference between two models, and all three references ran on a different device from their candidates.
gemma-3-1b on litert-lm 0.17.1
The same bundles and rows, verified again as The banking77 sections on litert-lm 0.17.1 describes. The two runs differ in runtime, transport and possibly CPU, so a difference between the rows is not attributed to the runtime.
| float | dynamic_wi8_afp32 |
weight_only_wi8_afp32 |
|
|---|---|---|---|
| 0.16.1 run | 0.7533 ±0.0345 | 0.7450 ±0.0349 | 0.7367 ±0.0352 |
| 0.17.1 run | 0.7533 ±0.0345 | 0.7433 ±0.0350 | 0.7533 ±0.0345 |
| Cost of conversion, 0.17.1 run | — | +0.0100 ±0.0113 (unresolved, 12 discordant) | +0.0000 ±0.0065 (unresolved, 4 discordant) |
The weight_only_wi8_afp32 cost resolved on 0.16.1 and does not here: +0.0167
on 14 discordant rows, twelve one way, there; +0.0000 on 4, two each way, here.
That is two runs' verdicts, not a measured change in the cost, and neither run
is withdrawn. dynamic_wi8_afp32 is unresolved in both, on 12 discordant rows
against 23.
A fifth family, and the first where channelwise four bits answered
Qwen/Qwen2.5-0.5B-Instruct @ 7ae55760, 494,032,768 parameters, and a
checkpoint litetune held no rule for when it ran — as Qwen3-0.6B was when it
ran. models.identify returned None for it, so every convert in this run
printed the unknown-family note — that litetune's rules were paid for one
family at a time and a family it has not met is one whose required flags are
simply unknown. The bundle is typed correctly regardless, and not by
litetune: config.json says model_type: "qwen2", and the switch in
litert_lm_builder.py — which lives in the export environment rather than in
this repository, read at litert_torch/generative/export_hf/core/ in
litert-torch 0.10.0.dev20260826 — has case 'qwen2' | 'qwen2p5'. It did not
run offline: this run logged HF_HUB_OFFLINE=unset where both Gemma 3 runs
logged HF_HUB_OFFLINE=1. Whether the weights then came over the network or
off a cache already on the instance is not something these manifests record,
for this run or for those.
The task, the rows and the scorer are the second family's, and max_seq_length
256 is the fourth family's: LoRA α32, lr 2e-4, one epoch, bfloat16 over the same
2,400 rows of mteb/banking77, scored on the same 600 held-out rows of split
0c7505b2b6f69ab1, --scorer exact-text, a 256-token decode limit, prompt mode
runtime_rendered. tune was given no --prompt-mode and inferred it: 0% of
the 2,400 training prompts carry a control token. verify read that record back
from beside the checkpoint and, before generating anything, found the runtime
and the reference rendering identical token ids on all 600 prompts, with the
runtime's prefill count equal to the reference's on the 8 it was sent — on all
seven verifies this run produced, the untuned base included. 8,798,208 of 494,032,768 parameters trained, final
loss 0.4472, the loss computed on 0.0946 of tokens. Training and the float
reference ran on one A100-SXM4-40GB, every candidate on litert-lm 0.16.1's CPU
backend in the same container, 12 vCPU. litetune 0.1.8; training environment
torch==2.5.1, transformers==5.16.1, peft==0.20.0,
sentencepiece==0.2.0; runtime litert-lm==0.16.1, numpy==2.0.2.
The float reference in every Qwen2.5 run here, this section's and the
re-measurements on 0.17.1 and 0.18.0, decoded with repetition_penalty 1.1:
litetune up to 0.4.1 left the checkpoint's generation_config in force, and
transformers merges it into a greedy generate call. litetune 0.4.2
decodes the reference greedily without it. On 2026-10-12, on litert-lm 0.18.0,
the dynamic_wi8_afp32 bundle verified against the same tuned checkpoint with
the reference of 0.4.1 and with that of 0.4.2 gave the same figures both
times: candidate 0.7700, reference 0.7700, cost 0.0000 on 8 discordant rows,
which are the 0.18.0 figures published above. The candidate never decoded with a
penalty: LiteRT-LM applies none unless asked, and litetune does not ask.
| float | dynamic_wi8_afp32 |
weight_only_wi8_afp32 |
|
|---|---|---|---|
| Base model | 0.0000 | 0.0000 | — |
| Fine-tuned | 0.7700 ±0.0337 | 0.7600 ±0.0342 | 0.7600 ±0.0342 |
| Cost of conversion | — | +0.0100 ±0.0131 (unresolved, 16 discordant) | +0.0100 ±0.0103 (unresolved, 10 discordant) |
On litert-lm 0.16.1. The same bundles on 0.17.1 are at the end of this section.
Sizes are 647,312,304 and 647,492,736 bytes.
What this run established that the table does not show
Neither eight-bit cost resolves here, and on the same runtime one did on each
of the two models before it. On litert-lm 0.16.1 Qwen3-0.6B and gemma-3-1b
both had weight_only_wi8_afp32 resolve at +0.0167 while dynamic_wi8_afp32
did not; re-measured on 0.17.1, neither resolves. This model puts both inside
their intervals. The reason is in the discordant column rather than in the
accuracy: the candidate was discordant with the reference on 16 rows under one
recipe and 10 under the other, and a paired test on 600 examples cannot separate
a difference that small from none. That is a statement about this sample, not a
finding that the conversion is free.
It scores higher than any model measured before it on these rows — 0.7700 against gemma-3-1b's 0.7533, Qwen3-0.6B's 0.6983 and gemma-3-270m's 0.6717, from the second smallest of the four. As with the 1B, this is an observation and not a resolved difference: litetune computes no interval for a difference between two models, and every reference here ran on a different device from its candidate.
The untuned base establishes nothing, as on the 1B. Both
sides score 0.0000 on all 600 rows, verify reports unmeasured and exits
3, and its manifest gives the same reason as the 1B's: the reference is the
untuned base, so training and conversion are confounded and both attribution
fields are unavailable. Of the five models fine-tuned and measured on banking77 up to
this run, not one has a recorded training gain — two scored zero on both sides, one was refused for
empty output, one was never scored, and Gemma 4's tuned run records no base figure at
all. FunctionGemma, at the top of this file, is the only model
here with one at all — on another task, with another scorer, and with three
readings of the figure that section sets against each other.
The terminator is the template's close, as in the three banking77 runs of
record before it. tune
recorded turn_terminator: {ids: [151645, 198], source: "chat_template", text: "<|im_end|>\n"}, and on the reference terminators_trimmed read 600 of 600,
one marker each. On litert-lm it read 0 of 600 — the runtime hands back the text
without its stop token, which the fourth family's section describes.
Qwen2.5-0.5B on litert-lm 0.17.1
The same bundles and rows, verified again as The banking77 sections on litert-lm 0.17.1 describes. The two runs differ in runtime, transport and possibly CPU, so a difference between the rows is not attributed to the runtime.
| float | dynamic_wi8_afp32 |
weight_only_wi8_afp32 |
|
|---|---|---|---|
| 0.16.1 run | 0.7700 ±0.0337 | 0.7600 ±0.0342 | 0.7600 ±0.0342 |
| 0.17.1 run | 0.7700 ±0.0337 | 0.7700 ±0.0337 | 0.7717 ±0.0336 |
| Cost of conversion, 0.17.1 run | — | +0.0000 ±0.0092 (unresolved, 8 discordant) | −0.0017 ±0.0057 (unresolved, 3 discordant) |
Neither cost resolves in either run; the discordant rows are 8 and 3, against 16 and 10.
The two Qwen families, one size up
Qwen/Qwen3-1.7B @ 70d244cc, 1,720,574,976 parameters, and
Qwen/Qwen2.5-1.5B-Instruct @ 989aa798, 1,543,714,304 parameters, run on
2026-10-19 with the code that first claims them in the qwen-3 and qwen-2.5
rules, before it was merged: commit 1e42ebb, which reports 0.5.1. Each ships its smaller size's chat template
byte for byte -- a55ee1b1… and cd8e9439…, the digests convert read back from
the checkpoints -- and declares the same model_type and architecture, which is
what the rules were widened on. This run is what they then did.
The task, the rows and the scorer are the fifth family's: LoRA α32, rank 16, lr
2e-4, one epoch, batch 8, bfloat16, max_seq_length 256, the same 2,400 rows of
mteb/banking77 and the same 600 held-out rows of split 0c7505b2b6f69ab1,
--scorer exact-text, prompt mode runtime_rendered, which tune inferred and
verify read back from beside the checkpoint. On all four verifies the runtime and
the reference rendered identical token ids on all 600 prompts, with the runtime's
prefill count equal to the reference's on the 8 it was sent. Trained parameters
17,432,576 (Qwen3) and 18,464,768 (Qwen2.5), final loss 0.6226 and 0.3756.
Training and the float reference ran on one A100-SXM4-40GB, every candidate on
litert-lm 0.18.0's CPU backend on Intel(R) Xeon(R) CPU @ 2.20GHz, 12 vCPU.
Training environment torch==2.5.1, transformers==5.16.1, peft==0.20.0;
export environment litert-torch-nightly 0.10.0.dev20260926,
ai-edge-quantizer-nightly 0.10.0.dev20260926, litert-lm-builder 0.18.0.
| float | dynamic_wi8_afp32 |
weight_only_wi8_afp32 |
|
|---|---|---|---|
| Qwen3-1.7B, fine-tuned | 0.7400 ±0.0351 | 0.7383 ±0.0352 | 0.7383 ±0.0352 |
| Cost of conversion | — | +0.0017 ±0.0098 (unresolved, 9 discordant) | +0.0017 ±0.0086 (unresolved, 7 discordant) |
| Qwen2.5-1.5B-Instruct, fine-tuned | 0.7683 ±0.0338 | 0.7717 ±0.0336 | 0.7733 ±0.0335 |
| Cost of conversion | — | −0.0033 ±0.0113 (unresolved, 12 discordant) | −0.0050 ±0.0073 (unresolved, 5 discordant) |
On litert-lm 0.18.0. Sizes are 2,056,778,672 and 2,057,090,176 bytes for Qwen3, 1,802,859,440 and 1,803,072,640 for Qwen2.5. The untuned base was not scored.
The template each rule chose is the one it chooses for the smaller size. For
Qwen3-1.7B convert packed LiteRT-LM v0.18.0's canonical Qwen 3 template
(chat_template.source canonical), offered because tune's record says the
checkpoint was trained runtime_rendered without declarations, and chosen after
its 96 single-turn renderings matched the checkpoint's own. For
Qwen2.5-1.5B-Instruct it composed the checkpoint's own template behind the
text-parts block (composed). Every bundle passed the conversation check after
export (72 cases, each a prefix of the next), and the bundles read back as
llm_model_type qwen3 and qwen2p5, with no type override.
Both hold a LiteRT-LM conversation. On litert-lm-api 0.18.0's CPU backend each
dynamic_wi8_afp32 bundle answered three messages in one Conversation and two
held-out prompts in another, every send returning a reply -- the second message is
where a Qwen3 bundle failed before #78.
Neither model is shown to be better or worse than its smaller size. Qwen3-1.7B's float 0.7400 and Qwen2.5-1.5B-Instruct's 0.7683 sit beside Qwen3-0.6B's 0.6983 and Qwen2.5-0.5B-Instruct's 0.7700 on these rows, and litetune computes no interval for a difference between two models. Neither run scored its untuned base, so neither records a training gain, as none of the five banking77 models before them does. No conversion cost resolves, as for the smaller sizes on 0.17.1 and 0.18.0.
Three more families: Granite 4.1, MiniCPM5 and Qwen 3.5
ibm-granite/granite-4.1-3b @ c0650403, 3,402,836,480 parameters,
openbmb/MiniCPM5-1B @ 87179e5c, 1,080,632,832, Qwen/Qwen3.5-0.8B @
2fc06364, 752,393,024, and Qwen/Qwen3.5-2B @ 15852e8c, 1,881,825,088, run
on 2026-10-20 with the code that first claims them in the granite-4.1,
minicpm5 and qwen-3.5 rules, before it was merged. Qwen3.5-0.8B and granite
ran every stage at 382925e; MiniCPM5 and Qwen3.5-2B at 1d6dee8, which adds the
start-token check below. Both report 0.5.1. From 1d6dee8 to the branch's head
only the decision path changed, and rendering.py's runtime-ids script moved
into a shared function with the same body.
The task, the rows, the recipe and the environments are the previous section's:
the same 2,400 training and 600 held-out rows of split 0c7505b2b6f69ab1,
--scorer exact-text, prompt mode runtime_rendered. On all eight verifies the
runtime and the reference rendered identical token ids on all 600 prompts.
Trained parameters 31,129,600 (granite), 11,206,656 (MiniCPM5), 6,389,760 and
10,911,744 (Qwen3.5); final loss 0.3506, 0.4297, 0.4143 and 0.3502.
| float | dynamic_wi8_afp32 |
weight_only_wi8_afp32 |
|
|---|---|---|---|
| granite-4.1-3b, fine-tuned | 0.7800 ±0.0331 | 0.7883 ±0.0327 | 0.7783 ±0.0332 |
| Cost of conversion | — | −0.0083 ±0.0135 (unresolved, 17 discordant) | +0.0017 ±0.0057 (unresolved, 3 discordant) |
| MiniCPM5-1B, fine-tuned | 0.7167 ±0.0361 | 0.7067 ±0.0364 | 0.7167 ±0.0361 |
| Cost of conversion | — | +0.0100 ±0.0122 (unresolved, 14 discordant) | +0.0000 ±0.0092 (unresolved, 8 discordant) |
| Qwen3.5-0.8B, fine-tuned | 0.7800 ±0.0331 | 0.7767 ±0.0333 | 0.7917 ±0.0325 |
| Cost of conversion | — | +0.0033 ±0.0113 (unresolved, 12 discordant) | −0.0117 ±0.0098 (resolved, 9 discordant) |
| Qwen3.5-2B, fine-tuned | 0.8000 ±0.0320 | 0.7833 ±0.0330 | 0.7967 ±0.0322 |
| Cost of conversion | — | +0.0167 ±0.0122 (resolved, 14 discordant) | +0.0033 ±0.0046 (unresolved, 2 discordant) |
On litert-lm 0.18.0. Sizes are 3,693,186,992 and 3,693,645,952 bytes for granite, 1,098,211,248 and 1,098,440,832 for MiniCPM5, 1,036,844,976 and 1,037,303,936 for Qwen3.5-0.8B, 2,424,750,064 and 2,425,209,040 for Qwen3.5-2B. The untuned bases were not scored.
Two costs resolve, in opposite directions. Qwen3.5-0.8B's weight_only
file scored above its float reference, on 9 discordant rows; Qwen3.5-2B's
dynamic file scored below its own, on 14. Each is one run's paired interval,
and neither says which way the next checkpoint will go.
Each rule's template holds a conversation. granite composes the checkpoint's
own template behind the text-parts block (composed). MiniCPM5 and both Qwen 3.5
sizes pack LiteRT-LM v0.18.0's canonical template with litetune's edits
(litert-lm-v0.18.0-minicpm5-litetune.jinja,
litert-lm-v0.18.0-qwen3_5-litetune.jinja), each chosen after its single-turn
renderings matched the checkpoint's. Every bundle passed the conversation check
after export, and on litert-lm-api 0.18.0's CPU backend each dynamic_wi8_afp32
bundle answered three messages in one Conversation and two held-out prompts in
another.
MiniCPM5's first convert refused, and was right to. The checkpoint's
template prints <s>; the runtime hands a template an empty bos_token and
puts the bundle's start token in front of what it renders. At 382925e convert
compared single turns without that start token and could not check them. The
litetune template now prints {{- bos_token -}}, and the single-turn check
predicts the start token the exporter will write, renders with it in front, and
reads it back from the bundle afterwards (<s> for MiniCPM5).
A shared Engine carries Qwen 3.5's state from one prompt into the next
(LiteRT-LM#3165). The first 50 held-out prompts through verify's own driver
script on the dynamic Qwen3.5-0.8B file, against a process per prompt, which
shares nothing:
| Qwen3.5-0.8B, prompts answered otherwise | Qwen3-0.6B, the control | |
|---|---|---|
| one Engine for every prompt | 22 of 50 (2,342 s) | 0 of 50 (69 s) |
| the same, prompts in reverse order | 29 of 50 (2,881 s) | 0 of 50 (52 s) |
| an Engine per prompt | 0 of 50 (88 s) | 0 of 50 (81 s) |
The qwen-3.5 rule therefore has verify build an Engine for every prompt
(0.79-0.92 s each on this CPU), and the eight Qwen 3.5 numbers above were taken
that way, which is also the faster of the two here. This measures verify's
driver, not an app.
LoRA reaches a quarter of Qwen 3.5's attention. Six of its 24 layers are
full_attention and carry self_attn.{q,k,v,o}_proj; the other 18 are
linear_attention, whose projections are not among the seven names tune
targets. The adapter covers every layer's MLP and those six layers' attention:
96 modules on both sizes.
What four bits cost
Everything above is 8-bit, except the Gemma 4 table, whose dynamic_wi4b32_afp32
row is a block-wise four-bit export of base weights rather than a tuned
checkpoint. This section converts four tuned checkpoints four more
ways: the gemma-3-270m-it run of the second family, Qwen/Qwen3-0.6B @
c1899de2, the gemma-3-1b-it run, and the Qwen2.5-0.5B-Instruct run above,
each trained the same way — LoRA α32, lr 2e-4, one epoch, bfloat16, over the
same 2,400 banking77 rows. All are
scored on the same 600 held-out rows of split 0c7505b2b6f69ab1, --scorer exact-text, 256-token limit, prompt
mode runtime_rendered, litert-lm 0.16.1's CPU backend against each model's own
float twin. Sizes are the .litertlm the export wrote.
| Qwen3-0.6B | bytes | exact match | cost of conversion | discordant |
|---|---|---|---|---|
| float twin | — | 0.6983 ±0.0367 | — | — |
dynamic_wi4_afp32 |
395,310,000 | refused at the gate | — | — |
weight_only_wi4_afp32 |
395,621,504 | refused at the gate | — | — |
dynamic_wi4b32_afp32 |
428,978,304 | 0.6633 ±0.0378 | +0.0350 ±0.0247 (resolved) | 57 of 600 |
dynamic_wi4b32_emb8_afp32 |
500,691,888 | 0.6433 ±0.0383 | +0.0550 ±0.0267 (resolved) | 67 of 600 |
| gemma-3-270m-it | bytes | exact match | cost of conversion | discordant |
|---|---|---|---|---|
| float twin | — | 0.6717 ±0.0376 | — | — |
dynamic_wi4_afp32 |
237,851,952 | refused at the gate | — | — |
weight_only_wi4_afp32 |
238,032,400 | refused at the gate | — | — |
dynamic_wi4b32_afp32 |
252,925,440 | 0.3233 ±0.0374 | +0.3483 ±0.0503 (resolved) | 237 of 600 |
dynamic_wi4b32_emb8_afp32 |
332,617,008 | 0.3517 ±0.0382 | +0.3200 ±0.0482 (resolved) | 218 of 600 |
| gemma-3-1b-it | bytes | exact match | cost of conversion | discordant |
|---|---|---|---|---|
| float twin | — | 0.7533 ±0.0345 | — | — |
dynamic_wi4_afp32 |
680,203,568 | refused past the gate | — | — |
weight_only_wi4_afp32 |
680,465,936 | refused at the gate | — | — |
dynamic_wi4b32_afp32 |
741,578,240 | 0.6650 ±0.0378 | +0.0883 ±0.0287 (resolved) | 77 of 600 |
dynamic_wi4b32_emb8_afp32 |
879,990,064 | 0.6650 ±0.0378 | +0.0883 ±0.0290 (resolved) | 79 of 600 |
| Qwen2.5-0.5B-Instruct | bytes | exact match | cost of conversion | discordant |
|---|---|---|---|---|
| float twin | — | 0.7700 ±0.0337 | — | — |
dynamic_wi4_afp32 |
332,256,176 | 0.5133 ±0.0400 | +0.2567 ±0.0436 (resolved) | 178 of 600 |
weight_only_wi4_afp32 |
332,436,608 | one generation of 600 never finished | — | — |
dynamic_wi4b32_afp32 |
359,203,968 | 0.6933 ±0.0369 | +0.0767 ±0.0257 (resolved) | 62 of 600 |
dynamic_wi4b32_emb8_afp32 |
422,409,136 | 0.6783 ±0.0374 | +0.0917 ±0.0271 (resolved) | 69 of 600 |
The tables and the paragraphs below, down to On a phone, are litert-lm 0.16.1's. The same bundles on 0.17.1 are at the end of this section.
Channelwise four bits reached a score on one model of four. On the other
three the harness never got that far. It gates a bundle on five prompts before
spending an hour on 600 — litetune has no gate of its own — and both channelwise
recipes failed that gate on gemma-3-270m and on Qwen3-0.6B: under
dynamic_wi4_afp32 Qwen3 repeated itself on one of five prompts at a ratio of
0.9937 and gemma leaked <bos>; under weight_only_wi4_afp32 Qwen3 did not
finish one prompt within 300 s, and gemma hit litetune's own 300 s per-prompt
limit on each of the first two, after which the gate's 900 s budget expired. No
manifest was written for that last one, so how many of the five it would have
finished is not known. The rendering check passed on all four
bundles, so neither refusal is a prompt the two sides disagreed about.
On the 1B the gate opened and the run failed anyway, which is the same
verdict arrived at one stage later. dynamic_wi4_afp32 passed its five prompts
and then repeated itself on 65 of 600, worst ratio 0.9978, so liveness
refused before any score was computed; weight_only_wi4_afp32 did not finish
one of its five gate prompts within 300 s, as Qwen3's had not. So a five-prompt
gate is a cheap way to catch a bundle that is broken on every row, and no way
to catch one that is broken on one row in ten — a limitation of the harness's
gate, not of verify, which is what found it.
On Qwen2.5-0.5B both channelwise recipes cleared the gate, and one of them
answered. dynamic_wi4_afp32 ran all 600 rows: 0.5133 against the float
twin's 0.7700, a cost of +0.2567 that resolves on 178 discordant rows. That
is the first channelwise figure in this file, and it is a third of the model's
accuracy — the recipe is not rehabilitated by having finally produced a number.
weight_only_wi4_afp32 got further here than on any earlier model and still
produced nothing: its gate opened, 599 of 600 generations ran, one exceeded the
300 s per-prompt limit, and verify returned failed_harness and exit 4 rather
than scoring the rows that did finish. On 0.16.1, across four models, the same
two recipes produced a refusal at the gate, a refusal past the gate, a run that
generated 599 of 600 and was refused for the one it did not, and one resolved
cost — which is four ways of learning that what these recipes do is a property
of the checkpoint they are given.
On 0.16.1, dequantising before compute rescued nothing, on any of the four.
weight_only_wi4_afp32 does exactly that, and it is the one recipe in this file
that never produced a score on 0.16.1 (on 0.17.1 it did, on Qwen2.5-0.5B,
below): it failed the gate on gemma-3-270m, Qwen3-0.6B and gemma-3-1b, and on
Qwen2.5-0.5B it cleared the gate and then lost a single generation to the
timeout. dynamic_wi4_afp32, which keeps activations in integers, is the one
that eventually answered. So integer activations are not what separates a
working bundle from a broken one here — if anything the evidence runs the other
way, and on three of the four checkpoints neither recipe produced an answer at
all. A five-prompt diagnostic through both int8 and both channelwise bundles of
gemma-3-270m and Qwen3-0.6B — the two block-wise recipes were never in it — says
the same from the other side: at 8 bits both models emit the reference's label
and stop, the terminator scoring at or above −0.001 in log-probability; at 4
bits channelwise, Qwen3 matches one of five labels exactly and on another emits
the right label and then does not stop — its terminator scores −0.64 to −4.17 —
while gemma produces no label at all, scoring the reference answer at −32 to
−107 against −0.03 to −0.47 at 8 bits. Those last figures are the diagnostic's
score_total with the terminator token's own log-probability taken off, which
is why they are not the raw totals in *__diag-int4.json.
Blocks of 32 fix the breakage and still cost accuracy. A scale per 32 weights instead of one per output channel passes the gate on all four models and scores all 600 rows. That costs the tuned Qwen3-0.6B 3.50 points of exact match, the tuned Qwen2.5-0.5B 7.67, the tuned gemma-3-1b 8.83, and the tuned gemma-3-270m 34.83. Every interval clears zero: these are differences this sample settles, not noise.
Whatever the 270M's collapse is, it is not a property of Gemma 3. The 1B is the same family, the same export rule, the same template and the same run recipe as the 270M, and four bits cost it 8.83 points where they cost the 270M 34.83. So the family does not predict the cost, which is the one thing this pair settles. It does not settle that size does, and the fourth model argues against it: at 0.49B Qwen2.5 pays 7.67 points where Qwen3 at 0.6B pays 3.50 and gemma-3-1b at 1.00B pays 8.83, so the four costs do not order by parameter count in either direction. Only the 270M's 34.83 stands apart, and it is the smallest. Parameter count, the share of the model that is embeddings, the architecture and the headroom a higher float score leaves all vary together across these four, and nothing in this design separates them.
int8 embeddings do not rescue gemma-3-270m. gemma holds 168M of its 268M
parameters in embeddings — a 262,144-token vocabulary at a hidden size of 640,
against the base_parameters its own tune metrics record — and
dynamic_wi4b32_afp32 rounds them to four bits with everything else: its
embedder section compresses 640.01 MiB to 90.01 MiB, a ratio of 0.14 computed
from the convert manifest, against the 0.26 the converter prints for the 8-bit
run. litetune's own
dynamic_wi4b32_emb8_afp32 keeps embeddings at int8 with OCTAV clipping on the
4-bit linear weights, which is the layout Google's quantization guide gives a
decoder. gemma still loses 32.0 points.
On the 1B the two block-wise recipes reach the same exact match, 0.6650, each paired against the float twin and neither against the other, and they reach it from different rows — 77 discordant against 79 — for 138 MB more on disk. The 1B holds 302M of its 1.00B parameters in embeddings, the same 262,144-token vocabulary at a hidden size of 1,152, a smaller share of the model than the 270M's. What that buys at four bits is not visible in these two scores.
What this does not establish. That either block-wise recipe is better than the other. Each was paired against its float twin and never against the other, and the intervals overlap on all four models — with int8 embeddings Qwen3 reads worse (+0.0550 against +0.0350), Qwen2.5 worse as well (+0.0917 against +0.0767), gemma-3-270m better (+0.3200 against +0.3483) and gemma-3-1b identically (+0.0883 either way), all on 0.16.1, and none of those differences is one this design can settle. Nor does it say anything about models larger than these four, or about 4-bit weights produced some other way, such as by quantization-aware training. One run each on 0.16.1; the 0.17.1 run below is not paired with it.
On a phone, the backend changes the answer. The Qwen3-0.6B artifacts above
were run on a Galaxy S24 (SC-51E, SM8650, Android 36) through Firebase Test
Lab, 600 rows per cell. The phone scores nothing: it records generations, and the
host scores them with the same exact-text scorer and the same paired interval
verify uses.
| bundle | backend | exact match | cost against the float reference | discordant |
|---|---|---|---|---|
dynamic_wi8_afp32 |
CPU | 0.6817 ±0.0373 | +0.0167 ±0.0146 (resolved) | 20 of 600 |
dynamic_wi8_afp32 |
GPU | 0.6500 ±0.0382 | +0.0483 ±0.0259 (resolved) | 63 of 600 |
dynamic_wi4b32_emb8_afp32 |
CPU | 0.6333 ±0.0386 | +0.0650 ±0.0255 (resolved) | 61 of 600 |
dynamic_wi4b32_emb8_afp32 |
GPU | 0.6550 ±0.0380 | +0.0433 ±0.0249 (resolved) | 58 of 600 |
Paired over the same prompts, the GPU backend costs +0.0317 ±0.0233 against the CPU one on the 8-bit bundle and −0.0217 ±0.0142 on the mixed int4 bundle. Both resolve, and they point in opposite directions: which backend is better depends on the recipe. README's limitation — that litert-lm's GPU backend is a different executor and a CPU number does not predict it — has a size here.
What the phone run does not establish: the difference between it and the cloud CPU number for the same file (0.6817 against 0.6917) is two numbers, not a paired test, because the cloud candidate's per-row generations were never shipped. One phone model, one run per cell, greedy decoding.
Four bits on litert-lm 0.17.1
The same sixteen bundles, verified again from 2026-09-28 to 2026-09-29 with
litetune at commit 0744a1e on litert-lm 0.17.1, behind the same five-prompt gate
with its 900 s budget, and otherwise as The banking77 sections on litert-lm
0.17.1 describes for the eight-bit
pairs. Thirteen of the sixteen wrote a manifest, and each SHA-256 there equals
the one convert recorded when 0.1.6, 0.1.7 or 0.1.8 built the bundle; the
three whose gate ran out of time wrote none. Every manifest records the
candidate on Intel(R) Xeon(R) CPU @ 2.20GHz with AVX-512 and 12 vCPU, and
every one that reached the reference records it on cuda. The two runs differ in runtime, transport and possibly CPU,
so a difference between them is not attributed to the runtime. The transport
matters here in one more way: on 0.16.1 litetune cut each prompt at 300 s, and
since #50 a split shares 300 s per prompt, so one slow prompt no longer refuses
a run by itself; it can still use up the rest of the split's budget.
| 0.16.1 | 0.17.1: exact match | 0.17.1: cost of conversion | |
|---|---|---|---|
Qwen3-0.6B, dynamic_wi4_afp32 |
refused at the gate | refused at the gate: repeated itself on 2 of 5 | — |
Qwen3-0.6B, weight_only_wi4_afp32 |
refused at the gate | refused at the gate: five prompts not done in 900 s | — |
Qwen3-0.6B, dynamic_wi4b32_afp32 |
+0.0350 (57) | 0.6700 ±0.0376 | +0.0283 ±0.0242 (resolved, 55 discordant) |
Qwen3-0.6B, dynamic_wi4b32_emb8_afp32 |
+0.0550 (67) | 0.6483 ±0.0382 | +0.0500 ±0.0244 (resolved, 56 discordant) |
gemma-3-270m, dynamic_wi4_afp32 |
refused at the gate | refused at the gate: repeated itself on 5 of 5 | — |
gemma-3-270m, weight_only_wi4_afp32 |
refused at the gate | refused at the gate: five prompts not done in 900 s | — |
gemma-3-270m, dynamic_wi4b32_afp32 |
+0.3483 (237) | 0.3067 ±0.0369 | +0.3650 ±0.0518 (resolved, 251 discordant) |
gemma-3-270m, dynamic_wi4b32_emb8_afp32 |
+0.3200 (218) | 0.2650 ±0.0353 | +0.4067 ±0.0529 (resolved, 262 discordant) |
gemma-3-1b, dynamic_wi4_afp32 |
refused past the gate | refused past the gate: repeated itself on 65 of 600 | — |
gemma-3-1b, weight_only_wi4_afp32 |
refused at the gate | refused at the gate: five prompts not done in 900 s | — |
gemma-3-1b, dynamic_wi4b32_afp32 |
+0.0883 (77) | 0.6700 ±0.0376 | +0.0833 ±0.0296 (resolved, 82 discordant) |
gemma-3-1b, dynamic_wi4b32_emb8_afp32 |
+0.0883 (79) | 0.6750 ±0.0375 | +0.0783 ±0.0283 (resolved, 75 discordant) |
Qwen2.5-0.5B, dynamic_wi4_afp32 |
+0.2567 (178) | 0.5017 ±0.0400 | +0.2683 ±0.0451 (resolved, 191 discordant) |
Qwen2.5-0.5B, weight_only_wi4_afp32 |
one generation never finished | 0.5200 ±0.0400 | +0.2500 ±0.0431 (resolved, 174 discordant) |
Qwen2.5-0.5B, dynamic_wi4b32_afp32 |
+0.0767 (62) | 0.6933 ±0.0369 | +0.0767 ±0.0253 (resolved, 60 discordant) |
Qwen2.5-0.5B, dynamic_wi4b32_emb8_afp32 |
+0.0917 (69) | 0.6867 ±0.0371 | +0.0833 ±0.0257 (resolved, 62 discordant) |
The 0.16.1 column is each cost with its discordant rows, from the tables above; every one of them resolved. The float references are the same to four places as there.
Every block-wise cost resolves again, and every recipe that refused on 0.16.1
refuses again but one: weight_only_wi4_afp32 on Qwen2.5-0.5B finished all
600 generations and costs +0.2500, a third of the model's accuracy, beside
dynamic_wi4_afp32's +0.2683, each paired against the float twin and not
against the other. On 0.16.1 it was refused because one prompt exceeded the 300
s per-prompt limit, which the 0.17.1 transport no longer enforces per prompt,
only across the split, so this is not the runtime finishing what 0.16.1 could
not; whether any of the 600 took longer than 300 s is not recorded.
The refusals otherwise read as follows. Qwen3's and gemma-3-1b's
weight_only_wi4_afp32 gates, which on 0.16.1 ran four of five prompts and cut
one at 300 s, wrote nothing within the gate's 900 s budget, as gemma-3-270m's
did in both runs. gemma-3-270m's dynamic_wi4_afp32 was refused for repetition
on all five gate prompts, worst ratio 0.9945, where on 0.16.1 it was refused for
a leaked <bos>; liveness stops at the first check that fails and the leak
check runs first, so whether it also repeated on 0.16.1 is not known. Qwen3's
repeated itself on two of five, worst 0.9829, against one on 0.16.1, and
gemma-3-1b's on 65 of 600 in both runs.
On gemma-3-270m the two block-wise costs reversed order: with int8 embeddings +0.3200 against +0.3483 on 0.16.1, and +0.4067 against +0.3650 here. Within each run both were paired against the float twin and never against each other, so neither run orders them, and which recipe costs the 270M less is not established. The int8-embeddings bundle scored 0.2650 here against 0.3517 on 0.16.1, 52 rows fewer against an unchanged float score; the rows were not kept, so that is not a paired test, and it is not attributed.
The same model through the runtime's tool path
functiongemma-270m-it LoRA-tuned on the 6434 single-call rows of
google/mobile-actions (5794 trained, 640 held out), in runtime_rendered
with the dataset's seven tool declarations, converted dynamic_wi8_afp32, and
measured the way an application calls it: create_conversation(tools=...), the
runtime rendering the declarations and parsing the call itself. The candidate
on litert-lm's CPU backend, the float reference on cuda -- as every run of this
section's manifests records. One run, 2026-09-17; a second, every stage from prepare on with the code
that reads a reply the way the runtime does, gave the same number in every cell
on 2026-09-19.
| exact match | tool name | arguments | refused by the runtime | |
|---|---|---|---|---|
| Float reference | 0.9250 ±0.0204 | |||
| Tool path, runtime grammar off | 0.9125 ±0.0219 | 1.0000 | 0.9125 | 0 |
| Tool path, runtime grammar on | 0.9125 ±0.0219 | 1.0000 | 0.9125 | 0 |
| Cost of conversion | +0.0125 ±0.0087 (resolved, 8 discordant) | |||
| Effect of the grammar | 0.0000 (no discordant row) |
The rendering check compared all 640 prompts, declarations included, and found identical token ids on both sides. Every loss is in the arguments: the model picked the right tool on all 640.
The same checkpoint on litert-lm 0.17.1
The runtime flutter_gemma ships from flutter_gemma_litertlm 1.8.0, measured
2026-09-27 by litetune at commit 9af0a90 (unreleased; it reports itself as
0.1.9) with the checkpoint, the held-out split and the bundle the
2026-09-19 run produced, so nothing was retrained: one A100-SXM4-40GB with 12
vCPU as then, reference on cuda as then. The 0.16.1 column is that run's. The
CPU the 0.17.1 runs computed on is recorded -- Intel(R) Xeon(R) CPU @ 2.20GHz,
with AVX-512 -- and the 0.16.1 run's is not, so the two columns are not shown
to share a CPU and, by the rule above, compare only loosely.
| 0.16.1 | 0.17.1, the same bundle | 0.17.1, re-converted | |
|---|---|---|---|
| Float reference | 0.9250 | 0.9250 | 0.9250 |
| Tool path, grammar off | 0.9125 ±0.0219 | 0.9109 ±0.0221 | 0.9109 ±0.0221 |
| Tool path, grammar on | 0.9125 ±0.0219 | 0.9109 ±0.0221 | 0.9109 ±0.0221 |
| Cost of conversion | +0.0125 ±0.0087 (8 discordant) | +0.0141 ±0.0092 (9 discordant) | +0.0141 ±0.0092 (9 discordant) |
| Effect of the grammar | 0.0000 | 0.0000 | 0.0000 |
583 of 640 right against 584, and the conversion cost still resolves. How much
of that one-row net difference is the runtime and how much the CPU is not
established, since the 0.16.1 run did not record its CPU. The
re-converted bundle -- litert-torch-nightly==0.10.0.dev20260926 with its
quantizer, LiteRT and converter pinned -- is the same size as the old one with a
different SHA-256, and gave the same score in both modes, with the same number
of rows discordant against the reference; the manifests keep scores, not rows,
so whether they are the same rows is not recorded. The tool name was right on
all 640 in every run; the rendering check matched all 640.
What it took to get there
The first two runs of this pipeline failed in ways no unit test and no earlier
measurement could see, because the text scorer finds call: anywhere:
- No call at all. Trained completions lacked the
<start_function_call>and<end_function_call>markers the runtime's parser looks for, and ended with the text turn's<end_of_turn>. Through the tool path the model returned no call on 5 of 5 prompts and nothing was refused. - A grammar that cost 0.1750. With the markers in place, the same pipeline
scored 0.9172 ±0.0214 with the runtime's grammar off and 0.7422 ±0.0339 with
it on, against a reference of 0.9234. All 112 rows that differed had lost an
argument —
send_email.bodyon every row that carried one — and no row was helped by the grammar. The grammar enforces the declared property order, the declarations were sorted, and the model had been trained in the dataset's own argument order: an argument out of place is illegal, so the call closed without it. A 20-row probe confirmed it:bodykept on 20 of 20 with the properties declared in the order the model writes them, on 0 of 20 with them sorted, and on 1 of 20 with four times the token budget. With arguments trained in the declared order, the grammar's effect is the zero above.
Limitations carried by these numbers
- One run, one recipe, one dataset. The dataset's arguments are all strings, so
no number went through the runtime here. Its parser returns every number as a
double (
fc_parser.rs, v0.16.1), and litetune compares numbers by value since — this run could not have shown the difference. - The prompt is one user turn with the developer turn's date lines moved into it: litetune trains no system message. The 3220 rows with two or three calls were left out; every target here is one call.
- An application that enables constrained decoding with declarations whose
properties are in another order than litetune trained against meets the
grammar problem above; with it off, the runtime's default, the order changes
only the prompt. A
runtime_renderedbundle ships its declarations in the order the model learned; an application that builds its own list has to keep that order. - Flutter Edge AI passes FunctionGemma
.litertlmdeclarations to LiteRT-LM as structured data and reads the runtime's parsed tool calls, so this is the same native tool path it uses for this model. - No row was refused by the runtime in either mode, in either run. A row the runtime gives no reply to is scored as a wrong answer when its parser refused it or the prompt reached the token limit, and leaves the mode unmeasured for any other reason. The second run read every reply whole: none carried two calls, in either mode or in the reference.
- The first run read the reference with the text path's parser, which takes the first call anywhere in the text. It is now read as the runtime reads a reply, only between the call markers and one call to a pair. The second run kept the reference's texts and read them both ways: 0.9250 either way, and no row reads differently.
- The untuned base could not be measured through the tool path: converted from its Hub id it carries no SentencePiece tokenizer, and litert-lm 0.16.1 refuses constrained decoding without one. So there is no training gain here.
- Without declarations in the prompt the text path measures nothing useful for this model: the reference itself degenerated on 50 of 640 generations.
Decisions: a model that chooses among options
google/gemma-3-270m-it at ac82b4e8, trained to answer a question about a
text with one of a fixed list of options and scored the way flutter_edge_ai's
proposed createDecider is to use it: every option's log-probability through
the runtime, with no generation (the README's Decisions section). Four
tasks, each one question over its own options. Every row of each dataset was
used, split by prepare (seed 0) into the sizes of the dataset's own splits:
| task | question | dataset | train / calibration / held-out |
|---|---|---|---|
| emotion | choice, six options |
dair-ai/emotion, config split, at cab853a1 |
16,000 / 2,000 / 2,000 |
| irony | noul |
cardiffnlp/tweet_eval, config irony, at b3a375ba |
2,862 / 955 / 784 |
| SST-2 | noul |
SetFit/sst5 at e51bdcd8, without its neutral rows |
6,920 / 872 / 1,821 |
| SST-5 | score, five levels |
SetFit/sst5 at e51bdcd8 |
8,544 / 1,101 / 2,210 |
SST-2 is SST-5 without its 2,242 neutral rows: very negative and negative
answer no, positive and very positive answer yes, and the question is
"Is the text positive?".
Each ran tune --method lora --epochs 2 --prompt-mode runtime_rendered --max-seq-length 2048 --micro-batch-size 4 (LoRA rank 16 on the seven
projections, bfloat16), convert --recipe dynamic_wi8_afp32 --recipe none,
which added --prefill_lengths=8,128, verify --engine-rows 300 --threads 4
with the none file as --float-twin, and bundle. Emotion was prepared,
tuned and its eight-bit file converted on #82's branch at d0833f1; its float
twin was converted, and it was verified and bundled, at b49aaab, the commit
that merged #82. Irony and SST-5 ran every stage at b49aaab. SST-2 ran every
stage at 46199f4, litetune 0.5.0, which also converted, verified and bundled
SST-5's checkpoint again: every score verify took, on all three sides,
equalled b49aaab's bit for bit.
The candidate is the eight-bit file on litert-lm 0.18.0's CPU backend, on four threads of an Intel Xeon @ 2.20GHz, scoring 300 held-out rows spread through the split. The reference is the float checkpoint in PyTorch on an NVIDIA A100, scoring every held-out row. Agreement below is therefore between a runtime on a CPU and a reference on a GPU.
| emotion | irony | SST-2 | SST-5 | |
|---|---|---|---|---|
| verify | passed | failed_gate | passed | passed |
| reference accuracy, every held-out row | 0.9335 | 0.6901 | 0.9055 | 0.5330 |
| runtime's top option is the reference's, of 300 rows | 1.0000 | 0.9367 | 0.9767 | 0.9567 |
| runtime's answer is the reference's, abstentions included | 0.9933 | 0.9367 | 0.9767 | 0.9567 |
| runtime accuracy on its 300 rows (reference on the same rows) | 0.9533 (0.9533) | 0.6767 (0.7000) | 0.8867 (0.8700) | 0.5267 (0.5167) |
| ms per decision, median | 370.1 | 234.8 | 235.4 | 394.9 |
| float twin against the reference, largest per-token difference on 4 rows | 2.96e-05 nats | 3.30e-04 nats | 6.25e-05 nats | 2.97e-05 nats |
verifyrefused irony's eight-bit bundle: 0.9367 is under its 0.95 floor. The 19 rows where the runtime chose otherwise were near-ties for the reference: its best option led its second by at most 0.637 nats on them (median 0.162), against a median of 1.426 on the 281 rows where the two agreed. On those 300 rows the runtime's accuracy differed from the reference's by −0.0233 ± 0.0285, which does not resolve a difference. Trained for longer, irony passed (below).- SST-2, the other
noultask, passed, and its reference was further from ties: its best option led its second by less than 0.5 nats on 7 of the 300 rows, where irony's did on 60, and by a median of 4.911 nats on the 293 rows where the two agreed. Six of the 7 rows where the runtime chose otherwise had margins of 0.011 to 0.866 nats. The seventh did not: the reference led by 2.248 nats, and the runtime moved one option's score by 1.674. On the 300 rows the runtime's accuracy differed from the reference's by +0.0167 ± 0.0173, which does not resolve a difference either. - Emotion's threshold abstains: the reference answered 0.9805 of the held-out
rows, and was wrong on 0.0571 of those it answered. A
noulorscorequestion never abstains. bundlewrote emotion'slitetune.decisionsection. For irony,b49aaabbundled the file without one, as it should, but reportedfailed_harnessrather than verify'sfailed_gate; #83 carries verify's status.
Irony trained for longer
Irony was trained again for four and for six epochs, from the same split and
with every other flag as above, and each checkpoint was converted, verified
and bundled at 46199f4. tune.py and decision_scripts.py are the same at
b49aaab and 46199f4, and both runs' first two epochs had the two-epoch
run's mean training losses, bit for bit. Both bundles passed, on the same 300
rows:
irony as noul |
2 epochs | 4 epochs | 6 epochs |
|---|---|---|---|
| verify | failed_gate | passed | passed |
| runtime's top option is the reference's, of 300 rows | 0.9367 | 0.9667 | 0.9500 |
| reference's best option led its second by under 0.5 nats, of the 300 rows | 60 | 17 | 19 |
| reference accuracy, 784 held-out rows | 0.6901 | 0.6671 | 0.7117 |
reference answered yes, of the 784 rows (the labels: 0.4949) |
0.2334 | 0.7666 | 0.4592 |
- The six-epoch bundle passed on the floor: the runtime agreed with the reference on 285 of the 300 rows, and one row fewer would have failed the gate.
- Neither longer run's reference accuracy differed from the two-epoch reference's by a resolved amount: −0.0230 ± 0.0511 at four epochs and +0.0217 ± 0.0365 at six, paired on the same 784 rows. The answers moved more than the accuracy did: the four-epoch reference answered otherwise than the two-epoch one on 418 of the rows, and was right on 200 of them.
Every family on emotion
The emotion task again, from the same split, on one or two models of every
family litetune has a rule for, each from its Hub revision through the same
five stages with the flags above: prepare, tune, convert, verify with the
none file as --float-twin, bundle. Every family but Gemma 3 text needs that
twin to be verified. Each model ran at d686851 but Gemma 4, whose reference
this run showed to be wrong and which ran again at eab4cf0 (below); the two
commits differ in nothing else a decision executes. The candidate and the
reference are as above: the eight-bit file on four threads of the same CPU
model, the float checkpoint on an A100.
| model @ revision | verify | reference accuracy, 2,000 rows | runtime accuracy, 300 rows | runtime's top option is the reference's | runtime's answer is the reference's | mean KL | ms per decision, median | float twin, largest per-token difference |
|---|---|---|---|---|---|---|---|---|
| gemma-3-270m-it @ ac82b4e8 | passed | 0.9335 | 0.9533 | 1.0000 | 0.9933 | 0.0007 | 415.8 | 2.96e-05 |
| gemma-3-1b-it @ dcc83ea8 | failed_gate | 0.9305 | 0.9467 | 0.9933 | 0.9900 | 0.0005 | 935.6 | 7.63e-05 |
| functiongemma-270m-it @ 39eccb09 | passed | 0.9305 | 0.9567 | 0.9933 | 0.9833 | 0.0014 | 371.8 | 1.79e-04 |
| gemma-4-E2B-it @ 3e22461f | passed | 0.9405 | 0.9600 | 0.9967 | 0.9933 | 0.0005 | 1069.8 | 5.50e-05 |
| Qwen3-0.6B @ c1899de2 | passed | 0.9380 | 0.9467 | 0.9900 | 0.9833 | 0.0013 | 1497.8 | 3.80e-04 |
| Qwen3-1.7B @ 70d244cc | passed | 0.9395 | 0.9567 | 0.9967 | 0.9900 | 0.0006 | 2084.6 | 1.05e-04 |
| Qwen2.5-0.5B-Instruct @ 7ae55760 | passed | 0.9330 | 0.9467 | 1.0000 | 0.9933 | 0.0004 | 550.5 | 5.96e-05 |
| Qwen2.5-1.5B-Instruct @ 989aa798 | passed | 0.9335 | 0.9533 | 0.9900 | 0.9867 | 0.0007 | 1332.8 | 2.43e-04 |
| MiniCPM5-1B @ 87179e5c | passed | 0.9355 | 0.9600 | 1.0000 | 0.9867 | 0.0006 | 921.5 | 1.23e-04 |
| granite-4.1-3b @ c0650403 | passed | 0.9325 | 0.9567 | 0.9967 | 0.9933 | 0.0003 | 2836.4 | 7.35e-05 |
| Qwen3.5-0.8B @ 2fc06364 | passed | 0.9295 | 0.9433 | 0.9967 | 0.9867 | 0.0005 | 39766.0 | 2.65e-02 |
- Every family but Qwen 3.5 had its options scored by rewinding one session, the method measured on Gemma 3, and every one of their twins was within 3.80e-04 nats of the reference, under the 1e-3 the check allows.
- gemma-3-1b was refused by the abstain rule, not by the runtime: the reference was wrong on 0.0629 of the 1,971 held-out rows it answered, a 95 % lower bound of 0.0541 against the 0.05 the threshold was fitted to keep. The runtime agreed with it as closely as every other model's did.
- Gemma 4's forward soft-caps lm_head's output at 30, with the
final_logit_softcappingof its text config; its exported bundle does not. A reference that applied the cap differed from the float twin by up to 3.13e+01 nats per token and was refused; without it, by 5.50e-05. The reference follows the bundle. Greedy text is the same either way, since the cap keeps the order of the logits; sampled text is not. - The seven other models a first run measured at an earlier commit,
e59d7bc, gave the same status, accuracies, agreements, mean KL and twin difference again atd686851, field for field. ms per decision moved by up to 15 % (gemma-3-1b: 816.5, then 935.6). - Qwen3.5-0.8B's row is its verify at
39ba2c2, which holds this family's twin to 5e-02 nats per token and says so in the manifest. Atd686851, under the 1e-3 every other family is held to, the same checkpoint was refused by the twin alone, with the same accuracies, agreements and mean KL. On the twin's rows PyTorch in float32 was within 2.7e-05 of a float64 reference and the bundle 2.65e-02 from it, so the difference is the exported bundle's own arithmetic. Each option is scored on an Engine of its own (fresh_engine, LiteRT-LM#3165): this verify loaded an Engine 1,813 times, and a decision took a median of 39,766.0 ms.
The three passing bundles on a phone
The bundles verify passed for emotion, SST-2 and SST-5 above, the same files,
scored on a Galaxy S24 (SC-51E, SM8650, Android 16) through Firebase Test
Lab, on its CPU (four threads) and on its GPU. The phone ran verify's runtime
scoring, ported step for step to LiteRT-LM 0.18.0's C API (libLiteRtLm.so
from flutter_gemma's native-v0.18.0-a build), on the same 300 held-out rows
and the same prompt ids, and its scores were compared with the server
runtime's and the reference's with litetune 0.5.1's own functions. The port is
not part of litetune, and a decider in an app may score otherwise. The server
column is the verify that bundled each file; SST-5's is litetune 0.5.0's, whose
median of 390.9 ms differs from the 394.9 of b49aaab's run above with the
same scores.
| emotion | SST-2 | SST-5 | |
|---|---|---|---|
| runtime's top option is the reference's: server / phone CPU / phone GPU | 1.0000 / 1.0000 / 0.9967 | 0.9767 / 0.9867 / 0.9967 | 0.9567 / 0.9433 / 0.9433 |
| phone's top option is the server's, of 300: CPU / GPU | 300 / 299 | 295 / 294 | 286 / 284 |
| ms per decision, median: server / CPU / GPU | 370.1 / 437.3 / 697.2 | 235.4 / 291.0 / 405.3 | 390.9 / 499.7 / 356.4 |
| engine init: CPU / GPU | 0.831 s / 5.171 s | 0.957 s / 4.451 s | 1.024 s / 4.117 s |
| peak RSS of the test process: CPU / GPU | 1,135,532 / 680,180 kB | 1,146,528 / 676,756 kB | 1,141,700 / 681,624 kB |
- No phone option score equalled the server's but one, and none of the
paired accuracy differences, phone against server or against the reference,
resolved: every 95 % interval contains 0. The self-check picked
onceon both backends for every bundle, as on the server, and a repeat session gave bit-identical scores on all 300 rows. - SST-5 is under verify's 0.95 floor on both backends, and its disagreements are near-ties. Its reference's best level led its second by under 0.2 nats on 54 of the 300 rows, where emotion's did on 2 and SST-2's on 5. Every row on which the server or the phone's CPU chose otherwise than the reference was among those 54 (13 and 17 rows), and 14 of the GPU's 17; its other three had margins of 0.2813, 0.3059 and 0.6728 nats. On the 246 rows with a margin of at least 0.2 nats the server and the phone's CPU agreed with the reference on all, the GPU on 0.9878.
- The GPU was faster than the CPU on SST-5 and slower on emotion and SST-2. A repeat of the GPU emotion session took a median of 435.8 ms, with the same scores; why the first was slower was not measured. Engine init includes writing a weight cache: every session was a fresh install.
- Not measured: thermal state and clock frequencies, GPU memory, another phone model, the NPU, and reading the section out of the file on the phone.
The reference, sixteen rows at a time
verify's float reference used to score a decision one row at a time: one
forward over the prompt, one over its options. It now scores up to sixteen
rows of a similar length together (decision_scripts). The most padded batch
goes first and every row of it is checked against the row scored alone with
no cache; if it differs or raises, the reference falls back to one row at a
time. The rows the float twin is compared on are recorded as scored alone.
The emotion decision of "Every family on emotion" was retrained with litetune
0.7.1 (gemma-3-270m-it, the same splits and flags) and verified on a Mac with an
M5 Pro, on the CPU, with --calibration --float-twin --engine-rows 300 --threads 4 and 4,000 reference rows. The Mac was running other work, so CPU
time is the comparable figure; the wall times are given with the load average.
| one row at a time | sixteen at a time | |
|---|---|---|
CPU time of the whole verify, user + system |
2,623 s | 1,175 s |
| reference stage, wall | 1,044 s | 1,257 s at load 30 to 50 (156 s for the first version at load 4) |
whole verify, wall |
18 min 27 s | 25 min 21 s at load 30 to 50 (3 min 23 s for the first version at load 4) |
| runtime's top option / answer is the reference's | 0.9967 / 0.9933 | 0.9967 / 0.9933 |
| temperature, abstain below | 1.2838772, 0.5074026 | 1.2838769, 0.5074019 |
| mean KL | 3.9384e-04 | 3.9383e-04 |
| float twin, largest per-token difference | 5.15e-05 | 4.58e-05 |
The same script before and after batching, on the first 100 held-out rows of the same task for other families' base checkpoints, measured on the first batched version, which chunked a fixed 96 pairs; over these prompts the committed version chunks about as many. The times are approximately milliseconds per row: the rows the script checked against uncached scoring are left out, and a batched row carries a share of its batch's checks. "Largest difference" is the largest per-token difference between the old scores and the new.
| checkpoint | one at a time | sixteen at a time | largest difference | top option changed |
|---|---|---|---|---|
| gemma-3-270m-it, tuned (300 rows) | 184.1 | 59.0 at load 45 | 4.2e-05 | 0 rows |
| Qwen2.5-0.5B-Instruct | 466.8 | 272.4 | 9.0e-05 | 0 rows |
| Qwen3-0.6B | 606.4 | 358.7 | 1.4e-04 | 0 rows |
| MiniCPM5-1B | 716.0 | 368.0 | 7.4e-05 | 0 rows |
| granite-4.1-3b | 3,582.8 | 818.1 | 4.9e-04 | 0 rows |
| Qwen3.5-0.8B | 2,969.5 | 4,941.2 | 0 | 0 rows |
- The gemma row is the committed version; the others are the first version.
- On Qwen3.5-0.8B no way of passing the cache matched uncached scoring on the first row, so it is scored one row at a time, uncached, before and after, and the scores were bit-identical. Its two times are the same code path under different load.
- No first batch fell back to one row at a time.
- On small random Gemma 3 (a sliding window shorter than the prompts), Granite and Qwen3 models, batched scores were within 4e-06 of one row at a time.
- gemma-4-E2B was not run here. In its verify for "Every family on emotion" (on CUDA) every way of passing the cache missed uncached scoring by 34.8 nats, because its forward soft-caps the logits and its bundle does not, so it was scored with no cache. The script does not batch without a cache, so by the code it scores one row at a time as before; that is not measured.
- On MPS, an experiment script scored the 300 gemma rows at 29.5 ms a row in batches of 16, 16.3 in batches of 64 and 14.7 in batches of 128, within 8.3e-05 of the CPU. The next section is the reference wired onto MPS.
- Not measured: FunctionGemma and gemma-4-E2B, whose checkpoints are gated, and CUDA.
- The M5 Pro's CPU has SME2, and the runtime's scores above were taken on it at
four threads. On such a CPU Google's litert-lm 0.18.0 wheel gives results that
depend on the thread count (XNNPACK #11789). Checked 2026-11-01 on the same Mac
with this decision's
dynamic_wi8_afp32bundle and 50 of its held-out rows: at four threads the scores repeated run to run and differed from one thread's by up to 0.481 nats a token on 12 of the 50 rows, and no top option changed; one thread gave, bit for bit, the scores of a run with SME hidden from the process. A float32 twin of an emotion decision, scored as the twin check scores it, varied at four threads by up to 2.5e-05 nats run to run, under the 1e-03 twin tolerance. The 300-row agreement and mean KL above were not measured again at one thread.verifynow runs LiteRT-LM on one thread on such a CPU.
The decision reference on MPS
On a Mac whose training environment's torch reaches MPS, verify runs a
decision's float reference there, 64 rows a batch, under the memory policy
evaluate uses; a reference that runs out of MPS memory, or stops on an
operation MPS does not implement, is scored again on the CPU. Measured
2026-10-31 on an M5 Pro with 64 GB, on the emotion decision above
(gemma-3-270m-it, LoRA, the dynamic_wi8_afp32 bundle): the same verify,
--calibration --engine-rows 300 --threads 4, no float twin, one run after
another. The first pair ran the first version of the change; the second ran
it as committed, with a third run whose MPS limit was set too low on purpose
(PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.01, 531 MB).
| run | reference on | rows a batch | batches | reference | verify wall | user CPU |
|---|---|---|---|---|---|---|
| first pair | CPU | 16 | 250 | 104.0 s | 145 s | 607 s |
| first pair | MPS | 64 | 63 | 73.3 s | 118 s | 128 s |
| second | CPU | 16 | 250 | 160.3 s | 204 s | 860 s |
| second | MPS | 64 | 63 | 69.4 s | 115 s | 133 s |
| second, 531 MB limit | MPS, then CPU | 16 | 250 | 157.4 s on the CPU | 204 s | 883 s |
- Every run passed with the same agreement (0.9967 top option, 0.9933 answer) and the same accuracies. MPS against the CPU moved the fit by 2.0e-07 in temperature (1.2838769 against 1.2838767) and 1.9e-06 in the abstain threshold; mean KL to the runtime 3.938340e-04 against 3.938337e-04.
- The run under 531 MB stopped on MPS when the model was moved there
(
MPS backend out of memory ... max allowed: 530.84 MB), was scored again on the CPU, and gave the CPU run's fit to the last digit. - The CPU reference took 104.0 s in one run and 160.3 s in the other, with load averages of 2 to 8 from other work on the Mac; the MPS reference took 73.3 s and 69.4 s.
- Under litetune's budget (27.5 GB here), torch's MPS counters read at most 2.57 GB allocated to tensors and 9.3 GB held by the driver, cached blocks included, over 368 readings: after loading the model, after each batch's prompt forward, at each chunk's log-probabilities and after each batch. Between readings they were not read, so these are not peaks.
- Not measured: other families, a Mac with less memory, a float twin on MPS.
- The runtime's scores in these runs, and so the agreement and KL, are the M5 Pro's SME2 CPU at four threads; the last bullet of the previous section says what that changed on 50 rows. The reference's MPS-against-CPU figures are torch's and are not affected.
Limitations carried by the decision numbers
- One training run per task and epoch count, on one model, one recipe and the CPU backend of one CPU model; on the other families, one task, emotion. One phone, for three of the tasks, above.
- The temperature, and for emotion the threshold, were fitted on the reference's calibration scores and are applied to the runtime's.
- The runtime scored 300 of each task's held-out rows. The reference scored every one of them: 2,000, 784, 1,821 and 2,210.
EmbeddingGemma 2: a decider fine-tuned and grafted into Google's file
tune --model google/embeddinggemma-2 fine-tunes the text tower for one
decision, and convert writes the result into Google's own
embeddinggemma-2-text-270m.litertlm
(litert-community/embeddinggemma-2-text-270m-litert-lm, revision 9be6e8b9,
164,626,432 bytes) in place of Google's weights: we found no published path
from a PyTorch checkpoint to an EmbeddingGemma 2 .litertlm as of October 2026
(litert-torch's embedding_gemma example converts the first EmbeddingGemma to
a bare .tflite, and its Hugging Face export has no embedding task). The
application uses
the file through flutter_edge_ai's EmbeddingModel.createDecider, which
embeds every input behind task: sentence similarity | query: and answers
with the option whose centroid of examples is nearest. Every number below was
taken on a 32-vCPU Linux machine, Intel Xeon @ 2.20GHz, with LiteRT-LM 0.18.0's
EmbeddingEngine on the CPU backend against sentence-transformers 6.1.0 in
float32 (torch 2.9.1, transformers 5.19.0). The measurements were driven by
scripts outside this repository (graft_s2.py, train_s5.py, emb_s5.py,
eval_s5.py); litetune's own code is what the last subsection measures.
The graft
Everything in this subsection was embedded behind
task: classification | query: , the prefix the first experiments used, not
the decider's; the next subsection uses the decider's.
-
Google's file holds the text tower as two TFLite sections, an embedder (a 262,144×512 table) and a text encoder with six signatures, one per input length. Its 219 two-dimensional weights are int4, one scale per output row, symmetric, and map one to one by name onto the Hugging Face checkpoint (
google/embeddinggemma-2at914f7f89). One of them carries a folded constant of 1/512. The RMSNorm weights are inline float32 constants, each shared by the six signatures and placed by tracing it back through the graph: 170 of them take the checkpoint's norms, and two belong to a value norm that has no weight in the checkpoint and are left as Google wrote them. -
Google's weights read out and written back by the graft reproduce Google's file to a mean cosine of 0.9993 (all int4) and 0.9987 (an int8 encoder with the embedder in int4) on 200 texts, so the writer loses nothing beyond re-rounding.
-
The base checkpoint grafted in int8 is 0.9975 (mean cosine) from sentence-transformers; Google's own file is 0.9690. Grafted in int4 without quantization-aware training it is 0.9451 (that run kept Google's norms; with the checkpoint's own, 0.9382): four bits cost the base model's vectors more than Google's file does.
-
Fine-tuned on emotion (six labels, 16,000 rows; a Linear-GELU-Linear head on the sentence embedding, cross-entropy + Brier, the head discarded) the centroid and linear accuracies on 2,000 test rows were:
embeddings centroid linear Google's file 0.6035 0.7435 fine-tuned, float32 0.9325 0.9295 fine-tuned, int8 graft (300,089,344 bytes) 0.9330 0.9300 fine-tuned, int4 graft, no QAT (164,626,432 bytes) 0.9330 0.9340 QAT, int4 graft 0.9335 0.9325 Quantization-aware training added nothing measurable there. int4 still moves the vectors: mean cosine 0.960, minimum 0.687, to the float32 fine-tune.
-
A soft-margin triplet loss tried first collapsed: its loss settled at ln 2 and its linear probe answered the largest label.
-
Of the 173 inline float32 constants of a norm's length in the text encoder's 1,458 subgraphs, 172 are those norms; the remaining one is read by a multiplication inside the composites' decompositions and runs geometrically from 1.06e-6 to 1.0, a table of inverse frequencies, not a norm.
-
Four engine processes sharing one model file failed with XNNPack's "could not verify buffer list mapping": the runtime writes its weight cache beside the model unless given a directory.
verifygives each run a directory of its own.
Many labels
The same recipe with the decider's prefix on every text, on banking77 (77 labels, 10,003 training and 3,080 test rows) and CLINC150's in-scope intents (150 labels, 15,000 and 4,500), accuracy on the test rows; the k-shot centroid is fitted on k rows per label, five seeded draws, the same rows for every embedding:
| banking77 | all rows | k=5 mean | k=10 mean | linear | cosine to float32, mean / min |
|---|---|---|---|---|---|
| Google's file | 0.9110 | 0.8801 | 0.8951 | 0.9364 | |
| fine-tuned, float32 | 0.9341 | 0.9322 | 0.9345 | 0.9367 | |
| int8 | 0.9341 | 0.9311 | 0.9343 | 0.9377 | 0.9993 / 0.9923 |
| int4 | 0.9321 | 0.9294 | 0.9318 | 0.9344 | 0.9693 / 0.8612 |
| CLINC150 | all rows | k=5 mean | k=10 mean | linear | cosine to float32, mean / min |
|---|---|---|---|---|---|
| Google's file | 0.9487 | 0.9138 | 0.9372 | 0.9660 | |
| fine-tuned, float32 | 0.9680 | 0.9682 | 0.9676 | 0.9693 | |
| int8 | 0.9684 | 0.9679 | 0.9674 | 0.9696 | 0.9994 / 0.9957 |
| int4 | 0.9662 | 0.9666 | 0.9659 | 0.9693 | 0.9754 / 0.8876 |
- int4 cost 0.0027 (banking77) and 0.0017 (CLINC150) of the 10-shot centroid's
accuracy, int8 0.0002 on both; no interval was computed for these (litetune's
verifycomputes a paired one). Soconvertwrites int4 by default. - An int4 encoder with an int8 embedder (231,735,296 bytes) scored within 0.0007 of int4 on the 10-shot centroid on both (within 0.0013 on every decider), and is not offered.
- The fine-tune gains most where the decider has few examples: +0.0521 and +0.0544 at k=5, +0.0394 and +0.0304 at k=10. With a linear layer on every training row the gain is 0.0003 and 0.0033.
- int4 moves the vectors (minimum cosine 0.86 to 0.89), so a decider threshold set on one file may not carry over to another. Carrying one over was not measured (the next subsections fit each file's own), nor were tasks that read distances directly, retrieval among them.
- Training took 2,880 s (banking77) and 3,189 s (CLINC150) on the 32 vCPUs, in float32. Nothing was trained on a GPU.
litetune end to end
litetune's own stages, prepare → tune → convert (int8 and int4) →
verify --with-base, on banking77 through prepare's split: 9,158 training
and 2,617 held-out rows (so not the official split the previous subsection
used, and not the same numbers).
All six stages exited 0. tune took 2,347 s.
| embeddings | all rows | k=5 mean | k=10 mean | linear | cosine to float32, mean / min |
|---|---|---|---|---|---|
| Google's file | 0.9270 | 0.8936 | 0.9137 | 0.9534 | |
| fine-tuned, float32 | 0.9316 | 0.9300 | 0.9312 | 0.9389 | |
| int8 file | 0.9308 | 0.9299 | 0.9314 | 0.9392 | 0.9993 / 0.9869 |
| int4 file | 0.9289 | 0.9260 | 0.9276 | 0.9400 | 0.9688 / 0.7768 |
- Both files passed
verify's gate. The conversion cost on the 10-shot centroid decider was -0.0002 for int8 (per draw 0 to -0.0011, intervals up to ±0.0021) and +0.0037 for int4 (per draw +0.0019 to +0.0050, intervals about ±0.004). Three of the five int4 draws resolve the cost as above zero; every draw's upper bound is under 0.01. - The files' gain over Google's at k=10 was +0.0177 (int8) and +0.0138 (int4), the float32 fine-tune's +0.0175. With a linear layer on every training row Google's file scored higher than the fine-tune, 0.9534 against 0.9389.
verifyembedded the file and Google's side by side, each at 4 threads, on 11,775 texts: 47 minutes for int8 and 35 for int4 from start to exit, where the previous run, one side after another, took 76 and 62. Per text the int4 file took a median 135.8 ms and Google's 134.2 ms; the int8 file 196.3 ms beside Google's 134.3 ms.- The int4 file's 10-shot draws equal the previous run's, draw for draw. The int8 file's 10-shot mean moved from 0.9318 to 0.9314; between the two runs int8 codes changed to stop at -127, as TFLite's quantization specification has them, instead of -128, and nothing else in the int8 path changed that the int4 path did not share.
CLINC150, from the published package
The same stages run from litetune 0.7.0 as installed from PyPI, on CLINC150's
in-scope intents (150 options) through prepare's split: 13,650 training and
3,900 held-out rows. All six stages exited 0; tune took 3,241 s.
| embeddings | all rows | k=5 mean | k=10 mean | linear | cosine to float32, mean / min |
|---|---|---|---|---|---|
| Google's file | 0.9592 | 0.9298 | 0.9493 | 0.9787 | |
| fine-tuned, float32 | 0.9792 | 0.9796 | 0.9791 | 0.9803 | |
| int8 file | 0.9790 | 0.9796 | 0.9792 | 0.9808 | 0.9994 / 0.9913 |
| int4 file | 0.9764 | 0.9770 | 0.9765 | 0.9787 | 0.9749 / 0.8574 |
- Both files passed: a conversion cost of -0.0001 (int8) and +0.0026 (int4) on the 10-shot centroid decider, every draw's upper bound under 0.01. The files' gain over Google's at k=10 was +0.0299 (int8) and +0.0272 (int4).
Abstention, as the app calibrates it
The app's createDecider abstains by default: EmbeddingDeciderCalibration.crossFit
(keep 0.95) fits a threshold on the options' own examples and refuses a request
whose best cosine is below it. verify now fits it the same way on each draw's
k examples. Measured again on the files of the two runs above (the same rows,
five draws), at k=10; every held-out row is in scope:
| banking77 | answered | right when answered | answered and right | right, answering every row |
|---|---|---|---|---|
| Google's file | 0.9558 | 0.9268 | 0.8857 | 0.9137 |
| fine-tuned, float32 | 0.9068 | 0.9702 | 0.8798 | 0.9312 |
| int8 file | 0.9086 | 0.9698 | 0.8812 | 0.9314 |
| int4 file | 0.9094 | 0.9660 | 0.8784 | 0.9276 |
| CLINC150 | answered | right when answered | answered and right | right, answering every row |
|---|---|---|---|---|
| Google's file | 0.9581 | 0.9594 | 0.9192 | 0.9493 |
| fine-tuned, float32 | 0.9082 | 0.9948 | 0.9035 | 0.9791 |
| int8 file | 0.9081 | 0.9948 | 0.9034 | 0.9792 |
| int4 file | 0.9061 | 0.9942 | 0.9008 | 0.9765 |
- With the fine-tune the decider answers fewer requests and is right on more of those it answers: 0.97 against 0.93 on banking77, 0.99 against 0.96 on CLINC150. Of all requests, the share answered and right is about the same on banking77 (0.878–0.886) and lower with the fine-tune on CLINC150 (0.901–0.904 against 0.919).
- Google's file answers 0.956 and 0.958 of the held-out requests, close to the 0.95 the calibration keeps; the fine-tune answers about 0.91 on both. The examples the threshold is fitted on are training rows, which the fine-tune was trained on, and the threshold sits high against the scores of the held-out requests; that is consistent with the examples scoring higher against their centroids than requests the fine-tune has not seen, which the next section tests. In absolute terms the fine-tune's thresholds were lower than Google's on banking77 (about 0.82 against 0.89) and about the same on CLINC150 (0.88–0.89 against 0.88).
- At k=5 the pattern is the same on both tasks.
- Out-of-scope requests were not in the rows, so how many of those the
threshold refuses is not measured here; the next section measures it on
CLINC150. No option had a description, which the app would add as one more
input and which changes the folds.
verifyreports these numbers and does not gate on them.
Which calibration, with a fine-tuned file
Besides none, the app offers three calibrations: crossFit with a chosen keep,
fromLabelled (a threshold fitted on labelled requests to an error budget),
and minSimilarity (a fixed threshold; the app documents 0.875 for Google's
int4 file). Measured on the int8 files and Google's file of the two runs
above, embedded again, at k=10 examples from the training rows, five draws.
fromLabelled was fitted on the run's calibration split (rows never trained
on, all in scope: the app accepts only labels that are options) with a 0.05
budget. On CLINC150, out-of-scope requests are its 1,000 test oos rows.
This embedding run's numbers for the default crossFit differ from the
section above by up to 0.002.
| banking77 | calibration | answered | right when answered | answered and right |
|---|---|---|---|---|
| fine-tuned | crossFit 0.95 | 0.9067 | 0.9701 | 0.8796 |
| fine-tuned | crossFit 0.98 | 0.9541 | 0.9557 | 0.9118 |
| fine-tuned | crossFit 0.99 | 0.9744 | 0.9471 | 0.9228 |
| fine-tuned | minSimilarity 0.875 | 0.8389 | 0.9802 | 0.8223 |
| fine-tuned | fromLabelled 0.05 | 0.9695 | 0.9499 | 0.9209 |
| Google's file | crossFit 0.95 | 0.9570 | 0.9263 | 0.8864 |
| Google's file | crossFit 0.98 | 0.9814 | 0.9194 | 0.9023 |
| Google's file | minSimilarity 0.875 | 0.9880 | 0.9175 | 0.9065 |
| Google's file | fromLabelled 0.05 | 0.8029 | 0.9545 | 0.7663 |
| CLINC150 | calibration | answered | right when answered | answered and right | out of scope refused |
|---|---|---|---|---|---|
| fine-tuned | crossFit 0.95 | 0.9083 | 0.9949 | 0.9036 | 0.9714 |
| fine-tuned | crossFit 0.98 | 0.9470 | 0.9918 | 0.9392 | 0.9500 |
| fine-tuned | crossFit 0.99 | 0.9644 | 0.9894 | 0.9542 | 0.9210 |
| fine-tuned | minSimilarity 0.875 | 0.9274 | 0.9934 | 0.9213 | 0.9668 |
| fine-tuned | fromLabelled 0.05 | 1.0000 | 0.9791 | 0.9791 | 0.0988 |
| Google's file | crossFit 0.95 | 0.9579 | 0.9588 | 0.9185 | 0.9062 |
| Google's file | crossFit 0.98 | 0.9841 | 0.9542 | 0.9390 | 0.8250 |
| Google's file | minSimilarity 0.875 | 0.9754 | 0.9560 | 0.9325 | 0.8676 |
| Google's file | fromLabelled 0.05 | 0.9939 | 0.9512 | 0.9454 | 0.5140 |
- With examples the fine-tune was not trained on (six per option from the
calibration split, the most its smallest option has), the default
crossFit0.95 answered 0.9505 of banking77 and 0.9433 of CLINC150, against 0.9067 and 0.9083 with training examples; Google's file answered 0.9537 and 0.9649. The examples differ in k as well as in source, but the result is what the training-row explanation above predicts. - The fine-tuned file at
crossFit0.98 against Google's file at the default: on CLINC150, answered and right 0.9392 against 0.9185, out of scope refused 0.9500 against 0.9062; on banking77, answered and right 0.9118 against 0.8864. Raising keep on Google's file to 0.98 refused 0.8250 of out-of-scope requests. fromLabelledon in-scope requests alone refused 0.0988 (fine-tuned) and 0.5140 (Google's file) of out-of-scope requests: when the decider errs less than the budget on in-scope requests, the threshold it fits can be as low as answering everything.minSimilarity0.875 answered 0.8389 of banking77 with the fine-tuned file: a threshold set for Google's file does not carry over.- Out-of-scope requests were measured on CLINC150 only, at k=10 only, without option descriptions.
EmbeddingGemma 2 on a Qualcomm NPU
Measured 2026-10-31. The banking77 fine-tune of litetune end to end above, its int8 graft (300,089,344 bytes), with the text encoder compiled ahead of time for SM8750, run on a Galaxy S25 Ultra (SM-S938U1, SM8750, Hexagon V79, Android 15).
How the file was made (what convert --npu does): the graft's text encoder with its
external weights inline and only Google's four NPU signatures (128, 256, 512 and 1024
tokens), compiled by LiteRT's apply_plugin_main with the Qualcomm plugin
(ai-edge-litert 2.3.0, ai-edge-litert-sdk-qualcomm 2.3.0, QAIRT 2.50.0.260828) and
--qualcomm_enable_weight_sharing=true, on a 32-vCPU x86-64 Linux machine; packed with the
graft's metadata, tokenizer and embedder byte for byte, in the section order of Google's
Qualcomm file.
| compiled encoder | partitions per signature | QNN context | file | compile |
|---|---|---|---|---|
| int4 graft | 194 (218 int4 FULLY_CONNECTED left on the CPU) | — | 332,988,416 B | 319 s |
| int8 graft, no weight sharing | 1 | 586,875,872 B | 729,006,080 B | 215 s |
| int8 graft, weight sharing | 1 | 169,586,688 B | 311,705,600 B | 233 s |
| Google's SM8750 file (base model) | 1 | 112,578,560 B (QAIRT 2.49) | 187,596,800 B | — |
Both int8 compiles leave one QNN context that the four signatures' DISPATCH_OPs share; what
tells them apart is its size against the encoder's 136,708,096 weight bytes, 1.24x with
weight sharing and 4.29x without. convert --npu refuses a context larger than 2x, which is
evidence of sharing, not a proof of it. The int4 file's QNN context did not load on the phone
(Failed to create QNN context: 1002). SM8650 compiles the same way (224–293 s); its file has not run on a device.
On the phone, through LiteRT-LM 0.18.0's EmbeddingEngine C API with the Qualcomm
dispatch built against QAIRT 2.50.0 and Qualcomm's QNN runtime 2.50.0 (the runtime
flutter_edge_ai's native-v0.18.0-h release ships), on the 2617 held-out rows and the
4247 training rows the k-shot draws use, behind the decider's prefix. Accuracy is verify's
k-shot centroid decider (five draws); the cost is against the float32 reference, paired.
| side | k=10 mean (min) | k=5 mean | cost, k=10 | cosine to float32, mean / min | ms per text |
|---|---|---|---|---|---|
| float32 reference | 0.9312 (0.9301) | 0.9300 | — | 1 | — |
| NPU, the int8 file compiled for SM8750 | 0.9316 (0.9308) | 0.9299 | −0.0004, unresolved in 5 of 5 draws | 0.99961 / 0.99696 | 9.86 |
NPU, the same graft compiled again by convert --npu |
0.9316 (0.9308) | 0.9299 | −0.0004 | 0.99961 / 0.99696 | 9.62 |
| the phone's CPU, the int8 graft, 4 threads | 0.9314 (0.9305) | 0.9302 | −0.0002 | 0.99928 / 0.98907 | 57.6 |
| an x86 CPU, the int8 graft, 4 threads | 0.9312 (0.9301) | 0.9298 | 0.0000 | 0.99927 / 0.98694 | 174 |
| NPU, Google's SM8750 file (base model) | 0.9169 (0.9113) | 0.8974 | +0.0144, resolved in 5 of 5 | — | 6.73 |
The two compiles of the same graft differ in size by 4,096 bytes of QNN context and gave byte-identical vectors on every one of the 6,864 texts. Google's NPU file against Google's CPU file on the same texts: cosine 0.787 (mean). Loading took 0.67 s on the NPU and 1.0 s on the phone's CPU; the peak resident memory was 421–423 MiB on the NPU and 511 MiB on the CPU. No text was longer than 105 tokens, so only the 128-token signature ran.
EmbeddingGemma 2 on images: beans
Measured 2026-11-04, once: litetune's own stages, prepare → tune → convert
(int8 and int4) → verify --with-base, at litetune commit c9904df (unreleased), on
image rows. The decider's inputs are pictures, and the file is Google's
embeddinggemma-2-text-vision-440m.litertlm
(litert-community/embeddinggemma-2-text-vision-440m-litert-lm, revision e301f74d) with
its text tower replaced by the fine-tune's. It is the first int4 image file litetune has
measured.
The rows. AI-Lab-Makerere/beans at revision 27aa014c (MIT): its train, validation
and test archives pooled, 1,295 JPEG leaf photos, every one 500×500, in three options —
bean_rust 436, angular_leaf_spot 432, healthy 427 — no two the same bytes.
prepare --heldout-size 300 split them into 865 training, 130 calibration (which the
embedding path does not read) and 300 held-out rows (99, 99 and 102 per option).
tune --vision-tokens 70, without mirrored copies, on one CUDA device: 110 steps (two
epochs) in 19.8 s, after 49.5 s computing the 1,165 pictures' inputs; 106 s for the stage.
Every picture took 64 soft tokens. The discarded head scored 0.92 on the held-out rows;
that is the head's, not the decider's. convert passed both times: int8 523,173,888 bytes,
int4 387,710,976 (the size of Google's file), the four text-tower sections from the graft
and the other seven Google's, every frozen tensor the base's.
verify ran on the CPU of the same machine, an Intel Xeon @ 2.20GHz with 12 CPUs, at 8
threads: the reference in float32 through transformers 5.19.0 (torch 2.9.1), the files
through LiteRT-LM 0.18.0's EmbeddingEngine from PyPI at 70 vision tokens per image. The
vision encoder takes no thread count in 0.18.0 and was given the CPU backend with its default
thread setting, and the
file and Google's were embedded one after the other. The reference made 64 soft tokens of
every picture, the count tune recorded. Nothing litetune reads shows which device the
vision encoder itself ran on.
| embeddings | all rows | k=5 mean | k=10 mean | linear | cosine to float32, mean / min |
|---|---|---|---|---|---|
| Google's 440m file | 0.8467 | 0.8013 | 0.8233 | 0.9300 | |
| fine-tuned, float32 | 0.9300 | 0.9287 | 0.9287 | 0.9400 | |
| int8 file | 0.9300 | 0.9307 | 0.9347 | 0.9367 | 0.9601 / 0.6824 |
| int4 file | 0.9400 | 0.9333 | 0.9413 | 0.9400 | 0.9164 / 0.6438 |
The 10-shot draws, the same five for every side, and the paired differences on them (conversion cost: reference minus file; gain: file minus Google's):
| side | k=10, per draw | cost per draw | gain over Google's per draw |
|---|---|---|---|
| fine-tuned, float32 | 0.9300, 0.9300, 0.9300, 0.9233, 0.9300 | ||
| int8 file | 0.9400, 0.9333, 0.9367, 0.9300, 0.9333 | -0.0100 ±0.0196, -0.0033 ±0.0173, -0.0067 ±0.0226, -0.0067 ±0.0160, -0.0033 ±0.0173 | +0.1533 ±0.0480, +0.0867 ±0.0453, +0.0967 ±0.0418, +0.0900 ±0.0448, +0.1300 ±0.0485 |
| int4 file | 0.9433, 0.9400, 0.9367, 0.9400, 0.9467 | -0.0133 ±0.0160, -0.0100 ±0.0196, -0.0067 ±0.0207, -0.0167 ±0.0196, -0.0167 ±0.0173 | +0.1567 ±0.0485, +0.0933 ±0.0453, +0.0967 ±0.0428, +0.1000 ±0.0453, +0.1433 ±0.0476 |
| Google's 440m file | 0.7867, 0.8467, 0.8400, 0.8400, 0.8033 |
- Both gates were inconclusive. No draw's cost is resolved, and at 300 held-out rows the intervals (±0.016 to ±0.023) are wider than the 0.01 threshold: an upper bound above it in three of five draws for int8 and one of five for int4. The mean cost was -0.0060 (int8) and -0.0127 (int4), the files scoring above the float32 fine-tune; the sample does not tell that apart from zero.
- The gain over Google's file is resolved in every draw of both: +0.1113 (int8) and +0.1180 (int4) on average at k=10. With a linear layer on every training row the files scored 0.9367 (int8) and 0.9400 (int4) against Google's 0.9300; no interval was computed for the linear decider.
- Four bits moved the vectors further than eight: mean cosine 0.9164 against 0.9601 to the float32 fine-tune, minimum 0.6438 against 0.6824.
- Per picture the int8 file took a median 481.9 ms and Google's 495.8 ms; the int4 file 481.7 ms and Google's 486.7 ms. The reference took 922.5 s (int8 run) and 941.8 s (int4 run) for the 1,165 pictures. The reference's and Google's accuracies were the same in both verify runs, draw for draw.
- Not measured: 140 vision tokens, mirrored copies, and the spliced file through flutter_edge_ai on any device.
The same int8 file on a Mac's CPU and GPU, and on Windows
Measured 2026-11-04 on one Mac (Apple M5 Pro, 18 cores), the same checkpoint, int8 file
and split as above, with verify --with-base at litetune commit 79e2fba (unreleased),
once on the CPU and once with --backend gpu. The checkpoint was tuned before tune
recorded the processor files' digests; their digests were added to its litetune.json
from the files tune saved (the original record is kept beside the run's reports).
On the CPU the text tower was given one thread, as on every Mac with SME2, and the vision
encoder was given the CPU backend with its default thread setting. With --backend gpu the
text tower was given the GPU backend (the kernel reported process-wide GPU work) and the
vision encoder was given the CPU backend, where
flutter_edge_ai_litertlm 1.19.0 puts it when the text tower is on the GPU. On this CPU,
which has SME2, both runs embedded the file twice and got the same vectors both times.
Those are the backends given; nothing litetune reads shows which device the vision encoder
itself ran on.
| k=10 mean | Google's file, k=10 mean | cosine to float32, mean / min | ms per picture, median | |
|---|---|---|---|---|
| CPU, Intel Xeon (above) | 0.9347 | 0.8233 | 0.9601 / 0.6824 | 481.9 |
| CPU, Apple M5 Pro | 0.9333 | 0.8287 | 0.9602 / 0.6787 | 172.5 |
| GPU, Apple M5 Pro | 0.9353 | 0.8313 | 0.9586 / 0.6856 | 154.5 |
| CPU, Windows 11 x64, Intel Core Ultra (16 logical CPUs, 8 threads) | 0.9327 | 0.8313 | 0.9608 / 0.7583 | 363.5 |
The float32 reference scored 0.9287 in every run. Every gate was inconclusive for the same reason as above: at 300 held-out rows no draw's interval (±0.015 to ±0.020) fits under the 0.01 threshold. The GPU computes in the precision LiteRT-LM picks for the file, F16 unless the file declares otherwise.
The Windows run used litetune at c493291 installed from a wheel, with Google's file given
as --base-litertlm: --with-base could not fetch it there, because verify provisions the
export environment to download it and that environment needs litert-converter, which
publishes no Windows wheel. Since #114 verify downloads it in the embed-train environment; on the same machine
--with-base then fetched Google's file itself and gave the same accuracies, draw for draw.
On 2026-11-07 the same Mac ran verify --with-base --backend gpu on the same checkpoint
and file at e0bbf41 (a wheel built from that commit; its sha256 is with the run), which
gave the GPU backend to the vision encoder as well:
| k=10 mean | Google's file, k=10 mean | cosine to float32, mean / min | ms per picture, median | |
|---|---|---|---|---|
| GPU, Apple M5 Pro, text and vision both on the GPU | 0.9467 | 0.8227 | 0.9567 / 0.6563 | 55.8 |
verifypassed: the conversion cost was −0.0167 ±0.0196, −0.0167 ±0.0217, −0.0200 ±0.0226, −0.0200 ±0.0207 and −0.0167 ±0.0196 in the five draws, every upper bound under the 0.01 threshold. The file scored above the float32 fine-tune (0.9287) in every draw (0.9433 to 0.9500); the cost is negative, not resolved as a gain.- The kernel reported the process's GPU work, as for the run above.
- The backend recorded for the vision encoder is the one litetune gave the engine; the process-wide reading does not show which device ran that encoder itself.
- On the Intel GPUs, through an outside harness, the same file scored 0.9473 and 0.9493 with the vision encoder given the GPU and 0.9467 with it given the CPU (The same fine-tune on Intel Panther Lake and Lunar Lake). Why the Mac's score moved from 0.9353 to 0.9467 was not measured.
The same fine-tune on a phone's NPU
Measured 2026-11-05 on one Galaxy S25 Ultra (SM-S938U1, SM8750, Android 15): the beans
fine-tune above, its file from convert --npu SM8750 with the image support that came with
this measurement (unreleased), 503,611,392 bytes. That file is Google's embeddinggemma-2-text-vision-440m_Qualcomm_SM8750.litertlm (revision e301f74d) with its
text encoder replaced by the int8 graft's, compiled in 278 s (QAIRT 2.50.0, ai-edge-litert
2.3.0, weight sharing; one DISPATCH_OP per signature, a 169,582,592-byte QNN context). Its
vision encoder, vision adapter and embedder are Google's, the embedder in four bits where the
CPU file's is the graft's eight.
The phone ran LiteRT-LM 0.18.0's EmbeddingEngine through the C API, with the same libraries
as EmbeddingGemma 2 on a Qualcomm NPU above (native-v0.18.0-h, QNN runtime 2.50.0), each
picture given as its JPEG bytes at 70 vision tokens, on the 1,165 pictures of the split above.
On the NPU the engine's log shows both encoders dispatched to it: the vision encoder
(vision_70, Google's 257 MB QNN context) and the text encoder (encoder_1x128, the compiled
one); the vision adapter ran on the CPU (XNNPACK). The CPU file ran on four CPU threads, its
vision encoder given the CPU backend with its default thread setting. Accuracy is verify's
k=10 centroid decider on the
same five draws, computed from the vectors the phone wrote, and paired differences are
metrics.paired_difference; there is no float32 reference on this side, so no conversion
cost.
| on the phone | k=10 mean | k=10, per draw | ms per picture, median | peak RSS |
|---|---|---|---|---|
| NPU, the fine-tune's SM8750 file | 0.9367 | 0.9333, 0.9333, 0.9367, 0.9433, 0.9367 | 70.7 | 661 MiB |
| CPU, the fine-tune's int8 file | 0.9300 | 0.9233, 0.9300, 0.9267, 0.9300, 0.9400 | 844.8 | 862 MiB |
| NPU, Google's SM8750 file | 0.8120 | 0.7867, 0.8067, 0.8233, 0.8367, 0.8067 | 68.7 | 609 MiB |
- On the 300 held-out pictures the NPU file's vectors had mean cosine 0.9746 (minimum 0.8596) to the CPU file's, on the same phone.
- NPU file minus CPU file on the phone, paired per draw: +0.0100 ±0.0173, +0.0033 ±0.0146, +0.0100 ±0.0173, +0.0133 ±0.0131, -0.0033 ±0.0173. The fourth is resolved, by 0.0002; the other four are not. On the CPU files elsewhere the fine-tune scored 0.9327 to 0.9353 (above), no paired difference computed against the phone.
- The fine-tune's NPU file minus Google's, paired per draw: +0.1467 ±0.0506, +0.1267 ±0.0471, +0.1133 ±0.0443, +0.1067 ±0.0423, +0.1300 ±0.0467, resolved in every draw. Google's NPU file scored 0.8120, its CPU file 0.8233 on the Xeon and 0.8287 on the Mac.
- Every picture was embedded on all three sides, none refused; each side embedded its first picture twice and got the same vector. Loading took 1.14 s (fine-tune, NPU), 1.19 s (Google's, NPU) and 1.59 s (CPU).
- Not measured: the other three SoCs
convert --npuwrites a file for (SM8550, SM8650, SM8850), 140 vision tokens on the NPU, and this file through flutter_edge_ai.
The same fine-tune on Intel Panther Lake and Lunar Lake
Measured 2026-11-05 on two Windows 11 machines, a Panther Lake (Core Ultra X7 358H, Arc B390)
and a Lunar Lake (Core Ultra 7 258V, Arc 140V), with the beans int8 file above and its 1,165
pictures. Nothing here is a litetune stage: convert --npu compiles for Qualcomm only, and
these files were built by hand with scripts outside this repository: the text or vision
encoder cut out of the int8 file with its weights inline, every RMSNorm composite inlined
with x scaled by 1/16 before it is squared so the square stays inside float16's range, 776
composites in the text encoder
and 224 in the vision encoder, and compiled by ai-edge-litert 2.3.0's Intel plugin (OpenVINO
2026.3.1) on the machine itself, with weight sharing and NPUW_ONLINE_PIPELINE=NONE.
- Panther Lake: Google's
embeddinggemma-2-text-vision-440m_Intel_PTL.litertlm(revisione301f74d) with its text encoder replaced by the compiled one, the splice litetune does for Qualcomm (its splice script, the other six sections Google's byte for byte). Its vision encoder is Google's NPU build. - Lunar Lake: Google's repository at
e301f74dhas no Lunar Lake file, so both encoders were compiled for it and packed with the int8 file's other sections. LiteRT-LM 0.18.0 refused every picture ("No signature found with prefix vision_ and length greater than or equal to 144") until the cut vision encoder kept its signatures in the order the int8 file has them,vision_140first.
The runs went through LiteRT-LM 0.18.0's EmbeddingEngine C API from Python (ctypes), with
flutter_edge_ai's native-v0.18.0-h Windows libraries for the CPU and NPU and
native-v0.18.0-g for the GPU (the two sets differ only in LiteRtWebGpuAccelerator.dll),
each picture given as its bytes at 70 vision tokens, the CPU at four threads. Accuracy is
verify's k=10 centroid decider on the same five draws, from the vectors each run wrote;
paired differences are against the CPU on the same machine (metrics.paired_difference).
| k=10 mean | cosine to the CPU on the 300 held-out pictures, mean / min | resolved against the CPU | ms per picture, median | |
|---|---|---|---|---|
| PTL NPU, Google's vision + our text encoder | 0.9347 | 0.9801 / 0.8801 | 0 of 5 draws | 52.7 |
| PTL NPU, both encoders ours | 0.9407 | 0.9779 / 0.7993 | 0 of 5 | 259.8 |
| PTL NPU, Google's file (base model) | 0.8273 | 51.1 | ||
| PTL GPU, vision on the CPU | 0.9467 | 0.9947 / 0.9755 | 1 of 5 (+0.0133 ±0.0131) | 380.9 |
| PTL GPU, vision on the GPU | 0.9473 | 0.9738 / 0.7330 | 0 of 5 | 65.2 |
| PTL CPU | 0.9380 | 402.8 | ||
| LNL NPU, both encoders ours | 0.9347 | 0.9773 / 0.8414 | 0 of 5 | 298.6 |
| LNL NPU, the same without the vision rewrite | 0.9287 | 0.9629 / 0.8184 | 0 of 5 | 297.5 |
| LNL GPU, vision on the CPU | 0.9467 | 0.9947 / 0.9755 | 1 of 5 (+0.0133 ±0.0131) | 332.1 |
| LNL GPU, vision on the GPU | 0.9493 | 0.9730 / 0.7901 | 1 of 5 (+0.0233 ±0.0173) | 94.4 |
| LNL CPU | 0.9380 | 369.2 |
- Every picture was embedded on every side, none refused, each side's first picture twice to the same vector. The two CPUs gave the same accuracy draw for draw.
- The fine-tune's PTL NPU file scored above Google's in every draw (+0.0767 to +0.1533, each resolved).
- Our vision encoder on an NPU took 4.9 times Google's: 259.8 ms against 52.7 on the same
PTL, with the same text encoder. It was neither weight sharing nor the pipeline setting: 50
pictures took 259.8 ms per picture compiled without weight sharing and 268.4 ms without
NPUW_ONLINE_PIPELINE=NONE. What differs is the graph. Google's compiled vision encoder is two partitions whose bytecode names no float type, onlyI8/U8/I4/U4; ours, cut from the int8 file, is 226 partitions (the 224 RMSNorm decompositions compiled beside the two signatures), and its bytecode namesf32911 times andNPU_USE_NPUW226 times. - On Lunar Lake the GPU with the vision encoder on it was the fastest, 94.4 ms per picture against 298.6 on the NPU.
- Not measured: Google's PTL file on Lunar Lake, peak memory, and any of these files through flutter_edge_ai.
EmbeddingGemma 2 on images: several questions
Measured 2026-11-11, once: three questions about one game's frames trained into one
fine-tune with tune --tasks, on revisions of this release before it was merged (their
commits are not public), at three epochs and at two. The frames are screenshots of the Dash sample game and are not
published, so this run cannot be repeated from the repository; it is here because the
three-epoch recipe for --tasks rests on it.
The rows. Three questions, each prepared on its own with --heldout-fraction 0.5 and
seed 0, each row carrying the group of the run it was recorded in, so no run is in two
splits:
| Question | Options | Rows | Groups | Train | Calibration | Held-out |
|---|---|---|---|---|---|---|
| zones | trail, grass, rock, jump | 28,722 | 277 | 13,235 | 2,302 | 13,185 |
| near | jump, run | 15,383 | 222 | 6,655 | 1,041 | 7,687 |
| steer | left, right, straight | 6,243 | 348 | 2,157 | 700 | 3,386 |
steer was mirrored with left and right exchanged: 2,157 training pictures and 2,157
mirrored copies. That run gave the mirror as mirror and mirror_swap keys of steer's
tasks.json entry, which this release replaced with "mirror": [["left", "right"]] in the
question; on these three splits both give byte-identical training items. No picture is in
two questions.
tune --tasks at --vision-tokens 70 on one NVIDIA A100-SXM4-40GB, torch 2.9.1,
transformers 5.19.0: every picture took 56 to 60 soft tokens. Two epochs: 3,026 steps in
524 s. Three epochs: 4,539 steps in 830 s through tune (the inputs cached by an earlier run
were computed again), and the same 4,539 steps in 1,306 s run as the training script alone
from the same spec at three epochs; the two three-epoch checkpoints are byte-identical
(model.safetensors sha256 4a712194…b203). The discarded heads on the held-out rows
(the heads', not a decider's): zones 0.8865 / 0.9224, near 0.9351 / 0.9573, steer 0.7877 /
0.8193 at two / three epochs.
The probes. Each question's pictures through the float32 checkpoint (transformers, on CUDA, the mean over every token, L2-normalised), then linear probes fitted on the embeddings, against the base model and against the hand-made fine-tune the recipe was taken from (three heads trained outside litetune, three epochs, continuing an earlier fine-tune of the same frames, its split drawn from another hash of the same groups). Because the two fine-tunes split the frames differently, a probe was fitted only on frames both trained on and scored only on frames neither trained on: zones 6,124 fitted / 8,195 scored, near 3,187 / 4,791, steer 989 / 1,871 (of them 104 left, 190 right):
| base | hand-made | litetune, 2 epochs | litetune, 3 epochs | |
|---|---|---|---|---|
| zones, softmax regression accuracy | 0.708 | 0.926 | 0.909 | 0.931 |
| zones, 10-shot centroid accuracy | 0.546 | 0.926 | 0.899 | 0.926 |
zones, recall of trail |
0.093 | 0.840 | 0.716 | 0.789 |
near, jump recall at 2% of run frames called jump |
0.466 | 0.830 | 0.765 | 0.838 |
| near, 10-shot centroid accuracy | 0.715 | 0.958 | 0.943 | 0.961 |
| steer, left against right, class-balanced regression | 0.446 | 0.816 | 0.820 | 0.827 |
| steer, 10-shot centroid accuracy | 0.549 | 0.893 | 0.872 | 0.900 |
At two epochs litetune's checkpoint probed below the hand-made one on zones and near; at
three it matched or passed it on every row but trail's recall. That is why --tasks
trains three epochs and one question keeps two. One run, one game, one seed; verify of
the converted files is not part of this section.
LLMs on a Qualcomm NPU
Measured 2026-11-01 on one Galaxy S25 Ultra (SM-S938U1, SM8750, Hexagon V79), through the
LiteRT-LM 0.18.0 C API with the Qualcomm dispatch built from the same tree and Qualcomm's
QNN runtime 2.51.0. Every bundle was built by litert-torch-nightly 0.10.0.dev20260926's
npu_export stages (ai-edge-litert-nightly 2.3.0.dev20260925, ai-edge-quantizer-nightly
0.10.0.dev20260926, ai-edge-litert-sdk-qualcomm 2.3.0 = QAIRT 2.50.0.260828,
transformers 5.16.1) on a 32-vCPU x86-64 Linux machine: prefill 128, cache_length 1024,
stage 1 dynamic_wi8_afp32, 64 calibration prompts with 32 decode steps each, A16W8,
compiled for SM8750. Greedy decoding; base weights unless a row says otherwise.
Needle prompts. "The access code for vault X is NNNN." and filler sentences, 12 rows
per set, each with its own code; correct means the reply contains the code. fq: the fact
first, the question last; fm: the fact after a third to a half of the filler; s1: one
prefill chunk. Two chunks are 191–210 rendered tokens, five 600–617, seven 853–861.
The last layer's KV inputs. In the stage-1 graph, the prefill signature's
kv_cache_k_<last> and kv_cache_v_<last> have no consuming op — prefill outputs only the
KV slices, so the last layer's attention over the cache is gone. The quantizer leaves them
FLOAT32 while the decode signature's and the cache-update graphs' are INT16, and the
runtime, which re-creates a host-memory KV buffer from the decode signature, rejects the
FLOAT32 prefill tensor (Custom allocation is too small for tensor idx: 54 on Qwen3-0.6B,
index 54 being kv_cache_k_27). Retyping the two unused inputs to their decode twins (what
convert --npu does) changes no computation and no byte count of the compiled file
(781,881,235 B for Qwen3-0.6B either way).
| model | unfixed | with the two inputs retyped, two chunks (s1 / fq / ff) | float32 |
|---|---|---|---|
| Qwen3-0.6B | does not load | 12/12 / 12/12 / 12/12 | 36/36 |
| Qwen2.5-0.5B-Instruct | does not load (layer 23) | 12/12 / 12/12 / 10–11/12 † | 32/36 |
| MiniCPM5-1B, thinking off ‡ | does not load (layer 23) | 12/12 / 12/12 / 12/12 | 36/36 |
| gemma-3-270m-it | loads (same FLOAT32 pair at layer 17; why it loads was not traced) | 12/12 / 12/12 / 11/12 | 34/36 |
† Qwen2.5-0.5B's rows ask "Complete the sentence with the four digits from the text above:
The access code for vault X is"; to "What is the access code…? Reply with the four digits
only." even its float32 model answered 14 of 36. ‡ A template that sets enable_thinking
false; with thinking on its float32 model needs about 128 output tokens to reach the code.
Calibration length decides how long a prompt the bundle serves. The same bundles, differing only in their calibration prompts (rendered tokens):
| bundle | calibration prompts | two chunks (fq) | five chunks (fq5 / fm5) | seven chunks (fq7 / fm7) |
|---|---|---|---|---|
| Qwen3-0.6B | 64 × ~200–230 | 12/12 | 0/12 / 0/12 | — |
| Qwen3-0.6B | 64 × 332–388 | 12/12 | 0/12 / 0/12 | 0/12 / 0/12 |
| Qwen3-0.6B | 64 × 605–859 | 12/12 | 12/12 / 12/12 | 12/12 / 12/12 |
| Qwen3-0.6B | 32 × ~200–230 + 32 × 605–859 | — | 12/12 / 12/12 | 12/12 / 12/12 |
| Qwen3-0.6B, float32 | — | 12/12 | 12/12 / 12/12 | 12/12 / 12/12 |
| gemma-3-270m-it | 64 × ~200–230 | 12/12 | 0/12 / 0/12 | — |
| gemma-3-270m-it | 64 × 613–848 | 10/12 | 11/12 / 12/12 | 3/12 / 1/12 |
| gemma-3-270m-it, float32 | — | 11/12 | 0/12 / 12/12 | 3/12 / 12/12 |
| Qwen2.5-0.5B-Instruct | 64 × ~200–230 | (above) | 0/12 / 0/12, 1/12 / 0/12 with HW cache update off (float32 11/12 / 7/12) | — |
The failures are not lost chunks but fluent-looking repetition ("The main. The main.", a
looping <|im_start|>) on rows the float32 model answers. Calibrated on prompts reaching
the test prompts' length, they are answered; three-chunk calibration does not help five or
seven chunks; Gemma calibrated up to 848 tokens answers 600-token prompts and fails
857–861-token ones. Half the set long was enough for Qwen3. So convert --npu packs half its
calibration prompts up to cache_length minus 128 and reports the longest; gemma-3's
fq sets are uninformative past two chunks because its float32 model does not carry the
code that far.
End to end through litetune convert --npu. A banking77 LoRA fine-tune of
Qwen2.5-0.5B-Instruct (the September recipe and split of A fifth family above, trained
again in float32 where that run used bfloat16), converted with
litetune convert --model … --npu SM8750 --calibration-data train.jsonl: calibration 32
training prompts of 49–76 tokens and 32 packed prompts of 448–884, stages 1–3 in 288 s and
the SM8750 compile in 53 s, 655,363,795 B, all 48 KV inputs of both signatures INT16. On the
first 100 held-out rows, exact text:
| side | exact | replies identical to float32's |
|---|---|---|
| float32 (transformers, the merged checkpoint) | 83/100 | — |
NPU, convert --npu's bundle, HW cache update on |
81/100 | 94/100 |
| NPU, the same bundle, HW cache update off | 81/100 | 94/100 |
| NPU, a bundle built by hand the same way, calibrated on two-chunk prompts | 82/100 | 94/100 |
Four rows are discordant with float32 (three the NPU gets wrong, one it gets right); 100 rows cannot resolve a two-row difference. The prompts are single-chunk (at most 135 tokens), well inside the calibrated range. Medians over the 100 rows: prefill ~1,860 tokens/s, decode ~47 tokens/s, time to first token 52 ms.
What the bundles above differ in from convert --npu as it is now. Only the fine-tune
above went through convert --npu, and through an earlier revision: its calibration
prompts were wrapped in a chat template a second time by litert-torch's calibrate
(which formats by default), and every bundle above was calibrated with 32 decode steps.
The gemma-3, Qwen3 and MiniCPM5 bundles above were built by hand: calibrated on needle
sets rather than the packed training prompts, without --externalize_embedder, gemma-3
without the retype, MiniCPM5 with a template that turns thinking off. The next part is
bundles of the path as it is now.
Bundles convert --npu built, on SM8750 (2026-11-02)
The same phone, runtime and harness as above, at the runtime's default NPU settings and
max_num_tokens 1024, replies capped at 128 tokens. Each bundle built by
litetune convert --model … --npu SM8750 --calibration-data train.jsonl (banking77's 2,400
training rows; for the three base models a litetune.json that records
runtime_rendered), cache_length 1024, on a 32-vCPU x86-64 Linux machine; every check in
What it checks passed. The float32 references are transformers 5.16.1, greedy,
repetition_penalty 1.0, 128 new tokens, rendered with the checkpoint's own template.
LiteRT-LM returns a <think> block in a channel of its own; it is put back in front of the
reply before comparing.
| bundle | bytes | longest calibration prompt | calibration replies, decode steps (median / max) | stages 1–3 | compile |
|---|---|---|---|---|---|
| gemma-3-270m-it | 460,113,711 | 891 | 2.5 / 128 | 3.7 min | 63 s |
| Qwen2.5-0.5B-Instruct banking77 fine-tune | 655,363,795 | 896 | 4 / 9 | 7.8 min | 99 s |
| Qwen3-0.6B | 781,897,619 | 890 | 128 / 128 | 68.5 min | 194 s |
| MiniCPM5-1B (thinking on: the path sets nothing) | 1,107,858,841 | 896 | 128 / 128 | 28.1 min | 164 s |
Needle prompts (as above, 12 rows per set; x2 two prefill chunks, nlq/nlm fact
first or after ~45% of the filler, grown to within 40 tokens below the bundle's longest
calibration prompt). Correct = the code appears in the reply (for MiniCPM5 within its
128-token thinking, for both sides); identical = the same text as float32.
| model | x2: NPU / float32 / identical | nlq | nlm | prompt tokens, nlq/nlm |
|---|---|---|---|---|
| gemma-3-270m-it | 11/12 / 12/12 / 11/12 | 12/12 / 4/12 / 1/12 | 12/12 / 11/12 / 0/12 | 857–863 |
| Qwen3-0.6B | 12/12 / 12/12 / 8/12 | 12/12 / 12/12 / 11/12 | 12/12 / 12/12 / 11/12 | 853–857 |
| MiniCPM5-1B | 12/12 / 12/12 / 0/12 | 12/12 / 12/12 / 0/12 | 12/12 / 12/12 / 0/12 | 856–874 |
Gemma's NPU answers the long rows with a sentence holding the code where its float32
answers "1234" on seven nlq rows: the NPU does not reproduce float32 there, in either
direction.
How long a reply holds. Prompts grown as nlq (or to ~190 tokens for gemma's second
set), then "Count from 1 to 100, …" (6 rows) or "Repeat the text above word for word, …"
(6 rows). Leading tokens shared with float32's reply, per row:
| model | prompt | count: shared leading tokens (float32's reply) | copy: shared leading tokens | replies that turned into repetition |
|---|---|---|---|---|
| gemma-3-270m-it | 854–861 | 0 ×6 (128) | 0–47 (128) | 8 of 12 |
| gemma-3-270m-it | 182–192 | 2 ×5, 128 ×1 (128): five NPU replies stop after "1" | 0–19 (15–128) | 0 of 12 |
| Qwen3-0.6B | 853–867 | 33–34 (34) | 7–82 (128) | 0 of 12 |
| MiniCPM5-1B | 857–872 | 28–127 (128) | 2–43 (128) | 0 of 12 (1 of the 36 needle rows looped) |
Repetition = more than 30% of a reply's word 4-grams repeated (gemma's long-prompt replies 0.00–0.97, float32's 0.00; Qwen3's 0.00; MiniCPM5's needle row 0.56, the rest ≤ 0.16). So: gemma-3-270m-it holds classification-length answers only; Qwen3-0.6B's replies stay fluent for 128 tokens but leave float32's text early on a copy; MiniCPM5-1B's thinking finds what float32's finds but in other words; the Qwen2.5 fine-tune below was measured on its labels only. Every bundle's report carries its family's line.
The banking77 fine-tune (first 100 held-out rows, exact text): NPU 81/100, float32 83/100, 94/100 identical — the same as the earlier revision's bundle above.
Medians over each run: prefill 15.8k tokens/s (gemma), 1.9k (Qwen2.5), 2.1k (Qwen3), 2.6k
(MiniCPM5); decode 178, —, 45 and 60 tokens/s (replies of 20 tokens or more); time to first
token 60, 52, 429 and 347 ms. LiteRT logged one DispatchDelegate partition for each of
prefill_128, decode, prefill_mask_128 and decode_mask in every run.
SM8550, SM8650, SM8850: compiled, compared, not run. The gemma-3-270m-it build also
compiled for these three. Against Google's gemma3-270m-it-q8.qualcomm.sm8650/8750/8850
files (SM8550's is gated and was not read), section by section:
| Google's | convert --npu's |
|
|---|---|---|
| sections | metadata, SentencePiece, embedder, aux, prefill/decode | the same five |
| prefill/decode graph | prefill_128, decode: one DISPATCH_OP each, 43 inputs |
the same |
| aux graph | masks one DISPATCH_OP each (2 inputs); cache updates and RoPE on the CPU |
the same layout; masks take a third input, valid_mask; the cache updates are other ops |
| LiteRtStamp | Qualcomm + the SoC, 250 bytes | the same |
| QAIRT build | 2.40.0.251030114326 | 2.50.0.260828221209 |
| KV cache | 4,096 positions (max_num_tokens 4096) |
1,024 |
| LlmMetadata | 337 bytes: template by prompt prefixes, stop <end_of_turn> and id 1 |
2,561 bytes: a Jinja template, 14 stop strings and ids 1 and 106 |
The structure matches; whether these files run on those SoCs was not measured.
Not measured: any SoC but SM8750 on a device; Gemma 3 1B, Qwen3-1.7B, Qwen2.5-1.5B and FunctionGemma
through this toolchain (FunctionGemma ran on SM8750 on the earlier one, see Limitations);
cache_length other than 1024; decisions, which the NPU executor cannot score (it rolls
back one token only).
The CPU and the GPU on a Mac
Each path was run through the script verify runs for it, unchanged except for
the backend, on an Apple M5 Pro with litert-lm 0.18.0 from PyPI: once or twice on
the CPU and three times on the GPU, four for option scoring. The kernel showed
the GPU working for every GPU run it was read on: a reading at the engine's end
in the runs of the table, and in the verify runs below a reading before and
after that grew. The text and option-scoring runs used the
emotion bundle from The three passing bundles on a phone and its 300 rows.
The tool runs used google/functiongemma-270m-it converted by litetune 0.7.1
(dynamic_wi8_afp32) and 20 single-turn requests, each with its own
declarations: constrained decoding off, 128 tokens at most. The EmbeddingGemma 2
runs used the banking77 int8 file from litetune end to end.
| path | the CPU against the GPU | the GPU, run against run |
|---|---|---|
| text, one-word answers (300) | the same text on 300 | identical |
| text, longer answers (20, median 225 characters) | the same text on 3 | identical |
| the same 20 through litert-lm's own CLI | the same text on 3 | identical |
| tools (20) | the same reply on 15 | identical |
| option scoring (300) | the same top option on 299 or 300 | 1 to 3 rows per run with wrong scores, up to 13.8 nats away |
| EmbeddingGemma 2 vectors (300) | cosine median 0.990460, minimum 0.975487 | identical |
-
On every backend, the CLI and
verify's text script gave the same text as each other on all 20 longer answers. The difference between the CPU and the GPU is litert-lm's, not litetune's. The longer GPU answers usually part from the CPU's within the first sentence and then read as different text. -
On the five tool requests where the CPU and the GPU differed, the GPU:
- dropped a "." from an e-mail address and a "," from a place;
- added a word to a message body;
- lengthened a map query;
- on one request, called the tool where the CPU asked for the date.
Where both called a tool, it was the same function.
-
The CPU repeated its option scores bit for bit; the GPU did not. Its bad rows fell at different places in each of four runs, and the top option changed on 1 of 1,200 decisions. Scoring each option on an Engine of its own, with no rewind, gave six rows more than 5 nats from the CPU's scores. The rewind is therefore not the cause. Over the 300 decisions, the GPU took a median of 69.55 ms per decision and the CPU 179.8 ms.
-
flutter_edge_ai's
createDecider, on its own build of the runtime, on the same Mac's GPU repeated its scores bit for bit. It ran four times on the same emotion file and 300 rows, and four times each on three other decision bundles (300, 60 and 60 rows). So the bad rows are not the GPU's whatever runs on it; the next bullet finds them with one accelerator. -
The package links LiteRT's GPU accelerator statically, and on macOS it is the WebGPU one, which loading
libLiteRtMetalAccelerator.dylibfrom disk does not replace (litert-lm 0.18.0 and 0.19.0). flutter_edge_ai's own build of the runtime, a v0.18.0 libLiteRtLm that loads its accelerator from a file, ran the same option-scoring script, four runs of the same 300 rows with each accelerator from LiteRT-LM's v0.18.0prebuilt/macos_arm64. With the WebGPU accelerator 298 rows were identical in all four runs; with the Metal accelerator all 300 were. litert-lm 0.18.1 and 0.19.0, no fp32 override and anothercache_dirleft the bad rows in place. -
verify --backend gputherefore scores a decision bundle on macOS twice, the second time in reverse order. The rows the two runs differ on are scored in a third run, five times each in a shuffled order, andverifykeeps the scores most of a row's seven readings gave, when no other did as often; a tie, or no two alike, fails the harness. In every run measured a row's right scores repeated bit for bit and its wrong ones were never the same twice; whether two wrong readings can coincide is not measured. A family that scores each option on an Engine of its own (Qwen 3.5) is refused on the GPU: its GPU work is on Engines that close, the kernel's reading does not show it, and the rule was measured with one Engine that rewinds. The scores are the WebGPU accelerator's; flutter_edge_ai's Metal scores were not compared with them, and the float twin is checked on the CPU. On an emotion checkpoint trained and converted with F1's flags and splits (litetune 0.7.1),verifyon this Mac, with three copies in the third run then:CPU GPU status passed passed top option equal to the reference's (300 rows) 0.9967 1.0000 answer equal to the reference's, abstentions included 0.9933 0.9900 mean KL, reference to runtime 3.94e-04 1.38e-04 rows the two GPU runs differed on 0 An earlier GPU run of the same files, with tests running beside it, differed on 9 of the 300 rows between its first two runs, and a third run of one row each did not settle row 253. That row, scored 36 times in three processes, gave the same scores 33 times and other scores once in each process: a process got a wrong reading however few rows it scored. So the third run scores each row several times, five now, which spreads a process's few wrong readings over more of them.
-
verify --backend gpuon the EmbeddingGemma 2 file passed the same gate as on the CPU, both on this Mac:CPU GPU candidate, 10-shot 0.9317 0.9311 reference 0.9312 0.9312 per-draw conversion cost -0.0011 to +0.0004 -0.0011 to +0.0023 cosine to the reference, mean / minimum 0.99928 / 0.98909 0.9969 / 0.944174 median per text 43.43 ms 11.71 ms verify, wall time 12 min 33 s 6 min 21 s The Python EmbeddingEngine takes no activation data type, so the GPU computes in the precision litert-lm picks: the file's own
prefer_activation_typeif it declares one, F16 otherwise. -
One Mac and one runtime version. The phone in The three passing bundles on a phone gave the same GPU option scores on a repeat of the emotion session.
-
The M5 Pro's CPU has SME2. The CPU's option scores and its column of the verify table were taken at four threads, the text and tool runs at the runtime's default thread count. On such a CPU Google's litert-lm 0.18.0 wheel gives results that depend on the thread count (XNNPACK #11789). Checked 2026-11-01 on the same Mac with the int8 bundle of The decision reference on MPS: on 50 rows four threads moved per-token scores from one thread's by up to 0.481 nats on 12 rows and changed no top option, and at the runtime's default count 1 of 60 of its texts differed from the text with SME hidden. The 300-row figures, the tool replies and the EmbeddingGemma 2 CPU figures were not measured again.
verifynow runs LiteRT-LM on one thread on such a CPU.
The GPU on Windows and Linux
Measured 2026-11-06 with litert-lm 0.18.0 from PyPI on two machines: Windows 11 on an Intel Core Ultra (Panther Lake, 16 logical CPUs) with its integrated Intel Arc B390, and Ubuntu 22.04 on an 8-vCPU Intel Xeon @ 2.20GHz with an NVIDIA L4, driver 580.178.04. On both the package's GPU path is LiteRT's WebGPU accelerator, linked into the package, and the runtime names on stderr the adapter it selected:
| adapter line | |
|---|---|
| Windows | Intel(R) Arc(TM) B390 GPU, arch=xe-3lpg, vendor=intel, backend=Direct3D 12, adapterType=Integrated GPU |
Ubuntu, with libnvidia-gl-580-server and libegl1 |
NVIDIA L4, arch=lovelace, vendor=nvidia, backend=Vulkan, adapterType=Discrete GPU |
Ubuntu, with libnvidia-gl-580-server, without libegl1 |
llvmpipe (LLVM 15.0.7, 256 bits), arch=software, vendor=mesa, backend=Vulkan, adapterType=CPU / Software |
- Without
libegl1NVIDIA's Vulkan driver could not loadlibEGL.so.1, Vulkan offered only Mesa's llvmpipe, and the runtime used it without an error. An EmbeddingGemma 2 picture with the text tower "on the GPU" took 11,443 ms there, against 585 ms with both towers on the CPU backend; Gemma 4 E2B failed to build its engine (a 384 MiB buffer binding against llvmpipe's 128 MiB limit). Withlibegl1installed the same picture took 527 ms and one text 15 ms, and Gemma 4 E2B answered one prompt in 1.6 s against 2.7 s on the CPU backend, with "colours" where the CPU wrote "colors" and otherwise the same reply;nvidia-smilisted the process with 3,151 MiB. - On Windows the per-process GPU engine counters
(
Win32_PerfRawData_GPUPerformanceCounters_GPUEngine) had no instance for the process before its engine was built, had instances once a GPU engine existed, and their running time grew with work: from 60,343 to 30,493,406 (100 ns units) over 40 embeddings, all of it on one adapter's engines (windows-ptl/gpu_split.json). A CPU engine's process had none at either reading.
verify --backend gpu reads those signals. On Windows: the counters at the two
points macOS reads its kernel, counted only on the adapter the runtime named, whose
LUID the driver script gets from DXGI's adapter list, and only on counters present
at both readings. On Linux: the adapter line, and the run counts as measured on the
GPU only when that adapter is NVIDIA's and nvidia-smi also lists the process after
the work on a host with one NVIDIA GPU; otherwise it is said as "selected", and a
finished run with no line fails the harness.
On every platform a software adapter fails the harness. Run on Windows with
litetune at cc4bdbe and on the L4 at 792ba63 (both unreleased; each run
directory's wheel.txt has its wheel's sha256, 14cd2c7b… and f469d534…, and
its file-for-file match to the commit), on the beans int8 file and checkpoint
of EmbeddingGemma 2 on images: beans and the emotion decision bundle of The CPU
and the GPU on a Mac:
| Windows, Arc B390 | Linux, NVIDIA L4 | |
|---|---|---|
| beans, status | inconclusive | inconclusive |
| beans, candidate / reference, k=10 mean | 0.9347 / 0.9287 | 0.9400 / 0.9287 |
| beans, cosine to float32, mean / min | 0.9589 / 0.7431 | 0.9578 / 0.7038 |
| beans, ms per picture, median (text tower on the GPU, vision on the CPU) | 291.0 | 446.4 |
| beans, what established the GPU | the Arc's counters (LUID 0x0000A62B) grew from 382,400 to 2,247,383,261 |
the L4's adapter line, and nvidia-smi listed the process at 450 MiB on the host's only NVIDIA GPU: a context held there, not a reading of each operation |
| decision, status | failed the harness | passed |
| decision, top option / answer equal to the reference's (300 rows) | 1.0000 / 0.9933 | |
| decision, mean KL, reference to runtime | 2.23e-04 | |
| decision, rows the first two GPU-backend runs differed on | 111 | 0 |
| decision, ms per decision, median | 105.3 |
- On Windows the decision bundle's first GPU-backend run was observed on the Arc
(its counters grew from 1,727,474 to 233,204,940), and its second, in reverse
order, scored 111 of the 300 rows differently. Five more readings of each in a
third run settled none of the 111. The record keeps only the first run's
reading: at
cc4bdbea refused repeat dropped the others' (kept since), so whether the second and third ran on the Arc is not recorded. No score came up twice and more often than any other.verifyfailed the harness, as the repeat rule is written to; there are no Windows GPU decision numbers. On macOS the same rule settled a few rows of 300 (The CPU and the GPU on a Mac); on the L4 the two runs agreed on all 300. Why: Why the decision failed on Intel Arc, below. - DXGI listed two adapters on the Windows machine: the Arc B390 at LUID
0x0000A62Band the Microsoft Basic Render Driver, DXGI's software adapter, at0x0000AA0B. The process held counters on both; all its engine time was on the Arc's, and the Basic Render Driver's stayed at 0. The first Windows records (windows-ptl-verify/), taken before the reading was restricted to the selected adapter, summed both and named an instance on0x0000AA0B; the totals agree only because the other adapter's time was 0. - The beans gates were inconclusive for the reason in EmbeddingGemma 2 on images: beans: at 300 held-out rows no draw's interval fits under the 0.01 threshold. The same file on the same Windows machine's CPU scored 0.9327 at 363.5 ms per picture (The same int8 file on a Mac's CPU and GPU, and on Windows). On Windows Google's file ran on the GPU too and scored 0.8333.
- Both machines ran the same checkpoint (
65bca52c) and int8 file (36e54790). The beans record as shipped predatestunerecording the processor files' digests, andverifyrefused it; both runs used the record with the digests added, as on the Mac and on Windows before, whose four files' digests matched. - An earlier decision run on Linux, at
770b825(from a wheel whose digest was not kept; the manifest records version 0.7.3), passed with the same numbers and was recorded as asked for, not as observed: the scoring script set the runtime's log to ERROR before building its engine, so the adapter line, logged at INFO, was never written, althoughnvidia-smilisted the process with 876 MiB. Since679fac9the script quiets the log once the engine exists. - With
VK_ICD_FILENAMESpointing at Mesa's llvmpipe ICD on the same Linux host,verify --backend gpuon beans failed the harness: the candidate's script read the llvmpipe line from its stderr once its engine existed and stopped, and the candidate check named the adapter and the variable that chose it. - The L4 records (
linux-l4-verify-r4/) name the adapter's vendor asnvidia, and nvidia-smi's reading in each lists one GPU on the host, the L4 with UUIDGPU-dcbf167e…, with the process's row on it. The same two runs atcc4bdbe(linux-l4-verify-r3/), before the reading carried the GPU count, gave the same accuracies, cosines and agreements; the Windows rule changed sincecc4bdbeonly for two adapters of one name, and the Windows records list one hardware adapter of that name, so they read the same under792ba63. - The forced llvmpipe run above was taken at
cc4bdbe(linux-l4-verify-r3/). - Not run on these machines: the text and tool paths on the GPU. Their reading is the same code and is held by tests, not by a run.
Why the decision failed on Intel Arc
Measured 2026-11-07 with scripts outside this repository, on the emotion decision bundle above and its first 40 held-out prompts, on two Windows 11 machines with integrated Intel GPUs under Direct3D 12: the Panther Lake (Core Ultra X7 358H, Arc B390, driver 32.0.101.8864) and a Lunar Lake (Core Ultra 7 258V, Arc 140V, driver 32.0.101.8826), each GPU named by the runtime's adapter line. The repeat rule read the failure as unsettled scores. There is run-to-run variation (below), but not only that: on these GPUs LiteRT-LM's GPU path gave other answers than its CPU path, pass after pass, in option scoring and in plain generation:
| answers that differ from the same machine's CPU, 40 prompts | |
|---|---|
| Panther Lake, greedy replies through a Conversation, litert-lm 0.18.0 | 10 in each of two passes, the same 10 |
| Panther Lake, the same, litert-lm 0.19.0 | 9 in each of two passes, the same 9 |
| Lunar Lake, the same, litert-lm 0.18.0 | 12 and 11 in two passes |
| Panther Lake, top option of verify's scoring sequence, 0.18.0 | 10, 11 and 11 in three passes |
| Lunar Lake, the same | 9 and 10 in two passes |
| Apple M5 Pro (Metal), the same, against the Panther Lake's CPU | 0 in each of two passes |
- The two Intel CPUs gave the same scores, 0.0 apart.
- Within one engine the scores depend on what ran before: the same 40 prompts in reverse order scored 15 differently. A new engine for every prompt removed most of that, not all: two of 20 prompts were still 10.8 and 12.9 nats from the CPU's scores (their top option the CPU's).
- Not the scoring sequence: scoring each option in a session of its own (no
checkpoint), no second prefill of the last prompt token, and float16 activations
each left 9 or 10 top options of 40 unlike the CPU's. Neither host-side change tried
removed the divergence: a 0.3 s pause after every prefill and every scoring call
(not after the checkpoint and the rewind) left 11 top options of 40 unlike the CPU's
in both passes, and
LITERT_LM_SYNC_EXECUTION=1, tried on generation only, left 10 (0.18.0) and 9 (0.19.0) replies of 40 unlike the CPU's. Whether host-side synchronisation around the checkpoint and rewind plays a part was not tested. - Shorter prompts were hit more often: on the Panther Lake the 37 of 60 prompts more than 0.5 nats from the CPU had 52 to 82 tokens, the 23 within it 63 to 97.
- The beans EmbeddingGemma 2 file scored 0.9347 on the same GPU and 0.9327 on that machine's CPU (above); its vectors were not compared row by row.
- Not run: litert-lm 0.19.0 on the Lunar Lake, Dawn's Vulkan backend on these GPUs (the package offers no switch), discrete Arc GPUs, other drivers, other models, and flutter_edge_ai's Windows GPU library.
A trigger, found 2026-11-08 on the Panther Lake: the 8-token prefill signature convert
added to every decision bundle. google/gemma-3-270m-it, untuned, exported
by litert-torch-nightly 0.10.0.dev20260926 (dynamic_wi8_afp32) in ways that differ only in
--prefill_lengths; 40 short prompts, the first "What is the capital of France? Answer in one
word.", each in a new Conversation, greedy, 32 tokens at most, then the same 40 in reverse
order on the same GPU engine. The command kept for the no-flag row ran litert-lm 0.19.1 with
the GPU at fp32 activations; the commands for the three --prefill_lengths rows were not
kept:
| export | GPU | replies unlike the CPU's, of 40 | empty GPU replies | forward vs reverse order |
|---|---|---|---|---|
--prefill_lengths=8 |
Arc B390 | 30 | 34 | 1 differs |
--prefill_lengths=8,128 (what decisions used) |
Arc B390 | 30 | 33 | 3 differ |
--prefill_lengths=128 |
Arc B390 | 17 | 4 | 0 |
| no flag (the exporter's default, 128) | Arc B390 | 17 | 4 | 0 |
--prefill_lengths=8, 8,128, or no flag |
Apple M5 Pro (Metal) | 14 each | 4 each | 0 |
- 17 and 14 are this model's ordinary GPU-against-CPU wording differences; with a
prefill_8signature the Arc answered the first prompt ("Paris") and left most later ones empty. The emotion decision bundle above (8,128), run with the same prompts (its activation type not recorded), gave 27 replies of 40 unlike the CPU's on 0.19.1 and 35 onlitert-lm-nightly0.20.0.dev20261106. Reported as google-ai-edge/LiteRT-LM#4460. - So decision bundles are exported with the 128-token signature only from the change that
adds this paragraph on; a decision bundle converted by litetune 0.8.2 or earlier carries
prefill_8, and converting it again drops it. Whether a fine-tuned decision without it agrees with the CPU on an Arc GPU was not measured, norprefill_8on the Arc 140V.
A GPU cache built on a software adapter
Measured 2026-11-07 on Ubuntu 22.04 with an NVIDIA A100 40GB (driver 580.178.04), litert-lm
0.18.0 from PyPI, with the beans picture bundle of Gemma 4 E2B tuned on pictures: beans
(dynamic_wi8_afp32, seed 0), a fresh copy of the file for each experiment, two held-out
pictures, greedy, text and vision on the GPU, through a script outside this repository.
LiteRT-LM given its default cache (cache_dir="", what the CLI passes and what litetune's
text driver passed) writes its GPU caches beside the model, named after the file:
<model>_<mtime>_<size>_mldrift_weight_cache.bin and …_mldrift_program_cache.bin, and
<model>.vision_encoder_<mtime>_<size>_mldrift_… for the vision encoder.
| run, in order, on one fresh copy | replies to the two pictures |
|---|---|
VK_ICD_FILENAMES set to Mesa's llvmpipe ICD, default cache |
none (the engine did not finish), but the two …_mldrift_…cache.bin files were written |
| the NVIDIA GPU, the same default cache | இரண்டாம் இரண்டாம் இரண்டாம் … for both (the first 60 characters printed) |
the NVIDIA GPU, no cache (:nocache) |
angular_leaf_spot for both, the label |
- On another fresh copy, a cache written by an F16 run (the GPU default) and read by an fp32 run gave the label for both pictures, as did both runs without a cache: a cache written under another activation type did no harm here. One run cannot tell whether what spoiled the llvmpipe cache was the software adapter or that its engine never finished building.
- Found because
verify --backend gpuof that bundle generated the same repeated word for every picture: beside it lay a weight cache written in the same second as an earlier GPU run on that host whose runtime named llvmpipe, beforelibegl1was installed. The same verify driver given no cache answered with the labels. - So a
verify --backend gputhat refuses llvmpipe (The GPU on Windows and Linux) leaves such a cache behind, and up to 0.8.0 the next text or picture GPU run of that file, whose driver passed the default cache, read it. The tool path passed no cache directory at all; what LiteRT-LM does then was not measured. The change that adds this section gives litetune's text, picture and tool-path GPU engines a cache directory of their own (EmbeddingGemma 2 already had one per run, decisions use none). - Given a directory of its own, LiteRT-LM 0.18.0 wrote every cache there and nothing beside
the model: on an Apple M5 Pro's GPU, the unconstrained copy of this bundle with text and
vision given the GPU (the label for both pictures) left
…_mldrift_{weight,program}_cache.bin,….vision_encoder_…_mldrift_{weight,program}_cache.binand…vision_adapter.xnnpack_cachein that directory, and the beans EmbeddingGemma 2 file likewise, its.text_encoder_and.vision_encoder_caches included. That was this measurement's script, not a litetune run. - Not run: a cache built on one hardware GPU read on another, Windows and macOS caches, litert-lm 0.19.0.