Skip to content

[MaxText][RL] Omit Redundant Weight Resharding Prior to Step 0 Evaluation & Add Engram Inheritance - #4636

Draft
igorts-git wants to merge 2 commits into
mainfrom
igorts/b528378191-slow-aot-attempt3
Draft

[MaxText][RL] Omit Redundant Weight Resharding Prior to Step 0 Evaluation & Add Engram Inheritance#4636
igorts-git wants to merge 2 commits into
mainfrom
igorts/b528378191-slow-aot-attempt3

Conversation

@igorts-git

Copy link
Copy Markdown
Collaborator

Description

his PR optimizes startup latency and restores evaluation stability for MaxText Reinforcement Learning (RL) post-training workloads (train_rl.py).

Key Changes

  1. Omit Redundant Weight Resharding Prior to Step 0: Removed redundant rl_cluster.rollout.update_params(nnx.state(actor_model)) call prior to step 0 evaluation in train_rl.py. RLCluster setup (create_rl_components) already synchronizes Actor model weights with vLLM engines during setup, eliminating ~65 seconds of unnecessary weight resharding latency.
  2. Engram Inheritance in RLConfig: Added Engram to RLConfig's inheritance list in src/maxtext/configs/types.py. Exposes sparse memory attributes (engram_layers, engram_num_heads, etc.) accessed during evaluation, preventing AttributeError exceptions during pre-training rollouts.

Tests

Ran train_rl.py on TPU VM.
CI test.

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • 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, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

Include Engram in RLConfig inheritance chain under the Mixture of Experts section.
This ensures DeepSeek Engram configuration fields (engram_layers, engram_num_heads,
engram_kernel_size, engram_seed, etc.) are properly exposed and validated when initializing
RL training jobs using RLConfig, preventing AttributeError exceptions during pre-training rollouts.
…luation

Remove redundant rl_cluster.rollout.update_params(nnx.state(actor_model)) call
prior to step 0 pre-RL evaluation in train_rl.py.

Rationale & Longevity:
Actor model parameters are already synchronized with vLLM rollout engines during RLCluster setup
(create_rl_components). Skipping this duplicate parameter transfer eliminates ~65s of unnecessary
weight resharding latency prior to step 0 evaluation.
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

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