4 ms·
One of the most powerful ways to integrate LLMs with existing systems is constrained generation. Libraries such as outlines[1] and instructor[2] allow structura
by gmt2027 3y ago
One of the most powerful ways to integrate LLMs with existing systems is constrained generation. Libraries such as outlines[1] and instructor[2] allow structural specification of the expected outputs as regex patterns, simple types, jsonschema or pydantic models. Llama.cpp supports bnf grammars.
These outputs often consume significantly fewer tokens than chat or text completions.
[1] https://github.com/outlines-dev/outlines https://github.com/outlines-dev/outlines
[2] https://github.com/jxnl/instructor https://github.com/jxnl/instructor
- Der_Einzige 3y agoI wrote a whole paper about this idea but for syntactic or phonetic constraints: https://paperswithcode.com/paper/most-language-models-can-be-poets-too-an-ai-1 https://paperswithcode.com/paper/most-language-models-can-be...