Skip to content

victorchall/fp-precision-graph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Precision visualizer

This is a basic application that allows you to visualize the precision of a floating point number with various mantissa and exponent sizes along the real number line.

It is based off Olli Etuaho's js app (code) that has functions to simulate floating point operations at arbitrary precision, but converted to Python and using matplotlib for visualization along with common precisions implemented in Nvidia GPU or other hardware.

Requirements

  • Python 3 (written in 3.10)
  • tkinter
  • matplotlib
  • numpy

Usage

python precision.py

Try out the zoom and recenter buttons to compare how different numbers are represented. For instance, try zooming in on the number 1.0 (1e0) and see how the precisions compare as you zoom in, or zoom to ~1e5 to see where FP16 range is limited (65,504).

FP8

The simulation for FP8 is only trivially implemented and probably needs more investigation of the FP8 paper and the actual hardware implementation and behavior.

Further reading

Formats such as FP8, Int8 are typically used in heirarhical quantization schemes, with block-wise biases and scaling factors.

If you are interested in quantization you should start by reading 8-bit Optimizers via Block-wise Quantization and the LoRA: Low-Rank Adaptation of Large Language Models.

screenshot

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages