Skip to content

Commit cfb6ab6

Browse files
aoshen02fede-kamel
andcommitted
Remove hollow unit test, strengthen e2e with semantic checks
The unit test only verified that a Python if/else branches correctly — it was a copy of the production logic, not a test of it. Replace with a stronger e2e assertion: raw_logprobs must be <= 0 (log_softmax guarantee), and the two modes must produce different values. Co-authored-by: Federico Kamelhar <209537060+fede-kamel@users.noreply.github.com> Co-authored-by: Allen Shen <aoshen@inferact.ai> Signed-off-by: Allen Shen <aoshen@inferact.ai>
1 parent 84809b3 commit cfb6ab6

2 files changed

Lines changed: 8 additions & 40 deletions

File tree

tests/v1/sample/test_prompt_logprobs_mode.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

tests/v1/sample/test_sampling_params_e2e.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ def test_seed(llm):
185185

186186

187187
def test_prompt_logprobs_respects_logprobs_mode():
188-
"""prompt_logprobs values must differ between raw_logits and raw_logprobs."""
188+
"""raw_logits must return positive logits, raw_logprobs must return
189+
negative log_softmax values, and both must differ."""
189190
prompt = "Hello world"
190191
values: dict[str, float] = {}
191192

@@ -201,6 +202,12 @@ def test_prompt_logprobs_respects_logprobs_mode():
201202
values[mode] = out.prompt_logprobs[1][tok_id].logprob
202203
del engine
203204

205+
# log_softmax values are always <= 0; raw logits for the top token
206+
# are typically positive. This verifies the mode actually changed
207+
# the computation, not just that two floats differ.
208+
assert values["raw_logprobs"] <= 0, (
209+
f"raw_logprobs should be <= 0, got {values['raw_logprobs']}"
210+
)
204211
assert values["raw_logits"] != values["raw_logprobs"], (
205212
"prompt_logprobs should differ between logits and logprobs modes"
206213
)

0 commit comments

Comments
 (0)