JSON generation fails for Llama-2-7b-chat-hf #692
Replies: 5 comments 1 reply
-
It's a known problem with small models. By default, Outlines lets the model choose the number of line breaks and white spaces (following the JSON standard). In |
Beta Was this translation helpful? Give feedback.
-
Interesting @rlouf I updated the above logits_processors = [JSONLogitsProcessor(json_schema, engine.engine, whitespace_pattern="")] Produces {"text":"{\"color\":\">Black•Rust\",\"maker\":\">Toyota\"}"} Do you know is it generally safe to define this whitespace-pattern for all models? or just llama ones? |
Beta Was this translation helpful? Give feedback.
-
@vegaluisjose this should be fine for any model which is capable of generating json without whitespace separation, which I believe should be almost all of them. IMHO, @rlouf We should consider making the |
Beta Was this translation helpful? Give feedback.
-
My honest answer is I don't know, for now it's all empirical. When you guide generation, you force the sequences to be sampled from a subspace of all the sequences that can possibly be sampled given the prompt. When you set a whitespace pattern, you are further reducing the size of that subspace. It might be that this overall gives better results because it's the "right" subset, but hard to tell without evaluation. Note that all of this is also conditional on the type of sampling algorithm that you use (greedy, multinomial, beam search, etc.), so it might also be that what works with one algorithm, actually doesn't with another one. Structured generation is more like a new line of research than a simple feature :) |
Beta Was this translation helpful? Give feedback.
-
I've tried setting whitespace_pattern to ' ' or '[ \n\t]' and the latter causes severe issues with generation. The space version also causes problems and leads to What do you recommend @rlouf ? |
Beta Was this translation helpful? Give feedback.
-
Describe the issue as clearly as possible:
When running vLLM serve with outlines version
0.0.32
andLlama-2-7b-chat-hf
the output does not create a valid json output. Theserve.py
I am using isSteps/code to reproduce the bug:
Expected result:
Error message:
Outlines/Python version information:
Version information
Context for the issue:
I would like to know if this is a known issue for
Llama-2-7b-chat-hf
? thanks!Beta Was this translation helpful? Give feedback.
All reactions