liveBook · Manning

Bfloat16

As explained in Deep Learning with JAX

A 16-bit floating-point format with a float32-like exponent range and reduced significand precision, commonly used for deep learning.

Need lower-memory floating-point arrays for deep learning? bfloat16 gives JAX a 16-bit format with a float32-like exponent range and reduced significand precision. It uses less storage than float32 and sits alongside float16, float32, and float64 in JAX's dtype system. section 3.3.2

Create and inspect a bfloat16 array

xb16 = jnp.array(range(10), dtype=jnp.bfloat16) xb16.dtype >>> dtype(bfloat16) xb16.nbytes >>> 20 A ten-element array therefore reports the bfloat16 dtype and occupies 20 bytes. Mixing xb16 with float16 promotes the result to float32, while adding two bfloat16 arrays preserves bfloat16. section 3.3.2

How Deep Learning with JAX covers it

How deep it goes
Defines the format, demonstrates construction and storage, and tests promotion with float16; it stops short of training details.
Examples
Demonstrates a ten-element bfloat16 array, its 20-byte size, and additions with bfloat16 and float16.
What you can do after
Operate JAX arrays with bfloat16 and predict result dtypes when combining bfloat16 and float16 operands.
How it connects
Connects bfloat16 with JAX arrays, NumPy dtype behavior, float16, float32, float64, and type promotion.

Also explained in

Compare how 3 books explain bfloat16 →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with JAX. The section links point to the parts of the book it draws on.