{"slug": "mirage-vlm-and-ocr-and-detection-and-segment-and-decide-in-22-mb", "title": "Mirage: VLM and OCR and Detection and Segment and Decide in 22 MB", "summary": "A small vision model called Mirage, with 51.3 million parameters and about 22 MB in size using 2-bit Cactus Quants, was released for phones, wearables and robots, running in 74 ms end to end on a Samsung Galaxy S26 NPU and 107 ms on its CPU. Mirage describes scenes, detects objects, reads Latin-script text, generates segmentation masks, identifies spatial relations and makes decisions in a single pass, and it runs locally in the browser in the same binaries as Needle and Whistle. The model returns a structured record with a scene graph of objects, masks, text boxes and a reasoning trace, and it describes images in English, German, French, Spanish, Italian, Dutch and Polish.", "body_md": "Today we release Mirage, a small vision model for phones, wearables, robots and other consumer devices. It describes scenes, detects objects, reads text, generates segmentation masks, identifies spatial relations and makes decisions in a single pass, taking 74 ms end to end on a Samsung Galaxy S26 NPU or 107 ms on its CPU.\n\nMirage has 51.3 million parameters and fits in about 22 MB using our 2-bit Cactus Quants. It runs in the same binaries as [Needle](https://cactuscompute.com/needle) and [Whistle](https://cactuscompute.com/blog/whistle).\n\nTry pointing your camera at something nearby, such as a mug on a desk or a label on a box. You can also upload a photo. The model runs locally in your browser, and the overlays show its predictions.\n\nStart the camera or upload an image.\n\n### Description\n\nThe scene description will appear here.\n\n## JSON\n\nScene, objects, text, relationships and reasoning will appear here.\n\n## [What comes back](#what-comes-back)\n\nMirage gives your app a record it can work with. Each part answers a different question about the same image.\n\nIt describes images in **English, German, French, Spanish, Italian, Dutch and Polish**.\n\n- **The scene.** What kind of place is this? What are the lighting, surface and background like?\n- **Objects and their properties.** Names, boxes, positions and attributes such as colour, shape or material. Names come from the language model, so they are not restricted to a detector's fixed class list. An object's`id` names the entity it belongs to, so when one entity covers several instances, such as two trees, every box shares that`id` .\n- **Segmentation.** A mask for each described object. Keep an outline, all its separate pieces, or a bitmap mask, depending on what you want to draw or select.\n- **Text.** The writing in the image, with a box and a detection score for each text region. A text reader inside Mirage reads the crops. It reads Latin script only. Its 306 characters are the 95 printable ASCII characters including space, every character from À to ÿ except × and ÷, all 128 characters of Latin Extended-A from U+0100 to U+017F, and the 21 symbols`¡ £ ¥ § © « ® ° ¶ · » ¿ € • … – — ‘ ’ “ ”` .\n- **Relations and events.** Which object is attached to another, what is on the table, or which action is depicted. References connect these descriptions to the objects in the result.\n- **Decisions and forms.** A choice from labels you supply, a count within a range, a short text field, or a box linked to a chosen object.\n\nHere is a small example from the released 2-bit model. Switch between the views to see what it found in one photo.\n\nThe names, attributes and relations form a small scene graph. This is what we mean by an ontology here. Your app can follow a relation from the sign to its pole, or find the objects described as red, using the fields directly.\n\nThe result also includes a short `reasoning` trace. It makes the model's description easier to inspect, including details it may have inferred incorrectly. It is generated text, so it deserves the same scrutiny as the rest of the answer.\n\n## [Get started](#get-started)\n\nSave the [example photo](https://cactuscompute.com/mirage/coco-231049.jpg) as `photo.jpg`, or use the path to one of your own images.\n\nThe base install includes image decoding. The first use downloads the engine and weights; subsequent uses reuse the cached files. Image inference runs on your device. You can pass a file path, encoded image bytes, a Pillow image or an RGB array.\n\nOnce you've seen the full result, ask for just the parts your app needs. For objects, masks and writing, for example:\n\nBoxes use a 0 to 1000 coordinate scale relative to the image. `conf` and `text_conf` set the minimum detection scores, and `max_objects`, `max_text_lines` and `max_tokens` bound the output. Pass `language=\"de\"`, for example, to ask for a description in German.\n\n## [Give it a decision to make](#give-it-a-decision-to-make)\n\nSometimes an app needs one answer from a small set. Using the same `vision` instance and photo, you can ask Mirage to score a set of choices and return the selected value alongside their probabilities.\n\n## [Use Mirage with a text model](#use-mirage-with-a-text-model)\n\nIf you already run an LLM, you can pass it Mirage's JSON alongside a question about the image. Mirage handles perception; the language model reads the observations as ordinary text. Neither model needs a new adapter or a change to its weights.\n\nWe tested this with **Qwen3-0.6B** on 256 VQAv2 validation questions from 128 images. With Mirage's structured record and complete trace, the system scored **31.3 out of 100** on VQA consensus credit. Giving it another image's record scored **22.2**. Omitting the trace produced **33.1**, so we did not find a reliable benefit from including it.\n\nThis is a small exploration of a text interface for vision. Qwen never sees the pixels, and a detail missing from Mirage's record remains unavailable to it. The [experiment in Structured Visuo-Semantic Perception](https://cactuscompute.com/blog/structured-perception#mirage-visual-perception--llm) includes the method, runnable code, all recorded answers and examples where the composition succeeds or makes a mistake. Follow-up runs with larger text-only readers did not establish consistent gains; their results and answer-format failures are included in the experiment record.\n\n## [Inside the model](#inside-the-model)\n\n**[HConvGLU](https://cactuscompute.com/blog/hconvglu) keeps channel mixing small.** Throughout the encoder, fixed Walsh-Hadamard transforms surround three learned, 65-channel banded convolutions. A gate controls which values pass through. Each convolution stores **512 × 65 weights**, about **8 times fewer** than a full 512 × 512 matrix, while the transforms let all channels interact.\n\nThe encoder works on **256 image cells**. Grouped-query attention shares key/value projections, four register tokens provide temporary working space, and gated level memory blends earlier features into the final grid without adding more tokens. Global Response Normalisation balances channel responses. Finer stem features feed the detection and mask heads, preserving detail without running the full encoder at that resolution.\n\nThe eight-layer decoder shares the [Simple Attention](https://cactuscompute.com/blog/simple-attention-networks) family used by Needle and Whistle, with [Hadamard MLPs](https://cactuscompute.com/blog/hadamard-mlp), engram lookups and four mHC residual lanes. It reuses cached image memory and writes short references to detected boxes. The engine combines its description with the boxes, masks and OCR to produce JSON. This [division of work](https://cactuscompute.com/blog/structured-perception) cuts the number of tokens the decoder needs to generate.\n\nMost quantised matrices use 2 bits. The token embedding and mHC routing matrices stay at 4 bits. HConvGLU bands stay at 16-bit floating point, alongside the other floating-point tensors the model retains. This is the deployment scheme behind the **21.6 MB file**.\n\nThe companion articles explain [shared instance masks](https://cactuscompute.com/blog/instance-segmentation), [OCR across overlapping windows](https://cactuscompute.com/blog/ocr-decoding) and [Gabor initialisation](https://cactuscompute.com/blog/gabor-initialisation) in more detail.\n\n## [Deploy](#deploy)\n\nFor a native application, `cactus_load` loads `mirage.cact` and `cactus_describe` accepts RGB pixels and the same options. Needle, Whistle and Mirage can all be loaded into the same engine, with their weights kept separately.\n\nThe [Python reference](https://cactuscompute.com/blog/needle-python-docs) covers the API. [Mirage's weights and config](https://huggingface.co/Cactus-Compute/mirage) are on Hugging Face, and [engine binaries and supported platforms](https://huggingface.co/Cactus-Compute/cactus) have their own repository.\n\nFind the source code on [GitHub](https://github.com/cactus-compute/cactus).", "url": "https://wpnews.pro/news/mirage-vlm-and-ocr-and-detection-and-segment-and-decide-in-22-mb", "canonical_source": "https://cactuscompute.com/blog/mirage", "published_at": "2026-12-06 16:35:19+00:00", "updated_at": "2026-12-06 16:45:17.520555+00:00", "lang": "en", "topics": ["computer-vision", "ai-products", "ai-tools", "machine-learning", "ai-infrastructure"], "entities": ["Mirage", "Cactus Quants", "Samsung Galaxy S26", "Needle", "Whistle"], "also_reported_by": [], "takeaway": "Mirage packs scene description, detection, Latin-script OCR, segmentation and decision scoring into a 51.3M-parameter model at roughly 22 MB with 2-bit Cactus Quants, running in 74 ms on a Galaxy S26 NPU and 107 ms on CPU.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/mirage-vlm-and-ocr-and-detection-and-segment-and-decide-in-22-mb", "markdown": "https://wpnews.pro/news/mirage-vlm-and-ocr-and-detection-and-segment-and-decide-in-22-mb.md", "text": "https://wpnews.pro/news/mirage-vlm-and-ocr-and-detection-and-segment-and-decide-in-22-mb.txt", "jsonld": "https://wpnews.pro/news/mirage-vlm-and-ocr-and-detection-and-segment-and-decide-in-22-mb.jsonld"}}