Skip to content

Use the actual global token count in distributed Sinkhorn - #9

Merged
sezginerr merged 1 commit into
mainfrom
fix/sinkhorn-global-token-count
Sep 15, 2026
Merged

sezginerr merged 1 commit into
mainfrom
fix/sinkhorn-global-token-count

Conversation

@sezginerr

Copy link
Copy Markdown
Member

The Sinkhorn-Knopp denominator assumed every rank holds the same number of rows (local_rows * world_size). iBOT block masking gives ranks different masked-token counts, so the prototype targets were biased. Sum the real local row counts across ranks instead; equal-count inputs (e.g. CLS logits) are bit-identical. A rank may now hold zero rows; a globally empty batch raises.

Adds single-process and two-rank gloo tests: equal-count parity with the historical implementation, unequal-count parity with a plain Sinkhorn over all tokens, and empty-rank handling.

The Sinkhorn-Knopp denominator assumed every rank holds the same number of
rows (local_rows * world_size). iBOT block masking gives ranks different
masked-token counts, so the prototype targets were biased. Sum the real local
row counts across ranks instead; equal-count inputs (e.g. CLS logits) are
bit-identical. A rank may now hold zero rows; a globally empty batch raises.

Adds single-process and two-rank gloo tests: equal-count parity with the
historical implementation, unequal-count parity with a plain Sinkhorn over
all tokens, and empty-rank handling.
@sezginerr
sezginerr merged commit 43c05c6 into main Sep 15, 2026
3 of 4 checks passed
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