File size: 2,745 Bytes
8afb4ca
3f9de27
 
 
 
8afb4ca
ed4ccf6
8afb4ca
 
 
3f9de27
 
 
 
 
 
 
8afb4ca
 
3f9de27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
title: PTS Visualizer
emoji: πŸ”
colorFrom: indigo
colorTo: green
sdk: gradio
sdk_version: 4.31.0
app_file: app.py
pinned: false
license: apache-2.0
tags:
  - pts
  - pivotal-tokens
  - thought-anchors
  - llm-interpretability
  - reasoning
  - visualization
---

# PTS Visualizer

Interactive visualization platform for exploring **Pivotal Tokens**, **Thought Anchors**, and **Reasoning Circuits** in language models.

Inspired by [Neuronpedia](https://neuronpedia.org/), this tool helps researchers and practitioners understand how language models reason through complex tasks.

## Features

### πŸ“Š Overview Dashboard
- Dataset statistics and distributions
- Quick summary of positive/negative impacts
- Category and pattern analysis

### πŸ” Token Explorer
- Highlight pivotal tokens in context
- Visualize probability changes before/after tokens
- Explore token-level impacts on success

### πŸ•ΈοΈ Reasoning Graph
- Interactive dependency graph for thought anchors
- Visualize causal relationships between reasoning steps
- Color-coded by impact (green = positive, red = negative)
- Node size indicates importance

### πŸ—ΊοΈ Embedding Space
- t-SNE visualization of sentence/token embeddings
- Color by category, pattern, or impact
- Explore clusters and patterns in reasoning

### ⚑ Circuit Tracer
- Step-by-step walkthrough of reasoning traces
- Probability progression chart
- Verification scores and error detection

## Supported Datasets

Load from HuggingFace Hub:
- `codelion/Qwen3-0.6B-pts` - Pivotal tokens
- `codelion/Qwen3-0.6B-pts-thought-anchors` - Thought anchors
- `codelion/Qwen3-0.6B-pts-steering-vectors` - Steering vectors
- `codelion/Qwen3-0.6B-pts-dpo-pairs` - DPO training pairs
- `codelion/DeepSeek-R1-Distill-Qwen-1.5B-pts-thought-anchors`

Or upload your own JSONL files!

## How to Use

1. **Select a data source**: Choose HuggingFace Hub or upload a local file
2. **Load the dataset**: Click "Load Dataset"
3. **Explore**: Navigate through the tabs to visualize different aspects

## Local Development

```bash
# Clone the repository
git clone https://github.com/codelion/pts
cd pts/visualizer

# Install dependencies
pip install -r requirements.txt

# Run the app
python app.py
```

## Related Resources

- [PTS GitHub Repository](https://github.com/codelion/pts)
- [Pivotal Token Search Collection](https://huggingface.co/collections/codelion/pivotal-token-search)
- [OptiLLM](https://github.com/codelion/optillm) - Inference optimization library

## Citation

If you use this tool in your research, please cite:

```bibtex
@software{pts,
  title = {PTS: Pivotal Token Search},
  author = {Asankhaya Sharma},
  year = {2025},
  publisher = {GitHub},
  url = {https://github.com/codelion/pts}
}
```