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
-
Generate an SSH key and add the SSH key to your GitHub account.
-
Configure SSH to automatically load your SSH keys:
cat << EOF >> ~/.ssh/config Host * AddKeysToAgent yes IgnoreUnknown UseKeychain UseKeychain yes ForwardAgent yes EOF
-
Install VS Code and VS Code's Dev Containers extension. Alternatively, install PyCharm.
-
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:
-
⭐️ GitHub Codespaces: click on Open in GitHub Codespaces to start developing in your browser.
-
⭐️ 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.
-
⭐️ 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
-
VS Code Dev Container: clone this repository, open it with VS Code, and run Ctrl/⌘ + ⇧ + P → Dev Containers: Reopen in Container.
-
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
poefrom 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 topyproject.tomlanduv.lock. Add--devto install a development dependency. - Run
uv sync --upgradefrom within the development environment to upgrade all dependencies to the latest versions allowed bypyproject.toml. Add--only-devto upgrade the development dependencies only. - Run
cz bumpto bump the app's version, update theCHANGELOG.md, and create a git tag. Then push the changes and the git tag withgit push origin main --tags. - Run
poe mutmutto 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)
| File | Size | Uploaded | |
|---|---|---|---|
| problm_solver-1.5.1.tar.gz | 30.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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 logRelease 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