Download Latest Version v0.6.4 source code.zip (10.6 MB)
Email in envelope

Get an email when there's a new version of uqlm

Home / v0.6.0
Name Modified Size InfoDownloads / Week
Parent folder
uqlm-0.6.0-py3-none-any.whl 2026-05-28 196.4 kB
uqlm-0.6.0.tar.gz 2026-05-28 10.4 MB
README.md 2026-05-28 4.6 kB
v0.6.0 source code.tar.gz 2026-05-28 10.4 MB
v0.6.0 source code.zip 2026-05-28 10.6 MB
Totals: 5 Items   31.6 MB 0

Highlights

Add CodeGenUQ for Code Generation Uncertainty Quantification

As an extension of the work in Functional Entropy: Predicting Functional Correctness in LLM-Generated Code with Uncertainty Quantification (Bouchard et. al, 2026), this minor release introduces CodeGenUQ, a unified interface for computing confidence scores that predict functional correctness in LLM-generated code without requiring execution or test cases at inference time. Under the hood, CodeGenUQ relies on new methods defined in uqlm.code subpackage. This release also creates a new demo notebook to illustrate this functionality.

Overview

CodeGenUQ extends ShortFormUQ to support code-specific uncertainty quantification across three scorer families:

Token-Probability Scorers (white-box)

  • Length-normalized sequence probability (LNSP)
  • Minimum token probability (MTP)
  • Probability margin (PM)
  • Average/minimum token negentropy (ATN@K, MTN@K)

Sampling-Based Consistency Scorers (black-box)

  • Functional equivalence methods: Replace NLI-based semantic comparison with LLM-based assessment of whether code snippets produce identical outputs for all valid inputs
  • functional_equivalence_rate: Proportion of samples functionally equivalent to the original
  • functional_negentropy: Entropy over functional equivalence clusters (code analogue of semantic entropy)
  • functional_sets_confidence: Normalized count of unique functional clusters
  • Similarity methods:
  • cosine_sim: Code embedding similarity (default: jina-embeddings-v2-base-code)
  • codebleu: CodeBLEU consistency incorporating n-gram, syntax, and data-flow matching

Reflexive Scorers

  • p_true: Token probability assigned to "True" for self-evaluation
  • verbalized_confidence: Likert-scale confidence elicitation

Usage

:::python
from uqlm import CodeGenUQ

uq = CodeGenUQ(
    llm=my_llm,
    scorers=["functional_equivalence_rate", "cosine_sim", "sequence_probability"],
    language="python"
)
results = await uq.generate_and_score(prompts, num_responses=5)

What's Changed

Full Changelog: https://github.com/cvs-health/uqlm/compare/v0.5.11...v0.6.0

Source: README.md, updated 2026-05-28