Ok then -- so these forward passes should take about the same amount of time per inference of the next token. That matches my intuition. When does the model know to stop? Is there a stop token?
Also aside -- totally crazy this thing can run a full forward-pass many times a second. I naively would have bet each pass token a lot longer even on powerful GPUs
To the best of my knowledge, a combination of special flags and fine tuning is used to let models "know" when to stop generating output:
Basically during pre-training/fine-tuning, for every sequence you'd like your model to generate (for example a multi-turn chat instruct model like chatGPT), you have a flag at the end of the expected output (like end of string, <|something like this|>, or some random hash to prevent users from doing weird "sql-injection style" prompt hacking (ex: https://twitter.com/nostalgebraist/status/168657604180309606...)
Then, during inference, if the model generates the special flag, it terminates the function and the string is returned.
Comments
Wow super helpful! Thank you
Ok then -- so these forward passes should take about the same amount of time per inference of the next token. That matches my intuition. When does the model know to stop? Is there a stop token?
Also aside -- totally crazy this thing can run a full forward-pass many times a second. I naively would have bet each pass token a lot longer even on powerful GPUs
To the best of my knowledge, a combination of special flags and fine tuning is used to let models "know" when to stop generating output:
Basically during pre-training/fine-tuning, for every sequence you'd like your model to generate (for example a multi-turn chat instruct model like chatGPT), you have a flag at the end of the expected output (like end of string, <|something like this|>, or some random hash to prevent users from doing weird "sql-injection style" prompt hacking (ex: https://twitter.com/nostalgebraist/status/168657604180309606...)
Then, during inference, if the model generates the special flag, it terminates the function and the string is returned.
Also on your note about multiple passes a second, it's absolutely wild how much compute modern computers have. My 3090 goes on full blast during inference on 13B llama models. To think that GPT 3.5 is 10 times the size of that https://en.wikipedia.org/wiki/GPT-3, and that GPT 4 is 10 times the size of THAT https://www.semianalysis.com/p/gpt-4-architecture-infrastruc...