[GH-ISSUE #2368] [Feature Request] Tracking Issue for Grammar-Constrained Sampling #957

Closed
opened 2026-11-04 01:47:18 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @Interpause on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2368

To avoid duplicates, having an open tracking issue while the feature is in backlog helps prevent people from creating issues and makes closing dupes faster.

I gathered all issues that can be traced back to lack of grammar sampling during chat completion atm:

  • low-bit quants or low-thinking finetunes ocassionally make malformed tool calls (e.g., createdAt instead of created_at, wrong tool call format, extra brackets): #1431
  • grammar sampling as robust approach to enforce tool calls separate from reasoning/output: #210, #804

Also PRs: #636, #1328

Non grammar-constrained approaches PRs: #762, #763, #790, #525

Unsure:

  • JSON structured output api route: #76, #976
    • resolved by PR #334? then why was #976 an issue?)

Let me know in comments if anything missing or if i misunderstood something.

Originally created by @Interpause on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2368 To avoid duplicates, having an open tracking issue while the feature is in backlog helps prevent people from creating issues and makes closing dupes faster. I gathered all issues that can be traced back to lack of grammar sampling during chat completion atm: - low-bit quants or low-thinking finetunes ocassionally make malformed tool calls (e.g., createdAt instead of created_at, wrong tool call format, extra brackets): #1431 - grammar sampling as robust approach to enforce tool calls separate from reasoning/output: #210, #804 Also PRs: #636, #1328 Non grammar-constrained approaches PRs: #762, #763, #790, #525 Unsure: - JSON structured output api route: #76, #976 - resolved by PR #334? then why was `#976` an issue?) Let me know in comments if anything missing or if i misunderstood something.
Author
Owner

@Interpause commented on GitHub (Oct 14, 2026):

when i get pissed enough at IQ3_S via strata breaking in vscode copilot because of invalid tool calls, or seeing it retry tool calls because of invalid arguments, ill consider fixing this.

Implementation likely is two PRs:

  • Add Grammar-Constrained Sampling
  • Specific Grammar for Qwen template wrt tool calls and reasoning

Should be a lot simpler than llama.cpp's implementation of grammar-constrained tool calls which has to support arbitrary templates from many different models.

<!-- gh-comment-id:6161180782 --> @Interpause commented on GitHub (Oct 14, 2026): when i get pissed enough at IQ3_S via strata breaking in vscode copilot because of invalid tool calls, or seeing it retry tool calls because of invalid arguments, ill consider fixing this. Implementation likely is two PRs: - Add Grammar-Constrained Sampling - Specific Grammar for Qwen template wrt tool calls and reasoning Should be a lot simpler than llama.cpp's implementation of grammar-constrained tool calls which has to support arbitrary templates from many different models.
Author
Owner

@Interpause commented on GitHub (Oct 19, 2026):

I am currently looking at LLGuidance. Main downside is it brings in Rust and is slightly slower than XGrammar. But it has better JSON schema support and the ability to "fast-forward" by injecting valid tokens during tool call like autocomplete. I think initial PR will just focus on reasoning and tool calls; I will look at simplifying complex/laggy JSON schemas and more robust handling/fallback to arbitrary JSON object for other tools next time.

<!-- gh-comment-id:6261283624 --> @Interpause commented on GitHub (Oct 19, 2026): I am currently looking at LLGuidance. Main downside is it brings in Rust and is slightly slower than XGrammar. But it has better JSON schema support and the ability to "fast-forward" by injecting valid tokens during tool call like autocomplete. I think initial PR will just focus on reasoning and tool calls; I will look at simplifying complex/laggy JSON schemas and more robust handling/fallback to arbitrary JSON object for other tools next time.
Author
Owner

@Niko1221 commented on GitHub (Oct 19, 2026):

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6270988286 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Author
Owner

@Interpause commented on GitHub (Oct 21, 2026):

can someone else reopen this for me please, im busy vibecoding in llguidance support. I think I am going to permanently fork off from upstream now.

<!-- gh-comment-id:6319750044 --> @Interpause commented on GitHub (Oct 21, 2026): can someone else reopen this for me please, im busy vibecoding in llguidance support. I think I am going to permanently fork off from upstream now.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#957
No description provided.