by brian_cloutier · 3y ago · 0 comments
In the ideal case, such as when you ask for a json array, the first "[" token you enforce will have a relatively high probability and forcing it to go down that path will give you good results.
In the dangerous case the model doesn't have a good structure-compliant completion to your prompt and the regex you supply forces the model into a path of extremely low probability and you get trash results.
It seems like there's two clear paths:
- Allow the model to complete whatever it wants and then anneal the structure into compliance - Force the model into a compliant structure and then anneal the quality
I think both options can make sense in different cases.
One case I'm thinking about where the second option feels simpler is when you want to implement a boolean function using a language model. I'm imagining a probability distribution that looks like:
- (40%) the answer is true - (39%) True - (21%) False
In this case it seems significantly more straightforward to force the model into completing T or F. I guess you then run into the "dangerous case" where you have
- (40%) the answer is false - (39%) True - (21%) False
For now, this is a good way to make sure that I can parse the output reliably in the minimal amount of completions (instead of looping until conformant).