I'm trying to understand if the relationship between the size of my inputs to ChatGPT API and the performance. It's super variable today so I imagine most of the time is spent waiting my turn in a queue....let's remove that for now.<p>In a hypothetical where I can run my inputs directly on good hardware how should I be thinking of performance of these models in relation to my input / output size?<p>And what's happening under the hood in the model's architecture? It seems to return 1 token at a time? Does that mean it predicts one token at a time, adds that to the context window, and then does another forward inference pass?<p>If I tune a model to respond with simple `0` or `1` answers to yes and no questions will that be faster than letting it answer "yes {reason}" or "no {reason}"? If it were inferring single tokens it seems like that would always be faster, but if it were inferring a block of tokens maybe not...?<p>I'll summarize everything shared here into a blog post for the next person who asks :) Thanks.
You're correct with interpreting how the model works wrt it returning tokens one at a time. The model returns one token, and the entire context window gets shifted right by one to for account it when generating the next one.<p>As for model performance at different context sizes, it's seems a bit complicated. From what I understand, even if models are tweaked (for example using the superHOT RoPE hack or sparse attention) to be able to use longer contexts, they still have to be fined tuned on input of this increased context to actually utilize it, but performance seems to degrade regardless as input length increases.<p>For your question about fine tuning models to respond with only "yes" or "no", I recommend looking into how the jsonformers library works: <a href="https://github.com/1rgs/jsonformer">https://github.com/1rgs/jsonformer</a> . Essentially, you still let the model generate many tokens for the next position, and only accept the ones that satisfy certain criteria (such as the token for "yes" and the token for "no".<p>You can do this with openAI API too, using tiktoken <a href="https://twitter.com/AAAzzam/status/1669753722828730378?t=d_WVC1e5kzMvIfH7gyVFDQ&s=19" rel="nofollow noreferrer">https://twitter.com/AAAzzam/status/1669753722828730378?t=d_W...</a> . Be careful though as results will be different on different selections of tokens, as "YES", "Yes", "yes", etc are all different tokens to the best of my knowledge