UQLM क्या है?
UQLM CVS Health की एक Python लाइब्रेरी, जो uncertainty quantification के साथ LLM हैलुसिनेशन पहचानती है और हर response को 0 से 1 के बीच एक confidence score देती है. यह Evaluation & Production Ops टूल्स की Evaluation & Red-Teaming श्रेणी में आता है; ओपन सोर्स है, Python में लिखा गया है और Apache-2.0 लाइसेंस के तहत है।
सारांश
UQLM (अनिश्चितता क्वांटिफ़िकेशन फ़ॉर लैंग्वेज मॉडल्स) एक ओपन सोर्स Python लाइब्रेरी है, जिसे CVS Health ने प्रकाशित किया है। यह लार्ज लैंग्वेज मॉडल के आउटपुट में हैलुसिनेशन पहचानने के लिए बनी है। प्रोडक्शन में किसी answer की तुलना उस ग्राउंड ट्रुथ से करना अक्सर संभव नहीं होता, जो आपके पास शायद ही होता है; इसके बजाय यह अनुमान लगाती है कि model कितना अनिश्चित था। हर scorer 0 से 1 के बीच एक confidence score लौटाता है, जहाँ ज़्यादा score का मतलब है गलती या हैलुसिनेशन की कम संभावना।

Scorers पाँच families में आते हैं, और उनके cost व compatibility के trade-offs अलग-अलग हैं। Black-box scorers एक ही prompt पर कई responses sample करते हैं और मापते हैं कि वे कितने consistent हैं, इसलिए ये किसी भी LLM के साथ काम करते हैं। White-box scorers एक ही generation की token probabilities पढ़ते हैं; इसमें लगभग कोई latency या cost नहीं जुड़ती, लेकिन ऐसा model चाहिए जो logprobs दिखाए। LLM-as-a-judge scorers एक या अधिक judge models से answer को grade करवाते हैं। Ensemble scorers बाकी scorers को weighted averaging से जोड़ते हैं, या तो सीधे इस्तेमाल करके या known answers वाले prompts पर tune करके। Long-text scorers claim या sentence स्तर पर काम करते हैं और कम confidence वाले claims हटाकर response को फिर से लिख सकते हैं। एक अलग `CodeGenUQ` interface बिना चलाए बताता है कि generate किया गया code functionally correct होगा या नहीं।
हर class एक LangChain chat model लेती है, इसलिए वही code OpenAI, Azure OpenAI, Vertex AI, Ollama या किसी भी अन्य LangChain-supported provider पर चल जाता है। यह लाइब्रेरी Apache-2.0 license के तहत है, PyPI से install होती है, और Journal of Machine Learning Research (2026) में छपे एक paper में इसका वर्णन है। Scorer methods और benchmarks को TMLR और EMNLP 2026 के companion papers में कवर किया गया है।
यह क्या करता है
- Black-box consistency scorers — discrete semantic entropy, semantic sets की संख्या, non-contradiction और entailment probability, exact match, BERTScore और cosine similarity — जो किसी भी LLM के साथ काम करते हैं
- White-box scorers, जो token probabilities से बनते हैं, जिनमें minimum token probability, length-normalized sequence probability और probability margin शामिल हैं, साथ ही P(True) self-reflection और CoCoA व semantic density जैसे multi-generation methods
- LLM-as-a-judge scoring, जिसमें categorical, continuous या Likert-scale judges हैं, या `LLMPanel` के ज़रिए कई judge models का panel



