Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
4574c72
serve: /tokenize and /detokenize, as SGLang and vLLM serve them, coun…
AmanSwar Nov 8, 2026
c291db0
router: send /tokenize and /detokenize to any live engine, outside th…
AmanSwar Nov 8, 2026
a5cccf3
tests: /tokenize counts what the engine would be sent, /detokenize an…
AmanSwar Nov 8, 2026
6ae2627
tests: the router's tokenize routes fail over and change no routing s…
AmanSwar Nov 8, 2026
6d9624c
docs: the tokenize and detokenize endpoints
AmanSwar Nov 8, 2026
6c4742b
changelog: /tokenize and /detokenize
AmanSwar Nov 8, 2026
78a6657
radix_cache: evict by SGLang's lfu, slru and priority policies, and tlru
AmanSwar Nov 9, 2026
6499230
tests: each eviction policy decides against recency, and lru is uncha…
AmanSwar Nov 9, 2026
90f3489
request: carry a priority, and the error of a request ended unserved
AmanSwar Nov 9, 2026
9ec5c03
scheduler: admission policies, priority scheduling and queue limits
AmanSwar Nov 9, 2026
4d31cc4
tests: the admission policies, priority preemption and queue limits k…
AmanSwar Nov 9, 2026
add1f5a
engine: take host-only scheduling settings and a request's priority
AmanSwar Nov 9, 2026
25f0638
tests: priority scheduling and a full queue through the engine's spec…
AmanSwar Nov 9, 2026
ed062bd
cli: SGLang's scheduling and eviction flags, host only
AmanSwar Nov 9, 2026
c266857
tests: the stand-in engine takes the scheduling settings
AmanSwar Nov 9, 2026
4dd3c23
tests: the scheduling flags reach every engine and change no engine c…
AmanSwar Nov 9, 2026
1d1a2ca
api: a request's priority, and 503 for a full queue
AmanSwar Nov 9, 2026
19007a6
router: pass a full queue's 503 on without marking the engine down
AmanSwar Nov 9, 2026
e31210d
tests: priority and a full queue over HTTP and through the router
AmanSwar Nov 9, 2026
940906d
serve: SGLang's native /generate and its info, load, health, abort an…
AmanSwar Nov 9, 2026
b032df6
serve: client request ids, abort with delivery, abort_all and an idle…
AmanSwar Nov 9, 2026
ca95b73
cli: hand the engine's preset to its server for /server_info
AmanSwar Nov 9, 2026
fe8ec67
router: route /generate by its prompt, and fan SGLang's info, load, h…
AmanSwar Nov 9, 2026
5b143f3
tests: the scripted engine has flush_cache, a page size and a model path
AmanSwar Nov 9, 2026
0d3196d
tests: SGLang's native endpoints on the scripted engine
AmanSwar Nov 9, 2026
3a4e66b
tests: the router's SGLang native routes
AmanSwar Nov 9, 2026
89bf2d0
tests: /generate matches /v1/completions and /flush_cache empties bot…
AmanSwar Nov 9, 2026
cbea0e7
docs: SGLang's /generate and the info and admin endpoints
AmanSwar Nov 9, 2026
49ac78a
docs: serve/native.py in the architecture map
AmanSwar Nov 9, 2026
7b3d732
changelog: SGLang's /generate and the info and admin endpoints
AmanSwar Nov 9, 2026
a6b706e
api: n choices, SGLang's stop_regex, kept stop text, skip_special_tok…
AmanSwar Nov 9, 2026
5d9b04a
tests: n and include_stop_str_in_output are served, and refused only …
AmanSwar Nov 9, 2026
b48a20a
tests: n choices, stop_regex, kept stop text, the stop token and the …
AmanSwar Nov 9, 2026
5616251
responses: the OpenAI Responses API, stateless, over the chat path
AmanSwar Nov 9, 2026
e03c388
anthropic: the Anthropic Messages API and count_tokens over the chat …
AmanSwar Nov 9, 2026
2738810
api: serve /v1/responses and /v1/messages
AmanSwar Nov 9, 2026
be62363
tests: /v1/responses gives the chat API's output as Responses items a…
AmanSwar Nov 9, 2026
343d382
tests: /v1/messages gives the chat API's output as Anthropic blocks a…
AmanSwar Nov 9, 2026
432984d
router: route /v1/responses and /v1/messages by their conversation, c…
AmanSwar Nov 9, 2026
6d5fbd4
tests: the router routes Responses and Messages conversations as it r…
AmanSwar Nov 9, 2026
f5cebf0
docs: sampling extras, the Responses API and the Anthropic Messages API
AmanSwar Nov 9, 2026
2260b1e
docs: the Responses and Messages modules in the repository map
AmanSwar Nov 9, 2026
0a33489
changelog: sampling extras, /v1/responses and /v1/messages
AmanSwar Nov 9, 2026
b749205
api: name the scheduler paths that share an n-choice prompt
AmanSwar Nov 9, 2026
0733cf3
stats: request rates, latency percentiles and a time series per engine
AmanSwar Nov 9, 2026
b369cef
prodlog: an opt-in on-disk log of request records and gauges
AmanSwar Nov 9, 2026
1423c26
prompt_cache: a chat turn's prompt ids from the previous turn's, exac…
AmanSwar Nov 9, 2026
6a175a9
dashboard: one self-contained page that draws /v1/stats
AmanSwar Nov 9, 2026
0813a99
api: richer /v1/stats, /dashboard, the production log and the prompt …
AmanSwar Nov 9, 2026
0216b16
cli: name each engine's production log directory by its port
AmanSwar Nov 9, 2026
3ad110f
router: each engine's /v1/stats and its dashboard
AmanSwar Nov 9, 2026
f79e05f
tests: /v1/stats keeps the router's gauges among the new fields
AmanSwar Nov 9, 2026
08066bb
tests: the prompt token cache gives the served ids turn by turn, or t…
AmanSwar Nov 9, 2026
384dc7b
tests: the statistics, the production log, the dashboard and their ro…
AmanSwar Nov 9, 2026
70a7c08
docs: priority, the full-queue 503, /v1/stats and /dashboard
AmanSwar Nov 9, 2026
5ccb6c2
docs: the scheduling flags, the production log and the prompt token c…
AmanSwar Nov 9, 2026
63558eb
docs: the statistics, production log and prompt cache modules
AmanSwar Nov 9, 2026
93d2b95
changelog: scheduling, statistics, the dashboard, the production log …
AmanSwar Nov 9, 2026
fa4f723
api: count a step's ticks even for an engine stand-in without a sched…
AmanSwar Nov 9, 2026
cd7c970
serve: merge n choices, stop_regex, and the Responses and Messages AP…
AmanSwar Nov 9, 2026
5cd0cdc
serve: merge scheduling, priority, the queue-full 503, statistics, th…
AmanSwar Nov 9, 2026
aa09c62
native: refuse n, no_stop_trim and skip_special_tokens false on /gene…
AmanSwar Nov 9, 2026
d00a260
tests: /generate refuses skip_special_tokens false
AmanSwar Nov 9, 2026
d28e55f
sampler: draw from logits under a token mask and penalties
AmanSwar Nov 9, 2026
de932cb
grammar: xgrammar matchers and packed token masks for guided decoding
AmanSwar Nov 9, 2026
87fdaab
request: grammar and min_tokens fields, and the host-bound rules
AmanSwar Nov 9, 2026
c2c6b3f
host_inputs: the per-call token mask, penalty inputs and variant tag
AmanSwar Nov 9, 2026
ee5dfba
guided: admit guided requests and advance grammars and thinking budgets
AmanSwar Nov 9, 2026
1c1abf3
config: structured_outputs, penalties and penalty_buckets, off by def…
AmanSwar Nov 9, 2026
527629d
model_runner: pass host inputs to decode and prefill and warm their v…
AmanSwar Nov 9, 2026
0278f19
scheduler: hold a host-bound decode until its newest token is read back
AmanSwar Nov 9, 2026
f82171b
engine: serve guided decoding, thinking budgets, min_tokens and penal…
AmanSwar Nov 9, 2026
e9edecc
cli: --structured-outputs, --penalties and --penalty-buckets
AmanSwar Nov 9, 2026
c6c5d28
structured: map OpenAI, vLLM and SGLang constraint fields to a grammar
AmanSwar Nov 9, 2026
44bd97e
api: accept output constraints, min_tokens and pass them to the engine
AmanSwar Nov 9, 2026
37c69f7
pyproject: an optional grammar extra with xgrammar
AmanSwar Nov 9, 2026
c263235
tests: masked and penalized draws, host inputs and constraint fields
AmanSwar Nov 9, 2026
209ff58
tests: penalties, min_tokens and thinking budgets on the engine
AmanSwar Nov 9, 2026
a7a1815
tests: guided decoding through xgrammar on the engine
AmanSwar Nov 9, 2026
ca8e21c
tests: the graphs the host-input flags add to warmup per preset
AmanSwar Nov 9, 2026
8af20d4
tests: constraint fields through the HTTP layer
AmanSwar Nov 9, 2026
feb1dc9
tests: min_tokens is checked against max_tokens, not refused
AmanSwar Nov 9, 2026
5e65beb
docs: structured outputs, penalties and thinking budgets in the API
AmanSwar Nov 9, 2026
6498f25
docs: the host-input flags and the graphs they add
AmanSwar Nov 9, 2026
e8d49ba
changelog: structured outputs, min_tokens, thinking budgets and penal…
AmanSwar Nov 9, 2026
b828f26
engine: serve an engine assembled without host sampling, as the fake …
AmanSwar Nov 9, 2026
df4e114
engine, serve: merge structured outputs, penalties, thinking budgets …
AmanSwar Nov 9, 2026
6f5e50f
tests: /generate's json_schema reaches guided decoding, which an engi…
AmanSwar Nov 9, 2026
8396aad
anthropic: a thinking budget is enforced with --structured-outputs, n…
AmanSwar Nov 9, 2026
d24e30e
docs: the Messages API's thinking budget with --structured-outputs
AmanSwar Nov 9, 2026
9f71710
serve: keep the prompt cache off for a tokenizer with single-word add…
AmanSwar Nov 11, 2026
09309b5
serve: leave a request submitted without metrics out of /v1/stats how…
AmanSwar Nov 11, 2026
57280c5
serve: check no_stop_trim even when include_stop_str_in_output is true
AmanSwar Nov 11, 2026
6d4de83
responses: refuse a service_tier other than auto or default, unknown …
AmanSwar Nov 11, 2026
2f02ca1
tests: the Responses stream test checks each delta event in its place
AmanSwar Nov 11, 2026
516bb6e
tests: a non-text input part is a 400 HTTPException, not any exception
AmanSwar Nov 11, 2026
16bd92f
responses: a whitespace-only answer makes no message item, as the str…
AmanSwar Nov 11, 2026
f11440b
anthropic: refuse a thinking block whose thinking is not a string, in…
AmanSwar Nov 11, 2026
6e71686
anthropic: a whitespace-only answer makes no text block, as the strea…
AmanSwar Nov 11, 2026
bdfb979
anthropic: refuse a tool_result with is_error true, which the chat te…
AmanSwar Nov 11, 2026
b938e2a
docs: the Messages API refuses a tool_result with is_error true
AmanSwar Nov 11, 2026
70e3b0a
tests: a Messages refusal adds nothing to the engine, asserted directly
AmanSwar Nov 11, 2026
1256eca
guided: end a request at its grammar's dead end, also under ignore_eos
AmanSwar Nov 11, 2026
cc44d05
guided: force only the rest of a close tag the thinking budget cut short
AmanSwar Nov 11, 2026
203e2f3
engine: a stop string that ended within min_tokens never ends the req…
AmanSwar Nov 11, 2026
b70a2cd
structured: refuse a structured_outputs.json_object that is not a boo…
AmanSwar Nov 11, 2026
2ad4a41
structured: refuse an unknown structured_outputs key whatever its val…
AmanSwar Nov 11, 2026
7b04d89
tests: draw the grammar tests' prompts below the reasoning tags' ids
AmanSwar Nov 11, 2026
a3d733a
stats: the start and today windows count every request in n, not only…
AmanSwar Nov 11, 2026
98d789a
grammar: keep at most 32 compiled grammars, the least recently used d…
AmanSwar Nov 11, 2026
ef42376
stats: today's output tok/s counts earlier processes' gauges all day,…
AmanSwar Nov 11, 2026
1c55ff3
stats: the current series point's RPM divides by the seconds its buck…
AmanSwar Nov 11, 2026
4fb4abf
scheduler: compare request priorities as exact integers, not floats
AmanSwar Nov 11, 2026
0a258ae
scheduler: refuse a negative priority preemption threshold, as the CL…
AmanSwar Nov 11, 2026
0275700
prodlog: publish a gzipped segment only once complete, and read one c…
AmanSwar Nov 11, 2026
044db74
scheduler: order an lpm queue past its limit by arrival, not its stal…
AmanSwar Nov 11, 2026
b1ea9d1
prodlog: a truncated or corrupt .gz keeps the records read before it,…
AmanSwar Nov 11, 2026
cb9b00c
docs: /generate serves guided decoding, min_new_tokens and penalties …
AmanSwar Nov 11, 2026
e248ad0
docs: the Responses API's service_tier and reasoning refusals, and th…
AmanSwar Nov 11, 2026
4edc3d4
radix_cache: keep a tlru evicted tail when a different branch is inse…
AmanSwar Nov 11, 2026
b55a7e3
changelog: the graph variants are tested on CPU, not yet on Trainium2
AmanSwar Nov 11, 2026
42002c1
docs: the default graphs' equivalence and the variants' Trainium2 run…
AmanSwar Nov 11, 2026
b4c32af
tests: bound every engine priority test's drain loop
AmanSwar Nov 11, 2026
4caa4c7
engine: refuse a request the queue has no room for before building it…
AmanSwar Nov 11, 2026
e3b96ec
Merge the engine review fixes
AmanSwar Nov 11, 2026
e873916
Merge the Responses, Messages, stats and docs review fixes
AmanSwar Nov 11, 2026
75a574e
docs: a stop string inside min_tokens does not end the request
AmanSwar Nov 11, 2026
b12d200
serve: refuse a stop_regex that backtracks badly, and bound how far b…
AmanSwar Nov 11, 2026
f9e6859
tests: slow the scripted engine so a stop_regex abort reaches it befo…
AmanSwar Nov 11, 2026
acc141d
serve: keep the queue-full header on a /generate 503
AmanSwar Nov 11, 2026
905c6b8
serve: keep a /generate request sent with no_logs out of the producti…
AmanSwar Nov 11, 2026
a3d26ca
tests: wait for the engine to hold the first flush before sending the…
AmanSwar Nov 11, 2026
e6820a5
router: write only the start of a long prompt for its session key
AmanSwar Nov 11, 2026
cf9b646
router: answer a non-ASCII or overlong engine index with 400
AmanSwar Nov 11, 2026
f91a6be
router: bound /flush_cache's wait on an engine by the timeout it pass…
AmanSwar Nov 11, 2026
e025304
router: count a /health_generate 503 toward down_after instead of mar…
AmanSwar Nov 11, 2026
0f4c18c
Merge the API and router review fixes
AmanSwar Nov 11, 2026
74a92bd
serve: refuse a service_tier other than auto or default on the OpenAI…
AmanSwar Nov 11, 2026
a089e84
serve: say in /generate's docstring that guided decoding and penaltie…
AmanSwar Nov 11, 2026
f1b268d
docs: stop_regex limits, no_logs, and the router's health and flush a…
AmanSwar Nov 11, 2026
d1b5b88
changelog: stop_regex limits, no_logs and service_tier
AmanSwar Nov 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,58 @@ and versions follow [Semantic Versioning](https://semver.org/). Rebuild the comp

## [Unreleased]

### Added

- `/tokenize` and `/detokenize` (also under `/v1`), as SGLang and vLLM serve them. A chat request is counted exactly as
`/v1/chat/completions` would send it to the engine. The router sends them to any live engine without touching its
routing state ([docs/API.md](docs/API.md)).
- SGLang's native `/generate` (also PUT): `text` or `input_ids`, one prompt or a batch, SGLang's `sampling_params`,
streaming, output logprobs and request ids. The router routes it by its prompt or session
([docs/API.md](docs/API.md#generate)).
- SGLang's `/model_info`, `/server_info`, `/get_load`, `/health_generate`, `/abort_request` and `/flush_cache` (and
their `get_` names), on each engine and on the router, which asks one engine or all of them
([docs/API.md](docs/API.md#info-and-admin-endpoints)).
- `n` choices on `/v1/chat/completions` and `/v1/completions`, sharing the prompt through the prefix cache; a seed gives
choice i `seed + i`, as in vLLM ([docs/API.md](docs/API.md#sampling-extras)).
- SGLang's `stop_regex`, and keeping the stop text with `include_stop_str_in_output` (vLLM) or `no_stop_trim` (SGLang).
- `skip_special_tokens: false`, and SGLang's `matched_stop` on every finished choice.
- `stop_regex` refuses a pattern whose search can take exponential or polynomial time, and matches within the last
2048 characters of output.
Comment on lines +23 to +24

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Clarify that the 2048-character limit applies to the match start, not the complete match. Unbounded patterns can extend beyond that window.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At CHANGELOG.md, line 23:

<comment>Clarify that the 2048-character limit applies to the match start, not the complete match. Unbounded patterns can extend beyond that window.</comment>

<file context>
@@ -20,6 +20,9 @@ and versions follow [Semantic Versioning](https://semver.org/). Rebuild the comp
   choice i `seed + i`, as in vLLM ([docs/API.md](docs/API.md#sampling-extras)).
 - SGLang's `stop_regex`, and keeping the stop text with `include_stop_str_in_output` (vLLM) or `no_stop_trim` (SGLang).
 - `skip_special_tokens: false`, and SGLang's `matched_stop` on every finished choice.
+- `stop_regex` refuses a pattern whose search can take exponential or polynomial time, and matches within the last
+  2048 characters of output.
+- SGLang's `no_logs` on `/generate`: the request's record stays out of the production log.
</file context>
Suggested change
- `stop_regex` refuses a pattern whose search can take exponential or polynomial time, and matches within the last
2048 characters of output.
+- `stop_regex` refuses a pattern whose search can take exponential or polynomial time, and only searches for matches
+ starting within the last 2048 characters of output.

- SGLang's `no_logs` on `/generate`: the request's record stays out of the production log.
- The OpenAI Responses API, `POST /v1/responses`, stateless: reasoning, message and function-call items, and the
Responses stream events ([docs/API.md](docs/API.md#responses-api)).
- The Anthropic Messages API, `POST /v1/messages` and `/v1/messages/count_tokens`: thinking, text and tool-use blocks,
Anthropic's stream events and error shape ([docs/API.md](docs/API.md#anthropic-messages-api)).
- The router routes `/v1/responses` and `/v1/messages` by session and prefix as it routes chat, and sends
`/v1/messages/count_tokens` to any live engine.
- Scheduling flags with SGLang's names, host only and per engine: `--schedule-policy` (`fcfs`, `lpm`, `lof`, `spf`),
priority scheduling with the request field `priority` and priority preemption, `--max-queued-requests` and
`--max-queued-tokens` (a full queue answers 503), and `--radix-eviction-policy` (`lru`, `lfu`, `slru`, `priority`,
`tlru`). The defaults schedule as before ([docs/CONFIGURATION.md](docs/CONFIGURATION.md#scheduling)).
- `GET /v1/stats` adds the engine's live state and request rates, TTFT, decode-speed and end-to-end percentiles over
recent windows, and `GET /dashboard` draws them; the router serves both for each engine
([docs/API.md](docs/API.md#statistics-and-the-dashboard)). The fields the router reads are unchanged.
- `TRNRT_PROD_DIR`: an opt-in on-disk log of request records (counts and times only) and gauges.
- `TRNRT_PROMPT_CACHE_MB`: an opt-in prompt token cache that builds a chat turn's prompt ids from the previous turn's,
with the same ids as a full encode or none.
- Structured outputs through xgrammar, an optional dependency: `response_format` `json_object` and `json_schema`, vLLM's

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: These Added entries announce the graph variants as complete, but the PR description states the new graph variants have not been validated on Trainium2 and that graph-equivalence evidence is still pending. AGENTS.md invariant 1 requires tools/graph_equiv.py or device evidence for graph-shape changes, so defer or flag these entries until the variants pass equivalence on-device; otherwise the release notes assert behavior that is unverified.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At CHANGELOG.md, line 39:

<comment>These Added entries announce the graph variants as complete, but the PR description states the new graph variants have not been validated on Trainium2 and that graph-equivalence evidence is still pending. AGENTS.md invariant 1 requires `tools/graph_equiv.py` or device evidence for graph-shape changes, so defer or flag these entries until the variants pass equivalence on-device; otherwise the release notes assert behavior that is unverified.</comment>

<file context>
@@ -5,6 +5,51 @@ and versions follow [Semantic Versioning](https://semver.org/). Rebuild the comp
+- `TRNRT_PROD_DIR`: an opt-in on-disk log of request records (counts and times only) and gauges.
+- `TRNRT_PROMPT_CACHE_MB`: an opt-in prompt token cache that builds a chat turn's prompt ids from the previous turn's,
+  with the same ids as a full encode or none.
+- Structured outputs through xgrammar, an optional dependency: `response_format` `json_object` and `json_schema`, vLLM's
+  `guided_*` and `structured_outputs`, and SGLang's `json_schema`, `regex` and `ebnf`. Also `min_tokens` and
+  `thinking_token_budget`. They need `--structured-outputs`, which adds graphs that take a token mask
</file context>

`guided_*` and `structured_outputs`, and SGLang's `json_schema`, `regex` and `ebnf`. Also `min_tokens` and
`thinking_token_budget`. They need `--structured-outputs`, which adds graphs that take a token mask
([docs/API.md](docs/API.md#structured-outputs-penalties-and-thinking-budgets)). Tested on CPU; not yet run on
Trainium2, and the check that the default graphs are unchanged is pending.
- Repetition, frequency and presence penalties, with `--penalties` and `--penalty-buckets`, which add graphs that take
penalty inputs ([docs/CONFIGURATION.md](docs/CONFIGURATION.md#structured-outputs-penalties-and-thinking-budgets)).
Tested on CPU; not yet run on Trainium2.

### Changed

- The stop token that ends a request (EOS or a `stop_token_ids` entry) is no longer part of its text when the tokenizer
does not mark it special, as in vLLM and SGLang.
- `min_new_tokens` (SGLang's name for `min_tokens`) and `spaces_between_special_tokens: false` are refused with 400;
they were ignored.
- `service_tier` other than `"auto"` or `"default"` is refused with 400 on `/v1/chat/completions`, `/v1/completions`
and `/v1/responses`.

## [0.1.0] - 2026-11-08

The first public release.
Expand Down
Loading
Loading