[docs]Refactor constrained decoding tutorial (#2633)
This commit is contained in:
@@ -4,17 +4,13 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"# Constrained Decoding Tutorial\n",
|
"# Constrained Decoding"
|
||||||
"\n",
|
|
||||||
"This tutorial shows how to format model outputs using constrained decoding in SGLang."
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"### Constrained Decoding\n",
|
|
||||||
"\n",
|
|
||||||
"With SGLang, You can define a JSON schema, EBNF or regular expression to constrain the model's output.\n",
|
"With SGLang, You can define a JSON schema, EBNF or regular expression to constrain the model's output.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"[JSON Schema](https://json-schema.org/): Formats output into structured JSON objects with validation rules.\n",
|
"[JSON Schema](https://json-schema.org/): Formats output into structured JSON objects with validation rules.\n",
|
||||||
@@ -23,7 +19,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"[Regular Expressions](https://en.wikipedia.org/wiki/Regular_expression): Matches text patterns for simple validation and formatting.\n",
|
"[Regular Expressions](https://en.wikipedia.org/wiki/Regular_expression): Matches text patterns for simple validation and formatting.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"### Constrained Decoding Backends\n",
|
"## Grammar Backend\n",
|
||||||
"\n",
|
"\n",
|
||||||
"SGLang has two backends: [Outlines](https://github.com/dottxt-ai/outlines) (default) and [XGrammar](https://blog.mlc.ai/2024/11/22/achieving-efficient-flexible-portable-structured-generation-with-xgrammar). We suggest using XGrammar whenever possible for its better performance. For more details, see [XGrammar technical overview](https://blog.mlc.ai/2024/11/22/achieving-efficient-flexible-portable-structured-generation-with-xgrammar).\n",
|
"SGLang has two backends: [Outlines](https://github.com/dottxt-ai/outlines) (default) and [XGrammar](https://blog.mlc.ai/2024/11/22/achieving-efficient-flexible-portable-structured-generation-with-xgrammar). We suggest using XGrammar whenever possible for its better performance. For more details, see [XGrammar technical overview](https://blog.mlc.ai/2024/11/22/achieving-efficient-flexible-portable-structured-generation-with-xgrammar).\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user