4 ms·
3B models are perfectly capable, I've had great luck with Phi 3.5. > For example, they seem to not care about instructions to only write a response and no exp
by com2kid 2y ago
3B models are perfectly capable, I've had great luck with Phi 3.5.
> For example, they seem to not care about instructions to only write a response and no explanation
You need to use tools to force the model to adhere to a schema. Or you can learn to parse out the part of the response you want, both work.
You'll also need to make good use of robust examples in your initial prompt, and give lots of examples of how you want the output to look. (Yes this quickly burns up the limited context length!)
Finally, embrace the fact that these models are tuned for chat, so the more conversational you make the back and forth the less you are stretching the models abilities.
I wrote a very small blog post at https://meanderingthoughts.hashnode.dev/unlock-the-full-potential-of-llms-ditch-json-for-dsls https://meanderingthoughts.hashnode.dev/unlock-the-full-pote... explaining some of this.
- teleforce 2y agoI wonder if CUE can help the situation in similar fashion to the DSL methods that you've described in your blog post [1]. After all CUE fundamentals are based on feature structure from the deterministic approach of NLP unlike LLM that's stochastic NLP [2],[3]. Perhaps deterministic and non-deterministic approaches is the potent combination that can effectively help reduce much of the footprint to get to the same results and being energy efficient in the process. [1] Cue – A language for defining, generating, and validating data: https://news.ycombinator.com/item?id=20847943 https://news.ycombinator.com/item?id=20847943 [2] Feature structure: https://en.m.wikipedia.org/wiki/Feature_structure https://en.m.wikipedia.org/wiki/Feature_structure [3] The Logic of CUE: https://cuelang.org/docs/concept/the-logic-of-cue/ https://cuelang.org/docs/concept/the-logic-of-cue/
- com2kid 2y agoOn my LinkedIn post about this topic someone actually replied with a superior method of steering LLM output compared to anything else I've ever heard of, so I've decided that until I find time to implement their method, I'm not going to worry about things. tl;dr you put into the prompt all the JSON up until what you want the LLM to say, and you set the stop token to the end token of the current JSON item (so ',' or '}' ']', whatever) and you then your code fills out the rest of the JSON syntax up until another LLM generated value is needed. I hope that makes sense. It is super cool, and I am pretty sure there is a way to make a generator that takes in an arbitrary JSON schema and builds a state machine to do the above. The performance should be super fast on locally hosted models that are using context caching. Eh I should write this up as a blog post, hope someone else implements it, and if not, just do it myself.
- shawnz 2y agoThere are many solutions for constrained/structured generation with LLMs these days, here is a blog post my employer published about this a while back: https://monadical.com/posts/how-to-make-llms-speak-your-language.html https://monadical.com/posts/how-to-make-llms-speak-your-lang... I'm partial to Outlines lately, but they all have various upsides and downsides. OpenAI even natively added support for this on their platform recently: https://openai.com/index/introducing-structured-outputs-in-the-api/ https://openai.com/index/introducing-structured-outputs-in-t...
- hedgehog 2y agoThis is a really good post. I did find one error, Instructor works well with at least one other back end (Ollama). Outlines looks quite interesting but I wasn't able to get it to work reliably.
- zackangelo 2y agoWith mixlayer, because the round trip time to the model is so short, you can alternate between appending known tokens of the JSON output and values you want the model to generate. I think this works better than constraining the sampling in a lot of cases. We haven’t built a state machine over JSON schema that uses this approach yet but it’s on the way.
- com2kid 2y ago> With mixlayer, because the round trip time to the model is so short, you can alternate between appending known tokens of the JSON output and values you want the model to generate. I think this works better than constraining the sampling in a lot of cases. Wow, that is a much more succinct way of describing it! > We haven’t built a state machine over JSON schema that uses this approach yet but it’s on the way. Really this should just be a simple library in JS and Python. Schema goes in, state machine pops out. Complications will be around optional fields, I'm not sure offhand how to solve that!
- 2y ago