logoalt Hacker News

nautilus50today at 8:28 AM1 replyview on HN

+1, llama.cpp has a --grammar parameter which you can pass a BNF style grammar file to constrain generation. It can be used in Python llama.cpp wrapper

https://til.simonwillison.net/llms/llama-cpp-python-grammars


Replies

porridgeraisintoday at 9:00 AM

Yes. But even then, the probabilities are not calibrated. In jev/laya, they are (well, relatively anyways).