Visualizing the Reasoning Process of Large Language Models
Project description
Landscape of Thoughts
Visualizing the Reasoning Process of Large Language Models
| Diagram of Landscape of Thoughts |
[!NOTE] Before start analysing your own data, you may need to setup model as described in setup model.
📋 Overview
Landscape of Thoughts (LoT) is a framework for visualizing and analyzing the reasoning paths of Large Language Models (LLMs). This library provides tools to:
- Sample reasoning traces from LLMs using various methods (CoT, ToT, MCTS)
- Calculate distances between reasoning steps
- Visualize the reasoning landscape through dimensional projection
🐍 Setting up Environment
# Create environment
conda create -n landscape python=3.10
conda activate landscape
pip3 install -r requirements.txt
# Use --use-pep517 flag to avoid deprecation warning with fire package
pip install fire --use-pep517
🚄 Simplified API
You can use our unified script (main.py) that combines all three steps into a single command:
python main.py \
--task all \
--model_name meta-llama/Llama-3.2-1B-Instruct \
--dataset_name aqua \
--method cot \
--num_samples 10 \
--start_index 0 \
--end_index 5 \
--plot_type method \
--output_dir figures/landscape \
--local \
--local_api_key token-abc123 \
--port 8000 # <== this should align with the port you used to host the model
The task parameter can be set to:
sample: Only run the sampling stepcalculate: Only run the calculation stepplot: Only run the visualization stepall: Run the complete pipeline
This unified approach simplifies the workflow by handling all steps with consistent parameters and proper sequencing.
🧩 Library Usage
For more advanced usage, you can directly import functions from the lot package or use the main function:
from lot import sample, calculate, plot
# Sample reasoning traces
features, metrics = sample(
model_name="meta-llama/Meta-Llama-3-8B-Instruct-Lite",
dataset_name="aqua",
method="cot",
num_samples=10,
start_index=0,
end_index=5
)
# Calculate distance matrices
distance_matrices = calculate(
model_name="meta-llama/Meta-Llama-3-8B-Instruct-Lite",
dataset_name="aqua",
method="cot",
start_index=0,
end_index=5
)
# Generate visualizations
plot(
model_name="Meta-Llama-3-8B-Instruct-Lite",
dataset_name="aqua",
method="cot",
)
🔧 Key Parameters
model_name: Name of the LLM to use (e.g., meta-llama/Meta-Llama-3-8B-Instruct-Lite)dataset_name: Dataset to use for reasoning tasks (e.g., aqua)method: Reasoning method (cot, tot, mcts, l2m)num_samples: Number of reasoning traces to collect per example
📊 Supported Datasets
Support any (multiple) choice question data structured as follows:
{
"question": XXX,
"options": ["A)XX", "B)XX", "C)XX"],
"answer": "C"
}
🛠️ Creating Custom Datasets
You can create your own custom datasets to use with the Landscape of Thoughts framework. The framework supports multiple-choice question datasets in JSONL format.
For detailed instructions on creating, validating, and using custom datasets, see our Custom Datasets Guide.
🤖 Supported Models
All open-source models are accessible via API, either vllm, or API provider, as long as the log probability of each token is accessible. An example is given as follows for using Qwen/Qwen2.5-3B-Instruct
Host the model locally using vllm:
vllm serve Qwen/Qwen2.5-3B-Instruct \
--api-key "token-api-123" \
--download_dir YOUR_MODEL_PATH \
--port 8000
Then run the following command to use the model:
python main.py \
--task all \
--model_name Qwen/Qwen2.5-3B-Instruct \ # <== change to your model name
--dataset_name aqua \
--method cot \
--num_samples 10 \
--start_index 0 \
--end_index 5 \
--plot_type method \
--output_dir figures/landscape \
--local \
--local_api_key token-abc123
📜 Citation
@article{
title={Landscape of Thoughts: Visualizing the Reasoning Process of Large Language Models},
author={Zhanke Zhou and Zhaocheng Zhu and Xuan Li and Mikhail Galkin and Xiao Feng and Sanmi Koyejo and Jian Tang and Bo Han},
journal={arXiv preprint arXiv:2503.22165},
year={2025},
url={https://arxiv.org/abs/2503.22165},
}
📝 License
This project is licensed under the MIT License - see the LICENSE.md file for details
Project details
Release history Release notifications | RSS feed
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 landscape_of_thoughts-0.1.0.tar.gz.
File metadata
- Download URL: landscape_of_thoughts-0.1.0.tar.gz
- Upload date:
- Size: 8.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20b936f4b344e7fc453c581eb8ec170318981a1fd1415d6ad9e2c1dea4bd6abe
|
|
| MD5 |
f8f4397002987e20d2e5d041405f87f0
|
|
| BLAKE2b-256 |
d08cf8d98af53d095fad5dc17cc05d966f4c3f47d177bdbf49783ee3b8f6d5fb
|
File details
Details for the file landscape_of_thoughts-0.1.0-py3-none-any.whl.
File metadata
- Download URL: landscape_of_thoughts-0.1.0-py3-none-any.whl
- Upload date:
- Size: 325.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afa02ec62d697b6168bef8e64792bbef03bd1f17cfde565fd68ad3ac4bed860f
|
|
| MD5 |
a567f5709f5e68437f43cbadb408894f
|
|
| BLAKE2b-256 |
305052da860b37ad2c8f764b193e48e92a06d8f6f94221d3dc024a0e1badc5fb
|