Skip to main content

Evaluate language models using multiple choice items

Project description

LM Pub Quiz

Evaluate language models using multiple choice items

Build status PyPI - Version PyPI - Python Version License


This library implements a knoweledge probing approach which uses LM's inherent ability to estimate the log-likelihood of any given textual statement. For more information visit the LM Pub Quiz website.

See also

Getting started

This short guide should get you started. For more detailed information visit the documentation.

Installing the Package

You can install the package via pip:

pip install lm-pub-quiz

For alternatives methods of installing the package, visit the documentation.

Example Usage

from lm_pub_quiz import Dataset, Evaluator

# Load the dataset
dataset = Dataset.from_name("BEAR")

# Load the model
evaluator = Evaluator.from_model(
    "gpt2",
    model_type="CLM",
)

# Run the evaluation and save the
results = evaluator.evaluate_dataset(
    dataset,
    save_path="gpt2_results",
    batch_size=32,
)

# If the results are analyzed in a different session, they can be loaded from the file system
# results = DatasetResults.from_path("gpt2_results")

print("=== Overall score ===")
print(results.get_metrics("accuracy"))

Contributing

We welcome any questions, comments, or even PRs to this project to improve the package.

We use hatch to manage this project. For the most comfortable development experience, please first install hatch using pip or pipx.

Then, to propose a change to the library,

  • test your code locally using hatch run all:test
  • format the code according to our formatting guidelines using hatch run lint:fmt,
  • check type- and style-consistency using hatch run lint:all, and
  • finally create a pull request describing the changes you propose.

For work on the documentation, use hatch run serve-docs to run a local documentation server.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lm_pub_quiz-0.3.3.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lm_pub_quiz-0.3.3-py3-none-any.whl (41.7 kB view details)

Uploaded Python 3

File details

Details for the file lm_pub_quiz-0.3.3.tar.gz.

File metadata

  • Download URL: lm_pub_quiz-0.3.3.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lm_pub_quiz-0.3.3.tar.gz
Algorithm Hash digest
SHA256 6903291aa5dbd21659e34c0fe2a6e17f667c94db56e9725a5fbb3d707ae3bdff
MD5 36d5e9abbd93b2e2f10823df39d5ddfc
BLAKE2b-256 0651037301452bbc3ce24b9a4eeccf2f52726faa8e97be944837da8caf9840d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for lm_pub_quiz-0.3.3.tar.gz:

Publisher: publish.yml on lm-pub-quiz/lm-pub-quiz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lm_pub_quiz-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: lm_pub_quiz-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 41.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lm_pub_quiz-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 07c539f544714ccbbd779856e82374487d960cf05f3a8e695bcde41356961e3c
MD5 7f5a45e0a223eb579756921e1563db17
BLAKE2b-256 30c99c5844b986e0b65013dffb4717461e283a14aeb11819a40308d7c1a972fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for lm_pub_quiz-0.3.3-py3-none-any.whl:

Publisher: publish.yml on lm-pub-quiz/lm-pub-quiz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page