Conversation
Summary of ChangesHello @fishcrap, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly upgrades AReaL by integrating comprehensive FP8 training support. The primary goal is to enable memory-efficient training with reduced precision without compromising model stability. This is achieved through the introduction of new FP8 quantization and dequantization utilities, extensive configuration options via the CLI, and updates to model loading and saving processes to handle FP8 weights. The core Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive FP8 training support, including new utilities for quantization/dequantization, CLI configurations, and updates to model loading/saving to handle FP8 weights. The changes are extensive and well-structured. I've identified a few areas with TODO or FIXME comments in the new code, particularly in tests and utility functions, that should be addressed to ensure correctness and clarity. The overall implementation seems robust, with good integration into the existing MegatronEngine and the addition of a comprehensive test suite.
|
I think end-to-end training testcases should be added to |
@rchardx It would be good but the test won't run in CI A100 nodes. We can just run them offline. |
rchardx
left a comment
There was a problem hiding this comment.
The core functionality looks solid. Once these changes (including others made ones) are addressed, this PR should be ready to merge.
Agreed. |
- Move fp8 utilities to areal/utils/fp8/ with clearer module separation - Implement UE8M0 quantization locally, eliminating sglang import - Extract common utils: areal/utils/math.py, areal/utils/cuda.py - Improve constants.py organization and naming - Clarify high_precision_init_val comment for FP8 HF model loading 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Use lazy initialization for DeepGEMM detection to avoid import-time CUDA access failures on CPU-only environments - Add informative error message for UE8M0 block size assertion - Document FP8 E4M3 max value (448.0) in quantization code
This PR adds comprehensive FP8 (8-bit floating point) training support to AReaL, enabling memory-efficient training with low precision while maintaining training stability. The implementation includes: - **FP8 quantization/dequantization utilities**: New `fp8_utils.py` and `fp8_kernels.py` modules providing blockwise quantization support - **CLI configuration**: Extended `TrainEngineConfig` with FP8-related options (fp8 mode, recipe, parameter quantization, etc.) - **Model loading/saving**: Updated HuggingFace model loading and saving to handle FP8 weights with proper conversion between PyTorch FP8 and Transformer Engine FP8 formats - **Megatron engine integration**: Enhanced `MegatronEngine` to support FP8 training with proper configuration propagation - **Comprehensive test suite**: Added extensive tests for FP8 conversion, BF16 comparison, and gradient correctness The implementation supports the blockwise scheme, with integration into Transformer Engine's FP8 infrastructure for efficient GEMM operations.
This PR adds comprehensive FP8 (8-bit floating point) training support to AReaL, enabling memory-efficient training with low precision while maintaining training stability. The implementation includes: - **FP8 quantization/dequantization utilities**: New `fp8_utils.py` and `fp8_kernels.py` modules providing blockwise quantization support - **CLI configuration**: Extended `TrainEngineConfig` with FP8-related options (fp8 mode, recipe, parameter quantization, etc.) - **Model loading/saving**: Updated HuggingFace model loading and saving to handle FP8 weights with proper conversion between PyTorch FP8 and Transformer Engine FP8 formats - **Megatron engine integration**: Enhanced `MegatronEngine` to support FP8 training with proper configuration propagation - **Comprehensive test suite**: Added extensive tests for FP8 conversion, BF16 comparison, and gradient correctness The implementation supports the blockwise scheme, with integration into Transformer Engine's FP8 infrastructure for efficient GEMM operations.
Description
This PR adds comprehensive FP8 (8-bit floating point) training support to AReaL, enabling memory-efficient training with low precision while maintaining training stability. The implementation includes:
fp8_utils.pyandfp8_kernels.pymodules providing blockwise quantization supportTrainEngineConfigwith FP8-related options (fp8 mode, recipe, parameter quantization, etc.)MegatronEngineto support FP8 training with proper configuration propagationThe implementation supports the blockwise scheme, with integration into Transformer Engine's FP8 infrastructure for efficient GEMM operations.
Related Issue
Fixes #(issue)
Type of Change
Checklist
jb build docs/gemini review)Breaking Change Details (if applicable):
N/A - This is a new feature that adds optional FP8 support without breaking existing functionality.
Additional Context
Training Curve
TODO: