You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Structured output (JSON schema) for LLM generation #1528
LLM generation cannot be forced to match a JSON schema, so apps put the schema in the prompt. With Llama 3.2 1B that gave 2/20 valid outputs (review).
Proposed solution
Grammar-constrained decoding (mask logits per step, e.g. via xgrammar), exposed as responseFormat: { type: 'json_schema', schema } on generate / sendMessage.
Alternative solutions
Prompt + validate + retry: what users do today, unreliable on small models.
Benefits to React Native ExecuTorch
Reliable structured output for extraction, classification and tool calling.
Additional context
Blocked on the LLM runner rewrite; the current runner uses upstream's sampler.
Activity
msluszniak commentedon Oct 12, 2026
cc: @barhanc
barhanc commentedon Oct 12, 2026
Isn't this duplicate of #1377?
msluszniak commentedon Oct 12, 2026
Yes, it's duplicate