Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What exactly is the nf4 data type? #543

Closed
AlpinDale opened this issue Jun 27, 2023 · 4 comments
Closed

What exactly is the nf4 data type? #543

AlpinDale opened this issue Jun 27, 2023 · 4 comments
Labels
documentation Improvements or additions to documentation high priority (first issues that will be worked on) question Further information is requested

Comments

@AlpinDale
Copy link

There seems to be no proper explanation for the data type anywhere I've seen (maybe I'm not looking hard enough). What exactly is this data type, and how is FP4 normalized to get NF4?

@r3curs10n
Copy link

nf4 is the normalized float 4 bit data type. It quantizes floats into 4 bits. This video (at the specific timestamp) explains it in more detail: https://youtu.be/TPcXVJ1VSRI?t=563

@TimDettmers TimDettmers added documentation Improvements or additions to documentation question Further information is requested high priority (first issues that will be worked on) labels Jul 14, 2023
@TimDettmers
Copy link
Owner

See also the QLoRA paper: https://arxiv.org/abs/2305.14314

I will see to add documentation somewhere for people that are interested to learn more.

@TimDettmers
Copy link
Owner

I now added documentation in the commit above. Thanks again for reporting the lack of information on this.

@RonanKMcGovern
Copy link

I see, so instead of evenly distributing the quantized levels, they are normally distributed. Interesting the optimum is a normal distribution. Is this because language model weights are normally distributed - kind of surprises me?

Interesting it's not exactly symmetric as well, those 16 datapoints

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation high priority (first issues that will be worked on) question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants