I wasn't involved with Lucene at that time, but I expect it came down to a 
better tradeoff between precision and range, and better support within modern 
JDKs (e.g. conversion methods on java.lang.Float).

On precision and range..

bf16 has an 8 bit exponent and 7 bit mantissa.

fp16 has a 5 bit exponent and 10 bit mantissa.

Both use 1 bit for the the sign.

More bits in the exponent give a wider dynamic range, while more bits in the 
mantissa give better precision. Assuming normalized vectors, it was likely 
judged that the greater dynamic range of bf16 wasn't useful, and greater 
precision would be more worthwhile.

Historically bf16 was cheaper to convert to and from fp32 without hardware 
support - since they have the same number of exponent bits you only needed to 
truncate or extend the mantissa. Much of the early popularity of bf16 I think 
is attributable to this.


Paul Richards

________________________________
From: Simon Cooper via dev <[email protected]>
Sent: Thursday, November 12, 2026 9:35 AM
To: [email protected] <[email protected]>
Cc: Simon Cooper <[email protected]>
Subject: [EXTERNAL] Float16 vectors in Lucene 11


CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you can confirm the sender and know the 
content is safe.

Hi,

Lucene 11 adds IEEE Float16 support to kNN vectors. I can't find any discussion 
about the pros and cons of Float16 vs BFloat16, and why specifically Float16 
was chosen for implementation. Can someone point me to the discussion, or 
outline why we went with Float16?

Thanks,
SimonC



Amazon Development Centre (Scotland) Limited registered office: Waverley Gate, 
2-4 Waterloo Place, Edinburgh EH1 3EG, Scotland. Registered in Scotland 
Registration number SC26867



Reply via email to