From 56848e805a0cd9fab421503c0ea05c5e28a17cbd Mon Sep 17 00:00:00 2001 From: Joel Teply Date: Wed, 11 Nov 2026 10:26:19 -0600 Subject: [PATCH] server: context_geometry reports the slot's capped context, the one size the slots enforce max_tokens_per_sequence read llama_n_ctx_seq while every slot caps that at the model's training context. On the M5 (Qwen3.6-35B-A3B, -c 524285 --parallel 5 --kv-unified) the report said 524288 and each slot refused past 262144. The capped value is now one member, set at load, that sizes the slots and is reported. --- tools/server/server-context.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/server/server-context.cpp b/tools/server/server-context.cpp index b03adacd3d3..9cacad5da33 100644 --- a/tools/server/server-context.cpp +++ b/tools/server/server-context.cpp @@ -884,6 +884,12 @@ struct server_context_impl { // serving slots working right now, refreshed by the loop at the start and end of every // update_slots pass; the trainer reads it between batches (see server-train.h) std::atomic n_busy_slots{0}; + + // The most one sequence may hold: llama_n_ctx_seq capped at the model's training context. + // ONE value, set at load: every slot is sized from it and context_geometry reports it, so + // the report never names a size the slots refuse (it said 524288 while each slot capped at + // 262144, the M5 2026-11-11). + int n_ctx_slot = 0; void publish_busy_slots() { int n = 0; for (const auto & slot : slots) { @@ -1387,7 +1393,7 @@ struct server_context_impl { const int n_ctx_train = llama_model_n_ctx_train(model_tgt); - int n_ctx_slot = llama_n_ctx_seq(ctx_tgt); + n_ctx_slot = llama_n_ctx_seq(ctx_tgt); if (n_ctx_slot > n_ctx_train) { SRV_WRN("the slot context (%d) exceeds the training context of the model (%d) - capping\n", n_ctx_slot, n_ctx_train); n_ctx_slot = n_ctx_train; @@ -5091,7 +5097,7 @@ server_context_meta server_context::get_meta() const { }(), /* context_geometry */ json { { "allocated_tokens", llama_n_ctx(impl->ctx_tgt) }, - { "max_tokens_per_sequence", llama_n_ctx_seq(impl->ctx_tgt) }, + { "max_tokens_per_sequence", impl->n_ctx_slot }, { "sequence_capacity", llama_n_seq_max(impl->ctx_tgt) }, }, };