Skip to content

Use single random seed across embedding chunks#4492

Merged
copybara-service[bot] merged 1 commit into
mainfrom
single_random_seed
Jul 17, 2026
Merged

Use single random seed across embedding chunks#4492
copybara-service[bot] merged 1 commit into
mainfrom
single_random_seed

Conversation

@Shuwen-Fang

@Shuwen-Fang Shuwen-Fang commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Description

Use a single random seed (rngs.params()) across all embedding chunks in RoutedMoE to ensure tokens are routed to the same destination for each chunk when random routing is enabled. This ensures tokens are routed to the same destination for each chunk, and removes unnecessary sorts across embedding chunks, reducing step time from 712 ms (xprof trace before) down to 665 ms (xprof trace after).

Tests

Added test_moe_emb_chunking_random_routing in tests/unit/moe_test.py to verify that chunked and non-chunked RoutedMoE with random routing produce identical outputs.

Checklist

  • I have performed a self-review of my code.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed.

@Shuwen-Fang Shuwen-Fang changed the title Use single random seed across embedding chunks in RoutedMoE and add r… Use single random seed across embedding chunks Jul 15, 2026
@copybara-service
copybara-service Bot merged commit f13ccd1 into main Jul 17, 2026
50 checks passed
@copybara-service
copybara-service Bot deleted the single_random_seed branch July 17, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants