LearnNewsExamplesServices
Frontmatter
id13855
titleOllama native Gemma 4 MoE format schema slice
stateClosed
labels
enhancementaiarchitecturemodel-experience
assigneesneo-gpt
createdAtJun 22, 2026, 12:32 PM
updatedAtJun 22, 2026, 3:10 PM
githubUrlhttps://github.com/neomjs/neo/issues/13855
authorneo-gpt
commentsCount0
parentIssue12740
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtJun 22, 2026, 3:10 PM

Ollama native Gemma 4 MoE format schema slice

Closed v13.1.0/archive-v13-1-0-chunk-5 enhancementaiarchitecturemodel-experience
neo-gpt
neo-gpt commented on Jun 22, 2026, 12:32 PM

Context

This leaf exists because #13854 is intentionally broader than the repo-local change already ready to ship. The parent ticket also contains #13853-dependent reasoningEffort work and a cloud benchmark, so a PR that only changes native Ollama defaults / structured-output payload shape must not use #13854 as its close target.

Release classification: post-release (repo-local provider parity slice; not release-blocking).

Live latest-open sweep: checked latest 20 open issues at 2026-06-22T10:31:31Z. Closest related tickets were #13854 (broader Ollama/cloud parity parent), #13853 (OpenAI-compatible / LM Studio reasoning-effort sibling), and #13852 (Ollama serving lifecycle). No equivalent closeable leaf for native Ollama format schema passthrough + gemma4:26b default was present.

A2A in-flight claim sweep: checked latest 30 A2A messages at 2026-06-22T10:31:31Z; only overlapping claim was @neo-gpt's own [lane-claim][#13854] Ollama MoE default + native format schema slice.

The Problem

Native Ollama dispatch still defaults NEO_OLLAMA_MODEL / aiConfig.ollama.model to the dense gemma4:31b model while Ollama publishes the 26B A4B MoE under the registry tag gemma4:26b. The provider also only maps JSON-output intent to format: "json"; callers that can provide a JSON schema have no native Ollama format: <schema> path and schema hints leak into payload.options instead of the top-level /api/chat request.

The Architectural Reality

  • ai/config.template.mjs is the canonical Tier-1 config template. ADR 0019 requires preserving the leaf(default, env, type) SSOT shape instead of adding parallel env parsing.
  • test/playwright/fixtures/aiConfigDefaults.mjs and test/playwright/unit/ai/config.template.spec.mjs mirror the Tier-1 defaults for deterministic assertions.
  • ai/provider/Ollama.mjs owns native Ollama /api/chat payload construction. Ollama's documented API accepts format as either "json" or a JSON schema object, and accepts think as a top-level request field for supported models.
  • test/playwright/unit/ai/provider/KeepAlive.spec.mjs already covers native provider payload shape without requiring a live daemon.

The Fix

  1. Change the native Ollama chat-model default from gemma4:31b to gemma4:26b while keeping NEO_OLLAMA_MODEL as the override leaf.
  2. Normalize provider-neutral schema hints into native Ollama top-level format:
    • responseSchema / response_schema -> schema object;
    • OpenAI-compatible response_format: {type: "json_schema"} -> nested schema object;
    • OpenAI-compatible response_format: {type: "json_object"} and JSON mime hints -> "json".
  3. Promote explicit caller-provided think to the native top-level field without inventing a reasoningEffort mapping before #13853 lands.
  4. Add hermetic unit tests plus an env-gated live Ollama probe that is skipped when NEO_TEST_SKIP_CI is set and only runs when NEO_RUN_LIVE_OLLAMA_TESTS=1 is provided.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
aiConfig.ollama.model ADR 0019 + ai/config.template.mjs leaf default gemma4:26b; env override remains NEO_OLLAMA_MODEL operator keeps current env override config JSDoc + config spec L1/L2 config spec
Ollama.preparePayload() structured output Ollama /api/chat native format field schema hints become top-level payload.format legacy format: "json" for plain JSON method JSDoc L2 provider payload specs
Ollama.preparePayload() think passthrough Ollama /api/chat native request field explicit think option becomes top-level payload.think no field emitted when caller omits it method JSDoc L2 provider payload specs
Live Ollama verification operator-local Ollama daemon opt-in env-gated test probes real /api/chat schema behavior skipped in CI / normal runs test title + skip reason L3 when operator runs with model pulled

Decision Record impact

aligned-with ADR 0019. The change updates the existing config leaf default and does not add a parallel provider alias, formula, or env parser.

Acceptance Criteria

  • Native Ollama default model is gemma4:26b while NEO_OLLAMA_MODEL remains the override.
  • Native Ollama provider emits JSON schemas via top-level format instead of leaking schema hints into payload.options.
  • Existing plain JSON extraction still emits format: "json".
  • Explicit think passes through top-level when provided, without mapping unresolved reasoningEffort leaves.
  • Focused unit coverage verifies the config and payload contracts.
  • Manual live Ollama verification is available through env vars without making CI depend on Ollama.

Out of Scope

  • Cloud benchmark and production deployment measurement; remains on #13854.
  • #13853 reasoningEffort config leaves and OpenAI-compatible / LM Studio path.
  • Ollama serve lifecycle, preload, and context-window residency; owned by #13852.
  • Pulling gemma4:26b during tests. Operators should run ollama pull gemma4:26b before the manual live probe.

Avoided Traps

  • Do not close #13854 with only repo-local L1/L2 evidence; its cloud benchmark remains unproven.
  • Do not invent a reasoningEffort config surface ahead of #13853.
  • Do not make CI perform live local-model inference or pull large Ollama artifacts.

Related

Related: #13854 Related: #13853 Related: #13852 Related: #12740

Origin Session ID: b9a8f817-9a9e-4243-abfb-62e762a94964

Handoff Retrieval Hints: Ollama native format schema gemma4:26b NEO_TEST_SKIP_CI #13854

tobiu referenced in commit 5f3238a - "feat(ai): add Ollama MoE schema format slice (#13855) (#13856)" on Jun 22, 2026, 3:10 PM
tobiu closed this issue on Jun 22, 2026, 3:10 PM