Skip to main content

BoostedProb

Implementation of Boosted Model Probability (BoostedProb) for Quality Estimation introduced in the paper: Are Generative Models Underconfident? Better Quality Estimation with Boosted Model Probability (EMNLP 2025 Main).

We provide 2 functions:

  • find_dominant(log_probs)
    Identifies the indices of tokens that have dominant probability values within each distribution.
  • calculate_boostedprob(log_probs, target)
    Computes the BoostedProb for each output token ID specified in target:
    • If the token is dominant: returns the sum of probabilities of all dominant tokens
    • If the token is not dominant: returns the probability of that token itself.

Toy example:

import torch
import boostedprob

log_probs = torch.log(torch.tensor([
    [0.5, 0.4, 0.05, 0.05],
    [0.5, 0.4, 0.05, 0.05],
]))  # shape [nr_tokens, vocab_size]

target = torch.tensor([2, 1])  # shape [nr_tokens, 1]

# Find dominant tokens
print(boostedprob.find_dominant(log_probs))
# Output
# tensor([[ 0,  1, -1, -1],  tokens at position 0 and 1 are dominant
#         [ 0,  1, -1, -1]])   tokens at position 0 and 1 are dominant
# -1 are dummy values to be ignored.

# Calculate boosted prob (find_dominant() runs internally)
print(boostedprob.calculate_boostedprob(log_probs, target))   # shape [nr_tokens, 1]
# Output
# tensor([0.0500, 0.9000])

Install

From PyPI (recommended):

pip install boostedprob

From GitHub (latest development version):

pip install "git+https://github.com/TuAnh23/boostedprob.git"

Or install locally in editable mode:

git clone https://github.com/TuAnh23/boostedprob.git
cd boostedprob
pip install -e .

Examples

See the examples/ folder for integration with Hugging Face models.

Metadata

Release files for boostedprob 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for boostedprob 0.1.3
File Size Uploaded Provenance Actions
boostedprob-0.1.3.tar.gz 5.9 kB Without provenance Details for boostedprob-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for boostedprob 0.1.3
File Interpreter ABI Platform Actions
boostedprob-0.1.3-py3-none-any.whl Python 3 none any Details for boostedprob-0.1.3-py3-none-any.whl

Total release size: 11.8 kB

Release files / boostedprob-0.1.3.tar.gz

Download URL boostedprob-0.1.3.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2a6796be5d115f95fa4c11c15938797a75f886e23cb36ae3cea2901fe1cbeaac
BLAKE2b-256 checksum
How to use checksums
f2536ef6cc682ef894f674446dec2586b03e8e66290cb876f8fbbd94fb7f4517
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release files / boostedprob-0.1.3-py3-none-any.whl

Download URL boostedprob-0.1.3-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
706b0ab83261b78c6322bf720afae26a6f9e79486b74902479b6925bb06c78c3
BLAKE2b-256 checksum
How to use checksums
c83ff3cde088b92beefe765c583cd8fd169d979ff57bb4427ff97abbce23cf68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Security for boostedprob 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page