Hacker News new | ask | show | jobs
by NitpickLawyer 17 days ago
You can do it with LLMs by looking at the logprobs of ('yes', 'Yes', 'YES'...) vs. ('no'...). This works for bool or whatever they call it in jev space nool I think?

You can do it manually or use ready made libs. I know there's one in python on top of vllm that can do something like this.

2 comments

LLM token probabilities are really poorly calibrated for decision making.

Every time I see someone saying something like "isn't this just structured output?", it's because they don't understand that probability calibration is one of the most important parts of the product, especially to understand uncertainty.

I think Jev did a pretty good job on calibration. I wonder how the fast-follow competition from OpenAI and Gemini do.

Yeah, a few years back I briefly worked on the outlines library that did alternate sampling/constrained outputs (classes, json, grammars etc).

It was pretty obvious that calibration was a major problem.

You might ask a question, and say your classes/target tokens are “high”/“medium”/“low”. Well maybe the model really want to say “The” first, and none of your classes might be in the top 1000 tokens for all you know. The models were really not trained to produce one word answer but sentences.

It was still useful for tool calling as back then parameter/API hallucinations were common. But the actual results were sub-par.

Right, that's always been true for LLMs + constrained generation. It ensures syntactic correctness, but semantics are "best effort".
Not reliably - look at microsoft's guidance project that did some of this.

Once a model goes through instruction fine tuning and RLVR/RLHF the log probs decorrelate from what's ground truth (given the propensity of the data seen during training)

But I assume it wouldn't take much more training to make them good again - just a matter of picking the right loss function, since this sort of stuff is probably all encoded in the last layer or two anyway.
I'm pretty sure these models also went through RL post-training, the question you ask still needs to be interpreted as an instruction.