How to use from the
Use from the
LiteRT-LM library
# LiteRT-LM runs on various platforms (Android, iOS, Windows, Linux, macOS, IoT, Web/WASM)
# and supports many APIs (C++, Python, Kotlin, Swift, JavaScript, Flutter).
# For platform-specific integration guides, please refer to the official developer website:
# https://ai.google.dev/edge/litert-lm

# To try LiteRT-LM, the easiest way is to use our CLI tool.
# 1. Install the LiteRT-LM CLI tool:
pip install -U litert-lm

# 2. Download and run this model locally:
# See: https://ai.google.dev/edge/litert-lm/cli
# A single .litertlm file in the repo is picked automatically; otherwise the CLI asks which one to run
# (or pass its name right after the repo id).
litert-lm run \
  --from-huggingface-repo=litert-community/LFM2.5-2.6B \
  --prompt="Write me a poem"

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 (edge-compat, lfm2.5-2.6b-int4), on an earlier int4 file of this repo: Galaxy S26 Β· LiteRT-LM 0.16.0 Β· GPU Β· decode 20.9–25.3 tok/s Β· prefill 297–495 tok/s Β· TTFT 0.46–0.73 s Β· fully delegated (2026-08-24); Raspberry Pi 5 Β· LiteRT-LM 0.16.1 Β· CPU, 4 threads Β· decode 4.9 tok/s Β· prefill 28.5 tok/s Β· TTFT 9.19–9.20 s (2026-09-01). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/lfm2.5-2.6b-int4/CARD.md

Measured on device (edge-compat, lfm2.5-2.6b-int8), on an earlier int8 file of this repo: Galaxy S26 Β· LiteRT-LM 0.16.0 Β· GPU Β· decode 16.3–19.7 tok/s Β· prefill 474–489 tok/s Β· TTFT 0.47–0.50 s Β· fully delegated (2026-08-25); Galaxy S26 Β· LiteRT-LM 0.16.0 Β· CPU Β· decode 13.7–15.5 tok/s Β· prefill 222–269 tok/s Β· TTFT 0.84–0.99 s (2026-09-06); Raspberry Pi 5 Β· LiteRT-LM 0.16.1 Β· CPU, 4 threads Β· decode 3.5 tok/s Β· prefill 44 tok/s Β· TTFT 6.12–6.15 s (2026-09-01). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/lfm2.5-2.6b-int8/CARD.md

LFM2.5-2.6B β€” LiteRT-LM

Try it in your browser: on 2026-11-04, the LiteRT-LM Web chat demo loaded an earlier LFM2.5-2.6B_int4.litertlm of this repo (1.67 GB download) and ran it with WebGPU.

LiquidAI/LFM2.5-2.6B converted to the LiteRT-LM (.litertlm) format for on-device inference with Google's LiteRT-LM runtime (for the Android GPU path of LFM2.5-2.6B_int4.litertlm and LFM2.5-2.6B_int8.litertlm, see Known runtime issues). For the GPU on LiteRT-LM 0.20.0, use LFM2.5-2.6B_int8_v0200.litertlm, one of the two _v0200 files added for it. On a Mac M4 Max with litert-lm 0.20.0 from PyPI, this command, run from an empty directory, printed its reasoning between [thought] and [/thought] and then 17 + 25 = 42.

uvx --from litert-lm==0.20.0 litert-lm run --from-huggingface-repo=litert-community/LFM2.5-2.6B LFM2.5-2.6B_int8_v0200.litertlm --backend gpu --cache no --prompt "What is 17 + 25?"

On a Mac, --backend gpu of litert-lm 0.20.0 from PyPI runs on WebGPU. litert-lm 0.20.0 from PyPI needs Python 3.10 or newer. Asked one question on the GPU of litert-lm 0.19.2 (PyPI, Mac M4 Max), the two _v0200 files printed garbled text that is not an answer, with no error and exit status 0. On the GPU, use the _v0200 files with LiteRT-LM 0.20.0. The _v0200 files were not run on a phone.

