Skip to content

Add Implementation of Native Sparse Attention#137

Open
yukavio wants to merge 26 commits intoHazyResearch:mainfrom
yukavio:nsa
Open

Add Implementation of Native Sparse Attention#137
yukavio wants to merge 26 commits intoHazyResearch:mainfrom
yukavio:nsa

Conversation

@yukavio
Copy link

@yukavio yukavio commented Jul 22, 2025

This PR try to add Implementation of Compressed Attention and Selected Attention of Native Sparse Attention
image

The hyperparameter of selected and compressed attention kernel is setting for good performance on H20. It should be changed if we want to get better performance on other devices.
This PR is not ready for merging. I will reorganize the code and add details of performance metrics for this PR this week.

The full implementation which could be used to training the Native Sparse Model could be find at https://github.com/yukavio/nsa/tree/main/. The current codebase is implemented with Triton, but we will soon switch to the kernel introduced in this PR for better performance. This is my first time contributing code to the ThunderKittens community, and I welcome any suggestions for improvement from the community.

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