Run this model with HF Jobs
Run litert-community/LFM2-700M on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/litert-community/LFM2-700M. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/litert-community/LFM2-700M on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/litert-community/LFM2-700M. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use litert-community/LFM2-700M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use litert-community/LFM2-700M 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/LFM2-700M \ --prompt="Write me a poem"
- LiteRT
How to use litert-community/LFM2-700M 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
README: the opening workload-time table, init and peak columns in the phone tables, shorter prose; the same measurements
Browse files17 unmodified lines181920212223242 unmodified lines2728293031323321 unmodified lines55565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610717 unmodified lines# LFM2-700M — LiteRT-LM[LiquidAI/LFM2-700M](https://huggingface.co/LiquidAI/LFM2-700M) converted to the **LiteRT-LM** (`.litertlm`) format for Google's [LiteRT-LM](https://github.com/google-ai-edge/LiteRT-LM) runtime. Tested on litert-lm 0.18.0 on a Mac (checks, evaluations, benchmarks and the commands below); the phone rows below ran the prebuilt Android binary named there. On litert-lm 0.17.1 the plain `run` of the int8 file answered as if no question had been asked (the int4 file was not tried on 0.17.1).Liquid AI suggests LFM2 for agentic tasks, data extraction, RAG, creative writing and multi-turn conversations, not for knowledge-intensive tasks or programming, and recommends fine-tuning it on narrow use cases. LFM2-700M has 742,489,344 parameters in 16 layers (10 convolution + 6 attention); Liquid AI lists English, Arabic, Chinese, French, German, Japanese, Korean and Spanish and states a 32,768-token context (4096 in these files).2 unmodified lines| `LFM2-700M_int8.litertlm` | int8 weights on linears, the 10 convolutions and the embedding (litert-torch's default export recipe `dynamic_wi8_afp32`), float activations | 808.3 MB | `ccc95007d868878ac749073cbc28b88097cb7d437fca3f9aec72f535cc7fd99b` || `LFM2-700M_int4.litertlm` | int4 blockwise-32 + OCTAV on linears, int8 lm_head + embedding, convs float | 480.8 MB | `4ecfc71299a304e97e8f0ef5134085ecc4b5d414755b8c1709f6b552d20250b9` |On IFEval-lite (n=120) bf16 passed 77 of 120 prompts, the int8 file 75 and 74 (two runs) and the int4 file 67; the int4 file is 40.5 % smaller. At the rates in the tables below, a 1024-token prefill plus 256 decoded tokens at context 2048 took less time with int4 on the Galaxy S26 GPU (3.92 vs 4.64 s) and the Mac M4 Max GPU (0.87 vs 0.97 s) and the same time with either file on the Pixel 8a GPU (8.07 s); on the CPUs, int8 took less time on the Mac (3.72 vs 4.18 s) and on the Galaxy S26 (6.76 vs 7.43 s; the int4 row is from a run that started on a hot phone, noted below), and int4 on the Pixel 8a (15.13 vs 16.21 s). Not measured on iOS.## Correctness21 unmodified lineslitert-lm benchmark ./LFM2-700M_int8.litertlm -p 1024 -d 256 --max-num-tokens 2048 --runs 3 --cache no --backend cpu```Both `run` commands, and the int4 file, listed the two dates with no chat marker such as `<|im_end|>` and no thought block. Without `--backend`, `run` uses the CPU. Without `--cache`, it writes a compiled-weights cache next to the model (on CPU 747 MB for int8, 465 MB for int4); `--cache no` writes none. For Android, see [android-gpu.md](https://github.com/john-rocky/hf-to-litertlm/blob/main/docs/android-gpu.md).The bundle's default sampler is temperature 0.1, top-k 50, top-p 1.0; Liquid AI recommends temperature 0.3, min_p 0.15 and repetition_penalty 1.05, and the bundle has no min_p or repetition penalty. `run` uses the bundle's sampler unless you pass `--top-k`, `--top-p`, `--temperature` or `--seed`; `--top-k 1` gives greedy output.The chat template is byte-identical to LiteRT-LM's [`models/lfm2/chat_template.jinja` at commit 86a7e6d0](https://github.com/google-ai-edge/LiteRT-LM/blob/86a7e6d098c3a6578208fc8538228fa704ca2e8b/models/lfm2/chat_template.jinja), and the stop set comes from the same configuration: stops `<|im_end|>` and `<|endoftext|>`, start token `<|startoftext|>`. The metadata marks it non-thinking (supports_thinking false) and keeps that configuration's `thought` channel (`<think>` / `</think>`); no reply in the checks and evaluations contained those strings.Tool calling is declared (model type lfm2): both files returned a parsed `get_weather` call (Python API, CPU, greedy) and, with automatic tool calling, used its result. Without tools, the template rendered the same text as Liquid AI's for the four conversations checked (a user turn, system + user, three turns, empty content); with tools it omits Liquid AI's `<|tool_list_start|>` / `<|tool_list_end|>` around the tool list and `<|tool_response_start|>` / `<|tool_response_end|>` around the tool result (wrapping it in `[ … ]` instead), and writes call arguments in double quotes where Liquid AI's template uses single quotes.Measured on the int8 file (Python API, CPU, greedy; 3 processes with a shared Engine and 3 with fresh Engines; the two conversations had different system prompts): after an Engine served one conversation, the next conversation's three answers ("Paris", "Blue", "Eight") and its token count were the same as on a fresh Engine in 3 of 3 processes. The open issue [LiteRT-LM #3165](https://github.com/google-ai-edge/LiteRT-LM/issues/3165) reports the runtime reusing the recurrent state across conversations that share prompt tokens; the probe's two conversations started with different system prompts. Open a new Engine for each conversation.## PerformanceMac M4 Max, litert-lm 0.18.0: the benchmark command above with `--backend cpu` or `gpu` (1024-token prefill, 256-token decode, context 2048), one warmup, then the mean of 3 iterations; GPU is WebGPU on Metal. The int8 GPU row is the one of three benchmark processes with the median time for the 1024-token prefill plus 256 decoded tokens (0.959, 0.969 and 0.966 s); the int4 GPU row is one benchmark process; each CPU row is the mean of two benchmark processes.| Mac M4 Max | Prefill 1024 (tok/s) | Decode 256 (tok/s) | TTFT (s) ||---|---|---|---|| int8 GPU | 7870.47 | 306.34 | 0.1334 || int4 GPU | 7839.15 | 348.26 | 0.1335 || int8 CPU | 1134.25 | 90.87 | 0.9139 || int4 CPU | 580.71 | 105.97 | 1.7826 |Engine init (first iteration): GPU int8 1.2774 s, int4 1.4619 s; CPU int8 9.5982 s, int4 2.3391 s.Phones, Android 16: Galaxy S26 (SM-S942Q, Qualcomm SM8850, Adreno, MemTotal 10.9 GiB) and Pixel 8a (Tensor G3, Mali, MemTotal 7.4 GiB), the same workload through the prebuilt `litert_lm_advanced_main` (sha256 adac974b…, 40,382,152 bytes) published 2026-09-18 in LiteRT-LM's public binary bucket (`binaries/latest/android_arm64/litert_lm/`), with `--benchmark=true --benchmark_prefill_tokens=1024 --benchmark_decode_tokens=256 --max_num_tokens=2048 --num_iterations=3 --report_peak_memory_footprint=true`. Rows are the mean of iterations 2 and 3 (GPU: LITERT_CL). Cold init is the first process after the compiled-program caches were removed, warm init the benchmark process, peak the largest of the benchmark process's three `Peak system ram usage` lines.| Galaxy S26 | Prefill 1024 (tok/s) | Decode 256 (tok/s) | TTFT (s) ||---|---|---|---|| int8 GPU | 3396.4 | 58.97 | 0.32 || int4 GPU ¹ | 2427.3 | 73.25 | 0.435 || int8 CPU | 890.1 | 45.65 | 1.20 || int4 CPU ² | 346.8 | 57.12 | 3.06 |Init cold/warm and peak: GPU int8 4.30/1.28 s, 517.2 MB; GPU int4 4.97/1.82 s, 534.4 MB; CPU int8 0.93/0.13 s, 1948.0 MB; CPU int4 1.59/1.22 s, 1652.5 MB. Before each process of the first three rows the harness waited for Android thermal status 0 and uncapped clocks; in the int8 CPU run the CPU clock was lowered in 9 of 10 samples, taken 2–3 s apart. ¹ The GPU clock limit fell from 1300 to 1100 MHz in the last 2 of 7 samples; the unflagged first iteration read 2494.6 / 69.22 tok/s. ² An earlier run that started on a hot phone (thermal status 3); the CPU clock was lowered in 10 of 11 samples.| Pixel 8a | Prefill 1024 (tok/s) | Decode 256 (tok/s) | TTFT (s) ||---|---|---|---|| int8 GPU | 1451.1 | 34.75 | 0.735 || int4 GPU | 619.7 | 39.91 | 1.675 || int8 CPU | 207.0 | 22.73 | 4.99 || int4 CPU | 153.0 | 30.33 | 6.78 |Init cold/warm and peak: GPU int8 19.42/1.88 s, 1107.6 MB; GPU int4 8.95/3.12 s, 1026.0 MB; CPU int8 2.03/0.46 s, 1534.8 MB; CPU int4 3.05/2.62 s, 1250.7 MB. Every run started at thermal status 1; in the CPU runs the CPU clock was lowered in 13 of 17 samples in each file's run, taken 2–4 s apart, and in the GPU runs in 3 of 11 (int8) and 5 of 11 (int4); the harness could not read the Mali GPU clock. Not run on the NPU.## Conversion notes- **Source and stack:** LiquidAI/LFM2-700M at revision 86f49fc9; litert-torch 0.9.4, litert-converter 0.4.0, ai-edge-quantizer 0.9.0, transformers 5.14.1, torch 2.13.0; packed by the litert-lm 0.18.0 CLI. `lfm_work/convert_lfm2_700m.sh` in [hf-to-litertlm](https://github.com/john-rocky/hf-to-litertlm) rebuilt both files, all four sections byte-identical (only the packer's uuid and timestamp differ).- **Order:** two exports (prefill signatures 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2 and 1, plus decode, over a 4096-position KV cache): the int8 file is the export with the default int8 recipe; the int4 file is post-hoc int4 quantization of an unquantized export (no zero or subnormal block scale in its 92 blockwise tensors) → metadata repack of each file with LiteRT-LM's lfm2 configuration.- **Template:** Liquid AI's chat template fails at render on litert-lm 0.18.0 (`message.get("content")`), so the bundle carries LiteRT-LM's lfm2 template, which reads message content as a list of parts.## License and changes17 unmodified lines181920212223242 unmodified lines2728293031323334353637383940414221 unmodified lines64656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311417 unmodified lines# LFM2-700M — LiteRT-LM[LiquidAI/LFM2-700M](https://huggingface.co/LiquidAI/LFM2-700M) converted to the **LiteRT-LM** (`.litertlm`) format for Google's [LiteRT-LM](https://github.com/google-ai-edge/LiteRT-LM) runtime. Tested on litert-lm 0.18.0 on a Mac; the phone rows ran the prebuilt Android binary named below. On litert-lm 0.17.1 the plain `run` of the int8 file answered as if no question had been asked (the int4 file was not tried on 0.17.1).Liquid AI suggests LFM2 for agentic tasks, data extraction, RAG, creative writing and multi-turn conversations, not for knowledge-intensive tasks or programming, and recommends fine-tuning it on narrow use cases. LFM2-700M has 742,489,344 parameters in 16 layers (10 convolution + 6 attention); Liquid AI lists English, Arabic, Chinese, French, German, Japanese, Korean and Spanish and states a 32,768-token context (4096 in these files).2 unmodified lines| `LFM2-700M_int8.litertlm` | int8 weights on linears, the 10 convolutions and the embedding (litert-torch's default export recipe `dynamic_wi8_afp32`), float activations | 808.3 MB | `ccc95007d868878ac749073cbc28b88097cb7d437fca3f9aec72f535cc7fd99b` || `LFM2-700M_int4.litertlm` | int4 blockwise-32 + OCTAV on linears, int8 lm_head + embedding, convs float | 480.8 MB | `4ecfc71299a304e97e8f0ef5134085ecc4b5d414755b8c1709f6b552d20250b9` |On IFEval-lite (n=120) bf16 passed 77 prompts, the int8 file 75 and 74 (two runs) and the int4 file 67 (table in Accuracy); the int4 file is 40.5 % smaller. Time for a 1024-token prefill plus 256 decoded tokens at context 2048, from the rates in Performance:| Seconds | Mac M4 Max | Galaxy S26 | Pixel 8a ||---|---|---|---|| int8 GPU | 0.97 | 4.64 | 8.07 || int4 GPU | 0.87 | 3.92 | 8.07 || int8 CPU | 3.72 | 6.76 | 16.21 || int4 CPU | 4.18 | 7.43 ² | 15.13 |int4 is faster on the Mac and Galaxy S26 GPUs and equal on the Pixel 8a GPU; on the CPUs int8 is faster on the Mac and the Galaxy S26 (the int4 row there is from a run that started on a hot phone, noted below) and int4 on the Pixel 8a. Not measured on iOS.## Correctness21 unmodified lineslitert-lm benchmark ./LFM2-700M_int8.litertlm -p 1024 -d 256 --max-num-tokens 2048 --runs 3 --cache no --backend cpu```Both `run` commands, and the int4 file, listed the two dates with no chat marker such as `<|im_end|>` and no thought block. Without `--backend`, `run` uses the CPU; without `--cache`, it writes a compiled-weights cache next to the model (on CPU 747 MB for int8, 465 MB for int4). For Android, see [android-gpu.md](https://github.com/john-rocky/hf-to-litertlm/blob/main/docs/android-gpu.md).The bundle's default sampler is temperature 0.1, top-k 50, top-p 1.0; Liquid AI recommends temperature 0.3, min_p 0.15 and repetition_penalty 1.05, and the bundle has no min_p or repetition penalty. `run` uses the bundle's sampler unless you pass `--top-k`, `--top-p`, `--temperature` or `--seed`; `--top-k 1` gives greedy output.The chat template is byte-identical to LiteRT-LM's [`models/lfm2/chat_template.jinja` at commit 86a7e6d0](https://github.com/google-ai-edge/LiteRT-LM/blob/86a7e6d098c3a6578208fc8538228fa704ca2e8b/models/lfm2/chat_template.jinja), with its stops `<|im_end|>` and `<|endoftext|>` and start token `<|startoftext|>`. The metadata marks the model non-thinking (supports_thinking false) and keeps that configuration's `thought` channel (`<think>` / `</think>`); no reply in the checks and evaluations contained those strings.Tool calling is declared (model type lfm2): both files returned a parsed `get_weather` call (Python API, CPU, greedy) and, with automatic tool calling, used its result. Without tools the template renders the same text as Liquid AI's (four conversations checked); with tools it omits Liquid AI's `<|tool_list_start|>` / `<|tool_list_end|>` and `<|tool_response_start|>` / `<|tool_response_end|>` markers, wraps the tool result in `[ … ]`, and quotes call arguments with double quotes instead of single quotes.Engine reuse (int8 file, Python API, CPU, greedy; 3 processes with a shared Engine and 3 with fresh Engines; the two conversations had different system prompts): after an Engine served one conversation, the next conversation's three answers ("Paris", "Blue", "Eight") and its token count were the same as on a fresh Engine in 3 of 3 processes. The open issue [LiteRT-LM #3165](https://github.com/google-ai-edge/LiteRT-LM/issues/3165) reports the runtime reusing the recurrent state across conversations that share prompt tokens; the probe's two conversations started with different system prompts. Open a new Engine for each conversation.## PerformanceMac M4 Max, litert-lm 0.18.0: the benchmark command above with `--backend cpu` or `gpu` (1024-token prefill, 256-token decode, context 2048), one warmup, then the mean of 3 iterations; GPU is WebGPU on Metal. The int8 GPU row is the one of three benchmark processes with the median time for the workload (0.959, 0.969 and 0.966 s); the int4 GPU row is one benchmark process; each CPU row is the mean of two benchmark processes. Init is the first iteration's engine init.| Mac M4 Max | Prefill 1024 (tok/s) | Decode 256 (tok/s) | TTFT (s) | Init (s) ||---|---|---|---|---|| int8 GPU | 7870.47 | 306.34 | 0.1334 | 1.2774 || int4 GPU | 7839.15 | 348.26 | 0.1335 | 1.4619 || int8 CPU | 1134.25 | 90.87 | 0.9139 | 9.5982 || int4 CPU | 580.71 | 105.97 | 1.7826 | 2.3391 |Phones, Android 16: Galaxy S26 (SM-S942Q, Qualcomm SM8850, Adreno, MemTotal 10.9 GiB) and Pixel 8a (Tensor G3, Mali, MemTotal 7.4 GiB), the same workload through the prebuilt `litert_lm_advanced_main` (sha256 adac974b…, 40,382,152 bytes) published 2026-09-18 in LiteRT-LM's public binary bucket (`binaries/latest/android_arm64/litert_lm/`), with `--benchmark=true --benchmark_prefill_tokens=1024 --benchmark_decode_tokens=256 --max_num_tokens=2048 --num_iterations=3 --report_peak_memory_footprint=true`. Rates are the mean of iterations 2 and 3 (GPU: LITERT_CL). Init cold = the first process after the compiled-program caches were removed, warm = the benchmark process; peak = the largest of the benchmark process's three `Peak system ram usage` lines.| Galaxy S26 | Prefill 1024 (tok/s) | Decode 256 (tok/s) | TTFT (s) | Init cold / warm (s) | Peak (MB) ||---|---|---|---|---|---|| int8 GPU | 3396.4 | 58.97 | 0.32 | 4.30 / 1.28 | 517.2 || int4 GPU ¹ | 2427.3 | 73.25 | 0.435 | 4.97 / 1.82 | 534.4 || int8 CPU | 890.1 | 45.65 | 1.20 | 0.93 / 0.13 | 1948.0 || int4 CPU ² | 346.8 | 57.12 | 3.06 | 1.59 / 1.22 | 1652.5 |Before each process of the first three rows the harness waited for Android thermal status 0 and uncapped clocks; in the int8 CPU run the CPU clock was lowered in 9 of 10 samples, taken 2–3 s apart. ¹ The GPU clock limit fell from 1300 to 1100 MHz in the last 2 of 7 samples; the unflagged first iteration read 2494.6 / 69.22 tok/s. ² An earlier run that started on a hot phone (thermal status 3); the CPU clock was lowered in 10 of 11 samples.| Pixel 8a | Prefill 1024 (tok/s) | Decode 256 (tok/s) | TTFT (s) | Init cold / warm (s) | Peak (MB) ||---|---|---|---|---|---|| int8 GPU | 1451.1 | 34.75 | 0.735 | 19.42 / 1.88 | 1107.6 || int4 GPU | 619.7 | 39.91 | 1.675 | 8.95 / 3.12 | 1026.0 || int8 CPU | 207.0 | 22.73 | 4.99 | 2.03 / 0.46 | 1534.8 || int4 CPU | 153.0 | 30.33 | 6.78 | 3.05 / 2.62 | 1250.7 |Every run started at thermal status 1; in the CPU runs the CPU clock was lowered in 13 of 17 samples in each file's run, taken 2–4 s apart, and in the GPU runs in 3 of 11 (int8) and 5 of 11 (int4); the harness could not read the Mali GPU clock. Not run on the NPU.## Conversion notes- **Source and stack:** LiquidAI/LFM2-700M at revision 86f49fc9; litert-torch 0.9.4, litert-converter 0.4.0, ai-edge-quantizer 0.9.0, transformers 5.14.1, torch 2.13.0; packed by the litert-lm 0.18.0 CLI. `lfm_work/convert_lfm2_700m.sh` in [hf-to-litertlm](https://github.com/john-rocky/hf-to-litertlm) rebuilt both files, all four sections byte-identical (only the packer's uuid and timestamp differ).- **Order:** two exports (11 prefill signatures, 1024 down to 1, plus decode, over a 4096-position KV cache): the int8 file is the export with the default int8 recipe; the int4 file is post-hoc int4 quantization of an unquantized export (no zero or subnormal block scale in its 92 blockwise tensors) → metadata repack of each file with LiteRT-LM's lfm2 configuration.- **Template:** Liquid AI's chat template fails at render on litert-lm 0.18.0 (`message.get("content")`), so the bundle carries LiteRT-LM's lfm2 template, which reads message content as a list of parts.## License and changes
README.md+38-31