Confidence Scores
LlamaIndex
In summer 2026, I worked on confidence scores for LlamaIndex’s Extract product as a Member of Technical Staff Intern.
Extract takes unstructured data, like PDFs, and extracts information out of it according to a schema specified by the user. Each extracted value has a confidence score representing how confident the user should be that the extracted value is right. I worked on making those scores more useful.
When I joined, confidence scoring was still in beta. The system used the extractor agent's token log probs as the confidence score. This is the probability that the agent outputted the field it did, and you'd intuitively expect this to be a decent proxy for confidence.
The problem here, is that LLMs tend to be very overconfident. Every token has a very high probability of being outputted, and thus most scores were clustered > 0.999, making it difficult for customers to resolve errors. Furthermore, null values had no outputted tokens, and thus had no confidence scores.
Looking at this, I saw there were three core problems to solve.
- Ranking: How do we make a correct field have higher confidence than an incorrect field?
- Calibration: How do we calibrate confidence scores to customer expectations? What distribution of confidence scores is ideal, and how do we achieve it?
- Serving: Given a confidence model, how do we serve it in production for millions of jobs?
Over 4 months, we solved all 3 problems, and deployed a new, much stronger confidence model to production. I owned majority of the design and implementation, with guidance and steering from my immensely talented mentors.
The new confidence scores were evaluated on ExtractBench, a diverse benchmark for document extraction, as shown below. This graph below shows strong ranking of incorrect vs. correct extractions, with a low AUGRC for LlamaExtract.
The graph below shows the distribution and coverage of our confidence scores. Notice the distribution of scores skews left, with many scores clustering > 0.95, as intuitively expected of a strong extraction system. However, the distribution is also slightly bimodal with a batch of scores near 0, intuitively representing likely errors and strong calibration. Notice also the 770k unique confidence values, allowing for granular control over acceptance threshold. Finally, notice the 100% coverage, making the score reliable and solving the issue of null scores mentioned above.
For a deeper look at these results, check this out.
Reflecting back on my experience at LlamaIndex, I'm grateful for the level of scope and freedom I was given. I'm glad I wasn't given a toy problem, and was given an important customer feature. Customers asking for my very project during the internship really kept me motivated to keep working and deliver a great solution, and I'm happy to say we did.
I'm most grateful, though, for the incredible culture and mentorship at LlamaIndex. I learned so much about how real engineering works at a fast-paced startup with a very flat organizational structure, and about the types of problems that come up when shipping production-level ML systems.
Very fun summer! I enjoyed the bay area as well, especially hiking Mt. Tam and scootering around the city.