LearnNewsExamplesServices
Frontmatter
id17048
titleBound OpenAI-compatible embedding batch width to leave one engine slot admissible
stateClosed
labels
enhancementaiagent-os
assigneesneo-gpt
createdAtAug 13, 2026, 1:26 PM
updatedAtAug 14, 2026, 8:37 AM
githubUrlhttps://github.com/neomjs/neo/issues/17048
authorneo-opus-vega
commentsCount1
parentIssue17072
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtAug 14, 2026, 8:37 AM

Bound OpenAI-compatible embedding batch width to leave one engine slot admissible

Closed Backlog/active-chunk-15 enhancementaiagent-os
neo-opus-vega
neo-opus-vega commented on Aug 13, 2026, 1:26 PM

Context

Neo's canonical provider lane binds the same elected slot count to both the engine and its consumers:

  • LLAMA_ARG_N_PARALLEL=${NEO_PROVIDER_LANE_EMBEDDING_SLOTS}
  • NEO_LOCAL_MODELS_EMBEDDING_PARALLEL=${NEO_PROVIDER_LANE_EMBEDDING_SLOTS}

For the shipped four-slot shape, 131072 / 4 = 32768 context tokens per slot. The slot count is therefore already available at the OpenAI-compatible embedding batching boundary.

Current TextEmbeddingService behavior is partly correct: it chunks large embedding arrays, gives batch calls their own timeout, and lets interactive work enter between chunks. Those mechanisms landed before this ticket and are not work for this leaf.

The Problem

The remaining width invariant is missing. #embedOpenAiCompatibleBatch() limits each provider POST only by batchEmbeddingChunkSize (default 5), without considering the declared engine parallelism (canonical provider lane: 4). A single multi-input /v1/embeddings request is expanded by the pinned llama.cpp server into one server task per input, with each task assigned an available slot. A five-input request can therefore occupy every four-slot lane and leave a concurrent small request with no admissible slot until one batch task completes.

This is a slot-admission defect, not proof that the provider is unhealthy or that any particular request will finish inside its deadline.

Intended solution shape

At the OpenAI-compatible batch boundary, derive the effective request width from the existing declarations:

  • when localModels.embedding.parallel > 1, send at most parallel - 1 inputs per provider POST;
  • when the value is absent, invalid, or <= 1, preserve the configured batch chunk size so remote or single-slot endpoints are not silently collapsed by a local-engine assumption.

No new config leaf, scheduler, health classification, or durable state is needed.

Acceptance criteria

  • With declared embedding parallelism 4 and configured batch width 5, five inputs are dispatched as provider batches [3, 2].
  • With declared parallelism 1 (and with no usable multi-slot declaration), the configured batch width remains unchanged.
  • Existing interactive-before-next-chunk ordering, abort behavior, result ordering, and batch timeout semantics remain green.
  • The implementation uses the same localModels.embedding.parallel value that the canonical provider-lane compose binds to LLAMA_ARG_N_PARALLEL; it introduces no second slot-count authority.

Out of scope

  • Admission aging / starvation freedom between priority classes (#17062).
  • New caller-class deadlines; interactive and batch ceilings already differ on current dev.
  • busy-behind-batch health taxonomy or a promise that an admitted request completes within a deadline.
  • Provider thread tuning, liveness probes, restart reconciliation, and deployment rollout (#17063, #17065, #17073).

Correction history

The original ticket attributed the incident to an unbounded MC array, one shared deadline, and missing interactive interleaving. Current-source intake disproved all three: batching is already chunked, batch and interactive timeouts are separate, and the queue already prefers interactive work between chunks. The surviving P - 1 request-width invariant above is the entire executable scope of this leaf.

Origin Session ID: 37509548-6568-47fe-9e6c-2aabd27c2b11

tobiu referenced in commit b4e8bfa - "fix(ai): leave embedding slot headroom for interactive work (#17048) (#17092)" on Aug 14, 2026, 8:37 AM
tobiu closed this issue on Aug 14, 2026, 8:37 AM