If run stops right after the download with no error message from the CLI (a bus error; exit status 138 on a Mac) or with an error log that contains too large for file size, the downloaded file may be incomplete. The litert-lm CLI (tested on 0.19.2 and litert-lm-nightly 0.20.0.dev20261112; 0.14.0 to 0.19.1 and 0.20.0 have the same download code) can keep an incomplete download in ~/.litert-lm/cache/huggingface/litert-community/LFM2.5-2.6B/ and uses it again on later runs without checking its size. Delete that file and run the command again.

LFM2.5-2.6B is the flagship of Liquid AI's LFM2.5 on-device family: a hybrid architecture (22 gated short-convolution blocks + 8 grouped-query attention layers) and a thinking model β€” it reasons inside a <think>…</think> block before answering. The file declares the thought channel, so LiteRT-LM apps receive the reasoning and the answer as separate streams.

File Recipe Size GSM8K (n=100)
LFM2.5-2.6B_int8.litertlm int8 dynamic (linears + convs + embedding) 2.87 GB 88% (on an earlier int8 file of this repo; bf16 reference: 92%)
LFM2.5-2.6B_int4.litertlm int4 blockwise-32 + OCTAV linears, int8 embedding, convs float 1.67 GB 83% (on an earlier int4 file of this repo)
LFM2.5-2.6B_int8_v0200.litertlm For LiteRT-LM 0.20.0: int8 on linears + embedding, convs float, on an export with GPU composites (ShortConv state channels-last) 2.87 GB not measured
LFM2.5-2.6B_int4_v0200.litertlm For LiteRT-LM 0.20.0: the int4 recipe above, on a separate export at the same litert-torch commit 1.67 GB not measured

The chat template accepts both the string form and the 0.18 content-parts form of a message.

