Abstract
When using a large language model (LLM) with constrained output, such as enforcing a JSON schema, providing examples in the target format can sometimes degrade output quality. This degradation may occur if the model learns syntactic variations from the examples that conflict with the schema, which can cause a schema enforcer to reject certain tokens, potentially leading to lower-quality results. A disclosed technique addresses this issue by providing examples of the desired semantic content in a different syntactic format from the target output. For example, to guide the generation of JSON output, examples can be provided in a different data serialization language. This approach can decouple semantic guidance from syntactic enforcement, which may allow the model to learn the desired content and structure without being guided to produce specific tokens that might otherwise be rejected by an enforcer. The described technique can improve the quality of the final, schema-compliant output by reducing potential conflicts between the provided examples and the enforced output constraints.
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.
Recommended Citation
Phoenix, Christopher Jonathan, "Using Semantic Examples to Mitigate Syntactic Conflicts in Constrained LLM Output", Technical Disclosure Commons, (September 24, 2025)
https://www.tdcommons.org/dpubs_series/8628