LiteRT is Google's on-device runtime, the new name for TensorFlow Lite (Android: com.google.ai.edge.litert:litert), and litert-torch, the renamed ai-edge-torch, is its PyTorch converter: a PyTorch model converted unmodified with litert_torch.convert matched the original to 4e-7 on a Galaxy S26 (measured, LiteRT 2.2.0, Android 16, 2026-09-05).

Measured on device on earlier files (edge-compat): Galaxy S26 Β· LiteRT-LM 0.16.0 Β· GPU Β· decode 10.1 tok/s Β· prefill 206 tok/s Β· TTFT 1.18 s Β· all 1243 ops delegated (2026-08-24); Pixel 8a Β· LiteRT-LM 0.16.0 Β· GPU Β· decode 12.0 tok/s Β· prefill 84 tok/s Β· TTFT 540 ms Β· all 1243 ops delegated (2026-08-19); Galaxy S26 Β· LiteRT-LM 0.16.0 Β· CPU Β· decode 29.7 tok/s Β· prefill 106 tok/s Β· TTFT 2.14 s (2026-09-05). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/qwen25-coder-1.5b-int4/CARD.md

Qwen2.5-Coder-1.5B-Instruct β€” LiteRT-LM

This repository is a conversion of Qwen/Qwen2.5-Coder-1.5B-Instruct to LiteRT-LM, made with litert-torch 0.9.3 (the file published on 2026-11-13, 19:40 UTC, has its prefill/decode graph rewritten for the GPU by a separate script; weights unchanged) for Google's LiteRT-LM runtime: on a Galaxy S26 GPU it decodes 44.3 tokens/s and prefills 1,024 tokens at 646 tokens/s (LiteRT-LM v0.19.0, 2026-11-14).

Requires litert-lm β‰₯ 0.16; on Android the GPU path needs 0.19.0 or later (Known runtime issues).

A 1.54B code model at 1.12 GB β€” small enough that a phone-class device runs it at conversational speed rather than merely running it. Code assistance is the use case that most needs that: it returns short outputs constantly, so decode rate is the experience.

File Recipe Size
Qwen2.5-Coder-1.5B-Instruct_int4.litertlm int4 blockwise-32 + OCTAV on linears, int8 embedding (externalised) 1.12 GB

A 3B sibling exists in this org β€” litert-community/Qwen2.5-Coder-3B-Instruct, 3.43 GB, converted by another contributor. Pick by what you are optimising: that one for capability, this one for speed and footprint. The two have not been benchmarked against each other on the same machine, so this card makes no claim about their relative quality.

Correctness

Two tests, because a general-knowledge check certifies nothing for a code model:

  • 8-question sanity check: 8/8 on the GPU of a Galaxy S26 and a Pixel 11 Pro (LiteRT-LM v0.19.0) and of a Mac (litert-lm 0.19.2), 2026-11-14; the file it replaced on 2026-11-13 (19:40 UTC) also had 8/8 on the Mac GPU and the Pixel 11 Pro GPU, with the same eight replies.
  • Code test: 6/6. Six small functions β€” fib, reverse_words, is_prime, largest contiguous sublist sum, count_vowels, flatten β€” where the generated code is executed against assertions, not read. A task counts only if the code imports and every assertion holds. Measured on an earlier file.

Usage

litert-lm run ./Qwen2.5-Coder-1.5B-Instruct_int4.litertlm \
  --prompt "Write a Python function that returns the nth Fibonacci number. Code only."

# GPU
litert-lm run ./Qwen2.5-Coder-1.5B-Instruct_int4.litertlm --backend gpu --cache no --prompt "..."

The bundle carries the tokenizer and Qwen's ChatML markers including the vendor's default system prompt (You are Qwen, created by Alibaba Cloud. You are a helpful assistant.), which the upstream template inserts whenever no system message is supplied β€” rendering byte-identical to upstream for a single-turn request. A 4096-token KV budget and six prefill signatures (1024, 256, 64, 16, 4, 1).

Performance

Measured on an earlier file: litert-lm benchmark (litert-lm 0.16.0), Apple M4 Max, -p 256 -d 256 --cache no, quiet machine, serialized:

Backend Prefill (256) Decode TTFT Init
GPU (Metal) 3037 tok/s 137.8 tok/s 0.099 s 2.38 s
CPU 292 tok/s 47.1 tok/s 1.06 s 2.87 s

