Skip to main content

llmwalk

Explore the answer-space for any prompt and any MLX-supported model. See https://huggingface.co/mlx-community/models for supported models.

Usage example 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 5
  • uvx 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), supported models can be found at https://huggingface.co/mlx-community/models
  • -n N: Number of answers to show. The search stops once it has N finished answers and no unfinished branch can beat the worst of those N.
  • --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 most k next 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.0 is the model distribution; must be > 0).
  • --stats-interval SECONDS: How often to refresh the live view (<= 0 disables periodic refresh; still renders at start/end).
  • --format {csv,json}: Output format for machine-readable output. When specified, disables the interactive display and prints results to stdout when the job completes.

Machine-readable output

Use --format to get structured output for scripting or further processing:

# JSON output
uvx llmwalk -p "What is 2+2?" --format json

# CSV output
uvx llmwalk -p "What is 2+2?" --format csv

JSON output includes detailed token-level information:

[
  {
    "answer": "4",
    "probability": 0.95,
    "finish_reason": "eos_token",
    "tokens": [
      {"token": "4", "probability": 0.95}
    ]
  }
]

CSV output provides a simpler tabular format with columns: answer, probability, finish_reason.

Metadata

Release files for llmwalk 0.2.0

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

Source distribution (sdist)

Source distribution for llmwalk 0.2.0
File Size Uploaded Provenance
llmwalk-0.2.0.tar.gz 85.5 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 96.3 kB

Release files / llmwalk-0.2.0.tar.gz

Download URL llmwalk-0.2.0.tar.gz
Size 85.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f49fa4943efa6c534dd9e1e42c065dd9223b9fc3c0150d3cc77aa3195a402181
BLAKE2b-256 checksum
How to use checksums
28284adc1af51b55736ba14dd58f7ef20b28805c98dde5e8877395b1554e589a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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}

Release files / llmwalk-0.2.0-py3-none-any.whl

Download URL llmwalk-0.2.0-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71d60494abb9f1b3f9d3d1a357799007ac1c7fe33e472d9b7ff8d2f304ac5979
BLAKE2b-256 checksum
How to use checksums
67a0beee1a05346b782c78b060871bd8b2663b2cc1ab5778b52fc063aff44cab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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}

Security for llmwalk 0.2.0

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