Repository navigation
server: /v1/completions takes echo, the prompt's text and legacy logprobs ahead of an unchanged reply - #3526
Merged
Merged
Conversation
ashhart
added a commit
that referenced
this pull request
Nov 16, 2026
ashhart
added a commit
that referenced
this pull request
Nov 17, 2026
ashhart
force-pushed
the
lead/completions-echo
branch
4 times, most recently
from
November 20, 2026 09:05
9b4bfe0 to
6a1cbbb
Compare
ashhart
force-pushed
the
lead/completions-echo
branch
6 times, most recently
from
November 24, 2026 02:45
40d987f to
ca33bfd
Compare
ashhart
force-pushed
the
lead/completions-echo
branch
from
November 24, 2026 10:24
ca33bfd to
28ae653
Compare
This was referenced Nov 24, 2026
…robs ahead of an unchanged reply echo: true puts the prompt's decoded ids in front of text and, with logprobs, each prompt token's entry (null for the first) ahead of the reply's, whose entries stay as without echo. max_tokens 0 with echo returns the prompt alone. Engines without prompt_logprobs, streams, messages bodies and non-boolean values are refused by name; prompt_logprobs keeps its own count.
ashhart
force-pushed
the
lead/completions-echo
branch
from
November 24, 2026 15:50
28ae653 to
9e3d511
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Evaluation harnesses such as lm-evaluation-harness score loglikelihood tasks through OpenAI's legacy completions
echo: they send a prompt withmax_tokens0 or 1,logprobs: Kandecho: true, and read the prompt tokens' logprobs back. TensorFold ignoredecho, so those tasks couldn't be run against it. This servesechoon the existing prompt-row path.What this changes
echo: trueon/v1/completions: the prompt's text comes ahead oftext.With
logprobs: K: the legacy arrays (tokens,token_logprobs,top_logprobs,text_offset) list every prompt token before the reply's. The first prompt token hasnullintoken_logprobsandtop_logprobs, andtext_offsetcounts from 0.The reply's own entries:
tokens,token_logprobsandtop_logprobsare byte-identical to the same request withoutecho(tested); only theirtext_offsetmoves past the prompt.max_tokens: 0withecho: returns the prompt alone, withfinish_reason: "length"andcompletion_tokens: 0. The engine draws one token, which the reply drops.Refused with a 400 naming
echo: engines without prompt logprobs, streamed requests, bodies withmessages, and non-boolean values. Chat routes still ignore the field.prompt_logprobs: its output is unchanged. Its value is now built in the route from the engine's raw rows, soechoandprompt_logprobscan share one engine read with different counts.The echoed text: the prompt's token ids decoded, so
text,tokensandtext_offsetagree.Issue: n/a. This came from the 16 Nov check of competitor gap docs against main (
echoand lm-eval are listed for vLLM-class servers and Hyperflare); no issue or PR covered it.Stacked on: main. The draft code-infill PR,
suffix, stacks on this one.atc overlap --json: to run after review. server: a raw completions prompt list gets one choice a prompt, each the reply that prompt gets alone #3194 (prompt lists) and server: n of 1 through 16 choices on chat and completions, each its own request on the one prompt #3148 (n> 1) also touchopenai.zig, which is at 599 lines here, so whichever lands later may need a split.Field shapes: OpenAI's legacy completions reference (
developers.openai.com/api/reference/resources/completions/methods/create). No other engine's or harness's source was read.Checks on this head
tools/pr_check.py: 0 errors, 1 advisory warning).zig build test-logprob-offers-host: 44/44. Against main's sources, 4 of the 5 new tests fail; the fifth checks unchanged output.zig build test-golden: 325/338 equal, 0 unexpected (the 13 are the existing known list), plus three new cases (echo-false,echo-unsupported,echo-stream). Security goldens 55/55.zig fmt --check,git diff --check: clean.Receipt
n/a for speed: the reply's tokens are unchanged by construction and by test. It reaches inference only to read prompt rows, which engines with
prompt_logprobsalready return. A device run with lm-eval against a served model is the follow-up.Checklist
The title and description match the head commit.
New tests fail before the change, pass after it, and skip cleanly without their dependency.
Comments and docstrings are one line. No measurements or history in the source.
No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
Every token still goes through the lane rounds; generated tokens equal the request without
echo.Synthena (Ash's Agent)