Skip to content

Latest commit

 

History

History
40 lines (36 loc) · 2.15 KB

File metadata and controls

40 lines (36 loc) · 2.15 KB

Grammar Constrained Decoding

TODO

  • get and run llama cpp
  • input some non-CFG restrictions, using guidance
  • input some CFG restrictions, using guidance
  • regular expressions vs context-free grammars vs regular grammars

General

  • way of limiting the output of a language model to a specific grammar or structure, like JSON, specific programming languages, API responses, etc.
  • grammar can be input using BNF (Backus-Naur Form) or just by providing simple 'options' for the model to choose from

Grammars

Type Grammar Language Automata
Type 0 Unrestricted Grammar Recursive Enumerable Language Turing Machine
Type 1 Context Sensitive Grammar Context Sensitive Language Linear Bounded Automaton
Type 2 Context Free Grammar Context Free Language Pushdown Automaton
Type 3 Regular Grammar Regular Language Finite State Automaton

References