Ollama Structured Output vs a JSON Tool: measured tool-call loss and invented values on a local model (2026)

There are two documented ways to get machine-readable output from a local Ollama model, and they look interchangeable. You can constrain the reply with format — or response_format on the OpenAI-compatible endpoint — so the decoder emits JSON that matches a schema. Or you can register a tool and let the model call it, with the tool’s result being the JSON you wanted. The practical failure comes from doing both at once, which is a natural thing to do: keep the tools registered, and add format when a structured summary is due. On a self-hosted server the constraint wins and the tool call disappears. Nothing reports an error. The response is HTTP 200, done_reason is stop, tool_calls is absent, and content holds a schema-valid object in which the model has invented the values the tool was supposed to fetch. ...

November 10, 2026 · 16 min · baeseokjae
Diagram of one measured fixture, three write policies. P1 verbatim recalls 25 of 25 slots but cannot attribute any of them because the store has no source column, at 69.0 whitespace tokens per assembled block. P2 provenance-tagged recalls the same 25 slots and labels 11 of them as tool-sourced, at 76.2 tokens. P3 adds a trust tier and quotes untrusted records as evidence, also labelling 11 of 25, at 101.6 tokens. A lower strip shows the purge-by-source read-back: recall 0 of the 4 purged records, live table 0 rows, audit log still returning 4 texts until the audit rows themselves are purged. Conceptual diagram of fixture output, not a vendor benchmark.

Agent Memory Provenance: can you tell a tool-fetched fact from a user's?

An agent writes to long-term memory from two channels: what the user said, and what a tool returned. A ticket comment, a PDF, a fetched runbook page and the user’s own sentence all arrive as strings, and the extraction step turns each into a fact. The store usually keeps the fact. Most schemas do not keep the channel. That produces a question an operator cannot answer from the store: of the memories assembled into this prompt, which ones came from outside the trust boundary? And its operational twin: when the page turns out to be wrong, can I purge everything that came from that URL and prove the purge worked? ...

November 8, 2026 · 10 min · baeseokjae
Conceptual checklist for an empty tool-call response: HTTP 200 with empty content, then inspect the stop reason, then check the token usage. Raising the token cap is not a guaranteed fix.

Ollama Returns an Empty Response? Check the Token Limit

An agent sends a request with a tools array and a modest output cap. The server answers HTTP 200, the body parses, and the assistant message is empty: content is "", tool_calls is absent, and no error field explains it. The loop logs “model returned no content”, retries the identical request, and the next turn is empty in the same way. The operator starts suspecting the model, the quantisation or the chat template, because nothing in the client raised an exception. ...

November 8, 2026 · 11 min · baeseokjae

Agent Loops That Alternate Local Models: Measuring Ollama keep_alive and Cold-Start Stalls (2026)

Your agent finishes a coding turn, then calls a vision model to read a screenshot, then goes back to the coder. Each hand-off costs a pause the client reports as model latency: eight seconds, fifty seconds, eight seconds. The obvious diagnosis is that the model is slow, the quantization is wrong, or the machine needs more RAM. On the host measured here, none of those explained it. The model was being loaded from disk, again, on every switch, and the HTTP response said so in its own timing fields. ...

November 8, 2026 · 11 min · baeseokjae
Conceptual checklist for time per agent turn: Prompt prefill, then Output decoding, then Tool overhead. Add the phases before estimating a multi-turn run.

Local Coding Agents: Estimate Time per Turn, Not Just Tokens/s

Your local model answers a chat question in a couple of seconds and feels fine. You wire it into an agent that needs thirty tool calls to finish one refactor, and around the eighth request the client gives up with a read timeout, or the patch comes back cut in half because generation stopped mid-function. Nothing in the server log looks like an error. Restart the session with a shorter conversation and it completes. ...

November 8, 2026 · 12 min · baeseokjae

What You Actually Pulled: Reading Quantisation, Parameter Count and Context Out of an Ollama GGUF File

You pulled a tag. The download is 18.99 GiB for a model the card calls 31B. The agent that needed long history behaves as if it had a fraction of the context the card advertises. The quality does not match the benchmark chart that made you choose the model in the first place. None of those three surprises is a property of the model. All three are properties of the artifact: which quantisation the tag actually resolved to, how many bits per weight that quantisation really costs, and which metadata value declares the context this particular build was made for. ...

November 6, 2026 · 14 min · baeseokjae
Diagram of one Ollama request through a single model slot: request arrival, then waiting in the pending queue while the model generates, then generation beginning. A timeline shows total_duration split into load and prompt evaluation, eval_duration, and the leftover queue wait.

Ollama Requests Queue Up? Check Parallel Slots and Latency

You start a second coding agent against the Ollama endpoint that already answers your first one. Nothing errors out. The second call simply sits there for two or three seconds, and when both finish your “parallel” run has taken longer than running the two prompts one after the other. The usual conclusion is that the model is slow, the quant is wrong, or the machine needs more RAM. On the host measured here, none of those were true: the second request was queued, and the HTTP response said so in its own timing fields. ...

November 4, 2026 · 12 min · baeseokjae

Ollama Thread Tuning on CPU: Measuring Where More Threads Stop Helping Token Generation (2026)

You follow the usual advice: the local model server is using all your cores, so you pin the thread count to the number of cores and expect token generation to speed up. On a 2-vCPU box the opposite happens. The same 66-token prompt that produced 55 tokens in about 4.5 seconds with one thread took 109 seconds with four, and two later requests at that setting, bounded at 90 seconds in the second window, never returned at all. Both completed requests returned HTTP 200 with an ordinary response body; nothing in them announced that the setting was wrong. ...

November 4, 2026 · 13 min · baeseokjae
Conceptual checklist for vision input diagnosis: does the tag exist, does the image path work, does the context budget fit? Packaging failures are separate from image-token pressure.

Ollama Ignores Your Image? Check the Tag and Token Budget

You pull a vision model, send a screenshot, and get an answer that reads as if no image was attached. Or the request that worked with one image dies as soon as a second one is in the prompt. The error message, when there is one, points at the request, not at the three very different things that can be wrong: the tag you typed does not exist, the tag exists but the runtime drops the image, or the model does see the image and the image tokens have already consumed the context window. ...

November 3, 2026 · 11 min · baeseokjae
Conceptual checklist titled 'Will the model fit?' with three stacked steps: model configuration, then context plus concurrency, then available memory, captioned 'state the assumptions before comparing the totals.' No measurements shown.

Will Your Local LLM Fit? Budget VRAM and KV Cache

A model card says 40,960 tokens. The Q4_K_M file is 4.68 GiB. The card has 12 GB. You set -c 40960, and one of three things happens: the load fails, the runtime spills layers to CPU and tokens per second collapse, or the server starts and silently serves a shorter context than you asked for. Which of the three you get depends on a number that appears in none of those three places — the key/value cache the runtime allocates at load time from the context you request. This page computes it for four specific models from their own config.json at a pinned revision, turns it into a “largest context that fits this card” table, and ships a planner you can run offline. ...

November 3, 2026 · 10 min · baeseokjae