Init is the Init time the CLI prints; that value includes both Init Total and the phases inside it, so it counts engine creation twice (LiteRT-LM #4057).

For scale, a 3B-class int4 bundle converted on the same day and measured on the same machine and protocol runs 1241 tok/s prefill / 86.3 decode / 0.233 s TTFT. On this Mac, decode is memory-bandwidth-bound, so halving the weights is the most direct speed lever there.

Honest notes:

  • A Mac's GPU-vs-CPU ratio does not transfer to a phone. Here the GPU decodes 2.9Γ— the CPU; on a Pixel 8a a 3B model's GPU and CPU decode land within 1% of each other. Measure on the phone you target: on a Galaxy S26 with LiteRT-LM v0.19.0, this file's GPU decodes 1.7–1.9Γ— as fast as its CPU (next section).
  • The embedding table is stored in its own bundle section. That is what keeps this file at 1.12 GB β€” with the table quantized inline it duplicates per prefill signature and the same weights come out at 2.53 GB.

Galaxy S26 β€” GPU and CPU

Backend Prefill, 1,024 tokens Decode Time to first token Peak (VmHWM)
GPU (LiteRT GPU, every node of the prefill and decode graphs) 646 tok/s 44.3 tok/s 1.61 s 0.85 GB
CPU (XNNPACK), iteration 1 195 tok/s 25.1 tok/s 5.30 s 2.14 GB
CPU (XNNPACK), iterations 2–3 99 tok/s 22.8 tok/s 10.4 s 2.14 GB

Samsung Galaxy S26 (SM-S942Q / SM8850, Android 16), litert_lm_advanced_main built from LiteRT-LM v0.19.0 (commit 771b06e1), --benchmark with a 1,024-token prefill and 256 decode tokens, context 2,048, 2026-11-14. Each run is a new process with 3 iterations; the GPU row is the median of iterations 2–3 over two runs. The phone starts lowering its CPU clock cap 2–4 s into a CPU run and reaches its floor after 16–18 s, so iteration 1 runs while the cap falls and iterations 2–3 run at the floor; the CPU rows show them apart. Peak is the process's VmHWM, which does not count memory the GPU driver holds: the phone's GPU allocation counter (kgsl_page_alloc) rose by about 1.6 GB during each GPU run, with this file and with the file it replaced. On a Pixel 11 Pro GPU this file decodes 18.3 tok/s and prefills 533 tok/s, 15 % and 4 % faster than the file it replaced on 2026-11-13 (19:40 UTC; see Conversion notes). The runs behind each number, the Pixel 11 Pro runs and the earlier files' rows: MEASUREMENTS.md.

On this phone the GPU decodes 1.7–1.9Γ— as fast as the CPU and prefills 3.3–6.5Γ— as fast, so this repo's litertlm_manifest.json recommends gpu for flagship-class Android. In one earlier CPU run whose clock cap fell later, the replaced file decoded 33.8 tok/s in its first iteration, 1.3Γ— below the GPU (MEASUREMENTS.md). The Pixel 11 Pro CPU was not measured.

GPU wiring, including the Gallery import toggle: GPU guide.

Conversion notes

Converted with litert-torch 0.9.3 / litert-converter 0.3.1 / ai-edge-quantizer 0.8.0 / litert-lm-builder 0.16.0 β€” a pristine released stack, no patched checkout. In the file published on 2026-11-13 (19:40 UTC), the prefill/decode graph was rewritten with a public script (below); the weights are still the ones this stack wrote.

  • EXTERNALIZE_EMBEDDER=1 is required, not cosmetic. Qwen2.5-Coder ties its embedding and lm_head, so a recipe asking for int4 linears and an int8 embedder describes one tensor two ways; the quantizer resolves it by copying the 151936Γ—1536 table once per signature. Seven copies, 1.63 GB, 65% of the file β€” and no error anywhere. Externalising the table removes the conflict.
  • The default system prompt is baked into the template. Upstream inserts it when the caller sends no system message; a plain ChatML template would drop it and put the model in a state it was not tuned in on every default request.
  • Quantization: int4 blockwise-32 with OCTAV clipping on the linears, int8 on the embedding.

2026-11-14 β€” GPU graph (weights unchanged)

The prefill/decode graph now has the form litert-torch writes with --apply_gpu_composites: one odml.cache_update per layer writes the KV cache, and odml.runtime_bmm runs the attention products. On a Galaxy S26 GPU (LiteRT-LM v0.19.0), decode went from 36.1 to 44.3 tokens/s and the 1,024-token prefill from 597 to 646 tokens/s, with both files measured back to back (previous, new, new, previous). Every weight, and every section outside that graph, is byte-identical to the previous file. sha256 ff9df270… (1,117,454,336 B) β†’ 289e5071… (1,118,076,928 B). On a Mac, the same replies byte for byte as the previous file: 4 prompts on the CPU (litert-lm 0.19.2, 1 thread, greedy), and one prompt on the CPU and on the GPU with litert-lm 0.16.0 and 0.17.0 to 0.19.1. 8 short questions on the GPU: 8 of 8 with both files on a Mac and a Pixel 11 Pro, and with this file on a Galaxy S26. On the Galaxy S26 CPU (XNNPACK) the two files ran within 1.5 % of each other in a second set of runs, measured back to back at the same clock cap (previous, new, new, previous; the table above shows the first set): iteration 1 prefill 194 β†’ 194 tokens/s and decode 26.1 β†’ 25.7, iterations 2–3 prefill 99.8 β†’ 99.3 and decode 23.1 β†’ 23.1. Procedure: REPRODUCE.md. Measured on this file: the speed in the opening sentence, the 8-question line, the end of the first Honest note, the Galaxy S26 section and this entry. Every other number and check on this card was measured on an earlier file.

Raspberry Pi 5 (CPU)

Measured on an earlier file on a Raspberry Pi 5 Model B Rev 1.1 (8 GB, Raspberry Pi OS 64-bit) with litert-lm benchmark 0.16.1: CPU backend, 4 threads, 256 prefill + 256 decode tokens, --cache memory (the compile cache lives and dies with the process, so every invocation compiles the model from scratch; nothing is reused between runs), one warm-up plus one timed iteration per invocation, 3 invocations per file with cooldown in between. Values are the median across invocations (min–max in parentheses). No thermal throttling occurred during these runs (vcgencmd get_throttled stayed 0x0). Every file listed produced coherent text in a real generation on this backend before its numbers were recorded.

File Prefill (tok/s) Decode (tok/s) TTFT Peak RSS
Qwen2.5-Coder-1.5B-Instruct_int4.litertlm 41.7 (40.6–41.9) 5.6 (5.5–5.7) 7.3 s 1.8 GB

Known runtime issues

External weights (since 2026-10-30). In Qwen2.5-Coder-1.5B-Instruct_int4.litertlm, the weights sit in TFLiteWeights sections at the end of the file (LiteRT's external weights) instead of inside the model graph. On Android, the GPU path needs LiteRT-LM 0.19.0 or later: the GPU engine of the v0.18.0 and v0.18.1 Android builds crashes (SIGSEGV) on such a file (LiteRT-LM#3986). The earlier file with the weights inside the graph stays at revision 7840209.

From the second turn of a conversation on, LiteRT-LM puts the previous answer's stop token into the KV cache with a zero embedding, because this file holds the embedding table in its own section and the decoder takes embeddings (read in the source of LiteRT-LM 0.16.0 to 0.18.1). Measured on an earlier file (the same embedding table and template as this file) with LiteRT-LM 0.18.1 (the litert-lm package from PyPI) on the Mac CPU, greedy: after "Remember this number: 4182.", the answer to "What number did I ask you to remember?" was "I asked you to remember the number 4182.", the text that file's own graphs give with the stop token's row set to zero; with the token's real row they give "You asked me to remember the number 4182." Three other two-turn conversations gave the same answer either way. One question per conversation avoids it, as does a new conversation that starts with the earlier messages and the new question.

On LiteRT-LM releases before 0.17.0 (read in the source of 0.10.1 to 0.16.1), an answer whose last punctuation mark is a token of its own, such as a . or ? after a word, arrives without that mark: this file carries stop sequences of <|im_end|> and a newline with each of 13 characters in front (12 punctuation marks and a space), so the runtime holds the mark back to see whether <|im_end|> and a newline follow, the answer ends on <|im_end|> alone, and the held mark is never written. LiteRT-LM 0.17.0 and later write the held mark (StopTokenStreamFilter in runtime/core/tasks.cc, read in the source of 0.17.0 to 0.18.1). Not measured on this file: this follows from the runtime's source read with this file's stop list and tokenizer; the drop itself was seen with LiteRT-LM 0.16.1 on a Galaxy S26, on another bundle whose stop sequences have the same form.

License and changes

Distributed under Apache-2.0 (inherited from the base model). Changes from the original work: weights converted from safetensors bf16 to LiteRT flatbuffers and quantized as described above; tokenizer and chat template repackaged into the .litertlm bundle; in the file published on 2026-11-13 (19:40 UTC), the prefill/decode graph was rewritten into the GPU form described under Conversion notes, with the weights unchanged. This repository is a community conversion and is not affiliated with Alibaba Cloud or the Qwen team.

Downloads last month
1,440
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for litert-community/Qwen2.5-Coder-1.5B-Instruct

Quantized
(213)
this model

Collection including litert-community/Qwen2.5-Coder-1.5B-Instruct