Context (KV cache) 4096 max (see --max-num-tokens note)
Backend CPU, and GPU (for the Android GPU path and for iOS Metal, see Known runtime issues). The _v0200 files run on the GPU with LiteRT-LM 0.20.0 (macOS verified by generation; see the top of this page).
Template in the file β€” ChatML-style with tool-list support; generation prompt pre-fills <think> (the model's trained convention); thought channel declared
Base model LiquidAI/LFM2.5-2.6B (LFM Open License v1.0)

Quality β€” GSM8K

GSM8K, greedy, 0-shot chain-of-thought, max-tokens 2048 (thinking model), n=100, same evaluation script for all rows:

Configuration GSM8K
PyTorch bf16 (reference, MPS) 92%
LiteRT int8 (an earlier int8 file of this repo) 88%
LiteRT int4-b32 OCTAV (an earlier int4 file of this repo) 83%

Earlier int8 and int4 files of this repo, the ones published on 2026-08-10, passed an 8-question check 8/8 with zero degenerate outputs (CPU), a 42-length prefill sweep with zero corrupt first tokens (a new Engine for each length), and a 3-turn conversation check (fact recall + arithmetic), with litert-lm 0.15.0.

With litert-lm 0.20.0 from PyPI on a Mac M4 Max (2026-11-28; these 8 questions with "Answer briefly." appended, greedy with --max-num-tokens 2048 and --thinking false, one process per question, one run), both _v0200 files scored 8/8 on the GPU and on the CPU, and no run degenerated.

Usage

pip install litert-lm
litert-lm run ./LFM2.5-2.6B_int4.litertlm --prompt "What is 17 + 25?"

The model thinks before answering β€” through the Python/C++ API the reasoning arrives on the thought channel and the reply stays clean; the CLI prints both.

Thinking cannot be switched off. In the _v0200 files the chat template ends the generation prompt with <think> and does not read enable_thinking. In the 0.20.0 check above, which passes --thinking false, all 8 replies of each _v0200 file began with the reasoning between [thought] and [/thought], on the GPU and on the CPU.

--max-num-tokens tip: reasoning turns are long β€” give the model at least 2048 tokens of budget for math/complex questions, or the think block may not close. Decode speed drops as the token budget grows, so don't set it higher than you need.

Multi-turn note: with the default filter_channel_content_from_kv_cache, LiteRT-LM takes each reply's thought out of the KV cache (0.18.1 when the next user message arrives; 0.19.0, 0.19.1 and 0.20.0 after each reply; read in the LiteRT-LM source, not measured with these files; see After a reply with a thought, the turn is prefilled again below).

One Engine per conversation. On litert-lm 0.18.0 the runtime starts a new Conversation on an Engine that already ran another conversation from the earlier conversation's short-convolution state: it reuses the prompt tokens the two conversations share and does not reset the state (my report). In a test that asks three questions (What is the capital of France? / What is 17 times 23? / What color is the sky on a clear day?) first in a pirate-persona conversation and then in a conversation told to answer in one word, on the same Engine against a fresh Engine in a new process (answers capped at 200 tokens; CPU backend; litert-lm 0.18.0 on a Mac; 2026-10-12), an earlier _int8 file of this repo gave the same three one-word answers on both Engines, in its one run. An earlier _int4 file was run twice (a test is run a second time when its first run shows a difference or when the fresh Engine misses one of the three expected answers: Paris, 391, blue): in its first run the arithmetic answer came back as an empty reply on the fresh Engine; in its second run the same three one-word answers came back on both Engines. Those three short questions say nothing about longer conversations. Create a new Engine for each conversation. The first conversation on an Engine is unaffected. A fix landed on LiteRT-LM main on 2026-11-03 (e1f86b05). The LiteRT-LM v0.20.0 release contains it; this model was not tested with a shared Engine on v0.20.0.

Tool calls on litert-lm 0.18.0. The files without _v0200 carry llm_model_type lfm2 and a chat template that renders tool calls and tool results; on litert-lm 0.18.0 the runtime parses the LFM2 tool call and the tool result reaches the model. The lfm2 model type needs litert-lm β‰₯ 0.15.0; the tool-call parser is 0.18.0's β€” on 0.15–0.17 the tool call still arrives as text (read from the runtime source, not run here). The model type lfm2 sets the runtime's GPU executor defaults (every non-generic LiteRT-LM model type shares them: allow_src_quantized_fc_conv_ops on, OpenCL hint_waiting_for_completion off, kernel batch size unset); the phone GPU rows on this card were measured with earlier files.

Replies that take over 10 minutes. On litert-lm 0.18.x and 0.19.0, a blocking send_message that is still generating after 10 minutes fails with DEADLINE_EXCEEDED (a fixed timeout with no setting), and the generation it leaves running can crash the process. For long replies on a slow backend (long thinking in particular), lower max_output_tokens or use the streaming send_message_async, which has no such limit.

Speed

litert-lm benchmark, CPU backend, Mac M4 Max, max-num-tokens 1024 (prefill-1024 rows measured at max-num-tokens 2048), on earlier files of this repo (2026-08-10):

Variant Prefill (256) Prefill (1024) Decode TTFT
int8 169 tok/s 434 tok/s 38.0 tok/s 1.54 s
int4 156 tok/s 193 tok/s 43.7 tok/s 1.66 s

GPU backend (litert-lm benchmark … --backend gpu --cache no, litert-lm 0.16.0, same machine, the same earlier files; both variants verified to generate correct text on GPU before quoting):

Variant Prefill (256) Decode
int8 1893 tok/s 125.6 tok/s
int4 1972 tok/s 161.6 tok/s

For the Android GPU path of the two files without _v0200, see Known runtime issues. Pixel 8a (Tensor G3), litert_lm_main v0.16.0 built from the release tag, 261-token prompt with generation capped at 256, 3 runs per backend (an earlier int4 file of this repo):

Backend Prefill (261 tok) Decode TTFT
GPU (OpenCL) 87.8–88.4 tok/s 11.0–11.2 tok/s 3.04–3.06 s
CPU 16.2–30.2 tok/s 7.4–10.2 tok/s 8.7–16.3 s

At this size the GPU won across the board on that phone β€” ~3–5Γ— prefill, ~3–5Γ— faster to the first token, and a steadier decode (the CPU rows spread because they throttle; the GPU rows repeat to within 2%) β€” so prefer the GPU backend where the runtime offers it. A short prompt shifted the ratio further toward the GPU: with a 19-token prompt the same file prefilled at 37.7–38.8 tok/s on GPU against 4.1 tok/s on CPU.

iPhone 17 Pro (CPU backend, cold first runs; earlier files of this repo, 2026-08-10): the int4 file answers the 8-question quality check 8/8 and decodes at ~20 tok/s warm (the first, cold run is slower while caches build). The int8 file also loads and runs on iPhone 17 Pro when the host app carries the extended-virtual-addressing / increased-memory entitlements β€” int4 is the recommended phone variant (smaller, faster on phone-class memory bandwidth).

Galaxy S26 β€” GPU backend

This section describes earlier files of this repo, the ones it held when they were checked (LFM2.5-2.6B_int4.litertlm on 2026-08-24, LFM2.5-2.6B_int8.litertlm on 2026-08-25): both ran on the Android GPU backend, LiteRT took the whole graph in each, and the model generated. For the Android GPU path of the current files without _v0200, see Known runtime issues.

file GPU backend delegation peak
LFM2.5-2.6B_int4.litertlm ran 11132 / 11132 ops across 12 subgraphs on LiteRT GPU 1231 MiB
LFM2.5-2.6B_int8.litertlm ran 11132 / 11132 ops across 12 subgraphs on LiteRT GPU 1189 MiB

Measured on a Samsung Galaxy S26 (SM-S942Q / SM8850, Android 16) with litert_lm_advanced_main from litert-lm 0.16.0, --backend=gpu --sampler_backend=cpu, prompt What is the capital of France?. Peak is the process high-water mark (VmHWM) sampled during that same run. Checked 2026-08-24 and 2026-08-25.

Speed. These checks measured delegation, generation and peak memory, not speed. Speeds measured on this handset with earlier files of this repo are in the Galaxy S26 rows of litertlm_manifest.json (GPU: int4 on 2026-08-24, int8 on 2026-08-25; CPU: int8 on 2026-09-06).

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

Run on Android

Install a recent Google AI Edge Gallery (1.0.16+ imports .litertlm directly from Hugging Face), import this repo (or adb push a file and use local import), select the CPU backend, and chat. For the Android GPU (litert_lm_main --backend=gpu, or the SDKs) with the two files without _v0200, see Known runtime issues; the Gallery app ships its own runtime β€” if its GPU toggle fails, use CPU there.

In a Flutter app, flutter_edge_ai_litertlm (1.14.0) installs this repo's file through FlutterEdgeAi.resolveHuggingFace('litert-community/LFM2.5-2.6B'), which reads the repo's litertlm_manifest.json and picks the file and backend for the device; in React Native, react-native-litert-lm (0.8.0) does the same through resolveFromManifest(). Neither route is device-verified by this card; each package's README states its tested platforms.

Conversion notes

The two files without _v0200 were converted with released litert-torch 0.9.2 (upstream lfm2 hybrid support incl. the ShortConv prefill-pad fix); the executor-metadata section binds the 22 conv states + 16 KV caches.

  • The generation prompt pre-fills <think> exactly as the vendor chat template does. This matters: with a bare assistant prompt, think-block emission becomes the model's choice, and the int4 quantization degrades that discipline first (unscaffolded rambling in place of answers on multi-turn). With the pre-fill, all variants answer tersely and the thought channel routes cleanly.
  • The checkpoint is notably sparse: OCTAV int4-b32 produced 746k all-zero weight blocks whose zero scales the XNNPACK delegate rejects at load. The zero scales are patched to the tensor's smallest nonzero scale (dequantization unchanged β€” the blocks are all zeros).
  • LFM2.5-2.6B_int8.litertlm quantizes convs at export time; LFM2.5-2.6B_int4.litertlm keeps convs float.
  • Multi-length prefill signatures (1–1024) are exported so the runtime picks tight chunks; a 42-length first-token sweep verifies no prefill-padding state corruption.
  • The _v0200 files were exported with litert-torch main at commit 5d18d996e, whose default GPU composites keep the ShortConv state channels-last. int8: the exporter's dynamic_wi8_afp32 (linears and embedding int8, convs float because they are operands of the ShortConv composite). int4: the int4 recipe of LFM2.5-2.6B_int4.litertlm, with the block scales floored at 2^-14. Both have a 4096-token KV cache and prefill signatures from 1 to 1024 tokens.

Raspberry Pi 5 (CPU)

Measured on 2026-09-01, on earlier files of this repo, 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
LFM2.5-2.6B_int4.litertlm 28.5 (28.5–28.5) 4.9 (4.9–4.9) 9.2 s 2.9 GB
LFM2.5-2.6B_int8.litertlm 43.8 (43.6–43.9) 3.5 (3.5–3.5) 6.1 s 3.9 GB

Known runtime issues

Measurements of LFM2.5-2.6B_int4.litertlm and LFM2.5-2.6B_int8.litertlm on this page made before 2026-11-26 used earlier files, not the current ones.

Android GPU with LiteRT-LM v0.18.0 and v0.18.1. LFM2.5-2.6B_int4.litertlm and LFM2.5-2.6B_int8.litertlm keep some of their weights outside the model graph (LiteRT's external weights), and on a Pixel 8a the GPU backend of the v0.18.0 and v0.18.1 Android builds crashes (SIGSEGV) on a Qwen3-0.6B file with external weights (LiteRT-LM#3986).

Android GPU with --max_num_tokens=256. On a Galaxy S26 (SM-S942Q / SM8850) on 2026-11-26, litert_lm_advanced_main built from the LiteRT-LM v0.19.1 tag exited with status 2 for LFM2.5-2.6B_int4.litertlm and LFM2.5-2.6B_int8.litertlm in all 8 runs with --backend=gpu --sampler_backend=cpu --sampler_top_k=1 --sampler_handles_input=false --max_num_tokens=256. In the log of one run per file, the GPU delegate refused two DYNAMIC_UPDATE_SLICE ops of the 1,024-token prefill signature (Updated_slice shape must be less or equal to the array to update), 120 of that signature's 936 ops were assigned to the GPU, and engine creation then failed with Failed to modify graph with delegate. With the same flags but without --max_num_tokens, the same files generated on the GPU in 8 of 8 runs, and LFM2.5-2.6B_int8.litertlm generated on the CPU in 4 of 4 runs with --backend=cpu --sampler_backend=cpu --sampler_top_k=1 --max_num_tokens=256. Other --max_num_tokens values, the int4 file on the CPU, other phones and other LiteRT-LM versions were not tried in these Android runs.

iOS Metal. On an iPhone 17 Pro, engine creation on the Metal GPU failed for an earlier int4 file of this repo in 2 of 2 chat runs of a test app, with LiteRT-LM v0.18.0 and a context of 672 tokens (2026-10-20). The log shows the same kind of DYNAMIC_UPDATE_SLICE refusal (120 of 936 ops assigned to the GPU, then Failed to modify graph with delegate). On the same phone on the same day, benchmark() with that file at a context of 2048 tokens ran on the GPU, 4 of 4. Those runs differ in the context and in the API; which of the two decides was not checked. The current files were not run on iOS.

Long greedy replies on the GPU vary between runs. On the GPU's default path, where the sampler writes the inputs of the next decode step, a long greedy reply can differ from one process to the next. Measured on an earlier int4 file of this repo with a question asking for a ~400-word essay (the thought and the essay, about 9,200 characters): on a Mac (Apple M4 Max, WebGPU), LiteRT-LM built from source (commit dab2e708) gave another reply in 2 of 8 runs, and the PyPI litert-lm 0.19.1 CLI in 2 of 15; on a Pixel 11 Pro GPU (PyPI litert-lm-api 0.19.0), 6 runs gave 2 different replies. With --sampler_handles_input=false (litert_lm_advanced_main built from source; the Python, Kotlin and Swift APIs of 0.19.1 have no such setting), that file gave one and the same reply in 8 of 8 runs.

From a conversation preface (the system message, initial messages, tools and extra context a conversation is created with) that has tools and no messages, LiteRT-LM renders these files' chat template with an empty message list, and the template reads messages[0] without checking that the list is non-empty, so the render fails with Failed to apply template: undefined value. This happens in two places: when the preface is prefilled at creation (prefillPrefaceOnInit = true in Kotlin, prefillPrefaceOnInit: true on the web, SetPrefillPrefaceOnInit(true) in C++; the default is false), where creating the conversation fails with that error, and in the preface render (renderPrefaceIntoString() in Kotlin and Swift, RenderPrefaceIntoString() in C++, litert_lm_conversation_render_preface_to_string in the C API). The same happens with extra context (such as enable_thinking) and no messages, and in the preface render with an empty preface (run in the runtime on one Qwen3 template; the other templates rendered with minijinja 2.14 and jinja2). Read in the source of LiteRT-LM 0.17.0, 0.18.1 and main as of 2026-10-23; measured on 2026-10-25 with LiteRT-LM 0.18.1 (the litert-lm package from PyPI) through its C API on the template text that all four files carry. The default path, where the first message is rendered together with the preface, is not affected: the Python API and the CLI of 0.18.1 expose neither the flag nor the preface render, and Google AI Edge Gallery sets neither (its source as read on 2026-10-25). A system message or any initial message in the conversation config avoids it.

Structured output: LiteRT-LM refuses constrained decoding for files of llm_model_type lfm2 when the conversation is created (Constrained decoding is not supported for Lfm2DataProcessor.), so such a file does not take a JSON ResponseFormat. That was measured on LFM2.5-1.2B-Instruct_int4.litertlm from LFM2.5-1.2B-Instruct with litert-lm 0.16.0 and 0.19.1 on a Mac CPU. All files here carry llm_model_type lfm2; they were not run with constrained decoding.

On LiteRT-LM 0.18.1 and 0.19.1, once a message fails because it does not fit in the context window, every later message in that conversation fails as well (the next one with Task failed with state: 7). Start a new conversation after such an error. For these files, start it on a new Engine (see One Engine per conversation above).

Token id 124893 (<|pad|>) is treated as padding by the short-convolution blocks. In the prefill signatures of 2 to 1,024 tokens, all four files mask every prompt token whose id is 124893: at that position the 22 short-convolution blocks get a zero input, while the attention layers still read the token. The 1-token prefill and the decode step have no such mask. This was read from the files' graphs, not run.

After a reply with a thought, the turn is prefilled again. After each reply that contains a thought, LiteRT-LM 0.19.0, 0.19.1 and 0.20.0 rewind the KV cache and prefill the reply again without the thought (the default filter_channel_content_from_kv_cache). These files' generation prompt opens the thought channel (<think>), so the rewind goes back to before the user message and the user message is prefilled again too. LiteRT-LM 0.19.0 and 0.19.1 do this before they report the reply as done; 0.20.0 reports the reply as done to a streaming caller while this prefill runs in the background, and the next message waits for it. This was read in the LiteRT-LM source of 0.19.0, 0.19.1 and 0.20.0, not measured with these files.

License and changes

Distributed under the LFM Open License v1.0 (see LICENSE, inherited from the base model). Note the license's commercial-use limitation for organizations with annual revenue of US$10M or more. Changes from the original work: weights converted from safetensors bf16 to LiteRT flatbuffers and quantized as described above; chat template rewritten for LiteRT-LM, accepting the 0.18 content-parts form of a message and taking its tool-call and tool-result rendering from LiteRT-LM's lfm2 template; LiteRT-LM metadata added (the start and stop tokens, a 4096-token context limit, the lfm2 model type, the thought channel and the pad token); the _v0200 files exported with litert-torch's GPU composites. This repository is a community conversion published by litert-community, not by Liquid AI.

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

Model tree for litert-community/LFM2.5-2.6B

Quantized
(117)
this model