-
-
Notifications
You must be signed in to change notification settings - Fork 792
Open
Labels
QuestionFurther information is requestedFurther information is requested
Description
I have a question regarding the functional.py file in the bitsandbytes library, specifically the comment on line 855:
0b000 = 0
0b001 = 0.0625
0b010 = 8
0b011 = 12
0b100 = 4
0b101 = 6
0b110 = 2
0b111 = 3
can also be created with bnb.functional.create_fp8_map(signed=True, exponent_bits=2, precision_bits=1, total_bits=4)
For the FP4 format with 1 sign bit, 2 exponent bits, and 1 mantissa bit, where the sign bit is 0, I'm struggling to understand why the values are calculated as shown above.
According to the IEEE 754 standard, I believe the calculations should be(not considering bias):
0b000 = 0
0b001 = 1.5 (1 + 1*2^-1) * 2^0
0b010 = 2 (1 + 0*2^-1) * 2^1
0b011 = 3 (1 + 1*2^-1) * 2^1
0b100 = 4 (1 + 0*2^-1) * 2^2
0b101 = 6 (1 + 1*2^-1) * 2^2
0b110 = 8 (1 + 0*2^-1) * 2^3
0b111 = 12 (1 + 1*2^-1) * 2^3
What am I missing here? Additionally, could you advise on what documents I should refer to for a better understanding of the FP4 format?
Thank you for your assistance.
ghishadow
Metadata
Metadata
Assignees
Labels
QuestionFurther information is requestedFurther information is requested