Live data from Hacker News

Character Prefix Conditioning

cursor.com

11–16 of 16 posts

Re: Character Prefix Conditioning

#11

So here is ChatGPT's token list: https://gist.github.com/s-macke/ae83f6afb89794350f8d9a1ad8a0... Is there some reason it isn't alphabetical? (More specifically, lexically sorted by codepoint) If you had a model with sorted tokens, you'd be able to solve this by constraining output to tokens with the desired prefix, probably with some mechanism similar to how this works: https://github.com/ggerganov/llama.cpp/blob/mas…

516 instances of "\r\n"!

Re: Character Prefix Conditioning

#12

> Can you construct an efficient algorithm for sampling from q(tk∣t1,…,tk−1), that minimizes calls to the original language model? I feel like I'm missing some issue here... Can't you query stopping at the last full token boundary, then reject any results which don't match the character prefix and continue from there with the completion? Kind of like when you mask the invalid actions when reinforcement training on ga…

I asked o1 to figure this out and this is essentially what it came up with as well.

https://chat.sshh.io/share/HIzUotMYVxFhRde94ZYJJ

Re: Character Prefix Conditioning

#13
This is harder than it looks.

First "token-healing" doesn't work. Consider the case "app" where the most likely options are "ap|praisal" or "apple|sauce". You can't just sample all tokens that start with app, or you'd miss appraisal.

Second, it's easy to come up with a naive algorithm that samples from the true distribution. It's very difficult to make this algorithm efficient.

Re: Character Prefix Conditioning

#14
post #9
post #6

Earlier quoted context omitted.

I don't mean switching to one byte per token, but switching to training on the token distribution that results from cutting off the input at arbitrary bytes. The bytes per token should be basically unchanged, as only the end gets a bit shorter.

Yeah I've tried that approach. The model ends up needing to learn every combination of tokens. For example, the word "apple" now has six bytes positions it can be split on and the model suddenly needs to learn that all six will yield the same output attention state. It ends up being O(max token length) more complex and so you end up needing a proportionally larger model to accommodate it.

Seems like we should just use gradual annealing of tokens to more fine grained single character tokens over the course of training then

Re: Character Prefix Conditioning

#15
post #14
post #9

Earlier quoted context omitted.

Yeah I've tried that approach. The model ends up needing to learn every combination of tokens. For example, the word "apple" now has six bytes positions it can be split on and the model suddenly needs to learn that all six will yield the same output attention state. It ends up being O(max token length) more complex and so you end up needing a proportionally larger model to accommodate it.

Seems like we should just use gradual annealing of tokens to more fine grained single character tokens over the course of training then

I believe that's similar to the idea behind https://github.com/facebookresearch/blt
Post reply on HN