Skip to content

Fix Nemotron prompt parity and first-byte/cache regressions - #962

Merged
Gajesh2007 merged 5 commits into
Layr-Labs:masterfrom
jonathan308:codex/nemotron-template-parity-20260911
Oct 1, 2026
Merged

Gajesh2007 merged 5 commits into
Layr-Labs:masterfrom
jonathan308:codex/nemotron-template-parity-20260911

Conversation

@jonathan308

@jonathan308 jonathan308 commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Align Nemotron tool prompts with the pinned Transformers reference while preserving other model families' metadata policy. Nemotron retains optional function strict and uses model-scoped scalar/JSON filters in the provider, scan-time render check and Rust sidecar.

Fix numeric parity in both filters: exponent spelling and the SDK's Int-before-Double conversion now produce matching token counts and cache hashes. Ambiguous decimal/exponent integers outside the exact Double range fail cold; plain integer inputs remain eligible. Apply non-Nemotron strict stripping to native media inputs as well as text. The provider's existing media/history/schema transformations remain in their own paths. Repair the exact-cache E2E fixture's SSD opt-in and repeat-demand setup, then make its unchanged output/isolation/recovery assertions a blocking CI gate.

Remove a redundant registry lookup from post-dispatch slot-metric attribution. Primary and backup paths use their already-selected provider, so registry writers cannot delay first content at this bookkeeping step; terminal attribution rules stay intact.

Rebased onto current master at d3300443b73defb0209a7d0a34f12c42545f01b2. This includes the latest payouts and default rectangular MiMo verification merges. The SDK pin stays at master's 1ee8675a035d0d842d5df663938d66cfedf88a8e, preserving the newer MiMo cache and decode fixes; it already includes mlx-swift-lm #147.

Before

flowchart TD
  A["Tool request"] --> B["SDK toolSpec includes strict"]
  B --> C["Generic template filters"]
  C --> D["Nemotron reference bytes can differ"]
  B --> E["Native media forwards tool metadata"]
  E --> F["Other model prompts can gain strict"]
  T["Exact-cache E2E: implicit defaults, immediate donation expected"] --> U["Setup timeout; CI ignores failure"]
  class T,U gap
  classDef input fill:#dbeafe,stroke:#1d4ed8,color:#172554
  classDef gap fill:#fee2e2,stroke:#b91c1c,color:#450a0a
  class A,B input
  class C,D,E,F gap
Loading

After

flowchart TD
  A["Tool request"] --> B["ChatTemplateFixes metadata policy"]
  B --> C["Nemotron retains strict"]
  B --> D["Other families strip function strict"]
  D --> E["Text and MediaIngest retain existing formats"]
  C --> F["NemotronTemplateFilters and Rust numeric mirror"]
  F --> G["Reference prompt bytes and tokens agree"]
  G --> H["Shared v8 / v4 contract and cache identity"]
  T["Exact-cache E2E: enable SSD; prime then repeat"] --> U["Assert reuse, isolation and recovery; blocking CI"]
  class T,U fixed
  classDef input fill:#dbeafe,stroke:#1d4ed8,color:#172554
  classDef fixed fill:#dcfce7,stroke:#15803d,color:#052e16
  class A input
  class B,C,D,E,F,G,H fixed
Loading

First-byte contention: before and after

flowchart LR
  subgraph Before
    direction TB
    A["Request handed to provider"] --> B["noteServingSlotFor: registry lookup"]
    B --> C["Registry writer can delay first content"]
  end
  subgraph After
    direction TB
    D["Request handed to provider"] --> E["noteServingSlotFor: selected provider"]
    E --> F["Same metric tags; no registry lookup"]
  end
  classDef gap fill:#fee2e2,stroke:#b91c1c,color:#450a0a
  classDef fixed fill:#dcfce7,stroke:#15803d,color:#052e16
  Before ~~~ After
  class A,B,C gap
  class D,E,F fixed
Loading

Validation

  • Nemotron reference gates pass: 25 original cases, seven numeric edge cases, 526 finite-number spellings, metadata isolation and cache identity fences. scripts/verify-nemotron-prompt-parity.sh provisions hash-verified metadata and runs both Swift and Rust artifact/planner checks without weights.
  • Rust all-target tests, format and clippy pass. Both normally ignored artifact gates also pass explicitly.
  • scripts/verify-prompt-parity.sh passes: all 154 production vectors match; 96/96 cold and 375/375 warm sidecar requests complete with no errors, mismatches or restarts.
  • The repaired exact-cache E2E passes twice locally (120 and 130 seconds) with real providers, the pinned Gemma e2b model, Postgres and sidecar. It also passes as a blocking step in CI on 54f6c81c4.
  • The held-registry-lock attribution regression fails before the fix. Primary/backup attribution and streamed-first-byte checks pass 25 repetitions with the race detector after the fix. The full local coordinator/testbed race-and-coverage suite and make coordinator-test pass; Postgres-backed cases run in CI.
  • Provider build and full make provider-test pass with the pinned MiMo fixtures. XCTest reports 553 tests including 125 opt-in skips; Swift Testing reports 3,542 tests. All isolated gates pass. Full-model qualification opt-ins remain separate.
  • Console lint/build pass; all 811 tests across 104 files pass.
  • Documentation impact, documentation lint and all 19 provider workflow tests pass.
  • Main CI and Integration Tests pass at 42b88351d, including blocking paged, exact-cache and default-provider checks. External advisory reviewers were unavailable; their green workflow status was not a completed review.

