[docs]Refactor constrained decoding tutorial (#2633)

This commit is contained in:
Shi Shuai
2024-12-28 15:00:38 +00:00
committed by GitHub
parent 239c9d4d3a
commit 333e3bfde5

View File

@@ -4,17 +4,13 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Constrained Decoding Tutorial\n",
"\n",
"This tutorial shows how to format model outputs using constrained decoding in SGLang."
"# Constrained Decoding"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Constrained Decoding\n",
"\n",
"With SGLang, You can define a JSON schema, EBNF or regular expression to constrain the model's output.\n",
"\n",
"[JSON Schema](https://json-schema.org/): Formats output into structured JSON objects with validation rules.\n",
@@ -23,7 +19,7 @@
"\n",
"[Regular Expressions](https://en.wikipedia.org/wiki/Regular_expression): Matches text patterns for simple validation and formatting.\n",
"\n",
"### Constrained Decoding Backends\n",
"## Grammar Backend\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",
"\n",