| ▲ | PcChip an hour ago | |||||||
this is a really dumb question, but how is -1 represented? is it a float? if so, how many bits is the float? I've never heard of a bit ever having more than two possible values | ||||||||
| ▲ | edflsafoiewq 5 minutes ago | parent | next [-] | |||||||
It appears they are using Q2_0 in llama.cpp, which is 2 bits per weight + 1 float16 scale per group of 64 weights. This is inefficient in two ways: one bit pattern is wasted on each weight, since ternary weights only use {-1,0,1} and Q2_0 allows {-1,0,1,2}; and their group size is 128 weights, so the scale will be stored twice in two groups of 64 instead of stored only once in one group of 128. Their fork corrects the second inefficiency by using a group size of 128, but still uses 2-bit weights AFAICT. It's possible to pack 5 trits into a byte, but the unpacking is not very efficient. Another recent idea is to add the constraint that exactly one weight in each group of four be zero, which gives exactly 32 possible states, so it fits in 5 bits. | ||||||||
| ▲ | petu 42 minutes ago | parent | prev | next [-] | |||||||
packing multiple trits together e.g. 5 trits (243 states) into a byte gives 1.6 bits per trit: https://compilade.net/blog/ternary-packing | ||||||||
| ▲ | zawaideh an hour ago | parent | prev [-] | |||||||
It’s still a bit with only two possible values. But they add a scaling factor to a group of them (128 for example) which when you factor in, results in a fractional number of bits per parameter. | ||||||||
| ||||||||