Instructions to use litert-community/FastContext-1.0-4B-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use litert-community/FastContext-1.0-4B-SFT with LiteRT-LM:
# 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/FastContext-1.0-4B-SFT \ --prompt="Write me a poem"
- LiteRT
How to use litert-community/FastContext-1.0-4B-SFT with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Measured on device (edge-compat, fastcontext-1.0-4b-sft-model-block128): Galaxy S26 Β· LiteRT-LM 0.16.0 Β· GPU Β· decode 7.5 tok/s Β· prefill 86 tok/s Β· TTFT 2.47 s Β· all 1674 ops delegated (2026-08-24); Raspberry Pi 5 Β· LiteRT-LM 0.16.1 Β· CPU, 4 threads Β· decode 1.5 tok/s Β· prefill 10 tok/s Β· TTFT 26.04 s (2026-09-02). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/fastcontext-1.0-4b-sft-model-block128/CARD.md
Measured on device (edge-compat, fastcontext-4b): Mac Studio M4 Max Β· LiteRT-LM 0.14.0 Β· GPU Β· decode 74.5 tok/s Β· prefill 964 tok/s Β· TTFT 279 ms (2026-07-23); Galaxy S26 Β· LiteRT-LM 0.16.0 Β· CPU Β· decode 7.1 tok/s Β· prefill 37 tok/s Β· TTFT 5.61 s (2026-09-05); Raspberry Pi 5 Β· LiteRT-LM 0.16.1 Β· CPU, 4 threads Β· decode 1.4 tok/s Β· prefill 10 tok/s Β· TTFT 28.46 s (2026-09-02). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/fastcontext-4b/CARD.md
FastContext-1.0-4B-SFT β LiteRT-LM (blockwise int4)
Try it in your browser: the LiteRT-LM Web chat demo loads model.litertlm from this repo's web branch (2.66 GB download) and runs it with WebGPU. That branch keeps the files from before the 2026-11-16 entry below.
Note (2026-11-03): the source repositories microsoft/FastContext-1.0-4B-SFT and microsoft/FastContext-1.0-4B-RL are no longer available on the Hugging Face Hub (last archived on 2026-06-28), and the FastContext paper was withdrawn on arXiv on 2026-06-30 (arXiv:2606.14066v4). This conversion was made before then from the SFT release, published under the MIT License, so the links to the source on this card no longer resolve.
microsoft/FastContext-1.0-4B-SFT
converted to the LiteRT-LM (.litertlm) format for on-device inference with
Google's LiteRT-LM runtime.
FastContext is a lightweight repository-exploration sub-agent for coding agents β
it specializes in repo discovery and evidence gathering via parallel tool calls
(READ / GLOB / GREP). The 4B backbone is Qwen3-4B-Instruct (Qwen3ForCausalLM),
so it rides the existing Qwen3 converter and runtime directly.
On a Galaxy S26 GPU model.litertlm decoded 18.4 tokens/s and prefilled 1,024 tokens at 168 tokens/s (LiteRT-LM v0.19.0; each run repeats the workload three times, and these values are the median of the second and third repetitions, iterations 2β3, over two runs): the Galaxy S26 section.
Run it with the litert-lm CLI:
pip install litert-lm
litert-lm run --from-huggingface-repo litert-community/FastContext-1.0-4B-SFT model.litertlm --prompt "List the files you would read to understand a Python project's entry point."
The first run downloads model.litertlm (2.5 GiB, as the CLI prints it). The litert-lm run line was run as written on 2026-11-16 with litert-lm 0.19.2 on a Mac: it printed a list of files to read, main.py, __main__.py, pyproject.toml, setup.cfg and setup.py among them.
When it does not work:
- On Android the GPU path needs LiteRT-LM 0.19.0 or later: Known runtime issues.
- The files published on 2026-11-16 were not run on an iPhone (earlier files were): Run on iPhone.
- The litert-lm CLI (0.14.0 to 0.19.2) reuses a
model.litertlmit downloaded before, without checking it against this repo, so a copy from before the files were replaced on 2026-11-16 (07:31 UTC), or an incomplete download, stays in use: Run on desktop says which file to delete; then run the command again.
On 2026-11-16 model.litertlm and model_block128.litertlm were replaced with files whose prefill/decode graph is rewritten for the GPU, with every weight unchanged.
Outside the dated entries under Conversion, three names are fixed. "These files" are the two files published on 2026-11-16. "The previous files" are the ones they replaced, on the main branch since 2026-10-30. "Earlier files" are any files there before that. The measured lines at the top of this card were taken with earlier files, on 2026-07-23 (Mac), 2026-08-24 and 2026-09-05 (Galaxy S26) and 2026-09-02 (Raspberry Pi 5).
These files were run only with LiteRT-LM 0.19.0 (phones and Mac) and 0.19.1β0.19.2 (Mac); earlier runtimes were not tried with them.
On the Galaxy S26 GPU model_block128.litertlm decoded 20.4 tokens/s and prefilled 1,024 tokens at 170 tokens/s, measured the same way as model.litertlm above. Run back to back with the previous files on that phone, these files decoded 1.45β1.54 times as fast and prefilled 1.19β1.47 times as fast, depending on the file and the iteration, and the phone-wide GPU allocation counter (kgsl_page_alloc) rose 5.21 GB (model.litertlm) and 4.83 GB (model_block128.litertlm) during their runs, against 4.03 GB and 3.65 GB with their previous files. On a Pixel 11 Pro GPU they decoded 1.31β1.53 times as fast and prefilled 1.18β1.29 times as fast as the previous files in the pairs of runs taken back to back (one pair for model.litertlm; see the Pixel 11 Pro section). On the Galaxy S26 CPU (2026-11-16) the speed differences between each new file and its previous file were smaller than the difference between one file's own two runs in the same iteration, except in two prefill cases, and the process peak (VmHWM) was 0.84β1.37 GB higher with each new file in each pair of runs (see the Galaxy S26 section).
| Files | model.litertlm β int4 block 32 Β· model_block128.litertlm β int4 block 128 |
| Quantization | int4 weights (symmetric) + OCTAV optimal-clipping; embeddings INT8 (externalized section) |
| Context (KV cache) | 4096 |
| Base model | microsoft/FastContext-1.0-4B-SFT (Qwen3-4B-Instruct) |
Which file?
The two files hold the same conversion and differ in the int4 block size, the number of weights that share one scale.
model.litertlm |
model_block128.litertlm |
|
|---|---|---|
| int4 block size | 32 | 128 |
| File size | 2.67 GB | 2.48 GB |
| GSM8K, earlier files (bf16 reference: 87.0%) | 88.0% | 81.0% |
| Galaxy S26 GPU, these files: decode | 18.4 tok/s | 20.4 tok/s |
| Galaxy S26 GPU, these files: prefill of 1,024 tokens | 168 tok/s | 170 tok/s |
| Galaxy S26 GPU, these files: engine start without cache files | 13.01 s | 6.03 s |
Galaxy S26 GPU, these files: peak process memory (VmHWM) + rise of the phone's GPU allocation counter |
1.43 GB + 5.21 GB | 1.07 GB + 4.83 GB |
| iPhone 17 Pro, earlier files (2026-06-27): decode | 10 tok/s | 14 tok/s |
| Mac (M-series) GPU with WebGPU, earlier files (2026-06-27) | 64β73 tok/s | 66β68 tok/s |
GSM8K: see the accuracy note below. Galaxy S26: each file's own two runs on 2026-11-15, the median of iterations 2β3 (the Galaxy S26 section); the two files were not alternated with each other. iPhone and Mac: one figure or range per file from the record of 2026-06-27, which does not state a run count or prompt.
Usage
Run with the LiteRT-LM runtime:
# build litert-lm from https://github.com/google-ai-edge/litert-lm, then:
litert_lm_main \
--model_path model.litertlm \
--backend gpu \
--input_prompt "List the files you would read to understand a Python project's entry point."
The .litertlm bundle carries the tokenizer and prompt template (Qwen3 ChatML β
<|im_start|>role\nβ¦<|im_end|>, stop token <|im_end|>), so no separate tokenizer
files are needed.
Run on Android
Update (July 2026): Google AI Edge Gallery v1.0.16+ can import litert-lm models directly from Hugging Face inside the app (tap +) β no computer or
adbneeded. The manual steps below are only required on older builds or for sideloading a local file.
The easiest way to try this on a phone is the official Google AI Edge Gallery app:
- Install a recent Gallery (package
com.google.ai.edge.gallery, APK from the repo's releases β 1.0.15+ supports.litertlm). - Download
model.litertlmand push it:adb push model.litertlm /sdcard/Download/ - In the app tap + (bottom-right), pick the file, choose the GPU backend.
- Chat β the bundle already carries the tokenizer and Qwen3 chat template.
The Galaxy S26 section below gives these files' memory use.
On Android the GPU path of these files needs a Gallery build with LiteRT-LM 0.19.0 or later (see Known runtime issues).
Run on desktop (LiteRT-LM CLI)
The same .litertlm bundle runs on macOS / Linux / Windows with the official
LiteRT-LM CLI β including as a
local OpenAI-compatible API server:
pip install litert-lm
litert-lm import --from-huggingface-repo litert-community/FastContext-1.0-4B-SFT model.litertlm fastcontext-1.0-4b-sft
litert-lm run fastcontext-1.0-4b-sft # interactive chat in the terminal
litert-lm serve # local OpenAI-compatible API server
If the run command above stops 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 file that import downloaded may be incomplete. The litert-lm CLI (0.14.0 to 0.19.2, and litert-lm-nightly 0.20.0.dev20261112) can keep an incomplete download in ~/.litert-lm/cache/huggingface/litert-community/FastContext-1.0-4B-SFT/ and imports it without checking its size. Delete that file and run the import command again: it downloads a new copy and replaces the imported one.
If you imported model.litertlm with --from-huggingface-repo before it was replaced on 2026-11-16 (07:31 UTC), delete ~/.litert-lm/cache/huggingface/litert-community/FastContext-1.0-4B-SFT/model.litertlm, then run the import command again. Without deleting it, import imports the file you downloaded before, not the one in this repo now: the litert-lm CLI (0.14.0 to 0.19.2) uses a file it finds there without checking it against this repo. The same holds for model_block128.litertlm, with its file name in the path.
Run on iPhone
Earlier files were run on an iPhone 17 Pro with the LiteRT-LM Swift runtime (swift-litert-lm) on 2026-06-27: both loaded and generated on-device (block 32 ~10 tok/s, block 128 ~14 tok/s). In those files the main weights section was ~2.11 GiB for block 32 / ~1.94 GiB for block 128 β both loaded on iPhone 17 Pro, so externalizing the embedder (below) was sufficient; no further size reduction was required to fit iOS. These files were not run on iOS.
Performance
With earlier files: litert-lm benchmark (litert-lm 0.15.0) on an Apple M4 Max, -p 256 -d 256 --runs 3 (the tool averages three iterations), max-num-tokens 4096, warm-up run discarded, otherwise idle machine.
| Device | Backend | Prefill (256) | Decode | TTFT | Load | Peak footprint |
|---|---|---|---|---|---|---|
| Apple M4 Max (macOS) | CPU | 96 tok/s | 16.9 tok/s | 3.08 s | β | β |
| Apple M4 Max (macOS) | GPU (Metal) | 995 tok/s | 73.8 tok/s | 0.28 s | β | β |
| iPhone 17 Pro | GPU (Metal) | β | 10 tok/s (block 32) Β· 14 tok/s (block 128) | β | β | β |
Reproducibility: the GPU rows repeat to within about 1% across invocations; the CPU rows are noisier β re-running a 1B model six times spread its CPU decode over 29.0β33.3 tok/s, so treat the CPU column as accurate to roughly Β±7%.
The desktop rows are an earlier model.litertlm (block 32); the block-128 file was not timed with this tool, so its Mac figure in βWhich file?β above is the older WebGPU range. The iPhone figures come from the 2026-06-27 on-device platform matrix for this model, one per file; that record does not state a run count or prompt.
The speed of these files was measured on two phones, the Galaxy S26 (GPU and CPU) and the Pixel 11 Pro (GPU), in the sections below, not on a Mac or an iPhone.
Accuracy note
Measured with earlier files on GSM8K (n=100, greedy, 0-shot chain-of-thought, identical prompt and answer-extraction for every row).
| Configuration | GSM8K |
|---|---|
| bf16 (reference) | 87.0% |
| LiteRT int4 β block 32 | 88.0% |
| LiteRT int4 β block 128 | 81.0% |
The block-32 build is at full parity (β0 pt vs bf16) β the OCTAV + blockwise-32 recipe leaves int4 indistinguishable from bf16 here. (FastContext is a tool-calling agent, not a math model, so GSM8K is an indirect capability measure; the bf16-vs-int4 delta is nonetheless the correct test for "did int4 quantization degrade the model" β and at block 32 it did not.) With earlier files it answered 8 of 8 short questions, with no degenerate output. These files answered 8 of 8 on a Mac GPU, a Galaxy S26 GPU and a Pixel 11 Pro GPU (the phone sections and the 2026-11-16 entry below).
Identity: asked "what is your name?", the model answers "I am Qwenβ¦" (observed with earlier files). FastContext is fine-tuned from Qwen3-4B-Instruct and the SFT does not override the base identity β this is inherited from the base model (the bf16 original behaves identically), not a conversion artifact.
Galaxy S26 β GPU and CPU
Each run starts the engine once and then, three times (three iterations), opens a new conversation that prefills 1,024 tokens and generates 256: by the runtime's source, the benchmark mode puts the prompt file's one sentence ("Explain what on-device AI means in simple terms.") in the chat template as a user message and pads the tokens to 1,024 with token id 0. Iteration 1 is the first pass after the engine starts. The GPU rows are the median of iterations 2β3 over a file's two runs, so they leave iteration 1 out (iteration 1 alone, the median over the same runs, prefill and decode: the new model.litertlm 198 and 18.6 tok/s, its previous file 146 and 12.7; the new model_block128.litertlm 199 and 20.9 tok/s, its previous file 146 and 13.6). On the CPU the median prefill speed of every file falls after iteration 1, so each iteration has its own row: the median of that iteration over a file's two counted CPU runs (a warm-up run before them is not counted). Every speed ratio on this card is computed from the speeds the runtime printed (two decimals, in MEASUREMENTS.md) before any further rounding.
| File | Version | Backend | Prefill, 1,024 tokens | Decode | Time to first token | Peak memory |
|---|---|---|---|---|---|---|
model.litertlm |
new (2026-11-16) | GPU, iterations 2β3 | 168 tok/s | 18.4 tok/s | 6.17 s | 1.43 GB + 5.21 GB GPU allocations |
model.litertlm |
previous (2026-10-30) | GPU, iterations 2β3 | 131 tok/s | 12.6 tok/s | 7.90 s | 1.61 GB + 4.03 GB GPU allocations |
model_block128.litertlm |
new (2026-11-16) | GPU, iterations 2β3 | 170 tok/s | 20.4 tok/s | 6.10 s | 1.07 GB + 4.83 GB GPU allocations |
model_block128.litertlm |
previous (2026-10-30) | GPU, iterations 2β3 | 121 tok/s | 13.5 tok/s | 8.54 s | 1.04 GB + 3.65 GB GPU allocations |
model.litertlm |
new (2026-11-16) | CPU, iteration 1 | 42.8 tok/s | 6.08 tok/s | 24.49 s | 5.44 GB |
model.litertlm |
new (2026-11-16) | CPU, iteration 2 | 34.3 tok/s | 5.80 tok/s | 30.07 s | 5.44 GB |
model.litertlm |
new (2026-11-16) | CPU, iteration 3 | 34.2 tok/s | 5.74 tok/s | 30.15 s | 5.44 GB |
model.litertlm |
previous (2026-10-30) | CPU, iteration 1 | 53.1 tok/s | 6.64 tok/s | 19.82 s | 4.44 GB |
model.litertlm |
previous (2026-10-30) | CPU, iteration 2 | 37.0 tok/s | 5.75 tok/s | 27.90 s | 4.44 GB |
model.litertlm |
previous (2026-10-30) | CPU, iteration 3 | 31.3 tok/s | 5.50 tok/s | 33.25 s | 4.44 GB |
model_block128.litertlm |
new (2026-11-16) | CPU, iteration 1 | 67.6 tok/s | 6.18 tok/s | 15.44 s | 5.01 GB |
model_block128.litertlm |
new (2026-11-16) | CPU, iteration 2 | 43.5 tok/s | 5.29 tok/s | 23.78 s | 5.01 GB |
model_block128.litertlm |
new (2026-11-16) | CPU, iteration 3 | 34.9 tok/s | 5.20 tok/s | 29.53 s | 5.01 GB |
model_block128.litertlm |
previous (2026-10-30) | CPU, iteration 1 | 59.8 tok/s | 6.01 tok/s | 17.28 s | 4.11 GB |
model_block128.litertlm |
previous (2026-10-30) | CPU, iteration 2 | 39.8 tok/s | 5.32 tok/s | 25.93 s | 4.11 GB |
model_block128.litertlm |
previous (2026-10-30) | CPU, iteration 3 | 33.8 tok/s | 5.21 tok/s | 30.45 s | 4.11 GB |
Samsung Galaxy S26 (model SM-S942Q, chipset SM8850, Android 16), litert_lm_advanced_main (LiteRT-LM's C++ command-line program) built from the LiteRT-LM v0.19.0 source (commit 771b06e1; the v0.19.0 tag is on the next commit, which changes only Package.swift and README.md), --benchmark with 1,024 prefill tokens and 256 decode tokens, context 2,048 (--max_num_tokens=2048); the GPU runs on 2026-11-15, the CPU runs on 2026-11-16. Each timing run is a new process, started after the runtime's cache files next to the model were deleted. The full command is in MEASUREMENTS.md.
In the GPU runs every node of the prefill and decode graphs ran on LiteRT GPU with every file: with these files 1,707 nodes in each of prefill_128 and prefill_1024 and 1,631 in decode, with the previous files 1,674 in prefill_128 and 1,596 in decode, for both block sizes. The embedding table is a separate graph in its own section of the .litertlm file, with two signatures (decode_embedder and prefill_embedder_128); in the GPU runs, in each of them, XNNPACK took 1 of the 4 nodes and no delegate took the other 3, with every file. The previous files have one prefill signature, of 128 tokens: by the runtime's source they prefill the 1,024 tokens in eight steps of 128, and these files in one step of 1,024 (read in the source, not measured).
GPU runs: four for each of model.litertlm and model_block128.litertlm, two with the previous file and two with the new one, in the order previous, new, new, previous (GPU runs 1β4). Each started at Android's thermal status 0 (none), with no CPU clock cap, the GPU clock cap at 1,300 MHz and GPU thermal level 0 (the GPU driver's own thermal level; 0 = no limit), and ended at thermal status 2 (moderate). The previous files' runs took 87β98 s each, the new files' 60β73 s. In every run the phone lowered the GPU clock cap step by step, from 18β43 s in; by the end of a run it read 902 MHz (level 5) in the new files' runs and 826 MHz (level 6) in the previous files' runs, except the first run of the previous model.litertlm, which ended at 1,050 MHz (level 3).
CPU runs: four counted runs for each of model.litertlm and model_block128.litertlm, two with the previous file and two with the new one, in the order previous, new, new, previous (CPU runs 1β4), after one warm-up run of the new file that is not counted. The runtime used its default of 4 threads. Every run started with no CPU clock cap and GPU thermal level 0, at thermal status 0 (the warm-up and CPU runs 1β2 of model.litertlm) or 1 (light; the other runs). The runs ended at thermal status 2 (CPU runs 1β3 of model.litertlm), 3 (severe; its CPU run 4 and every run of model_block128.litertlm) or 1 (the warm-up of model.litertlm). The phone began to lower the caps of its two CPU clock domains 2β4 s into each counted run (7 s into the warm-up of model.litertlm). By the end of a run the caps read 1.56 and 1.50 GHz (CPU runs 1β2 of model.litertlm), 1.32 and 1.38 GHz (its CPU run 3), 1.23 and 1.27 GHz (its CPU run 4 and every run of model_block128.litertlm) or 1.79 and 1.75 GHz (the warm-up of model.litertlm). Each counted run took 206β224 s. CPU run 4 of model.litertlm ran 1 hour 50 minutes after its CPU run 3, and CPU runs 3β4 of model_block128.litertlm 1 hour 52 minutes after its CPU run 2; other tests ran on the phone in both gaps. During CPU runs 3 and 4 of model_block128.litertlm, two Chrome processes used 73 and 74 s of CPU time; in its earlier runs the phone's process list showed no CPU time added for Chrome. The 8 short questions were not asked on this phone's CPU.
On the GPU, in each iteration of each back-to-back pair (GPU run 2 against run 1, run 3 against run 4), the new model.litertlm decoded Γ1.45β1.48 and prefilled Γ1.19β1.44 as fast as its previous file, and the new model_block128.litertlm decoded Γ1.51β1.54 and prefilled Γ1.35β1.47 as fast as its previous file (each pair and iteration in MEASUREMENTS.md). Each run's mean of iterations 2β3, runs 1β4: model.litertlm prefill 137, 169, 167 and 119 tok/s and decode 12.7, 18.4, 18.4 and 12.5 tok/s, so prefill Γ1.234 and decode Γ1.453 in the first pair and prefill Γ1.406 and decode Γ1.471 in the second; model_block128.litertlm prefill 122, 169, 172 and 118 tok/s and decode 13.5, 20.4, 20.5 and 13.5 tok/s, so prefill Γ1.386 and decode Γ1.511 in the first pair and prefill Γ1.460 and decode Γ1.521 in the second.
On the CPU, by the median of each iteration (iterations 1, 2 and 3), the new model.litertlm prefilled Γ0.805, Γ0.927 and Γ1.092 as fast as its previous file and decoded Γ0.916, Γ1.010 and Γ1.045 as fast. In iteration 2 both of its runs prefilled more slowly than both of the previous file's (34.33 and 34.17 against 37.54 and 36.36 tok/s), a gap larger than the spread of either file's own two runs (0.5 % and 3.2 %). In iteration 1 both of its runs decoded more slowly than both of the previous file's (6.33 and 5.82 against 6.59 and 6.68 tok/s), a gap of 8.4 %; its own two runs are 8.8 % apart there. Its other four differences (1.0β19.5 %) are smaller than the spread of the previous file's own two runs in the same iteration (15.9β32.7 %). The previous file's CPU run 4, taken 1 hour 50 minutes after the other three, decoded 5.11 and 5.09 tok/s in iterations 2 and 3, against 6.38 and 5.90 tok/s in its CPU run 1. The new file's warm-up run (not counted) started at thermal status 0, and its CPU clock caps came down only to 1.79 and 1.75 GHz; in iterations 2 and 3 it prefilled 43.61 and 43.82 tok/s and decoded 6.75 and 6.58 tok/s, faster than any counted run of the new or the previous model.litertlm there.
The new model_block128.litertlm prefilled Γ1.130, Γ1.093 and Γ1.031 as fast as its previous file and decoded Γ1.029, Γ0.994 and Γ0.999 as fast. In every iteration both of its runs prefilled faster than both of the previous file's. That gap is smaller than the spread of its own two runs in iterations 1 and 2 (13.0 % against 20.3 %, and 9.3 % against 10.0 %) and larger than either file's spread in iteration 3 (3.1 % against 1.0 % and 0.5 %). Its decode differences (0.1β2.9 %) are smaller than the spread of one file's own two runs in the same iteration. By pair, the new file prefilled Γ1.034, Γ1.031 and Γ1.039 as fast in CPU runs 1β2 and Γ1.224, Γ1.157 and Γ1.024 as fast in CPU runs 3β4, the pair taken later with Chrome using CPU time (each pair and iteration in MEASUREMENTS.md).
Peak memory is per run, so the three CPU rows of a file share one value. A GPU row gives the highest VmHWM (the process's peak resident memory) of the file's runs and the rise of the phone's GPU allocation counter (kgsl_page_alloc of the phone's kgsl GPU driver; phone-wide, not per process), which was the same, to 0.01 GB, in both runs of a file; a CPU row gives the highest VmHWM of the file's two counted CPU runs. On the GPU, VmHWM was 1.35 and 1.43 GB in the new model.litertlm runs and 1.61 and 1.56 GB in its previous file's, and 0.97 and 1.07 GB in the new model_block128.litertlm runs and 1.04 and 0.95 GB in its previous file's; in every run it stayed below the counter's rise, so the GPU rows give both. During the new files' GPU runs the phone's available memory (MemAvailable) fell to 2.47β2.76 GB (3.12β3.96 GB in the previous files'). On the CPU, VmHWM was 5.44 GB in both runs of the new model.litertlm and 4.07 and 4.44 GB in its previous file's, and 5.01 and 4.95 GB in the new model_block128.litertlm runs and 4.09 and 4.11 GB in its previous file's. It was higher with each new file than with its previous file in every CPU run: by 1.37 and 1.00 GB (model.litertlm) and 0.92 and 0.84 GB (model_block128.litertlm), CPU run 2 against run 1 and run 3 against run 4. During the CPU runs the GPU allocation counter rose by at most 0.06 GB. Engine start on the GPU (the runtime's init time, the median of a file's two runs, each started without cache files) took 13.01 s with the new model.litertlm and 11.54 s with its previous file, and 6.03 s with the new model_block128.litertlm and 5.78 s with its previous file; on the CPU (the median of a file's two counted runs, each started without cache files) it took 5.40 s with the new model.litertlm and 3.48 s with its previous file, and 3.06 s with the new model_block128.litertlm and 1.72 s with its previous file.
8 short questions (such as "What is 17 + 25? Answer briefly.") on this phone's GPU: 8 of 8 with each new file. The previous files were not asked on this phone. These runs did not wait for the phone to cool down (they started at thermal status 2).
An earlier model.litertlm was run on this phone's CPU on 2026-09-05 (LiteRT-LM v0.16.0, 4 threads, a 202-token prompt, two runs): decode 7.14 and 6.62 tok/s, prefill 36.95 and 23.89 tok/s. With these files the GPU rows decoded 3.0, 3.2 and 3.2 times (model.litertlm) and 3.3, 3.9 and 3.9 times (model_block128.litertlm) as fast as the CPU rows of iterations 1, 2 and 3, and prefilled 3.9, 4.9 and 4.9 times and 2.5, 3.9 and 4.9 times as fast (the GPU runs on 2026-11-15, the CPU runs on 2026-11-16). The runs behind each number, and the Galaxy S26 section this card carried for earlier files: MEASUREMENTS.md.
GPU wiring, including the Gallery import toggle: GPU guide.
Pixel 11 Pro β GPU
On a Pixel 11 Pro (Android 17; the same program and workload as the Galaxy S26 section, 2026-11-15) every node of the prefill and decode graphs runs on the GPU with every file. Each of model.litertlm and model_block128.litertlm had four runs, two with the previous file and two with the new one, in the order previous, new, new, previous; every run started at thermal status 0 with no CPU or GPU limit and ended at thermal status 1 (light).
model_block128.litertlm: each run's mean of iterations 2β3 was prefill 121, 148, 150 and 120 tok/s and decode 7.13, 10.3, 10.3 and 7.27 tok/s, so prefill Γ1.216 and decode Γ1.440 in the first pair and prefill Γ1.251 and decode Γ1.416 in the second; in each iteration of each pair the new file decoded Γ1.31β1.53 and prefilled Γ1.18β1.29 as fast. The median of iterations 2β3 over a file's two runs: the new file 148 tok/s prefill, 10.3 tok/s decode and 7.00 s to the first token; the previous file 121 tok/s, 7.13 tok/s and 8.58 s.
model.litertlm: runs 1 (previous) and 2 (new) ran back to back: means of iterations 2β3 prefill 121 and 143 tok/s and decode 6.84 and 9.02 tok/s, so prefill Γ1.182 and decode Γ1.318; in each iteration Γ1.18 prefill and Γ1.31β1.37 decode. In run 3 (new) prefill fell from 148 tok/s in iteration 1 to 109 and 108 tok/s in iterations 2 and 3, and decode from 7.58 to 7.32 and 7.23 tok/s; during that run the phone's launcher (home screen) and display compositor used more CPU time than in the other runs (the cause was not looked into). Run 4 (previous; prefill 120 tok/s and decode 6.88 tok/s) ran 8 minutes after run 3 ended, in a separate series, so runs 3 and 4 give no ratio.
Peak memory (VmHWM) was 1.12 GB with the new model.litertlm and 1.10 GB with its previous file, and 0.91 GB with the new model_block128.litertlm and 0.90 GB with its previous file; the GPU driver's allocations were not read on this phone. On this phone each run wrote a 2.01 GB weight cache file next to the model, with every file. 8 short questions on the GPU: 8 of 8 with all four files, and each new file's replies were the same as its previous file's, byte for byte. The Pixel 11 Pro CPU was not measured. The runs: MEASUREMENTS.md.
Conversion
Converted with the official litert-torch
converter β FastContext is a standard Qwen3ForCausalLM, so it uses the existing Qwen3
path with no custom graph code. Recipe: blockwise int4 + OCTAV (INT4 weights, block 32
or 128, symmetric, OCTAV optimal-clipping) with embeddings kept at INT8, KV cache 4096.
Blockwise (not the tool's default channelwise) int4 is what preserves accuracy. In the two files published on 2026-11-16, the prefill/decode graph was rewritten and given a 1,024-token prefill signature with public scripts (the 2026-11-16 entry below); every weight is unchanged.
from litert_torch.generative.export_hf.export import export
export(
model="microsoft/FastContext-1.0-4B-SFT",
output_dir="out",
quantization_recipe="qwen3_int4_block32_octav.json", # blockwise-32 int4 + OCTAV, int8 embeddings
cache_length=4096,
externalize_embedder=True, # embedding β its own section (dedups tied matrix)
)
externalize_embedder=True writes the (tied) embedding as its own .litertlm section
and dedups the tied matrix, shrinking the main weights section β the generic equivalent
of Gemma's per-layer-embedding mmap.
Each dated entry below was written on its date: in it, "these files" are the files published that day and "the previous files" are the ones they replaced.
2026-11-16 β GPU graph and a 1,024-token prefill (weights unchanged)
The prefill/decode graphs of model.litertlm and model_block128.litertlm now have the GPU 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. The previous files had one prefill signature, of 128 tokens; these files also have prefill_1024, copied from it and sharing every weight buffer. Every weight, and every section outside that graph, is byte-identical to the previous files. The bundle header's file-format version went from 1.7.0 to 1.9.0. model.litertlm went from sha256 f67ff513β¦ (2,662,924,288 B) to c9b4e835β¦ (2,665,742,336 B), and model_block128.litertlm from b8880ee6β¦ (2,474,377,216 B) to b22525c9β¦ (2,477,211,648 B). The previous files stay at revision 7f5f9f5 and on the web branch.
On a Mac (litert-lm 0.19.2 unless a line says otherwise), each file against its previous file:
- 4 text prompts on the CPU (1 thread, top-k 1), one of them 1,425 tokens long before the chat template is applied (longer than the 1,024-token prefill): the same replies, byte for byte.
- A prompt that asks for a Python function, with litert-lm 0.19.0, 0.19.1 and 0.19.2 (top-k 1, a 512-token limit): on the CPU (1 thread) and on the GPU, the same reply from both files and all three versions, byte for byte.
- 8 short questions (each ends with "Answer briefly.") on the GPU: 8 of 8 with both files, and the same replies, byte for byte.
Galaxy S26 GPU (LiteRT-LM v0.19.0, four runs for each of model.litertlm and model_block128.litertlm in the order previous, new, new, previous): each run's mean of iterations 2β3 gives model.litertlm prefill Γ1.234 and Γ1.406 and decode Γ1.453 and Γ1.471 per pair, and model_block128.litertlm prefill Γ1.386 and Γ1.460 and decode Γ1.511 and Γ1.521; in iteration 1 alone model.litertlm prefill Γ1.360 and Γ1.355 and decode Γ1.454 and Γ1.463, and model_block128.litertlm prefill Γ1.348 and Γ1.369 and decode Γ1.525 and Γ1.540. On a Pixel 11 Pro GPU (same build and workload; each run's mean of iterations 2β3) model_block128.litertlm prefill Γ1.216 and Γ1.251 and decode Γ1.440 and Γ1.416, and model.litertlm prefill Γ1.182 and decode Γ1.318 in its one back-to-back pair. 8 short questions on the GPU: 8 of 8 with these files on both phones, and with the previous files on the Pixel 11 Pro. Procedure: REPRODUCE.md.
Raspberry Pi 5 (CPU, earlier files)
Measured with earlier files 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), except Peak RSS, which is the highest of the three invocations' peaks in MiB (VmHWM in kB Γ· 1024, rounded down). 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 |
|---|---|---|---|---|
model.litertlm |
10.2 (10.2β10.2) | 1.4 (1.4β1.4) | 28.5 s | 4,404 MiB |
model_block128.litertlm |
10.3 (10.3β10.5) | 1.5 (1.5β1.5) | 26.0 s | 4,009 MiB |
Known runtime issues
External weights (since 2026-10-30). In model_block128.litertlm and model.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 files with the weights inside the graph stay at revision 69a5b56.
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 these files hold the embedding table in its own section and the decoder takes embeddings, so later answers in a conversation can differ from the answer the model gives to the same messages in one prompt (read in the source of LiteRT-LM 0.16.0 to 0.18.1; measured with 0.18.1 on WeVisOne-VL-2B and Qwen2.5-Coder-1.5B-Instruct, not on these files). One question per conversation avoids it, as does a new conversation that starts with the earlier messages and the new question.
License
MIT, inherited from the base model microsoft/FastContext-1.0-4B-SFT (itself built on Qwen3-4B-Instruct).
- Downloads last month
- 620
Model tree for litert-community/FastContext-1.0-4B-SFT
Base model
microsoft/FastContext-1.0-4B-SFT