# Ask about images

> Ask yes/no, choice and score questions about pictures, and find an object in one with a Box question, on a Gemma 4 server started with images on.

Source: https://opendecisio.com/docs/images/

A picture goes in the request, and the answer is the one you already read for text. This script sends one photo as a data URL and asks whether the parcel in it is damaged:

 python

```
import base64
import json
import urllib.request

with open("photo.jpg", "rb") as f:
    image = "data:image/jpeg;base64," + base64.b64encode(f.read()).decode()

body = {
    "state": "A photo of a delivered parcel.",
    "images": [image],
    "questions": {"damaged": {"type": "noul", "instructions": "Is the parcel visibly damaged?"}},
}
request = urllib.request.Request(
    "http://127.0.0.1:8000/v1/systemone",
    data=json.dumps(body).encode(),
    headers={"Content-Type": "application/json"},
)
with urllib.request.urlopen(request) as response:
    print("damaged:", json.load(response)["answers"]["damaged"]["noul"])
```

 

A shape to fill in, not a command to run.

 

It prints the [probability](https://opendecisio.com/docs/glossary/#probability) that the parcel is damaged. Choice and score [questions](https://opendecisio.com/docs/glossary/#question) work the same way, and a Box question finds where something is in the picture.

 

## Start a server for images

 

A Gemma 4 base started with `--images on` reads the pictures with the engine that reads its text. There is no second engine and no second copy of the weights:

 shell

```
pip install "decisio[serve]==0.60.0"
python -m decisio.serve.vllm_engine --base gemma-4-12b --images on
```

 

Needs Linux with one NVIDIA card.

 

- Gemma 4 12B, including Decisio v3 and the FP8 repositories, and Gemma 4 31B take `--images on`, on the vLLM server or on a Mac.
- So do Qwen3.5-4B and [Decisio-mini-4b-v1](https://opendecisio.com/docs/deploy/decisio-mini/#read-pictures), which take `--image-budget` too, at 1120 unless set: a picture costs one token per 32 by 32 pixels, up to the budget.
- `--images on` does not combine with `--image-model`, `--one-engine` or `--mode packed`.
- `--max-images` is the most images one request may carry, 16 unless set.

 

On a Mac, the same flag works with the MLX backend and the extra `mlx-images`:

 shell

```
uv sync --extra mlx-images
uv run python -m decisio.serve.vllm_engine --backend mlx --base gemma-4-12b --model google/gemma-4-12B-it --images on
```

 

Needs an Apple silicon Mac with room for the model.

 

- Google’s bf16 checkpoint has the vision weights. An MLX conversion made for text drops them and takes the base’s vision add-on, which `--vision-weights` names.
- Box questions are not served on a Mac with a Gemma base; Decisio-mini-4b-v1 answers them there.

 

On Ollama, the untrained Gemma listing `aminroudaki/decisio-gemma` reads images through Ollama’s own `images` field, on Ollama 0.40.4 or later. Ollama puts the images before the state and has no Box question. [On a Mac or a laptop](https://opendecisio.com/docs/deploy/mac/) has the commands.

 

The Qwen base serves images through a second engine instead, started with `--image-model`:

 shell

```
python -m decisio.serve.vllm_engine --base qwen3.6-35b-a3b --image-model Qwen/Qwen3.6-35B-A3B-FP8
```

 

Needs Linux with one NVIDIA card.

 

- Its two engines’ default shares of the card fit one card together, so no memory flag is needed.
- `--one-engine` loads only the image engine and serves text on it too, for a card that cannot hold both.
- With an image engine, the longest text stays at 32,768 tokens, and a request may carry up to 128 images.

 

## Send the images

 

An image goes where its reference stands, inside the state or inside a question, and not all at the start. A photo in the state is read by every question of the request.

 

A photo in a question’s `instructions` or `criteria` is read by that question alone.

 

[Figure: A picture is read where its reference stands, and only by the questions that can see it. A request has two questions. A photo in the state is read once and shared, so both questions read it. A photo in question 2's own text is read by question 2 alone and is not in question 1's prompt. A photo sent in a list with no place opens the state, so both questions read it.]

 

Four ways to send one:

  

| How | What it looks like |
| --- | --- |
| A data URL in `images` | the list; an image no text names opens the state, and `[image N]` in the text places the Nth |
| A `data:image/...` URI inside the state | the image stands where the URI stands |
| An `assets` placeholder | `{"type": "image", "format": "png", "data_base64": "..."}`, named in the text, as System One sends images |
| A `multipart/form-data` request | the JSON in `request`, each file in its own part |

 

- The image route accepts only PNG, JPEG and WebP. An animated image is refused.
- Up to 20 MB and 20 megapixels each; a request body over 32 MiB is refused with 413.
- A multipart request needs an `X-Decisio-Client` header, any value, or it is refused with 415.
- TypeSafe’s Python SDK sends images as it does to System One, with nothing added.

 

## Ask where something is

 

A Box question finds an object and answers with one box, as fractions of the image, with a confidence. Say what to find in `instructions`, a short noun phrase:

 

[Figure: A Box question answers with one box and a confidence, or the whole image at confidence 0 when the target is absent. A Box question for the turquoise mug answers with a box: top 0.31, bottom 0.86, left 0.36, right 0.72, as fractions of the photo, at an example confidence of 0.93. Multiplying the edges by the image size gives the crop. A Box question for a red umbrella that is not in the parcel photo answers with the whole image at confidence 0.]

 

The request:

 json

```
{"state": "The photo: PHOTO",
 "questions": {"mug": {"type": "box", "instructions": "the turquoise mug"}},
 "assets": {"PHOTO": {"type": "image", "format": "png", "data_base64": "..."}}}
```

 

Needs a Gemma server started with --images on, on one NVIDIA card, and a photo of your own.

 

The answer:

 json

```
{"mug": {"type": "box", "box": {"top": 0.31, "bottom": 0.86, "left": 0.36, "right": 0.72}, "confidence": 0.93}}
```

 

It is the shape of an answer from a Gemma server started with --images on, on one NVIDIA card.

 

- Multiply `left` and `right` by the image’s width and `top` and `bottom` by its height to crop.
- When the model says the target is absent, the answer is the whole image at `confidence` 0.
- `confidence` is the probability that the target is in the picture times how sure the model is of the edges. Use it to rank and compare, not as a probability of a correct box.
- To decide in code whether something is there, ask a [yes/no question](https://opendecisio.com/docs/glossary/#yesno-question) beside the Box and use the Box only where it says yes.
- Ask one thing per question: to find three mugs, ask for the left, the middle and the right one.

 

A Box question needs a Gemma server or a Decisio-mini-4b-v1 server started with `--images on`, on vLLM; Decisio-mini-4b-v1 answers it on a Mac too. It is not served on a Mac with a Gemma base or by the Ollama listings.

 

## Choose the image budget

 

`--image-budget` is the soft tokens one image may take: 70, 140, 280, 560 or 1120. The picture is scaled to fill it, so a bigger budget gives small objects more tokens and costs more per image.

  

| Model | Default budget | What to know |
| --- | --- | --- |
| Gemma 4 12B | 560 | 1120 is refused at start: the 12B’s window is 1,024 tokens, shorter than the block |
| Gemma 4 31B | 280 | 1120 is an opt-in; the 31B reads pictures through its own vision encoder |

 

[Figure: A bigger budget reads a picture in more tokens: finer detail for small things, and a slower first read. One square picture of a parcel read at each budget: 70 is 64 tokens, a 8 by 8 grid of 48 pixel blocks; 140 is 121 tokens, a 11 by 11 grid of 48 pixel blocks; 280 is 256 tokens, a 16 by 16 grid of 48 pixel blocks; 560 is 529 tokens, a 23 by 23 grid of 48 pixel blocks; 1120 is 1,089 tokens, a 33 by 33 grid of 48 pixel blocks. The small print on the label gets sharper as the budget grows. The 12B reads at 560 by default, the 31B at 280, and the 12B refuses 1120.]

 

At 560 an image costs about 1.8 times the tokens of 280, and Box answers read better. A small object in a large image is found better after you crop to its region and ask again, or at a higher budget.

 

A first read, with the image new to the server, was a median of this many milliseconds for one image, on one RTX PRO 6000 Blackwell at 600 W, with generated 512 by 512 pictures:

  

| Model and budget | One image (ms) | Four images (ms) | Sixteen images (ms) |
| --- | --- | --- | --- |
| Gemma 4 12B, 280 | 85 | 202 | 727 |
| Gemma 4 12B, 560 | 117 | 353 | 1,379 |
| Gemma 4 31B, 280 | 143 | 372 | 1,426 |
| Gemma 4 31B, 1120 | 504 | 1,955 | 8,728 |
| Decisio-mini-4b-v1, 256 tokens a picture | 59 | 107 | 333 |

 

A second question on the same pictures reads them from the cache. `/health` reports the budget in use and the budgets the base allows.

 

## Read the probabilities

 

Probabilities for a request with images are read at a temperature fitted for images. Gemma 4 31B multiplies its text temperature by 1.376, fitted on images at budget 280. Gemma 4 12B reads images at its text temperatures.

 

The Qwen route reads at 0.80, fitted on its layout. An adapter keeps its own temperatures, and how well a tuned model reads pictures was measured for the previous tuned 12B only: Decisio v3 was trained on text, and its pictures are not measured.

 

## Limits

 

- **The 31B’s text answers can shift with images on.** The 31B then serves text requests through its multimodal class too. On 100 BANKING77 questions the right answers moved from 73 to 69 at budget 280, beyond the spread between two images-off starts. A deployment that serves mostly text on the 31B can keep images off, or serve images from a separate server.
- **The 12B refuses budget 1120.**
- **No registered [task](https://opendecisio.com/docs/glossary/#task) applies to a request with images:** no certificate, no [intent head](https://opendecisio.com/docs/glossary/#intent-head), no fast table and no thinking when unsure.
- **Box needs a vLLM server, or Decisio-mini-4b-v1 on a Mac.** It is not answered on a Mac with a Gemma base, by the Ollama listings or on the `--image-model` route.
- **The Qwen route’s figures were measured on its earlier layout.** `--image-prompt legacy` keeps that layout, is deprecated, and a later release removes it.
- **Generated scenes are easier than photographs.** Measure your own pictures before you rely on a figure.

 

## What next

 

- [Server flags](https://opendecisio.com/docs/flags/): every flag of the image engines.
- [The HTTP API](https://opendecisio.com/docs/api/): the images field, the multipart form and the System One `assets` field.
- [Requirements and limits](https://opendecisio.com/docs/limits/): what was measured on what.
- [Release notes](https://opendecisio.com/docs/releases/): what changed in each release.
- [Images on Gemma 4](https://github.com/aminry/decisio/blob/v0.47.0/docs/design/gemma-images.md): how a request’s images reach the prompt, who sees them and where the cache ends, for anyone who wants the design.
