Skip to content

[Fix] Fix logprob and normalized_logprob - #1428

Merged
merrymercy merged 16 commits into
mainfrom
logprob
Sep 15, 2024
Merged

merrymercy merged 16 commits into
mainfrom
logprob

Conversation

@merrymercy

@merrymercy merrymercy commented Sep 15, 2024 •

Copy link
Copy Markdown
Collaborator

There are multiple bugs in how we compute the logprob and normalized logprobs. Sometimes the logprobs of input tokens are not returned correctly.
This PR cleans up and fixes them.

@merrymercy merrymercy changed the title [Fix] Fix logprob lens [Fix] Fix logprob and normalized_logprob Sep 15, 2024
@merrymercy
merrymercy merged commit 9ba1f09 into main Sep 15, 2024
@merrymercy
merrymercy deleted the logprob branch September 15, 2024 13:36
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 16, 2026
…DCP extend path

Boot kvt6d (16.09. 15:35Z, D-layout TP3 uneven DCP + MTP + graphs, --kv-tail-min-tokens 16384,
no memory saver): READY after 120 s, ring 36864 rows/rank bf16, 0 tracebacks at boot. On the
needle request the verify plan attended 3 tail rows (6 ring rows held) but tail_merges stayed 0
and the W56 falsifier stopped the step by name: the sgl-project#1426 merge hook sat only on the non-DCP
forward_extend, while this layout runs _forward_extend_dcp.

Fix: after each of the two paged body reads of _forward_extend_dcp (prefill_wrapper_paged
.forward_return_lse over q_full) the rank-local body partial is merged with the rank-local
ring partial (_kv_tail_merge_verify) BEFORE cp_lse_ag_out_ar_mha_uneven -- the tail is a
partition of this rank's owned set. _kv_tail_merge_verify accepts the 3-D q_full unchanged
(the tail wrapper is planned with the same iu.num_qo_heads as the body wrapper).

Tests: test/registered/unit/mem_cache/test_kv_tail_1243.py 127 passed, 19 subtests
(hermetic); new Test1428: every DCP paged read is followed by the tail merge before the
LSE all-gather; merge accepts 3-D q.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 16, 2026
…ICE counter, so a CUDA-graph replay counts

Boot kvt7d (16.09. 16:06Z, D-layout TP3 uneven DCP + MTP + graphs, --kv-tail-min-tokens 16384):
READY after 120 s, 0 tracebacks at boot; the DCP verify merge (sgl-project#1428) ran (tail_merges rose to
288 during graph capture). On the needle request the verify steps replayed captured graphs:
the tail wrapper's kernels ran, but note_merge() is Python and a replay runs no Python, so
tail_merges_this_step stayed 0 and the W56 falsifier refused a tail that WAS read
(W56 raised from init_forward_metadata_out_graph -> _kv_tail_plan_verify -> plan).

Fix: KvTailRing._merge_dev, an int64 device scalar bumped in note_merge() by a captured
kernel; plan() (out of graph) reads it and folds the delta into tail_merges /
tail_merges_this_step before the W56 judgement. Eager steps count once (delta == Python
count), replays count on the device only. reset() zeroes it.

Tests: test/registered/unit/mem_cache/test_kv_tail_1243.py 130 passed, 19 subtests
(hermetic): replayed-graph merges (device bump, no note_merge) are accepted; eager merges
are not double counted; reset zeroes the device counter.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 16, 2026
…ject#1285 retry too. xsn188 died at the first wake with W4 although P answered /resume_memory_occupation 200: the kv_cache leg went out on the shared pooled session without an epoch, a stale keep-alive connection raised ServerDisconnectedError before any response line, and plain rpc() has no retry. Both KV legs now go through leg_rpc with credit_epoch(boot_epoch, epoch) -- one retry on a fresh force_close connection, deduplicated on the far side by the epoch-scoped leg ledger. Tests: 1285, 1233, 1394/1369 green.
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.

1 participant