Skip to content

Add constrained_json_whitespace_pattern to ServerArgs - #1438

Merged
merrymercy merged 2 commits into
sgl-project:mainfrom
zifeitong:json_schema
Sep 16, 2024
Merged

merrymercy merged 2 commits into
sgl-project:mainfrom
zifeitong:json_schema

Conversation

@zifeitong

@zifeitong zifeitong commented Sep 16, 2024 •

Copy link
Copy Markdown
Contributor

CC @qeternity @max99x

Motivation

It's hard to find a single whitespace pattern that works for all models(see dottxt-ai/outlines#691). I think it's better to leave the choice to the users.

Related PR: #1277

Modifications

constrained_json_whitespace_pattern is added to ServerArgs with the default value set to None (uses outlines default value).

Checklist

  • Format your code according to the Contributor Guide.
  • Add unit tests as outlined in the Contributor Guide.
  • Update documentation as needed, including docstrings or example tutorials.

CI States

Latest PR Test (Base): ❌ Missing run-ci label -- add it to run CI tests.
Latest PR Test (Extra): ❌ Blocked -- run-ci is required first.

Comment thread python/sglang/srt/server_args.py Resolved
@zifeitong zifeitong changed the title Add constrained_json_whitespace_pattern ServerArgs Add constrained_json_whitespace_pattern to ServerArgs Sep 16, 2024
@merrymercy
merrymercy merged commit 93dffd6 into sgl-project:main Sep 16, 2024
@zifeitong
zifeitong deleted the json_schema branch September 17, 2024 04:39
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 16, 2026
…l-project#1435 census walk), needles 6/6, but D still took ~9.5 s per 100k prompt, serial. py-spy on TP0 around the flip: 17 % presence probe (batch_exists_v2 stat()ing 100k stems on disk), 12 % draft page flags (a Python genexpr per page), 7 % blake2 of the same stems for find/ref/draft, 4 % lazy pinning -- the KV/draft pre-pin of sgl-project#1436 never ran (its anchor missed the sgl-project#1427 lines; only the mamba arena was pre-pinned). Now: KV/draft arenas pre-pinned at bind; presence answered from the arena (COMPLETE slot = present, one C call per width) before any disk stat; key128 cached; draft row checks and resolve_rows as tensor ops. Tests: arena 1427/1424/1433/0828, told 1400, 861, 931, 706 green.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 16, 2026
…he cache-hit batch of a 100k prompt (then ~80 tok/s decode); py-spy on TP0: 27 % presence probe -- batch_exists_v2 formatting, hashing (blake2 in Python + a ctypes array per key) and set-checking 300k stems, 13 % page transfer. BLAKE2b (RFC 7693) in arena.c, verified against hashlib on 280 stems; arena_find_stems answers a whole prefix by stem in one C call; batch_exists_v2 takes the leading COMPLETE KV prefix from that call, checks only the remainder the old way and asks the component pools lazily for the pages the trailing rule inspects. The redundant sgl-project#1438 block is gone (_readable_stems already asks the arena). Tests: arena claim (5, incl. C-vs-Python key), 1427/1424/1433/0828/1400/861/931/706 green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants