Sujet : Re: Misc: Applications of small floating point formats.
De : bohannonindustriesllc (at) *nospam* gmail.com (BGB-Alt)
Groupes : comp.archDate : 05. Aug 2024, 23:35:22
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v8rk3b$154kc$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
On 8/5/2024 11:24 AM, George Neuner wrote:
On Sat, 3 Aug 2024 21:09:43 -0000 (UTC), Lawrence D'Oliveiro
<ldo@nz.invalid> wrote:
On Sat, 3 Aug 2024 11:40:23 +0200, Terje Mathisen wrote:
>
MitchAlsup1 wrote:
>
So, you have identified the problem:: 8-bits contains insufficient
exponent and fraction widths to be considered standard format. Thus, in
order to utilize 8-bit FP one needs several incarnations.
This just points back at the problem:: FP needs at least 10 bits.
>
I agree that fp10 is probably the shortest sane/useful version, but
1:3:4 does in fact contain enough exponent and mantissa bits to be
considered an ieee754 format.
>
The AI folks are quite happy with 8-bit floats for many applications. In
fact, they prefer more exponent bits and fewer in the mantissa.
Insufficient precision is one of the many reasons that ANNs are prone
to hallucinate.
Also likely depends on the type of NN as well.
As noted, for some of the stuff I had tried doing, there was a noticeable detrimental effect with fewer than around 8 to 10 bits in the mantissa for the accumulator. Weights and biases could use fewer bits (as could the inputs/outputs between layers), but not so much the accumulator.
Whereas, large exponent ranges tended to be much less of a factor (though with training via genetic algos, it was needed to detect and handle some cases where values went outside of a "reasonable" exponent range, such as E+14 or so).
One other thing I had found was that it was possible to DC-bias the inputs (before multiplying against the weight), but the gains were small.
So, say, for each input:
(In+InBias)*Weight
Then, output:
OutFunc(Accum*OutGain+OutBias)
Though, OutGain is also debatable (as is InBias), but both seem to help slightly. Theoretically, they are unnecessary as far as the math goes (and what gains they offer are more likely a product of numerical precision and the training process).
Will note that for transfer functions, I have tended to use one of:
SQRT: (x>0)?sqrt(x):0
ReLU: (x>0)?x:0
SSQRT: (x>0)?sqrt(x):-sqrt(-x)
Heaviside: (x>0)?1:0
While tanh is traditionally popular, it had little obvious advantage over SSQRT and lacks a cheap approximation (and numerical accuracy doesn't really matter here).
...