Skip to main content

Open in Dev Containers Open in GitHub Codespaces Documentation

probLM-solver

A python library and CLI app built on top of llama.cpp which can generate and modify language model outputs based on internal probabilities. Included are utilities for generating large numbers of LLM outputs for performing statistical analysis, as well as outputting and modifying token-by-token conditional probabilities for a given output.

Of particular importance is the ability to define sampling functions for token generation, based off of the answer's power distribution, via iteratively sampling branches of future tokens.

This library is currently in active development, so expect large changes.

Usage

Bare Metal

This project is managed with uv, ensure you have Python, pip, and uv installed. To create and activate the virtual environment, run:

uv sync --python 3.13 --no-dev
source .venv/bin/activate

To install this package as a library, if you have cloned the repository, run:

python3 -m pip install /path/to/repository

else, if you only desire the library, run:

pip install git+https://github.com/muse-writes/probLM-solver

Conda

An environment.yml is provided for conda users (Miniforge, Miniconda, or Anaconda). To create and activate the environment, run:

conda env create -f environment.yml
conda activate problm-solver

If you have an NVIDIA GPU and want hardware-accelerated inference, reinstall llama-cpp-python with CUDA support after activating the environment:

CMAKE_ARGS="-DGGML_CUDA=on" pip install "llama-cpp-python>=0.3.23" --force-reinstall

On the HEC, and other HPC systems which use Nvidia L40(S) and H200 GPUs, oftentimes the login node won't have native GPUs, so use the command:

CMAKE_ARGS="-DGGML_CUDA=on -DGGML_NATIVE=off -DCMAKE_CUDA_ARCHITECTURES=89;90 pip install --force-reinstall --no-cache-dir "llama-cpp-python>=0.3.23"

For complete and custom installation of llama-cpp-python, see llama.cpp build docs.

Docker

The CLI itself can be run in a docker container for testing the program.

To serve this app, run:

docker-compose run app --build

Within the Dev Container this is equivalent to:

poe serve

Contributing

Prerequisites
  1. Generate an SSH key and add the SSH key to your GitHub account.

  2. Configure SSH to automatically load your SSH keys:

    cat << EOF >> ~/.ssh/config
    
    Host *
      AddKeysToAgent yes
      IgnoreUnknown UseKeychain
      UseKeychain yes
      ForwardAgent yes
    EOF
    
  3. Install Docker Desktop.

  4. Install VS Code and VS Code's Dev Containers extension. Alternatively, install PyCharm.

  5. Optional: install a Nerd Font such as FiraCode Nerd Font and configure VS Code or PyCharm to use it.

Development environments

The following development environments are supported:

  1. ⭐️ GitHub Codespaces: click on Open in GitHub Codespaces to start developing in your browser.

  2. ⭐️ VS Code Dev Container (with container volume): click on Open in Dev Containers to clone this repository in a container volume and create a Dev Container with VS Code.

  3. ⭐️ uv: clone this repository and run the following from root of the repository:

    # Create and install a virtual environment
    uv sync --python 3.13 --all-extras
    
    # Activate the virtual environment
    source .venv/bin/activate
    
    # Install the pre-commit hooks
    pre-commit install --install-hooks
    
  4. VS Code Dev Container: clone this repository, open it with VS Code, and run Ctrl/⌘ + ⇧ + P → Dev Containers: Reopen in Container.

  5. PyCharm Dev Container: clone this repository, open it with PyCharm, create a Dev Container with Mount Sources, and configure an existing Python interpreter at /opt/venv/bin/python.

Developing
  • This project follows the Conventional Commits standard to automate Semantic Versioning and Keep A Changelog with Commitizen.
  • Run poe from within the development environment to print a list of Poe the Poet tasks available to run on this project.
  • Run uv add {package} from within the development environment to install a run time dependency and add it to pyproject.toml and uv.lock. Add --dev to install a development dependency.
  • Run uv sync --upgrade from within the development environment to upgrade all dependencies to the latest versions allowed by pyproject.toml. Add --only-dev to upgrade the development dependencies only.
  • Run cz bump to bump the app's version, update the CHANGELOG.md, and create a git tag. Then push the changes and the git tag with git push origin main --tags.
  • Run poe mutmut to analyse test coverage via mutation.
  • The library can be installed in editable mode using python -m pip install -e ..

Metadata

Release files for problm-solver 1.5.1

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

Source distribution (sdist)

Source distribution for problm-solver 1.5.1
File Size Uploaded
problm_solver-1.5.1.tar.gz 30.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for problm-solver 1.5.1
File Interpreter ABI Platform
problm_solver-1.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 66.0 kB

Release files / problm_solver-1.5.1.tar.gz

Download URL problm_solver-1.5.1.tar.gz
Size 30.5 kB
Tags Source
SHA-256 checksum
How to use checksums
00156c5b40afa7ee582022dcb858c96a3751e8f4a55fbc255076a061ade594a8
BLAKE2b-256 checksum
How to use checksums
2348d7a1b5daa2758e14fe1d5d8109d1c5eb2b16080f39de49c2164da05b7f02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 6, 2026.

Transparency log

Release files / problm_solver-1.5.1-py3-none-any.whl

Download URL problm_solver-1.5.1-py3-none-any.whl
Size 35.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b5800ae8566bae93797cf77f62dfe135299ed98dedff0b85d694a7bc2ec569b
BLAKE2b-256 checksum
How to use checksums
34e0515cd76438c081589715e452504961010de9f237d5798e2532cb7a39018d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 6, 2026.

Transparency log

Release history Release notifications | RSS feed

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

This release

1.5.1 This release

2 release files

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