Skip to content

Handle n > 1 consistently in output measurement and server token usage #565

Open

Description

@arekay-nv

Problem

Follow-up to #552, reviewed at c805b32655fe675520bc90a4fe182053816c1e39.

OpenAI chat and completions requests accept n > 1 from dataset rows. The benchmark measures the first choice, while server usage can sum tokens across all choices. PR #552 rejects these rows when server token counts are primary; the default client-primary mode warns and permits them.

For streams, omitting stream_options.include_usage does not guarantee that a server omits usage. Ordinary content frames are reduced to their first choice, losing choice multiplicity. A separate usage-only trailer has no choices, so the accumulator can accept summed counts as first-choice counts. Secondary server OSL/TPS/TPOT and paired comparisons then become misleading. The completions adapter shares this issue.

Reproduction

Pass these frames through OpenAIMsgspecAdapter.decode_sse_message and OpenAISSEAccumulator:

{"choices":[{"index":0,"delta":{"content":"first"}},{"index":1,"delta":{"content":"second"}}]}
{"choices":[],"usage":{"prompt_tokens":10,"completion_tokens":42}}

The result contains only first but publishes completion_tokens: 42. This corresponds to an accepted client-primary n: 2 request when an endpoint sends usage despite the request not asking for it.

Expected behavior

Define and consistently enforce the policy for n > 1. While measurement remains first-choice-only, summed usage must not be presented as valid first-choice server metrics. Carry request multiplicity into response accumulation or another reliable request-level guard. Do not rely solely on choice count in a single streaming frame: choices can arrive separately.

If full multi-choice benchmarking is supported instead, define its output population, per-choice accounting, and throughput semantics explicitly.

Validation

  • Cover chat and completions, streaming and non-streaming.
  • Cover multiple choices in one frame and choices in separate frames, followed by an empty-choices usage trailer.
  • Verify excluded summed counts are absent from events and appear as unavailable/partial in secondary server metrics and paired comparisons.
  • Preserve the server-primary setup rejection until multi-choice server measurement is defined.
  • Preserve n = 1 behavior.

This is follow-up work; #552 still has the described limitation for permitted n > 1 streams.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions