Views
No views yet
.litertlm) format for on-device image+text inference with Google's LiteRT-LM runtime — the first Cohere-family model in this format.fast_vlm path — attach an image, ask a question, get a grounded answer fully on-device.| Files | North-Micro-Vision-Instruct_wi8.litertlm (3.07 GB, primary) · North-Micro-Vision-Instruct_int4.litertlm (2.19 GB, size-constrained variant) |
| Vision | 27-block ViT (hidden 1152, 16 heads, patch 16) made static 512×512 → 1024 patches → 2×2 merge → 256 image tokens; DeepStack (3 extra vision embeddings) folded into the single image embedding; int8 weights |
| Adapter | Patch merger + the three DeepStack mergers, summed; int8; output at the 2048 text hidden size |
| Decoder | 2B Cohere decoder (28L, hidden 2048, GQA kv8, parallel attn+MLP blocks, sliding/full 3:1, tied 262k-vocab embedding) — int8 dynamic weights (wi8) or int4 blockwise-32; int8 externalized embedder; mixed-precision activations (fp32_fp16) declared in-bundle |
| Context (KV cache) | 4096 |
| Image input | resized to 512×512 (normalization (x/255−0.5)/0.5 baked into the encoder) |
| Chat format | Cohere turn tokens (`< |
| Base model | CohereLabs/North-Micro-Vision-Instruct (Apache-2.0) |
litert-lm benchmark -p 256 -d 256 --runs 3 --cache no, wi8 bundle:| Backend | Prefill (tok/s) | Decode (tok/s) | Init (s) |
|---|---|---|---|
| CPU | 671.8 | 27.3 | 6.7 |
| GPU | 1236.6 | 80.6 | 1.8 |
--backend gpu --vision-backend gpu, not benchmark-only.)--disable_cache), wi8 bundle — the decoder fully delegates to the OpenCL GPU (1380/1380 prefill, 1204/1204 decode nodes):| Config | Prefill (tok/s) | Decode (tok/s) |
|---|---|---|
| decoder GPU + vision CPU, image turn (271-token prefill) | 124.5 | 4.3–4.4 |
| decoder GPU, text-only (255-token prefill) | 181.1 | 6.4 |
| file | GPU backend | delegation | peak |
|---|---|---|---|
North-Micro-Vision-Instruct_int4.litertlm | runs | 5344 / 5344 ops across 4 subgraphs on LiteRT GPU | 1787 MB |
North-Micro-Vision-Instruct_wi8.litertlm | runs | 5344 / 5344 ops across 4 subgraphs on LiteRT GPU | 1403 MB |
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. Gated 2026-08-25.LiteRT GPU partitions. XNNPACK additionally takes 1 of the 4 nodes in main; the runtime accepts that split.![]() | ![]() |
| Q: Describe this image. A: "The image shows two cats lying on a pink surface, which appears to be a couch or a cushion. Both cats are in a relaxed position, with their bodies stretched out and their heads resting on the surface. They are both wearing collars, indicating they are pets. The cats are positioned close to each other, suggesting a sense of companionship…" | Q: What is in this image? Mention the colors. A: "The image shows a vintage Volkswagen Beetle car parked in front of a building with a yellow wall and two wooden doors. The car is painted in a light teal or turquoise color, and it has a classic design with round wheels and a rounded body shape. The building behind the car has a weathered appearance… The ground is paved with rectangular tiles." |
| Q: How many cats are there, and what is between them? A: "There are two cats in the image, and they are both lying on a pink surface. Between them, there are two remote controls." | Q: Where is the car parked, and what is behind it? A: "The car is parked on a paved street, and behind it is a yellow wall with two wooden doors. The setting appears to be an urban or semi-urban area." |
litert_lm_advanced_main (litert-lm v0.16.1, --backend=gpu --vision_backend=cpu --disable_cache, greedy, 80-token cap) on a Pixel 8a; per turn: TTFT 2.5–2.8 s (≈270-token image prompt, prefill 110–128 tok/s), decode 2.9–3.6 tok/s. The photos are the Hugging Face documentation sample images (COCO cats / Beetle), resized by the runtime to the bundle's 512×512.What the fast_vlm contract changes, and what it costs. The released model injects three DeepStack vision embeddings after decoder layers 0/1/2 and uses interleaved M-RoPE. This bundle folds the DeepStack embeddings into the single image embedding (exactly representable; teacher-forced top-1 vs the released model 0.96 fold-only, 0.93 with the runtime's 1-D positions) and the runtime supplies plain sequential positions in place of M-RoPE. Measured effect on probe prompts: describe / VQA / spatial relations / single-cell lookup preserved; 2-D table cross-cell questions and digit-dense OCR degrade (row count off-by-one, "$652,000" read as "$652,000,000", a duplicated word in a dense paragraph). Same class of trade as the Qwen2-VL-2B bundle. Use it for reading and describing; don't rely on it to rank table cells.
One image per chat. Send each image in a fresh conversation, as with the other fast_vlm bundles.
North-Micro-Vision-Instruct_wi8.litertlm, import it (tap +, enable "Support image"), attach an image and ask. Choose the GPU accelerator for the decoder.litert-lm run North-Micro-Vision-Instruct_wi8.litertlm \
--prompt "What is in this image?" --attachment photo.jpg \
--backend gpu --vision-backend cpuModality.textImage), attach a photo, and ask. Vision-only bundle (no audio tower): bring the engine up with the vision modality only.fast_vlm bundle: VISION_ENCODER ([1,512,512,3]→[1,1024,4608] — the final block plus the three DeepStack taps, concatenated) + VISION_ADAPTER ([1,1024,4608]→[1,256,2048]) + single-token EMBEDDER + PREFILL_DECODE (embeddings-input, cache 4096).Conv3d (temporal 2) folded to Conv2d with the summed temporal kernel; patches kept in raster order through the encoder with the 2×2 merge done by strided slices + concat in the adapter (no GATHER_ND, which the mobile GPU delegate cannot compile). Every activation keeps a leading batch dim (rank ≥3) — required for correct results on the Metal GPU delegate. LayerNorm inputs are pre-scaled by calibrated powers of two so the tower survives fp16 GPU precision.Cohere2ForCausalLM (parallel block, mean-subtracting LayerNorm, NoPE full-attention layers, logit scale 0.25, tied head) with its rotary layout patched to the checkpoint's half-split convention — text-only logits identical to the original (max |Δ| = 0.0). The decoder section declares prefer_activation_type = fp32_fp16: some mobile GPUs accumulate fp16 and overflow at the image-token positions, which blanks the vision conditioning (the model answers as if it saw nothing); the in-bundle declaration selects mixed precision automatically.tokenizer.json is bundled as-is (byte-level BPE, 255k + 38 special tokens).bash scripts/reproduce_vlm.sh north-micro-vision (REPRODUCE.md has the full recipe and gotchas).North-Micro-Vision-Instruct_int4.litertlm, North-Micro-Vision-Instruct_wi8.litertlm matched history turns only on role 'model', so a conversation created through the Conversation API with the standard role 'assistant' (for example create_conversation(messages=[...]) restoring a chat) silently dropped every assistant turn from the rendered prompt — the model saw consecutive user turns with its own replies gone. The template's role conditions now also accept 'assistant'. The engine's own send_message flow was never affected.'assistant'. Details: google-ai-edge/LiteRT-LM#3417 (https://github.com/google-ai-edge/LiteRT-LM/issues/3417).