Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Jump forward w/ outlines backend slightly changes the decoding results #2025

Open
merrymercy opened this issue Nov 13, 2024 · 0 comments

Comments

@merrymercy
Copy link
Contributor

merrymercy commented Nov 13, 2024

Observation

For a json schema, outlines w/o jump forward and outlines w/ jump forward give slightly different results. We want to understand whether it is a bug or it is expected.

outlines w/ jumpforward
{ "name" : "Paris" , "population" : 2 }

outlines w/o jumpforward
{ "name": "Paris", "population": 2140000 }

xgrammar w/ jumpforward
{"name": "Paris", "population": 2140000}

xgrammar w/o jumpforward
{"name": "Paris", "population": 2140000}

Reproduce

python3 -m sglang.launch_server --model meta-llama/Meta-Llama-3.1-8B
import json
import requests

json_schema = json.dumps(
    {
        "type": "object",
        "properties": {
            "name": {"type": "string"},
            "population": {"type": "integer"},
        },
        "required": ["name", "population"],
    }
)

# JSON
response = requests.post(
    "http://localhost:30000/generate",
    json={
        "text": "Here is the information of the capital of France in the JSON format.\n",
        "sampling_params": {
            "temperature": 0,
            "max_new_tokens": 32,
            "json_schema": json_schema,
        },
    },
)
print(response.json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant