| ▲ | sigmoid10 7 hours ago |
| Going directly for the logprobs is always icky when you use a chat model as base, because they are trained to write prose as output. So your "choice" tokens and thus their probabilities might get diluted in whatever else it wanted to say. If you have to do it in the same way as this post, at least add clear system instructions and a carefully worded beginning to the assistant output section of the prompt to lower the chances of it wandering off immediately. I've found that using structured outputs solves this problem much better. Instead of letting a model generate only "A", "B" or "C" and looking at the probs, have it directly generate "Legitimate", "Spam" or "Phishing" or any other pre-defined option from a set of multi-token sequences. Behind the scenes it boils down to something quite similar, but you're not running into the risk that the model actually wanted to say "A phishing attempt seems likely, so answer (C) is correct.", which would lead "A" to have the highest probability in the first token. You can even use a reasoning budget this way either via inherent reasoning or a free-form part preceding the remaining output structure. You can also have it assign probabilities (either in words or numbers) using more complex output structures, but I would not rely on them much more than the token logprobs (they can still be quite good though). |
|
| ▲ | dTal 6 hours ago | parent | next [-] |
| The whole point is the quantified output. If you just ask an LLM to type out its confidence "manually", it'll make up some nonsense. The logprob numbers are more reliable. I got this technique to work extremely reliably last year. However there were a bunch of caveats:
1) Firstly, you must institute a check that the multiple choice tokens dominate the output distribution. They should sum to 95% or more, ideally 99%, or the LLM is not following instructions properly. This is also the problem with constrained decoding - if the LLM really doesn't want to output a valid answer, the one you extract will not be high quality.
2) You need to ask it multiple times, permuting which option corresponds to which letter, and average the results. LLMs are surprisingly biased towards picking "A", especially if they're otherwise not sure.
3) For the same reason, performance improves if you frame the prompt as if it were the middle of a quiz. "Question 1" carries baggage that "Question 12" doesn't.
4) You must be exceedingly careful with tokenization. But when all was said and done, I got a general purpose A/B classifier that gave high resolution quantitative output for the cost of a couple dozen tokens ingested and a couple inference passes. |
| |
| ▲ | sigmoid10 4 hours ago | parent | next [-] | | >The whole point is the quantified output. If you just ask an LLM to type out its confidence "manually", it'll make up some nonsense. The logprob numbers are more reliable. The whole point of my argument is that neither is good, but from a technical perspective logprobs is probably the worst unless you train a model on specific outputs. In which case you'd throw out the generality again, so when I think about it more, it's actually the worst overall. In my experiments, having the model simply assign "high" or "low" probability in a structured output generally performs best. You can try numbers, but you will never get anything close to what you could expect from traditional ML. And most certainly not from logprobs. | |
| ▲ | TeMPOraL 4 hours ago | parent | prev | next [-] | | > LLMs are surprisingly biased towards picking "A" GP pointed at a causal explanation for this: almost every sentence in English that's a statement will start with "A" or "An", so "biased towards picking ''A''" will include most attempts at saying anything long-form for any reason. | | |
| ▲ | dTal 4 hours ago | parent | next [-] | | I don't think that's the source of the bias I saw. I am confident that my prompting strategy eliminated attempts to generate long form content - specifically, I took care to wrap (A) and (B) in parentheses, so the completion looked like "Answer: (" - with this scheme an LLM is very unlikely to want to write "Answer: (A sentence goes here...". I know this, quantitatively, because I reliably got 99% distribution coverage with only A+B - that is, no inclination to write "The" or other common sentence starter. That's the beauty of the scheme - you can pretty directly and quantitatively validate how well the LLM understood the instructions. You expect it to only output A or B - so does it? Meanwhile, the bias could be as much as 70% in favor of A in ambiguous cases - a signal completely drowning the <1% inclination to violate the format. | |
| ▲ | podocarp 3 hours ago | parent | prev | next [-] | | What about switching to numbers or just some random Unicode character like smiley faces. Could be interesting if someone tested what LLMs like to say on a "cold start" lol. | |
| ▲ | LoganDark 3 hours ago | parent | prev [-] | | I would also note that models aren't people and don't think like people, so it's also possible that (at least for autoregressive ones) it could just be more likely to say "A" than "B" at that point, not necessarily because of "want" or "reason" but simply because that's what it was trained to do (such as in English writing). |
| |
| ▲ | dragonwriter an hour ago | parent | prev | next [-] | | Sure, it was high resolution (precise), how was accuracy compared to Jev (or existing open source implementations of the same concept, like laya)? Also, Jev/laya do it in one forward pass, for multiple questions about the same state, rather than multiple passes for one question about that state. Well, for the usual multilingual configuration, two forward passes through different small models for laya, but that's because one is the router which chooses which model should do the real work, but still. | |
| ▲ | boredumb 2 hours ago | parent | prev [-] | | > LLMs are surprisingly biased towards picking "A", especially if they're otherwise not sure. Not nearly as sophisticated as myself who would mutter "When in doubt - Charlie out" before marking C. |
|
|
| ▲ | ainch 7 hours ago | parent | prev | next [-] |
| In my experience as well using logprobs to try to quantify uncertainty, LLMs are a poor fit. Neural nets in general struggle with 'calibration' --- ie. if a prediction is truly 50/50, neural nets are often prone to predicting overconfidently [0]. I ran some tests using GPT-4 to do some basic classification a couple years ago. On ambiguous options which had to be escalated to a human, the LLM would regularly output something like a 99.8% probability, compared to 99.99% for a correct answer. 0: https://arxiv.org/pdf/1706.04599 |
|
| ▲ | nautilus50 7 hours ago | parent | prev | next [-] |
| +1, llama.cpp has a --grammar parameter which you can pass a BNF style grammar file to constrain generation. It can be used in Python llama.cpp wrapper https://til.simonwillison.net/llms/llama-cpp-python-grammars |
| |
| ▲ | porridgeraisin 6 hours ago | parent [-] | | Yes. But even then, the probabilities are not calibrated. In jev/laya, they are (well, relatively anyways). |
|
|
| ▲ | foo12bar 4 hours ago | parent | prev | next [-] |
| If we're talking about running it locally, what about passing a partial response as part of the input? Prompt part: "What is better, toast or bread?" Incomplete answer part: "The answer to this question is " and then have the LLM finish the answer. I did this with subtitle translation using llama.cpp (with Python) and had great success. Just past 5 already translated subtitles as the incomplete answer, and the LLM infallibly just continues to translate. No markdown, and usually no talkback if the subtitles contain nasty subjects like bioweapons or nuclear stuff. It just works. |
|
| ▲ | _davide_ 7 hours ago | parent | prev | next [-] |
| Agreed, it's a real issue, but it can probably be vastly reduced by having the schema in the system prompt and by giving the model an expectation of a fixed value: no decent modern would pick a prose ligament over a provided value. To completely squash the issue, a few cheap LoRa iterations will do the trick just fine. |
| |
| ▲ | wongarsu 7 hours ago | parent [-] | | Sure, you can fix that in a couple lines. Then a couple more lines for evaluating multiple questions on the same answer in parallel. Then a couple more lines for the confidence score (which is trivial to compute from all we have, but missing regardless). Then a harness to fine-tune an existing model to perform better on this specific task, and a collection of training data to use for that I think we can all agree that Jev is not rocket science. It's a good idea executed well, with marketing that might have been a tad too bold | | |
| ▲ | porridgeraisin 6 hours ago | parent [-] | | The confidence score is not trivial to compute. That is the whole point of the model. Even if you are using a proper scoring function such as NLL, it is not enough to ensure calibration in deep nets. So you have to do good post training to ensure it. These are all known techniques, but they are far from trivial, especially on large scale datasets. | | |
| ▲ | wongarsu 6 hours ago | parent [-] | | Their docs at https://docs.typesafe.ai/confidence state "confidence is a statistic computed from the probability distribution the answer already gives you. TypeSafe computes it for you" And further down "TypeSafe computes confidence from how the probability is spread across the options. All of it on one option gives 1.0; the more evenly it spreads, the lower the confidence. This demo uses (3 × largest probability − 1) / 2 to approximate confidence for three options." So while we don't know the exact formula they use, it is just a function over the probabilities I am open to the argument that this does not work well if you just plug in a qwen model instead of a model that is trained to output more statistically useful token distributions | | |
| ▲ | kantahayashi 2 hours ago | parent | next [-] | | For N options, it's (N x Max Probability - 1) / (N - 1). It's verified in this article: https://bernoulli.app/articles/is-jev-confident It means confidence is just a converted max probability and not an independent signal. | |
| ▲ | porridgeraisin 6 hours ago | parent | prev [-] | | > I am open to the argument we agree then, that is the entirety of my argument. Getting a deep net especially one that is anywhere near even SLM size to be calibrated is tough, especially across domains. They claim calibration across a variety of datasets which is interesting. |
|
|
|
|
|
| ▲ | _flux 7 hours ago | parent | prev | next [-] |
| Seems like all normal english words could risk the same, so would using short but random strings be even better? Actually to me it sounds it could be benchmarked if this kind of effect exists in the first place. |
| |
| ▲ | sigmoid10 7 hours ago | parent [-] | | Best option would be reasoning + clear system instructions + constrained output. That is, if you have to use a chat model. Which works well enough to be sure, but hey I haven't tried raising millions of dollars when I did that 3 years ago. But perhaps I was the stupid one. |
|
|
| ▲ | ActivePattern 3 hours ago | parent | prev | next [-] |
| "Reply with just the letter A, B, or C." There, I fixed your problem. |
|
| ▲ | dchftcs 6 hours ago | parent | prev | next [-] |
| A fundamental benefit of LLMs over Jev is that you can use test-time compute to improve the accuracy. Jev might eventually evolve to use test-time compute, but the formulation seems to more elusive to me than for LLMs. |
|
| ▲ | petesergeant 6 hours ago | parent | prev [-] |
| That's the approach that daseinlabs/open-jev takes, in contrast to the above, which is what TheoLeeCJ/openjev and ekzhang/openjev-sglang do https://sgnt.ai/p/jev/ |