# The AI That Sees 15 Apples and Says 14

> Source: <https://sotaaz.com/post/vlm-apple-count-en>
> Published: 2026-12-06 11:19:44+00:00

**Recommendation:** When testing a vision model's counting, compare a number-only prompt against a bounding-box prompt on the same images; the 27B missed 18 of 40 counts by exactly one but boxed every apple.
More in the playbook "Evals and testing for LLM apps": <https://wpnews.pro/playbooks/evals-testing>

# The AI That Sees 15 Apples and Says 14

Why did Qwen3.6 27B say 14 for 15 apples? In 40 synthetic images, a number-only prompt missed 18 counts; bounding boxes found every apple. See the follow-up tests and code.

There are 15 apples on this table. We asked Qwen3.6 27B, running locally on llama.cpp, "How many apples are in this picture? Reply with a number only." It answered **14**.

Then we asked the same model, on the same picture, to put a box around every apple. It returned 15 boxes, one on each apple, with no duplicates and no boxes on empty table. Those are the boxes in the picture above, drawn straight from its reply.

When asked for boxes, the model located every apple in this picture. When asked for a number, it missed one. This was not one unlucky picture: on our 40-picture counting test the 27B was wrong 18 times, and **every one of the 18 misses was exactly one short**. We changed the prompt and image-token setting to find out when that happened.

### The original test: 40 pictures with a known answer[#](#the-original-test-40-pictures-with-a-known-answer)

We made 40 pictures with a script. Each one is a 1024 by 640 composite of a wooden table photo and 3 to 15 copies of an apple cutout, placed at random positions and sizes. Apples may touch or overlap slightly. Because the script places the apples, the right answer is known for every picture. The prompt was the one above, temperature 0, reasoning off, one reply per picture.

We ran four Qwen vision models in the same way, each with its own F16 vision encoder file (mmproj) and the Q4_K_M model file:

| Model | Exact out of 40 | 
|---|---|
| Qwen3.5 0.8B | 20 | 
| Qwen3.5 4B | 31 | 
| Qwen3.5 9B | 31 | 
| Qwen3.6 27B | 22 | 

The largest model scored below the 4B and 9B. The way it missed was also unusual. The small 0.8B missed in many directions (from one over to five under) and answered "10" on 17 of the 40 pictures. The 27B missed by exactly −1 every time it missed. It got all 17 pictures with 7 or fewer apples right, and it missed 16 of the 19 pictures with 10 or more.

The 27B's repeated one-short answers suggested a systematic error in this setup. We wanted to know whether it failed to locate an apple or failed when turning what it saw into a number.

### The follow-up runs[#](#the-follow-up-runs)

For the six 40-picture conditions below, we kept the same pictures, 27B file and vision encoder, llama.cpp build 4da633776 on one GPU, temperature 0, and one reply per picture. Each follow-up changed either the prompt, thinking mode, or the minimum image-token setting. Requests ran in groups of four. The later apple-removal test used additional images derived from these 40.

All of this is one model family on synthetic pictures, with one reply per condition. The differences below are large, but treat them as what this model did on these pictures, not as a rule for every vision model.

#### Run 1: the same test again[#](#run-1-the-same-test-again)

**Question:** at temperature 0, does the model give the same answers twice?

**Result:** almost. The rerun matched the original answers on 39 of 40 pictures. On one picture with 10 apples, the original said 9 and the rerun said 10. So the rerun scored 23 out of 40 instead of 22, and its 17 misses were all −1 again. Temperature 0 was not perfectly repeatable in our setup, but the pattern held.

We use this rerun, 23 out of 40, as the baseline for everything below.

#### Run 2: give the encoder more image tokens[#](#run-2-give-the-encoder-more-image-tokens)

**Question:** is the picture too coarse for the model to separate 15 apples?

A vision model does not pass the raw pixels straight to the language model. Its vision encoder produces image tokens. In the default run, the full input, including the picture and question, used 668 tokens. That total alone cannot tell us the encoder's exact image resolution.

llama.cpp lets you raise the floor with `--image-min-tokens`. At 1024, the full input grew to 1,094 tokens. This gives the model more image tokens, but it cannot add detail absent from the original picture.

