Skip to main content

Explore the answer-space for any prompt and any MLX-supported model.

Project description

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).

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

llmwalk-0.1.2.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

llmwalk-0.1.2-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file llmwalk-0.1.2.tar.gz.

File metadata

  • Download URL: llmwalk-0.1.2.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

Hashes for llmwalk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 78b2a4d55c212225de1868b77c7dd7c38cbe06e296bab9272c2c56e99d8fe570
MD5 2a5ee59755622931199654a4079e08e2
BLAKE2b-256 343622b076ae19c1b234bc58d445cc0bbcfed50b20037d27972a55243ad0539e

See more details on using hashes here.

File details

Details for the file llmwalk-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: llmwalk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.6 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

Hashes for llmwalk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1d7d6dbd6749db579e8c9b58480bff3c325292a6c00f764c5f44093f4feaa8ff
MD5 0117e22a052e88814743686a7d8d93b5
BLAKE2b-256 154c4ffcc3fdb3e82250ea317869ab8850550d0d382150a66ad2f96a21dfce1e

See more details on using hashes here.

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