128 karma · joined October 11, 2020
Playground: https://automorphic.ai/playground
I think approach #1 outlined above is the better (more cost- and time-efficient) technique—where a pretrained model already understands JSON (among myriad other formats), and you merely constrain it at text-gen time to valid JSON (or other format).
Does this help clarify?
We also prefill some tokens depending on the set of allowed tokens at a given state, so the model doesn't waste resources trying to predict them.
1) You're wasting GPT tokens on outputting JSON instead of meaningful information.
2) GPT functions won't, with absolute, 100% certainty, return JSON in the schema you want. In 1% to 3% of cases it hallucinates fields, etc.
3) This also allows you to output data in arbitrary non-JSON formats.
4) You can't self-host OpenAI functions.
Though it may not seem too fast right now on account of the hundreds of simultaneous requests we're getting :)
I'm currently faced with this existential problem myself.