Instructions to use litert-community/Falcon-H1-1.5B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use litert-community/Falcon-H1-1.5B-Instruct 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 litert-lm run \ --from-huggingface-repo=litert-community/Falcon-H1-1.5B-Instruct \ --prompt="Write me a poem"
- LiteRT
How to use litert-community/Falcon-H1-1.5B-Instruct 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
Falcon-H1-1.5B-Instruct β LiteRT-LM
tiiuae/Falcon-H1-1.5B-Instruct converted to the LiteRT-LM (.litertlm) format for on-device inference with Google's LiteRT-LM runtime. Requires litert-lm β₯ 0.15. Sibling of litert-community/Falcon-H1-0.5B-Instruct β same conversion, same patch.
Falcon-H1 is TII's fully-hybrid design: every one of the 24 layers runs a grouped-query attention branch and a Mamba2 selective-scan branch in parallel on the same input and sums them. Each layer therefore carries both a KV cache and constant-size conv + SSM recurrent state.
| File | Recipe | Size |
|---|---|---|
Falcon-H1-1.5B-Instruct_int8.litertlm |
int8 dynamic on linears + embedding (convs and the scan stay float); fp32 activations declared for GPU | 1.61 GB |
Correctness
- Logits parity vs PyTorch: the float export matches the HF model teacher-forced across 8 decode positions β max|logit diff| 1.6e-04, correlation 1.000000, top-1 and top-5 identical at every position.
- 8-question sanity gate: CPU 7/8, GPU 6/8. The shared miss ("17+25") is answered "32" verbatim by the HF bf16 reference too β the model's own level, not conversion damage. The GPU-only miss (8Γ7) is a borderline int8 greedy flip; nothing degenerates.
- Prompt-length robustness: hermetic prefill-chunk sweep (fresh engine per length, 12β60 tokens) β all clean.
- iPhone 17 Pro (Metal): the 8-item composite quality probe answers 8/8 on GPU and 8/8 on CPU, identical answers on both backends.
Usage
litert-lm run ./Falcon-H1-1.5B-Instruct_int8.litertlm --prompt "What is the capital of France? Answer in one word."
# GPU
litert-lm run ./Falcon-H1-1.5B-Instruct_int8.litertlm --backend gpu --cache no --prompt "..."
Multi-length prefill signatures (1β1024) are exported so the runtime picks tight chunks. The bundle carries the tokenizer and the stock ChatML-style Falcon-H1 chat template.
Performance
litert-lm benchmark (litert-lm 0.16.0), Apple M4 Max, -p 256 -d 256 --runs 3 --cache no, quiet machine:
| Backend | Prefill (256) | Decode | TTFT |
|---|---|---|---|
| GPU | 1447 tok/s | 102.9 tok/s | 0.19 s |
| CPU | 238 tok/s | 33.7 tok/s | 1.11 s |
On device (cold start, single runs, 146-token composite prompt, quality harness):
| Device | Backend | Prefill | Decode | TTFT | Peak memory |
|---|---|---|---|---|---|
| iPhone 17 Pro | GPU (Metal) | 186.8 tok/s | 25.8 tok/s | 0.88 s | 2.54 GB |
| iPhone 17 Pro | CPU | 50.3 tok/s | 15.5 tok/s | 3.16 s | 1.02 GB |
Honest notes:
- GPU runs with fp32 activations (declared in the bundle) β expect a corresponding memory multiple over CPU.
- Arithmetic at this scale is fragile in the base model itself (see the 8Q note above); int8 adds borderline greedy flips on exactly those items.
Conversion notes
Converted with litert-torch plus a hybrid-cache patch (reproduction script + patch: hf-to-litertlm falcon_h1_work/):
- Composite hybrid cache layer: every layer holds KV + conv + recurrent state at ONE layer index β a cache layer class that is full-attention and Mamba2 at the same time (the runtime binds states by tensor name, so co-residency is just packaging).
- Folded selective scan: the Mamba2 scan is re-expressed as batched matmuls with chunk and head axes folded into the batch axis (all tensors rank β€ 4, no
BROADCAST_TO, no int64 index math) β this is what makes the graph fully delegable on GPU. - Falcon-specific wiring: the Β΅P multiplier vector (
mup_vector, a non-persistent model-level buffer) andssm_in_multiplierare preserved in the traced scan; the exporter's timestamp-index kwargs are re-injected at the attention layer (FalconH1's layer loop drops kwargs). - Prefill-pad guard: the runtime runs partially-filled prefill chunks; pad positions are made exact identity steps for the SSM and the stored conv window is gathered at the last valid column.
- Quantization: post-hoc dynamic int8 over linears + embedding only; convs and the scan stay float.
License and changes
Distributed under the Falcon LLM License (inherited from the base model β see the license link). Changes from the original work: weights converted from safetensors bf16 to LiteRT flatbuffers and quantized as described above; tokenizer and chat template repackaged unmodified. This repository is a community conversion and is not affiliated with TII.
- Downloads last month
- 9
Model tree for litert-community/Falcon-H1-1.5B-Instruct
Base model
tiiuae/Falcon-H1-1.5B-Base