- `UQEnsemble` scorers को fixed weights के साथ जोड़ता है, या ground-truth answers वाले prompts पर weights tune करता है
- `LongTextUQ` लंबे answer के हर claim को score करता है और एक confidence threshold से नीचे के claims हटाकर response को refine कर सकता है
- `CodeGenUQ` बिना execute किए अनुमान लगाता है कि LLM-generated code functionally correct है या नहीं
शुरू करें
UQLM एक pip से install होने वाला Python package है। हर scorer class एक LangChain chat model को wrap करती है और एक async `generate_and_score` method देती है, जो ऐसे results लौटाता है जिन्हें आप DataFrame में बदल सकते हैं। नीचे `prompts` आपकी अपनी prompt strings की सूची है।
Install करें
यह package PyPI पर publish है और Python 3.10 और उससे ऊपर के versions को सपोर्ट करता है।
pip install uqlmBlack-box scorer से responses score करें
`BlackBoxUQ` हर prompt के लिए कई responses sample करता है और उनकी consistency मापता है। `use_best=True` uncertainty-minimized response को answer के रूप में लौटाता है।
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o-mini")
from uqlm import BlackBoxUQ
bbuq = BlackBoxUQ(llm=llm, scorers=["semantic_negentropy"], use_best=True)
results = await bbuq.generate_and_score(prompts=prompts, num_responses=5)
results.to_df()
मॉडल token probabilities दिखाए तो उनका इस्तेमाल करें
`WhiteBoxUQ` एक single generation को उसकी token probabilities से score करता है। Single-generation scorers के लिए कोई अतिरिक्त LLM calls नहीं होतीं।
from langchain_google_vertexai import ChatVertexAI
llm = ChatVertexAI(model='gemini-2.5-pro')
from uqlm import WhiteBoxUQ
wbuq = WhiteBoxUQ(llm=llm, scorers=["min_probability"])
results = await wbuq.generate_and_score(prompts=prompts)
results.to_df()LLM judges के panel से answers grade करें
`LLMPanel` हर question-answer pair को कई judge models को भेजता है और उनके verdicts को मिलाकर एक confidence score बनाता है।
from langchain_ollama import ChatOllama
llama = ChatOllama(model="llama3")
mistral = ChatOllama(model="mistral")
qwen = ChatOllama(model="qwen3")
from uqlm import LLMPanel
panel = LLMPanel(llm=llama, judges=[llama, mistral, qwen])
results = await panel.generate_and_score(prompts=prompts)
results.to_df()Labelled prompts पर ensemble tune करें
`UQEnsemble` black-box, white-box और judge scorers को मिलाता है। इसे सीधे इस्तेमाल करें, या नए prompts को score करने से पहले known answers वाले prompts पर इसके weights tune करें।
from uqlm import UQEnsemble
scorers = [
"exact_match", "noncontradiction", # black-box scorers
"min_probability", # white-box scorer
llm # use same LLM as a judge
]
uqe = UQEnsemble(llm=llm, scorers=scorers)
tune_results = await uqe.tune(
prompts=tuning_prompts, ground_truth_answers=ground_truth_answers
)
results = await uqe.generate_and_score(prompts=prompts)
results.to_df()लंबे answers को claim-दर-claim score करें
`LongTextUQ` हर response को claims में बाँटता है, हर claim को sampled responses के मुकाबले score करता है, और `response_refinement=True` के साथ वह answer उन्हीं claims से फिर बनाता है जो वह रखता है।
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o")
from uqlm import LongTextUQ
luq = LongTextUQ(llm=llm, scorers=["entailment"], response_refinement=True)
results = await luq.generate_and_score(prompts=prompts, num_responses=5)
results_df = results.to_df()
कमांड और कोड प्रोजेक्ट के अपने दस्तावेज़ों से लिए गए हैं — हमेशा जांचें आधिकारिक repo ताज़ा जानकारी के लिए।
कब इस्तेमाल करें
- प्रोडक्शन LLM ऐप में कम confidence वाले answers को चिह्नित करें, ताकि उन्हें रोका जा सके, किसी इंसान के पास भेजा जा सके या दोबारा generate किया जा सके
- एक ही generation पर भरोसा करने के बजाय कई sampled responses में से सबसे ज़्यादा self-consistent response चुनें
- Summaries या biographies जैसे लंबे answers से बिना आधार वाले claims हटाएँ, इससे पहले कि वे पाठक तक पहुँचें
- बिना चलाए generated code में संभावित functional errors जाँचें, और शोध के लिए अपने डेटा पर UQ methods की तुलना करें
How UQLM compares
UQLM alongside other open-source evaluation & red-teaming tools AI/TLDR tracks, ranked by GitHub stars.
| टूल | स्टार | यह क्या करता है |
|---|---|---|
| Strix | ★ 78.7k | ओपन सोर्स AI एजेंट जो आपके ऐप को हैक करके असली सिक्योरिटी कमज़ोरियाँ ढूंढते और उन्हें साबित करते हैं |
| iFixAi | ★ 47.6k | ऑडिट करें कि एजेंट को सौंपा गया काम वह सच में कर रहा है या नहीं |
| promptfoo | ★ 27.9k | कमांड लाइन से अपने LLM प्रॉम्प्ट और ऐप्स की टेस्टिंग, तुलना और रेड-टीमिंग करें |
| DeepEval | ★ 19.8k | 50+ मूल्यांकन मेट्रिक्स के साथ अपने LLM ऐप्स की यूनिट-टेस्टिंग करें |
| OpenAI Evals | ★ 19.8k | LLM और LLM-आधारित सिस्टम के मूल्यांकन के लिए एक फ़्रेमवर्क और ओपन रजिस्ट्री |
| Ragas | ★ 16.5k | LLM और RAG एप्लिकेशन के लिए मेट्रिक-आधारित evaluation और टेस्ट-सेट जेनरेशन |
| Arize Phoenix | ★ 12.5k | LLM और agent ऐप्स के लिए ओपन सोर्स ऑब्ज़र्वेबिलिटी और इवैल्यूएशन |
| UQLM | ★ 1.2k | CVS Health की एक Python लाइब्रेरी, जो uncertainty quantification के साथ LLM हैलुसिनेशन पहचानती है और हर response को 0 से 1 के बीच एक confidence score देती है |
