MMLU benchmark for different inverse implementations#374
MMLU benchmark for different inverse implementations#374gioelegott wants to merge 17 commits intosgl-project:mainfrom
Conversation
Summary of ChangesHello @gioelegott, 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 enables the use of the AIV 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. Changelog
Activity
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 updates the fast_inv_tril function to handle a new tensor format and integrate with an NPU-specific triangular inverse operation, which is a good step towards optimizing for specific hardware. My review focuses on ensuring the correctness and robustness of this new implementation. I've found a critical issue in the padding logic that can cause unnecessary processing and memory allocation, and another high-severity issue related to tensor memory layout that could lead to unsafe operations. Code suggestions are provided to address these points.
The merge-base changed after approval.
|
When replacing |
I haven't tested the gsm8k benchmark myself, but I am surprised by the results you obtain. Do you get any errors during the benchmark execution? |
No errors occurred during the benchmark. Also in custom test: Output: |
In this PR we propose a small change that allows to integrate the AIV triangular_inverse into the triton backend of
fla.Additionally here we provide the instructions to run the sglang server on A2 and to evaluate different inverse implementations using the MMLU benchmark.
Running the sglang server
Once the server is up and running you can send requests with:
Model's accuracy
To check and compare the model's accuracy for different implementations of the triangular inverse, clone sgl-kernel-npu and sglang.
Then run:
From the docker image run the server, adjusting
--tp-sizeand--max-total-tokensso that the model can fit:From another window run the sglang benchmark:
cd sglang/benchmark/mmlu/ bash download_data.sh python3 bench_sglang.py --nsub 10This will run the benchmark on the model using the native implementation of GDN. By running this experiment we obtain:
Triton backend
To run the triton backend force reinstall
sgl-kernel-npuwith the latest version in the docker image:And run the sglang benchmark as before. By running it we obtained:
Fast inverse backend
To run the fast inverse backend some modifications of
sgl-kernel-npuare required. More precisely replacesolve_trilwithfast_inv_trilin https://github.com/sgl-project/sgl-kernel-npu/blob/main/python/sgl_kernel_npu/sgl_kernel_npu/fla/chunk.py#L215Then reinstall
sgl-kernel-npuagain with:And run the accuracy benchmark again as before. By running it we obtain: