Instructions to use litert-community/SmolVLM2-500M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use litert-community/SmolVLM2-500M 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/SmolVLM2-500M \ --prompt="Write me a poem"
- LiteRT
How to use litert-community/SmolVLM2-500M 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
- SmolVLM2-500M β LiteRT-LM (on-device Vision-Language Model)
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).
SmolVLM2-500M β LiteRT-LM (on-device Vision-Language Model)
This repository is a conversion of HuggingFaceTB/SmolVLM2-500M-Video-Instruct (image path) to LiteRT-LM, made with litert-torch (the file published on 2026-11-13, 19:44 UTC, has its prefill/decode graph rewritten for the GPU by a separate script; weights unchanged) for Google's LiteRT-LM runtime, for on-device image+text inference: on a Galaxy S26 GPU it decodes 79.8 tokens/s and prefills 1,024 tokens at 1,741 tokens/s (LiteRT-LM v0.19.0, 2026-11-14).
SmolVLM2-500M is a tiny vision-language model from Hugging Face: a SigLIP vision encoder + pixel-shuffle connector feeding a SmolLM2 (Llama-architecture) 360M decoder. At just 363 MB it is one of the smallest on-device VLMs β give it an image and a question, get a grounded answer, fully offline.
| File | SmolVLM2-500M.litertlm (~363 MB) |
| Vision | SigLIP encoder (512Γ512, 1024 patches, no CLS) + pixel-shuffle Γ4 + Linear connector, int8 β 64 image tokens |
| Decoder | SmolLM2-360M (Llama, 960-dim, 32 layers, GQA 15/5), int4 weights (blockwise-32 + OCTAV); tied embedding INT8 (externalized) |
| Compute | integer |
| Context (KV cache) | 2048 |
| Image input | resized to 512Γ512 ((xβ0.5)/0.5 normalization baked into the vision encoder) |
| Base model | HuggingFaceTB/SmolVLM2-500M-Video-Instruct |
How to use
1. Install the runtime
pip install litert-lm
2. Run it in one command β this downloads the file, encodes your image and answers:
litert-lm run --from-huggingface-repo litert-community/SmolVLM2-500M SmolVLM2-500M.litertlm \
--attachment photo.jpg \
--prompt "Describe this picture in one sentence." --top-k 1
On a 640 Γ 480 photo of two tabby cats on a pink blanket, this file answers:
Two tabby cats are sleeping on a pink blanket.
(litert-lm 0.17.0 to 0.19.2 on a Mac, with the CPU on 1 thread and with the GPU; litert-lm 0.19.2 also with the CPU's default thread count; 2026-11-14.) Without --top-k 1 the runtime samples, and the wording can change from run to run.
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 (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/SmolVLM2-500M/ and uses it again on later runs without checking its size. Delete that file and run the command again.
If you downloaded SmolVLM2-500M.litertlm with --from-huggingface-repo before it was replaced on 2026-11-13 (19:44 UTC), delete ~/.litert-lm/cache/huggingface/litert-community/SmolVLM2-500M/SmolVLM2-500M.litertlm, then run the command again. Without deleting it, the litert-lm CLI (0.14.0 to 0.19.2) keeps running the previous file: it uses a file it finds there without checking it against this repo.
Drop --prompt for an interactive chat, and pass --attachment more than once for several images. litert-lm serve exposes the same model as a local OpenAI-compatible API. The same file runs on macOS, Linux and Windows.
Performance
Measured on an earlier file: 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. These figures cover the text path; the vision encoder runs once per image and is not included.
| Device | Backend | Prefill (256) | Decode | TTFT |
|---|---|---|---|---|
| Apple M4 Max (macOS) | CPU | 409 tok/s | 63.9 tok/s | 0.64 s |
Every desktop backend listed above was checked by actually generating a caption on it, not just by reading the benchmark tool's output.
The macOS GPU backend is not usable for this file on litert-lm 0.15.0. Asked to describe an image with --backend gpu, it returns a stream of <|endoftext|> tokens instead of a caption. litert-lm benchmark still reports GPU numbers for it β 104,040 tok/s prefill and 862 tok/s decode for a 0.36 GB file β but they measure a path that produces no usable text, so no GPU row is quoted here. On litert-lm 0.15.0, use the CPU backend on the desktop. This is a desktop-runtime observation and says nothing about the iPhone or Android GPU paths described elsewhere on this card. With litert-lm 0.17.0 to 0.19.2 (checked 2026-11-14) the macOS GPU backend answers: on a photo of two cats on a pink blanket it gives the same caption as the CPU, "Two tabby cats are sleeping on a pink blanket.", and with 0.19.2 it answers 7 of 8 short questions.
Accuracy note
Single-image VQA produces coherent, image-grounded answers (CPU-verified; the SigLIP vision tower
converts bit-faithfully, float CPU output corr β 1.0). It is a very small (500M) model β keep a
sensible max_tokens and use sampling (e.g. top-p); at pure greedy it can be repetitive/verbose.
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) |
1,741 tok/s | 79.8 tok/s | 0.60 s | 0.43 GB |
| CPU (XNNPACK), iteration 1 | 567 tok/s | 72.1 tok/s | 1.82 s | 0.90 GB |
| CPU (XNNPACK), iteration 2 | 485 tok/s | 49.3 tok/s | 2.13 s | 0.90 GB |
| CPU (XNNPACK), iteration 3 | 345 tok/s | 41.2 tok/s | 3.00 s | 0.90 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, and each CPU row the median of that iteration over two runs. The phone starts lowering its CPU clock cap about 2 s into a CPU run and reaches its floor after about 20 s, near the end of the 22-second run, so each CPU iteration runs at a lower clock than the one before. 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 0.83 GB during this file's GPU runs and by about 0.53 GB during those of the file it replaced. The rows cover the text path. With a photo of two cats on a pink blanket and the vision encoder on the GPU too (--vision_backend=gpu), the phone answered "Describe this picture in one sentence." with "Two tabby cats are sleeping on a pink blanket." On a Pixel 11 Pro GPU this file decodes 24.4 tok/s, 16 % faster than the file it replaced on 2026-11-13 (19:44 UTC; see Conversion notes), and prefills 1,115 tok/s, 5 % slower. On the S26 CPU this file was no slower than the replaced file in any iteration (by 0.1 % at most), and its CPU peak is 0.90 GB against that file's 0.73 GB. The runs behind each number, the Pixel 11 Pro runs and the earlier files' rows: MEASUREMENTS.md.
On this phone the GPU decodes 1.1β1.9Γ as fast as the CPU and prefills 3.1β5.0Γ as fast, so this repo's litertlm_manifest.json recommends gpu for flagship-class Android. The Pixel 11 Pro CPU was not measured.
GPU wiring, including the Gallery import toggle: GPU guide.
β οΈ Best for single-image VQA β one image per conversation
Ask about one image per chat (start a new conversation for a different image). Single-image VQA is
the primary use case. (On the GPU backend, a second image in the same conversation may degrade β a
GPU-delegate trait shared across fast_vlm models; CPU handles multi-image.)
Run on iPhone / macOS
Use the LiteRT-LM Swift runtime (swift-litert-lm /
the LiteRTDemo sample). Load SmolVLM2-500M.litertlm with the vision tower enabled
(modalities Modality.textImage / [.vision] β vision-only file, no audio tower), attach a photo,
ask a question.
Run on Android β Google AI Edge Gallery
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.
Run this model with image input in the official Google AI Edge Gallery app β no custom app needed (the file carries the tokenizer, chat template, and image preprocessing config):
- Push the file onto the phone (or download it there directly from this repo):
adb push SmolVLM2-500M.litertlm /sdcard/Download/ - Open the Gallery app, tap the + icon (bottom-right) and pick
SmolVLM2-500M.litertlmin the file picker. - In the Import Model dialog, check "Support image" (required for image input), set a sensible max tokens, pick GPU (fast) or CPU, then tap Import.
- Open the Ask Image task, choose the imported model, attach a photo, and ask.
Tip: ask about one image per conversation. It's a tiny 500M model β keep max-tokens modest so it doesn't ramble.
Run on desktop (LiteRT-LM CLI)
The same .litertlm file 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/SmolVLM2-500M SmolVLM2-500M.litertlm smolvlm2-500m
litert-lm run smolvlm2-500m # 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/SmolVLM2-500M/ 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 SmolVLM2-500M.litertlm with --from-huggingface-repo and your first download of it (by run or by import) was before it was replaced on 2026-11-13 (19:44 UTC), the imported copy is the previous file: delete ~/.litert-lm/cache/huggingface/litert-community/SmolVLM2-500M/SmolVLM2-500M.litertlm (unless you already deleted it for the run --from-huggingface-repo command under How to use), then run the import command again. Without deleting it, import takes the previous file again: the litert-lm CLI (0.14.0 to 0.19.2) uses a file it finds there without checking it against this repo.
Conversion notes
- LiteRT-LM
fast_vlmfile: VISION_ENCODER ([1,512,512,3]β[1,1024,768], SigLIP) + VISION_ADAPTER ([1,1024,768]β[1,64,960], pixel-shuffle Γ4 + Linear) + single-token EMBEDDER + PREFILL_DECODE. - The vision encoder uses the static
arange(1024)position-embedding path (the model's dynamic bucketize position logic is bypassed β numerically identical for a full 512Γ512 frame) and bakes the (xβ0.5)/0.5 normalization + NCHW transpose into the graph. - Single-image, no high-res splitting β a fixed 64 soft tokens; SmolLM2 (Llama) decoder exported with externalized (tied) embedder.
2026-08-28 β start_token fix (weights unchanged)
LiteRT-LM prepends the metadata start_token to every prompt, and this model's chat template already renders <|im_start|> itself β so the model was reading <|im_start|><|im_start|>β¦, a stream it was never trained on. The start token has been removed.
Metadata-only change: every section of the file except the LlmMetadata block is byte-identical to the previous file (verified by sha256 per section), so the weights, the graph and the tokenizer are unchanged and the speed and memory numbers on this card still describe exactly this file β only the file's own sha256 differs. What changed is the input: the token stream the model reads for a given conversation can differ from the previous file's, and it now matches this model's own reference chat stream. Greedy decoding can turn on a single token, so an individual answer can differ from the previous file in either direction. Unless a row says otherwise, the accuracy figures on this card were measured on the previous file and have not been re-measured on this one. If you downloaded before 2026-08-28, download again; with the litert-lm CLI, first delete the cached file as described under the command in How to use.
2026-08-30 β tokenizer section replaced (weights unchanged)
The tokenizer in SmolVLM2-500M.litertlm was a SentencePiece conversion of the model's BPE tokenizer, and the conversion lost the byte-level semantics: a standalone accented letter or symbol (Γ©, Β°, Β·, β¦) was encoded to the id of a single-byte token instead of the token the upstream tokenizer uses, and any character without a whole-character vocabulary entry (emoji, most of Latin Extended-A) became the token the conversion had reused as UNK β the end-of-text token for this vocabulary. SmolVLM2-500M.litertlm now embeds the upstream tokenizer.json (the same HF tokenizer path most files in this collection use).
Tokenizer-only change: every section of the file except the tokenizer is byte-identical to the previous file (verified by sha256 per section), so the weights, the graph and the chat template are unchanged and the speed and memory numbers on this card still describe this file per token β only the file's own sha256 differs. Verified on the LiteRT-LM runtime: one user message ("What is the capital of France?") as the chat template renders it, 7 test strings, the 223 standalone characters U+00A1βU+017F and every special token now tokenize identically to the upstream tokenizer, and the four ASCII-only test questions answer byte-identically to the previous file (same ids in, same tokens out). In the checks, text with accented letters, symbols, emoji or non-Latin scripts and a short Python snippet reach the model differently from before (digits and plain English text do not), so individual answers to such prompts can change. When this entry was written, the accuracy figures on this card and its on-device rows had been measured on earlier files unless a row said otherwise, and the 2026-08-25 Galaxy S26 GPU check had not been re-run on the 2026-08-30 file (the runtime's tokenizer code is the same on macOS and on device; the weights and graph are byte-identical). If you downloaded before 2026-08-30, download again; with the litert-lm CLI, first delete the cached file as described under the command in How to use.
2026-11-14 β GPU graph and a 1,024-token prefill (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. It also gained prefill_1024, a 1,024-token prefill copied from prefill_512 that shares its weights. On a Galaxy S26 GPU (LiteRT-LM v0.19.0), decode went from 67.4 to 79.8 tokens/s and the 1,024-token prefill from 1,659 to 1,741 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 f820b08dβ¦ (360,857,600 B) β 7b432bbcβ¦ (363,085,824 B). On a Mac, the same replies byte for byte as the previous file: 4 prompts and a picture question on the CPU (litert-lm 0.19.2, 1 thread, greedy), and one text and one picture question on the CPU and on the GPU with litert-lm 0.17.0 to 0.19.2. 8 short questions on the GPU: 7 of 8 with both files on a Mac and a Pixel 11 Pro, and with this file on a Galaxy S26; the one miss is the rhyme question. Procedure: REPRODUCE.md. Measured on this file: the speed in the opening sentence, the example answer under How to use, the macOS GPU sentence for litert-lm 0.17.0 to 0.19.2, the Galaxy S26 section and this entry. Every other number and check on this card was measured on an earlier file.
Known runtime issues
External weights (since 2026-11-09). In SmolVLM2-500M.litertlm, the weights sit in TFLiteWeights sections at the end of the file (LiteRT's external weights) instead of inside the model graph. On a Pixel 8a, the GPU engine 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). The earlier file with the weights inside the graph stays at revision 53203d9.
litert-lm 0.16.0 does not start a conversation with this file or with the file it replaced (Failed to create conversation, from the vision encoder's executor; checked on a Mac, CPU and GPU, 2026-11-14); litert-lm 0.17.0 to 0.19.2 do.
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, 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 this file). One question per conversation avoids it, as does a new conversation that starts with the earlier messages and the new question.
- Downloads last month
- 1,746
Model tree for litert-community/SmolVLM2-500M
Base model
HuggingFaceTB/SmolLM2-360M