Skip to content

Score prompt logprobs in llm-server --replay - #382

Merged
stikves merged 1 commit into
apple:mainfrom
stikves:sukru/replay-loglikelihood
Oct 30, 2026
Merged

stikves merged 1 commit into
apple:mainfrom
stikves:sukru/replay-loglikelihood

Conversation

@stikves

@stikves stikves commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

A --replay line can now carry a /v1/completions body under completion, so log-likelihood scoring, such as rolling-window perplexity, runs from a file without HTTP:

{"id":"d0","completion":{"prompt":[[504,3575,282,4649],[4649,314,7042,30]],"logprobs":0}}

Its result carries choices in the /v1/completions shape. Both paths score through runLoglikelihood; put many prompts in one line, since the scorer batches within a line.

@stikves
stikves marked this pull request as ready for review October 29, 2026 00:35
@stikves
stikves requested a review from a team as a code owner October 29, 2026 00:35
@stikves
stikves requested review from Lewis300 and guru-desh October 29, 2026 00:35
@stikves stikves self-assigned this Oct 30, 2026
A replay line can carry a `completion` body (a `/v1/completions` request)
in place of a chat `request`, so scoring runs from a JSONL file the same
way chat does.

- `ReplayRequest.body` is `.chat` or `.completion`; each line has exactly
  one of `request` or `completion`.
- `ReplayResult.choices` takes the shape of the matching response, so a
  completion line returns `token_logprobs`, `top_logprobs`, `tokens` and
  `text_offset`.
- `runLoglikelihood` scores the prompts for both `/v1/completions` and
  `--replay`.
- Completion lines run under the scoring access, one at a time; the
  scorer batches the prompts within a line. On an engine without logits
  the line reports the same error as the endpoint's 501.
@stikves
stikves force-pushed the sukru/replay-loglikelihood branch from f499aa4 to e4b4cbf Compare October 30, 2026 18:27
@stikves
stikves merged commit 1c25c57 into apple:main Oct 30, 2026
3 checks passed
@stikves
stikves deleted the sukru/replay-loglikelihood branch October 30, 2026 18:52
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.

2 participants