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

Repeated properties in vllm + xgrammar #174

Open
denadai2 opened this issue Jan 29, 2025 · 1 comment
Open

Repeated properties in vllm + xgrammar #174

denadai2 opened this issue Jan 29, 2025 · 1 comment

Comments

@denadai2
Copy link

denadai2 commented Jan 29, 2025

Is it normal that constrained properties could be repeated a lot?

from pydantic import BaseModel
class EpisodeGuestExtractionResponse(BaseModel):
    guests: List[str]

This is not a valid json: :/

{ "guests": ["David Farrier", "Monica Padman] }  (no guests)  { " 

  , 
  "guests" 
  , 
  "guests" 
  , 
  "guests" 
  , 
  "guests" 
  , 
  "guests" 
  , 
  "guests" 
  , 
  "guests" 

thx

@Ubospica
Copy link
Collaborator

Ubospica commented Feb 12, 2025

Hi @denadai2 , thanks for reporting this issue! Sorry for the late response because I was occupied with some paper-related work.

Your output still seems to be valid JSON, but just its content is not expected. One possible reason for that is you may not describe the output structure in the prompt, but only rely on constraint decoding. This may not work well because LLM is not aware of the constraint. If this is the case, you can describe the structure in the prompt, say, "output a json object that contains a key 'guests' with a value that is a list of strings". That is helpful in practice.

Otherwise, could you provide your specific model and prompt? I can dig into that to see what the problem is.

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

No branches or pull requests

2 participants