Skip to content

[Feat] Perft E#2155

Open
Jackmin801 wants to merge 3 commits intomainfrom
feat-perft-e
Open

[Feat] Perft E#2155
Jackmin801 wants to merge 3 commits intomainfrom
feat-perft-e

Conversation

@Jackmin801
Copy link
Copy Markdown
Member

@Jackmin801 Jackmin801 commented Mar 31, 2026

Note

Medium Risk
Adds a new MoE LoRA application path (perft_e) with custom forward/EP handling, which could affect training correctness and performance for MoE models. Also changes adapter checkpoint/broadcast serialization to cast to a configurable dtype, which may impact downstream loading expectations and numeric fidelity.

Overview
Adds a new MoE LoRA strategy, moe_lora_mode="perft_e", that applies a single bypass LoRA over the entire MoE block (PErFT-E) via the new MultiLoRAPERFTE module and updates apply_lora_to_model to select it vs the existing per-projection MoE LoRA.

Introduces LoRAConfig.save_dtype and updates both weight checkpointing (WeightCheckpointManager.get_run_adapter_state_dict) and filesystem weight broadcast (adapter-only path) to cast LoRA adapter tensors to CPU in the configured dtype before saving.

Written by Cursor Bugbot for commit 4eac31f. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Field(
description="MoE LoRA strategy. 'per_projection' applies separate LoRA to each of w1/w2/w3. 'perft_e' applies a single bypass LoRA to the entire MoE block (PErFT-E).",
),
] = "per_projection"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New config fields missing CHANGELOG entry

Low Severity

Two new config fields are added to LoRAConfig in src/prime_rl/configs/trainer.pymoe_lora_mode and save_dtype — without a corresponding CHANGELOG.md update. Per the project rule, any PR modifying configuration structures (including added fields) in src/prime_rl/*/config.py must update the changelog.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: BugBot Instructions

DTYPE_MAP = {
"bfloat16": torch.bfloat16,
"float32": torch.float32,
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate DTYPE_MAP definitions across files

Low Severity

This PR introduces two new identical DTYPE_MAP / _DTYPE_MAP dictionaries (in ckpt.py and filesystem.py) that duplicate the existing DTYPE_MAP already defined in src/prime_rl/trainer/model.py. All three map the same two strings to the same torch dtypes. A single shared definition would avoid inconsistency risk if new dtypes are added later.

Additional Locations (1)
Fix in Cursor Fix in Web

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