All 154 existing production vectors retain identical requests, normalized inputs and token arrays. Only contract-dependent IDs/hashes change. The number oracle is regenerated by scripts/generate-nemotron-number-vectors.swift; the additional prompt corpus uses local-only Transformers via scripts/generate-nemotron-prompt-edges.py.

Existing CI regression addressed

The failed Provider Prompt Parity jobs on #1282, #1299, #1279 and #1289 report the same three tool_function_extra_keys mismatches: Qwen3.8, Qwen3.5 and Qwen3.6 retain function-level strict in Swift while the sidecar strips it. This PR restores that non-Nemotron normalization in both text and native-media paths. Existing token expectations remain unchanged, and the production parity lane passes with this correction. The red aggregate Provider Tests check on those PRs reflects this failed child lane.

Contract and release impact

Normalization advances v7 to v8 and renderer v3 to v4 consistently in Swift, Go and Rust. This invalidates old prompt/cache identities for every model. Provision matching contracts and update configured exact-artifact allowlists together before rollout; never relabel old cached objects. Mixed identities retain ordinary serving without cross-version cache credit.

This PR establishes prompt fidelity. It does not include #963's parser/sampling changes or prove that the intended Nemotron weight artifact selects tools with reasoning disabled. That generation acceptance case, signed release qualification and fleet rollout remain separate release gates. No model weights, sampling defaults or inference kernels change in this PR.

Rollback

Revert the prompt normalization/rendering/identity changes together with signed commits. If deployed later, coordinate provider and coordinator/sidecar contracts and restore their matching allowlists; preserve the newer upstream SDK fixes.

@vercel

vercel Bot commented Sep 12, 2026

Copy link
Copy Markdown

@jonathan308 is attempting to deploy a commit to the EigenLabs Team on Vercel.

A member of the Team first needs to authorize it.

@jonathan308
jonathan308 force-pushed the codex/nemotron-template-parity-20260911 branch from 4ed2446 to 398fe79 Compare October 1, 2026 02:25
@jonathan308 jonathan308 changed the title provider: render pinned Nemotron tool definitions with reference prompt bytes (prompt-contract identity v4) provider: align Nemotron tool prompts (normalization v8, renderer v4) Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Threat model review — advisory

Reviewed head 42b88351d313 against base d3300443b73d.

Review not completed for this head. Previous findings are superseded, not confirmed resolved.
Scan incomplete: one or more configured reviewers did not finish; completed reviewers' findings are shown below

Reviewers: anthropic/claude-opus-5.5: incomplete (review unavailable); openai/gpt-6-astra: incomplete (review unavailable)

Models: anthropic/claude-opus-5.5, openai/gpt-6-astra. Findings require human validation; this review never requests changes or blocks merging.

@Gajesh2007

Copy link
Copy Markdown
Member

@codex review this

jonathan308 and others added 3 commits October 1, 2026 11:52
Retain strict metadata and render Nemotron scalar and JSON values with reference-compatible semantics. Advance normalization v8 and renderer v4 across Swift, Go and Rust; regenerate identity-only production vectors and preserve newer model normalization behavior. Pin the content-identical signed SDK dependency and include reference fixtures, regressions and documentation.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Gajesh2007
Gajesh2007 force-pushed the codex/nemotron-template-parity-20260911 branch from ed1a1d9 to 58c8bc7 Compare October 1, 2026 18:58
0xkydo
0xkydo previously approved these changes Oct 1, 2026
@Gajesh2007 Gajesh2007 changed the title provider: align Nemotron tool prompts (normalization v8, renderer v4) Fix Nemotron prompt parity and restore exact-cache CI coverage Oct 1, 2026
@Gajesh2007 Gajesh2007 changed the title Fix Nemotron prompt parity and restore exact-cache CI coverage Fix Nemotron prompt parity and first-byte/cache regressions Oct 1, 2026
@Gajesh2007
Gajesh2007 merged commit 36154ac into Layr-Labs:master Oct 1, 2026
22 of 27 checks passed

This branch was successfully deployed

No deployments
benchmarks — 42b88351 Deployed Oct 1, 2026 by Gajesh2007 via E2E Benchmarks #2080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants