Explore likely completions as a prompt tree.
Project description
llmwalk
Explore the answer-space for any prompt and any MLX-supported model.
TODO: gif
Instead of sampling from the possible tokens each step, llmwalk branches out
and completes all of the branches the sampler would consider based on
--top-k, --top-p and --temperature, ranking the results by probability
as it goes.
The tree is walked prioritising the most likely branches, until it finds -n
branches and then it stops. It doesn't enumerate all possibilities, just enough
to know for sure it has found the -n most likely branches.
Usage
uvx llmwalk -p "In what year was Barack Obama born?"uvx llmwalk -p "Write a haiku about compilers" -n 5uvx llmwalk -p "Give me one word: " --top-k 200 --temperature 0.7
Options
-p, --prompt TEXT: Prompt to score (wrapped with the model’s chat template).-m, --model MODEL: MLX-LM model identifier or path (default:mlx-community/Llama-3.2-1B-Instruct-4bit).-n N: Number of answers to show. The search stops once it hasNfinished answers and no unfinished branch can beat the worst of thoseN.--min-probability FLOAT: Any branch whose cumulative probability falls below this is marked finished (low_probability) and not expanded further.--top-k INT: At each step, expand at mostknext tokens (highest probability).--top-p FLOAT: Nucleus cutoff applied within the top-k tokens at each step (keep adding tokens until cumulative probability ≥p).--temperature FLOAT: Softmax temperature applied when computing per-step probabilities (1.0is the model distribution; must be> 0).--stats-interval SECONDS: How often to refresh the live view (<= 0disables periodic refresh; still renders at start/end).
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llmwalk-0.1.0.tar.gz.
File metadata
- Download URL: llmwalk-0.1.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d969a6a022e3dc43ae82267c6a2f481a7f0d64bd0b1535b8a219eeb73e838dd7
|
|
| MD5 |
1bf73cf5697571d50b1e9d9efa753e78
|
|
| BLAKE2b-256 |
79459e62961d1c87120eb77c3796f169525d3285ecb1caf2a02c83d4f3084f62
|
File details
Details for the file llmwalk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llmwalk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e559b084d8248c90ae89b82fe004e54d992892f9239d84481743a463182cbca
|
|
| MD5 |
b096f57d3491d52005e84109b01a3e30
|
|
| BLAKE2b-256 |
5c40cacfb05c8c7c0be502d25fd2a61a31839b5f5a23a103e0b37aaba9320be3
|