Ask HN: Has anyone considered using rich tokens for LLMs?
The tokens used by LLMs are the rough equivalent of the tokens produced during programming language parsing, but LLM tokens can only represent fixed character sequences. In programming language parsing, literals are parsed into tokens that have the literal value as extra baggage that they carry around.
Current LLMs map words to token IDs, such as "apple" -> '1', "the" -> '2', etc...
Why not have them map numeric literals to special token IDs that also has the numeric values associated with them?
E.g.: token IDs 0..1000 could be assigned to the first 1K distinct numeric literals being processed.
Subsets of the matrices at each layer could be special-purposed to do arithmetic on those tokens. E.g.:, if a "maths operator neuron" is activated with inputs that are IDs 533 and 712, then it'll "multiply" those two numeric values.
This could allow LLM-like systems to be built that can do arithmetic in the same way as a calculator instead of trying to do long-form multiplication like a human with pencil and paper.
10 comments
[ 5.8 ms ] story [ 30.8 ms ] threadPS: I just asked GPT 4 to use long form division to calculate 73732/64. It took over ten seconds and the result was wrong.
Make a cyborg without surgery.
Processing tabular data such as spreadsheets.
Efficiency — invoking Python would be very inefficient for scenarios such as a math tutor AI checking a student’s arithmetic.
Generally I like to think of a useful AI as a hybrid between biological networks and computers. Give an LLM the ability to compute directly so it’s not emulating a human with a calculator, but working more like a human with a calculator neural implant.
If the LLM is trained on arithmetic, its arithmetic results could be more accurate than its untested code, due to that being a simpler task with simple rules over a small number of symbols with a fixed meaning.
Situations in which the LLM produces code requires the operator to be a programmer, in order to understand, and test the code, possibly fixing it, and give feedback about it. Someone who just wanted the AI to check some arithmetic doesn't want to be checking the AI's buggy code and may not even know how.
This to me seems much more flexible and likely to work than training a neural network to do arithmetic.