Commit graph

5831 commits

Author SHA1 Message Date
Cursor Agent
b933ca379d
transfer: return disk-full errors during blob download (fixes ollama/ollama#18644)
The MLX pull path ignored errors from writing a blob, so a full disk
still counted the blob as downloaded. "no space left" only appeared
later, while writing the manifest, after the payload had been read.
Return the write error immediately and do not retry it.

Co-authored-by: Ganesh <ganeshmaheshwaram2005@gmail.com>
2026-10-06 03:12:58 +00:00
Daniel Hiltgen
8a971df3ba
mlx: fix patch for recent mlx update (#18812) 2026-10-05 18:15:59 -07:00
Daniel Hiltgen
18846f8a9b
MLX: version bump (#18720)
* MLX: version bump

* add scopes for unit tests to reduce memory usage
2026-10-05 17:41:51 -07:00
Daniel Hiltgen
ec318f4d11
llama.cpp: version update (#18761) 2026-10-05 17:38:50 -07:00
Daniel Hiltgen
1970ce82a3 Merge remote-tracking branch 'upstream/main' into release_v0.40.0 2026-10-05 17:35:11 -07:00
Daniel Hiltgen
d9dec1509d
Reduce model lookup and MLX decision request overhead (#18806)
* Reduce model lookup and MLX decision request overhead

Avoid decoding unrelated manifests when resolving existing model names.
Reuse small Metal scratch buffers between decision requests, releasing
larger working sets and clearing scratch after scoring errors.

* address comments
2026-10-05 17:34:41 -07:00
Daniel Hiltgen
cf6c9de620
mlx: mitigate high latency after GPU idle (#18807)
Carry the MLX residency-refresh patch and enable it every second in the
runner, preserving explicit environment overrides.

Fixes #18744.
2026-10-05 16:49:32 -07:00
Daniel Hiltgen
e363843b83
test: split create integration tests out (#18470)
The create tests upload blobs which can cause problems when run in parallel on multiple systems.  This change splits them out with an explicit tag to make it easier to control when they are run.
2026-10-05 15:01:48 -07:00
Dongluo Chen
ec8e5a4dcd
Merge pull request #18722 from ollama/openai-tool-array-content 2026-10-05 14:54:40 -07:00
Daniel Hiltgen
991421d4db
pull: allow RCs to pull matching min_version (#18790)
Strip off pre-release from the version string so RCs can pull
models for the same release.
2026-10-04 16:15:37 -07:00
Daniel Hiltgen
0fde06c4d2 Merge remote-tracking branch 'upstream/main' into release_v0.40.0 2026-10-04 08:48:45 -07:00
Daniel Hiltgen
195f4cdca1
mlx: match publisher tokenizer semantics (#18779)
* mlx: match publisher tokenizer semantics

Honor pretokenizer stage order, split behavior, Unicode boundaries,
added-token normalization, and ranked BPE merges. Handle empty added
tokens and empty Metaspace input consistently.

Add shared Go/Python reference cases using published tokenizers, pulling
missing models directly and failing on errors, plus focused regressions
for configuration precedence, byte fallback, and parallel encoding.

* address comments
2026-10-04 07:45:15 -07:00
Daniel Hiltgen
27a36513d2
mlx: Decision model improvements (#18776)
* reject instead of truncate on overflow

* tune route logic for faster warm runner lookup
2026-10-03 17:48:08 -07:00
Daniel Hiltgen
a00d083bb5
mlx: System one support (#18701)
* mlxrunner: restore System One scoring

Carry the MLX implementation and its tests from the original System One
commit. The API/compiler and llama-server implementation already exist on
the release branch, so retain those versions. Adapt the optional model test
to the renamed decision package and its explicit rendering/context setup.

(cherry picked from commit 26e546ddb3)

* Enable MLX System One and add regression coverage

* mlxrunner: add Laya support for System One

Import Laya checkpoints and implement bidirectional decision scoring.

* mlxrunner: release cached buffers after System One scoring

* decision: match Tev1 and Nimble publisher prompt formats

Select Tev1 prompts using renderer metadata and fix JSON formatting, with regression coverage for GGUF and MLX.

* mlx: support Clef and Clef Flash decision models

Add model import, quantization safeguards, and text/image scoring with the Clef joint decision head.

* support vision capabilities for decision models

* Make Clef scoring cancellable between prefill chunks

Preserve joint-head inputs and test cancellation, cleanup, and recovery.

* mlx: separate decision preparation and readout from forward

Let serial and batched scoring share model-owned preparation and readout
without duplicating architecture-specific logic in the runner.

* mlx: add Strands Decider support

* implement caching

---------

Co-authored-by: ParthSareen <parth.sareen@ollama.com>
2026-10-03 13:17:21 -07:00
Dong Chen
31547a6cd7 openai: split tool results with images instead of adding [img] markers
The [img] placeholders mixed internal markers into tool text: the native
llama-server path sends them as literal text, so an image-only result
gained a text part, and tool output containing [img] or [img-N] moved or
dropped image tags. api.Message cannot carry image positions without
in-band markers, so stop merging tool results that include images.

Text-only tool results, the only array form the Chat Completions spec
allows for tool messages, are still merged into one message (now with a
strings.Builder). Results with images keep the per-part split in order,
which preserves image positions, with the tool call id and name set on
every part.
2026-10-02 20:41:11 -07:00
Parth Sareen
42e911bc3d
docs: document image input for decision models (#18757) 2026-10-02 11:52:27 -07:00
Parth Sareen
e896a52a4f
docs: link to available decision models (#18758) 2026-10-02 11:51:55 -07:00
Dong Chen
bea35c8984 openai: keep image positions when merging tool result parts
Merging a tool result's parts collected its images separately from the
text, so renderers placed them all before the text: "Before: <A> After:
<B>" rendered as "<A><B>Before: After:". Write an [img] placeholder at
each image's position so renderContentWithImageTags and chatPrompt put
each image back where it was.
2026-10-01 20:19:01 -07:00
Daniel Hiltgen
b0c1ca4f75
ci: fix missing build context (#18742) 2026-10-01 18:05:01 -07:00
Daniel Hiltgen
1c345795ab Merge remote-tracking branch 'upstream/main' into release_v0.40.0 2026-10-01 16:51:30 -07:00
Jeffrey Morgan
e4c0d18eb8
models: add clef support (#18741) 2026-10-01 15:52:04 -07:00
Daniel Hiltgen
3b1999d1d9
server: report only decision capability for decision models (#18737)
Show and list now return just "decision" for models declaring it, so clients don't offer them for general chat, tools, or thinking. The show response also omits the thinking field for these models. Scheduling and serving still check the full capability set.
2026-10-01 13:49:46 -07:00
Dong Chen
77cef85de4 openai: keep empty tool results sent as an empty content array
A tool message with "content": [] produced no message at all, so the
tool call it answers had no result in the rendered prompt. Emit an empty
tool message that keeps its ToolCallID and ToolName, and skip it only
when it has no parts, call id, or name.
2026-10-01 10:59:10 -07:00
Dong Chen
de119ea47f openai: keep tool message content parts in one message
FromChatRequest splits array content into one api.Message per part. That
is intended for user content, but a tool message is a single result: the
split also dropped its tool_call_id and tool name, since those were only
copied when the message had tool_calls. Renderers that resolve tool
results by ID then see extra, unnamed results; for example, Kimi K3 fails
with "tool message 2 has no resolvable tool name" on a tool result with
two text parts, which the OpenAI spec allows.

Merge the parts of a tool message into one message with the text joined,
the images kept, and ToolCallID and ToolName set, matching how
function_call_output items are converted for /v1/responses.
2026-09-30 13:02:51 -07:00
Parth Sareen
1abe35e6e6
docs: document System One API (#18702) 2026-09-29 19:33:23 -07:00
Daniel Hiltgen
eadb68a609 Merge remote-tracking branch 'upstream/main' into release_v0.40.0
# Conflicts:
#	server/routes.go
2026-09-29 11:15:31 -07:00
Daniel Hiltgen
b3f78b7732
create: support explicit model capabilities (#18708)
Add CAPABILITY declarations to Modelfiles and an additive capabilities
field to create requests. Preserve declarations across GGUF and safetensors
creation, inheritance, and Modelfile export.

Require decision capability before scheduling System One requests instead
of matching Qwen architecture/renderer metadata. Retain main's GGUF-only
scoring restriction until the separate MLX runtime work lands.

Extracted from the capability foundation in 36d46a0c3 on system_one_mlx;
MLX scoring and manifest-list changes are intentionally separate.
2026-09-29 11:10:25 -07:00
Daniel Hiltgen
eab3d8b37f Merge remote-tracking branch 'upstream/main' into release_v0.40.0 2026-09-28 18:25:49 -07:00
Daniel Hiltgen
a8aaf9fcfa
llama.cpp: version bump b11232 (#18652) 2026-09-28 18:25:08 -07:00
Daniel Hiltgen
6bdccd24e4
MLX: version bump (#18651) 2026-09-28 18:24:48 -07:00
Parth Sareen
05a7a91dae
feat: allow ten web searches per response (#18602) 2026-09-28 14:21:25 -07:00
Daniel Hiltgen
47bbe1eebe Merge remote-tracking branch 'upstream/main' into release_v0.40.0
# Conflicts:
#	server/images.go
#	server/routes.go
2026-09-28 14:14:00 -07:00
Daniel Hiltgen
cc4069396f
mlx: bound pull stall retries and let the watchdog interrupt them (#18625)
* transfer: bound stall retries and let the watchdog interrupt them

A download that stalls could never recover. copy derived its own
cancellable context, but the request was built from the parent, so
cancelling on a stall never reached the in-flight body and the read
stayed parked. The stall watchdog could detect a stall it had no way
to stop.

Stall retries were also unbounded: they never incremented attempt, so
the retry loop had no limit, and because backoff was gated on
attempt > 0 they retried with no delay at all.

The request now owns the cancellable context and passes its cancel
down to copy, so a stall aborts the read. Stalls get their own retry
budget before counting against the limit, and backoff is keyed to
every retry rather than only the counted ones.

* move out of x/
2026-09-28 13:31:38 -07:00
Parth Sareen
ffb6f220d0
feat: add System One scoring API (#18606) 2026-09-28 13:21:01 -07:00
Daniel Hiltgen
16b4376aea
bench: use HumanEval patch prompts (#17480)
* bench: use code prompts for prompt-token runs

Replace the synthetic word-list prompt with packed HumanEval Python prompts so speculative draft models see code-like continuations.

Keep the benchmark on the chat path, and calibrate -prompt-tokens with untimed chat probes that read PromptEvalCount instead of relying on a separate token-count API.

Each request still gets a nonce prefix to avoid prefix-cache hits while timed epochs measure the chat-rendered workload.

* review comments

* use different windows for each epoch

* add OpenAI API support

* address comments
2026-09-26 07:29:54 -07:00
Daniel Hiltgen
75b952780f llama-server: prepare to remove compatibility patch
Add manifest-list storage so runner-specific manifests can coexist under one tag while preserving existing v1 tags as best-effort downgrade anchors. Show/list/copy/remove/pull/push now understand runner and digest selection and transfer referenced child manifests and layers.

Add lazy local compatibility migration for legacy Ollama GGUFs into llama.cpp-compatible children, covering the patched model families and preserving parser/renderer, templates, projectors, media metadata, split GGUFs, and MTP/draft tensors where applicable.

Extend create/import/conversion paths for the same compatibility rules, harden manifest-list combine validation, and add focused manifest, migration, transfer, and integration coverage for first-load conversion plus chat/tools/vision/audio/embedding behavior.
2026-09-24 19:25:52 -07:00
Daniel Hiltgen
7af393188d
api: deprecate typical_p (#18627)
Switch from rejecting API requests to logging a warning.  Model creation still rejects the deprecated param.

Follow up from #18448 to remove the hard API failure.
2026-09-24 15:03:28 -07:00
Devon Rifkin
5f4b01e638
app: isolate cloud-setting tests from Windows user config (#18626)
Set USERPROFILE alongside HOME in both cloud-setting handler tests.
On Windows, os.UserHomeDir uses USERPROFILE, so the tests could write
to the developer's real server.json and leave cloud disabled.
2026-09-24 13:57:52 -07:00
Parth Sareen
8a5d443148
app: defer Settings model discovery (#18598) 2026-09-24 13:47:43 -07:00
Eva H
9eae4fac93
app: sync macOS update menu and icon at startup (#18622) 2026-09-24 09:42:49 -07:00
Jesse Gross
b2da9e468a mlxrunner: Update XGrammar to 0.2.7 for structured outputs
We pick up schema fixes for typed dictionary values and short arrays.
2026-09-23 16:36:46 -07:00
Parth Sareen
01c0fbfd35
launch: default Claude Code to client-side auto checks (#18596) 2026-09-23 15:20:45 -07:00
Daniel Hiltgen
b9cd4b1efb
xgrammar: add standalone CMake project for native library (#18611)
Move the ollama_xgrammar target into mlxrunner/xgrammar/native so it
can be configured on its own against an installed xgrammar. cmake/mlx
now adds it as a subdirectory and still uses the pinned xgrammar.
2026-09-23 11:20:59 -07:00
Parth Sareen
c173758997
docs: document thinking control discovery (#18501) 2026-09-22 18:28:11 -07:00
Daniel Hiltgen
c0f8da35b2
mlx: speed up Qwen 3.8 prompt processing (#18550)
* mlx: speed up Qwen 3.8 prompt processing

Use MLX's gated-delta kernel for long scans and fold dense MLP global scales into SwiGLU.

* address comments
2026-09-22 17:53:23 -07:00
Daniel Hiltgen
b8c3d1f62d
mlx: select Gemma 4 image resolution dynamically (#18603)
Replace the fixed checkpoint image budget with per-image selection across
the supported 70, 140, 280, 560, and 1120 budgets. Choose the publisher resize
grid closest to the input resolution, accounting for aspect ratio.

This preserves more detail in high-resolution documents while allowing
smaller images to use fewer tokens, without adding an API parameter.

Cover budget boundaries, extreme dimensions, position limits, and media
expansion for both vision architectures.
2026-09-22 17:47:31 -07:00
Daniel Hiltgen
421d74d20e
MLX: version bump (#18576)
Plumbs fast::gated_delta_update through a temporary MLX-C patch for now.
2026-09-22 17:13:16 -07:00
Daniel Hiltgen
13e0247132
llama.cpp: version update (#18577)
Refine memory allocation failure log substrings for upstream changes.

Remove the no longer needed Laguna metal patch - fixed upstream.
2026-09-22 13:58:49 -07:00
Eva H
ac3439083d
app: avoid System Events for ChatGPT/Codex detection (#18601) 2026-09-22 13:28:58 -07:00
Jesse Gross
5a0ff3116d server: apply structured outputs in a single pass on thinking models
A format on a thinking model ran two generations: an unconstrained one,
cancelled once the parser reported content, then a re-rendered prompt with
the parsed thinking under the grammar. The restart cost a second prefill,
dropped the chunk that crossed the boundary, needed a harmony prompt hack,
stitched metrics across the two requests, and on MLX could leak a stray
first token into the JSON. The generate endpoint never deferred at all, so
its JSON was forced inside the thinking.

Both handlers now make one completion request that names the strings
ending the response's thinking, from the builtin parser or the generic
thinking parser, and the runner constrains only the content after them in
a single generation. The prompt is evaluated once and metrics pass straight
through. A raw generate prompt names no strings, since nothing says where
its response starts, and its format applies from the first token as
before. A format now applies to whatever follows the thinking, so a tool
call can no longer take the place of formatted content, which was already
the case with thinking off; harmony is the exception, since its tool calls
precede the final message.

The per-token metrics flag both runners carried for the cancelled first
pass has no caller left and goes with the two-pass code and its tests.

Fixes #18441
Fixes #17544
Fixes #14196
Fixes #10929
2026-09-22 11:24:11 -07:00