Repository navigation
[rl] Add CI for RL integration tests - #2300
Conversation
fix comments remove tests add enable_gqa flag [ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
… inference" [ghstack-poisoned]
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * #2300 * __->__ #2299 Following #2259 Context: Fix RL attention implementation, add numerics check scripts comparing torchtitan Qwen3 model (with vllm wrapper) and vllm native Qwen3 model NOTE: I tried enabling CI for this work, but need more efforts install vllm from source code (need to build vllm from scratch). Will enable CI in later PRs
[ghstack-poisoned]
… inference" [ghstack-poisoned]
[ghstack-poisoned]
… native inference"
Test cases:
1. Integration tests:
- multiple GPU (with TP), no compile + cudagraph
- multiple GPU, with compile + cudagraph
- This test runs on A10G (default CI GPU type), and uses FA2 for attention part.
2. Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.
- test_weights_match: max_diff <= 1e-5 (exact weight loading)
- test_attention_module: atol=1e-5 (TP=1)
- test_end_to_end_logits: atol=1e-3 (TP=1)
- We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.
- This test runs on H100, and runs FA3 kernel for attention.
Both tests are downloading from huggingface and run test on qwen3 0.6B.
[ghstack-poisoned]
Test cases:
1. Integration tests:
- multiple GPU (with TP), no compile + cudagraph
- multiple GPU, with compile + cudagraph
- This test runs on A10G (default CI GPU type), and uses FA2 for attention part.
2. Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.
- test_weights_match: max_diff <= 1e-5 (exact weight loading)
- test_attention_module: atol=1e-5 (TP=1)
- test_end_to_end_logits: atol=1e-3 (TP=1)
- We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.
- This test runs on H100, and runs FA3 kernel for attention.
Both tests are downloading from huggingface and run test on qwen3 0.6B.
[ghstack-poisoned]
… native inference"
Test cases:
1. Integration tests:
- multiple GPU (with TP), no compile + cudagraph
- multiple GPU, with compile + cudagraph
- This test runs on A10G (default CI GPU type), and **uses FA2 for attention part as FA3 doesn't support A10G machine.**
2. Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.
- test_weights_match: max_diff <= 1e-5 (exact weight loading)
- test_attention_module: atol=1e-5 (TP=1)
- test_end_to_end_logits: atol=1e-3 (TP=1)
- We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.
- This test runs on H100, and runs FA3 kernel for attention.
Both tests are downloading from huggingface and run test on qwen3 0.6B.
[ghstack-poisoned]
Test cases:
1. Integration tests:
- multiple GPU (with TP), no compile + cudagraph
- multiple GPU, with compile + cudagraph
- This test runs on A10G (default CI GPU type), and **uses FA2 for attention part as FA3 doesn't support A10G machine.**
2. Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.
- test_weights_match: max_diff <= 1e-5 (exact weight loading)
- test_attention_module: atol=1e-5 (TP=1)
- test_end_to_end_logits: atol=1e-3 (TP=1)
- We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.
- This test runs on H100, and runs FA3 kernel for attention.
Both tests are downloading from huggingface and run test on qwen3 0.6B.
[ghstack-poisoned]
… native inference"
Test cases:
1. Integration tests:
- multiple GPU (with TP), no compile + cudagraph
- multiple GPU, with compile + cudagraph
- This test runs on A10G (default CI GPU type), and **uses FA2 for attention part as FA3 doesn't support A10G machine.**
2. ~Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.~
- test_weights_match: max_diff <= 1e-5 (exact weight loading)
- test_attention_module: atol=1e-5 (TP=1)
- test_end_to_end_logits: atol=1e-3 (TP=1)
- ~We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.~
- ~This test runs on H100, and runs FA3 kernel for attention.~
Both tests are downloading from huggingface and run test on qwen3 0.6B.
[ghstack-poisoned]
Test cases:
1. Integration tests:
- multiple GPU (with TP), no compile + cudagraph
- multiple GPU, with compile + cudagraph
- This test runs on A10G (default CI GPU type), and **uses FA2 for attention part as FA3 doesn't support A10G machine.**
2. ~Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.~
- test_weights_match: max_diff <= 1e-5 (exact weight loading)
- test_attention_module: atol=1e-5 (TP=1)
- test_end_to_end_logits: atol=1e-3 (TP=1)
- ~We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.~
- ~This test runs on H100, and runs FA3 kernel for attention.~
Both tests are downloading from huggingface and run test on qwen3 0.6B.
[ghstack-poisoned]
|
Update: remove numerics test in this PR. Will adding more rigorous numerics test along with deterministic mode in next PRs. Discussed with @tianyu-l offline, we should aim for adding the numerics using the same pattern with pre-training side CI:
|
| # the varlen attention API to work with paged attention (KV cache in block | ||
| # layout) because vLLM uses default page size 16 but FA2 only supports | ||
| # page_size=256. Error out if FA3 is not available in the current environment. | ||
| if current_flash_attention_impl() != "FA3": |
There was a problem hiding this comment.
why deleting this line? I'm not sure if there's a cost associated with this line. cc @liangel-02 @zhxchen17
There was a problem hiding this comment.
Previously the check is saying if current attention is not FA3, then we should activate FA3. However on A20G machine, this should not be true as we want to use FA2 instead of FA3.
So I changed the check to be if the machine has SM 9.0+, then activate FA3
There was a problem hiding this comment.
Oh that's not what I was asking. I'm asking why don't we do
if has_cuda_capability(9, 0):
if current_flash_attention_impl() != "FA3":
activate_flash_attention_impl("FA3")
why do we omit if current_flash_attention_impl() != "FA3": now? If it is not helping, why we have it before?
There was a problem hiding this comment.
You are right, it will just activate FA3 once, not every layer's attention. Changed
Test cases:
1. Integration tests:
- multiple GPU (with TP), no compile + cudagraph
- multiple GPU, with compile + cudagraph
- This test runs on A10G (default CI GPU type), and **uses FA2 for attention part as FA3 doesn't support A10G machine.**
2. ~Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.~
- test_weights_match: max_diff <= 1e-5 (exact weight loading)
- test_attention_module: atol=1e-5 (TP=1)
- test_end_to_end_logits: atol=1e-3 (TP=1)
- ~We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.~
- ~This test runs on H100, and runs FA3 kernel for attention.~
Both tests are downloading from huggingface and run test on qwen3 0.6B.
[ghstack-poisoned]
Test cases:
1. Integration tests:
- multiple GPU (with TP), no compile + cudagraph
- multiple GPU, with compile + cudagraph
- This test runs on A10G (default CI GPU type), and **uses FA2 for attention part as FA3 doesn't support A10G machine.**
2. ~Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.~
- test_weights_match: max_diff <= 1e-5 (exact weight loading)
- test_attention_module: atol=1e-5 (TP=1)
- test_end_to_end_logits: atol=1e-3 (TP=1)
- ~We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.~
- ~This test runs on H100, and runs FA3 kernel for attention.~
Both tests are downloading from huggingface and run test on qwen3 0.6B.
[ghstack-poisoned]
| # the varlen attention API to work with paged attention (KV cache in block | ||
| # layout) because vLLM uses default page size 16 but FA2 only supports | ||
| # page_size=256. Error out if FA3 is not available in the current environment. | ||
| if current_flash_attention_impl() != "FA3": |
There was a problem hiding this comment.
Oh that's not what I was asking. I'm asking why don't we do
if has_cuda_capability(9, 0):
if current_flash_attention_impl() != "FA3":
activate_flash_attention_impl("FA3")
why do we omit if current_flash_attention_impl() != "FA3": now? If it is not helping, why we have it before?
Test cases:
1. Integration tests:
- multiple GPU (with TP), no compile + cudagraph
- multiple GPU, with compile + cudagraph
- This test runs on A10G (default CI GPU type), and **uses FA2 for attention part as FA3 doesn't support A10G machine.**
2. ~Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.~
- test_weights_match: max_diff <= 1e-5 (exact weight loading)
- test_attention_module: atol=1e-5 (TP=1)
- test_end_to_end_logits: atol=1e-3 (TP=1)
- ~We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.~
- ~This test runs on H100, and runs FA3 kernel for attention.~
Both tests are downloading from huggingface and run test on qwen3 0.6B.
[ghstack-poisoned]
Test cases:
1. Integration tests:
- multiple GPU (with TP), no compile + cudagraph
- multiple GPU, with compile + cudagraph
- This test runs on A10G (default CI GPU type), and **uses FA2 for attention part as FA3 doesn't support A10G machine.**
2. ~Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.~
- test_weights_match: max_diff <= 1e-5 (exact weight loading)
- test_attention_module: atol=1e-5 (TP=1)
- test_end_to_end_logits: atol=1e-3 (TP=1)
- ~We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.~
- ~This test runs on H100, and runs FA3 kernel for attention.~
Both tests are downloading from huggingface and run test on qwen3 0.6B.
[ghstack-poisoned]
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * __->__ #2300 Test cases: 1. Integration tests: - multiple GPU (with TP), no compile + cudagraph - multiple GPU, with compile + cudagraph - This test runs on A10G (default CI GPU type), and **uses FA2 for attention part as FA3 doesn't support A10G machine.** 2. ~Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.~ - test_weights_match: max_diff <= 1e-5 (exact weight loading) - test_attention_module: atol=1e-5 (TP=1) - test_end_to_end_logits: atol=1e-3 (TP=1) - ~We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.~ - ~This test runs on H100, and runs FA3 kernel for attention.~ Both tests are downloading from huggingface and run test on qwen3 0.6B.
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * __->__ #2300 Test cases: 1. Integration tests: - multiple GPU (with TP), no compile + cudagraph - multiple GPU, with compile + cudagraph - This test runs on A10G (default CI GPU type), and **uses FA2 for attention part as FA3 doesn't support A10G machine.** 2. ~Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.~ - test_weights_match: max_diff <= 1e-5 (exact weight loading) - test_attention_module: atol=1e-5 (TP=1) - test_end_to_end_logits: atol=1e-3 (TP=1) - ~We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.~ - ~This test runs on H100, and runs FA3 kernel for attention.~ Both tests are downloading from huggingface and run test on qwen3 0.6B.
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * pytorch#2300 * __->__ pytorch#2299 Following pytorch#2259 Context: Fix RL attention implementation, add numerics check scripts comparing torchtitan Qwen3 model (with vllm wrapper) and vllm native Qwen3 model NOTE: I tried enabling CI for this work, but need more efforts install vllm from source code (need to build vllm from scratch). Will enable CI in later PRs
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * __->__ pytorch#2300 Test cases: 1. Integration tests: - multiple GPU (with TP), no compile + cudagraph - multiple GPU, with compile + cudagraph - This test runs on A10G (default CI GPU type), and **uses FA2 for attention part as FA3 doesn't support A10G machine.** 2. ~Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.~ - test_weights_match: max_diff <= 1e-5 (exact weight loading) - test_attention_module: atol=1e-5 (TP=1) - test_end_to_end_logits: atol=1e-3 (TP=1) - ~We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.~ - ~This test runs on H100, and runs FA3 kernel for attention.~ Both tests are downloading from huggingface and run test on qwen3 0.6B.
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * pytorch#2300 * __->__ pytorch#2299 Following pytorch#2259 Context: Fix RL attention implementation, add numerics check scripts comparing torchtitan Qwen3 model (with vllm wrapper) and vllm native Qwen3 model NOTE: I tried enabling CI for this work, but need more efforts install vllm from source code (need to build vllm from scratch). Will enable CI in later PRs
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * __->__ pytorch#2300 Test cases: 1. Integration tests: - multiple GPU (with TP), no compile + cudagraph - multiple GPU, with compile + cudagraph - This test runs on A10G (default CI GPU type), and **uses FA2 for attention part as FA3 doesn't support A10G machine.** 2. ~Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.~ - test_weights_match: max_diff <= 1e-5 (exact weight loading) - test_attention_module: atol=1e-5 (TP=1) - test_end_to_end_logits: atol=1e-3 (TP=1) - ~We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.~ - ~This test runs on H100, and runs FA3 kernel for attention.~ Both tests are downloading from huggingface and run test on qwen3 0.6B.
Stack from ghstack (oldest at bottom):
Test cases:
Numerics parity test: vLLM native model vs vLLM + TorchTitan wrapper.We would need to run numerics test for only TP=1. This is because we are assuming both torchtitan and vllm will make sure their multi-GPU implementation is on par with single GPU. And we can add more numerics test under parallelism if needed.This test runs on H100, and runs FA3 kernel for attention.Both tests are downloading from huggingface and run test on qwen3 0.6B.