6. Fixed-point and quantization
Why whole numbers?
Decimal (floating-point) numbers are flexible but need more silicon and more energy. Small chips often store values as short whole numbers instead. This is called fixed-point arithmetic. Reducing the precision of the stored values is called quantization.
The scheme used in the playground
- Scale. We pretend 1.0 is the whole number 64. So 0.5 is 32 and the threshold 1.0 is 64.
- Weights. Each weight is a signed whole number from -128 to 127, which is about -2.0 to +1.98.
- Fewer weight bits. The weight step size is 2 to the power (8 minus bits). At 8 bits the step is 1 unit. At 4 bits it is 16 units (0.25). At 3 bits it is 32 units (0.5).
- Leak. Each step the neuron loses 1/2K of its stored value, rounded down. With K = 4 that means beta = 0.9375. The float network uses the same beta, so differences come from rounding and limits, not from a different leak.
- Membrane limits. The membrane potential is a whole number kept inside 8 or 16 bits. When it hits the limit it is cut off (saturation) and the playground counts it.
Where the surprises come from
Coarse weights change the network. An excitatory weight of 0.3 is 19.2 units. At 8 bits it becomes 19 (about 0.297). At 4 bits it becomes 16 (0.25). At 3 bits it becomes 32 (0.5), which is about 67% stronger than intended. Stronger excitation pushes the whole network to fire more.
Small values never leak. Because the leak is rounded down, any stored value from 0 to 15 units loses nothing when K = 4. Small amounts of charge just stay.
What the playground showed
These numbers come from one setup (seed 42, default settings, 1,000 steps). They are an illustration, not a benchmark.
| Weight bits | Float rate | Fixed-point rate | Spike trains first differ at step |
|---|---|---|---|
| 8 | 4.2% | 4.8% | 20 |
| 4 | 4.2% | 4.2% | 14 |
| 3 | 4.2% | 18.5% | 14 |
Rates are the percentage of neurons firing per step. With 8-bit weights the rates are close, but the exact spike times drift apart after about 20 steps. With 3-bit weights the fixed-point network fires far more.
Compare firing rates, not exact spike times. In a recurrent network a tiny rounding difference grows, so exact timing diverges even when the overall behaviour is similar.
Try it
- Open the network playground with the defaults and read when the two spike trains first differ.
- Slide "Weight bits" down to 3 and compare the two rates.
- Set "Membrane bits" to 8 and raise the inhibitory weight. Watch the saturation counter.
Limits
This is a teaching model. Real chips differ in number formats, rounding, routing and timing, and this page does not describe any particular chip. Lesson 7 will move these ideas into Verilog.