**Result:** 22 out of 40, all 18 misses −1. Only one picture changed from the baseline, a 9-apple picture that went from right to one short. More image tokens did not help.

#### Run 3: ask for boxes instead of a number[#](#run-3-ask-for-boxes-instead-of-a-number)

**Question:** is there one apple the model can't see?

If the model misses one apple, a box per apple should show which one: maybe the smallest, the one at the edge, or two that touch. The prompt was "Find every apple in this picture. Reply with JSON only: a list of [x1, y1, x2, y2] boxes, one per apple." The model returns coordinates from 0 to 1000 relative to the picture. We matched each box to the apple whose centre it contains, after checking the coordinate convention by eye on an overlay.

**Result:** 40 out of 40. On every picture the model returned one box per apple: 0 apples missed, 0 duplicate boxes, 0 boxes on empty table. We ran it again with the larger image-token setting and got the same 40 out of 40.

That ruled out a consistently invisible apple in this set. Under the box prompt, the model located all of them; under the number-only prompt, it often answered one short. These are different prompts, so the result does not show what the model internally located while producing the single number.

#### Run 4: count out loud, without reasoning mode[#](#run-4-count-out-loud-without-reasoning-mode)

**Question:** does writing the count help, even without reasoning turned on?

The prompt asked the model to "Count the apples one by one. Write one numbered line per apple, then the total on the last line as: TOTAL: N".

**Result:** 31 out of 40, up from 23. Of the 9 misses, 7 were one short and 2 were one over. In all 9, the total matched the list: the model wrote one line too few (or too many) and then added correctly. Here is its list for the 15-apple picture:

```
1. Apple at top left
2. Apple below the first one
3. Apple in the middle left
...
13. Apple below the twelfth one
14. Apple at bottom right

TOTAL: 14
```

The lines describe positions in words ("below the first one", "next to the fifth one"). The 14-line list does not establish which apple was omitted. Writing a list improved the score, but did not eliminate errors.

#### Run 5: turn reasoning on[#](#run-5-turn-reasoning-on)

**Question:** what happens with Qwen's thinking mode on, same number-only question?

**Result:** 40 out of 40. In all 40 reasoning texts, the model wrote box coordinates for the apples before answering, without being asked to. This is the start of its reasoning on the 15-apple picture:

```
1.  Top left: One small apple [53, 172, 134, 310].
2.  Below that: One small apple [45, 388, 130, 532].
3.  Moving right: One large apple [178, 353, 307, 563].
...
14. Top right corner: One large apple [750, 220, 876, 439].
15. Bottom right corner: One large apple [773, 732, 907, 955].

Let me recount to be sure.
```

It then recounted several times, by rough rows and by walking from neighbour to neighbour, before answering 15. The cost is length: the thinking replies ran from 199 to 6,343 tokens (median about 1,070), against 2 or 3 tokens for the plain number.

In this set, the runs that scored 40 out of 40 (reasoning, and boxes at both image-token settings) included coordinates for every apple. The run that wrote positions in words reached 31. The runs that wrote nothing but the number stayed at 22 and 23. That association does not establish that coordinates alone caused the improvement; the prompts and thinking mode also changed.

### At 11 apples, every answer was 10[#](#at-11-apples-every-answer-was-10)

One more run, to see where the miss starts. We took the 18 pictures the model had missed and removed apples one at a time, the last-placed apple first, keeping every other apple exactly where it was, down to 3 apples. That made 183 pictures. (Rendering any of the 40 pictures with all its apples gives back a file byte-identical to the original, so the scenes really are the same.) Same number-only prompt.

From 3 to 6 apples, the model was right on all 18 pictures. Errors start at 7 and grow through 9 and 10. At 11 apples it was right on none of the 15 pictures, and all 15 answers were the same number: 10. At 12 it recovered to 6 out of 9, and at 13, 14 and 15 it was wrong every time.

Every wrong answer in this run was one short, except one 12-apple picture answered 10. The 11-apple step is the clearest: fifteen different arrangements of apples, one answer, and one more apple (12) brought six of them back.

### Scoreboard[#](#scoreboard)

Qwen3.6 27B Q4_K_M, 40 pictures, temperature 0, one reply each:

| Run | What the model had to write | Exact | Misses | 
|---|---|---|---|
| Number only (rerun) | one number | 23 | 17, all −1 | 
| Number only, more image tokens | one number | 22 | 18, all −1 | 
| Count one by one, reasoning off | a numbered list in words, then a total | 31 | 7 × −1, 2 × +1 | 
| Reasoning on | reasoning with a coordinate list, then a number | 40 | none | 
| Boxes as JSON | one box per apple | 40 | 0 missed, 0 duplicate, 0 stray | 
| Boxes, more image tokens | one box per apple | 40 | 0 missed, 0 duplicate, 0 stray | 

The claim this supports is narrow. On these synthetic pictures, this model returned a correctly matched box for every apple when asked for coordinates. The one-short miss was common with the number-only prompt and less common with the numbered-list prompt. We did not isolate whether the change came from the coordinates, the prompt, or the extra output tokens.

Others have documented counting trouble in vision models on simple synthetic pictures. In [Vision language models are blind](https://arxiv.org/abs/2407.06581) (Rahmanzadehgervi et al., 2024), four leading models struggled to count circles and line crossings when shapes overlap or sit close together, and the authors report that linear probes on the vision encoder could recover what the language side failed to say. [Vision Language Models are Biased](https://arxiv.org/abs/2505.23941) (Vo et al., 2025) found counts pulled toward familiar answers, like three stripes on an Adidas-like logo with a fourth added. Neither tested our box-versus-number prompts or established why this model said one fewer.

### What we do now: ask for a list, count it in code[#](#what-we-do-now-ask-for-a-list-count-it-in-code)

For this task, we now ask for one box per apple and count the returned boxes in code. On these 40 pictures that was 40 out of 40, with a median of 314 output tokens versus 1,066 in thinking mode. A box count still needs a check for missed, duplicate, and stray boxes before it can be trusted on new images.

With llama-server's OpenAI-compatible endpoint, it looks like this:

``` python
import base64, json, re, urllib.request

def count_objects(path, thing="apple", port=8080):
    img = base64.b64encode(open(path, "rb").read()).decode()
    prompt = (f"Find every {thing} in this picture. Reply with JSON only: "
              f"a list of [x1, y1, x2, y2] boxes, one per {thing}.")
    body = {"messages": [{"role": "user", "content": [
                {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64," + img}},
                {"type": "text", "text": prompt}]}],
            "temperature": 0, "max_tokens": 2048,
            "chat_template_kwargs": {"enable_thinking": False}}
    req = urllib.request.Request(f"http://127.0.0.1:{port}/v1/chat/completions",
                                 json.dumps(body).encode(), {"Content-Type": "application/json"})
    text = json.load(urllib.request.urlopen(req))["choices"][0]["message"]["content"]
    boxes = json.loads(re.search(r"\[.*\]", text, re.S).group(0))
    # Qwen often wraps each box as {"bbox_2d": [...], "label": ...}
    boxes = [b["bbox_2d"] if isinstance(b, dict) else b for b in boxes]
    return len(boxes), boxes
```

Two details from our runs. First, even though the prompt asked for a plain list, on 36 of the 40 pictures the 27B wrapped each box in an object with a `bbox_2d` key, so the code accepts both forms. Second, the boxes come back in 0 to 1000 units relative to the picture, not pixels. Multiply x by width/1000 and y by height/1000 before you draw them.

The boxes give you a way to inspect the answer: draw them over the image and check for missed apples, duplicate boxes, and boxes on empty space. The code above counts returned boxes; it does not perform that visual check.

If you need a number-only final answer, thinking mode got all 40 right here, at the cost of much longer replies. Raising the minimum image-token count did not improve this run.

The setup: llama.cpp `llama-server` build 4da633776, Qwen3.6-27B-Q4_K_M with the F16 mmproj, one GPU, `-ngl 99 -c 65536 -np 4 --jinja --temp 0 --seed 0`, and `--image-min-tokens 1024` for the higher image-token runs.
