Quantum LLM inference prototype that explores multiple reasoning paths simultaneously by maintaining probability vectors instead of collapsing to single tokens.
pip install -r requirements.txtpython main.py --prompt "Hello world" --steps 5 --branches 3| Option | Default | Description |
|---|---|---|
--prompt, -p |
required | Initial prompt text |
--steps, -s |
5 | Number of tokens to generate |
--branches, -b |
3 | Number of branches per node |
--max-leaves, -m |
10 | Maximum active leaves for pruning |
--temperature, -t |
1.0 | Sampling temperature (higher = more diverse) |
--model |
gpt2 | Model name |
--device |
auto | Device to use (cuda/cpu) |
The tool visualizes a tree of possible continuations with:
- Log probabilities for each path
- Convergence score showing how focused the model is
- Key bifurcation points where the model hesitated between options
- Entropy analysis of the generation space
python main.py --prompt "What is the meaning of life"Loading model gpt2 on cuda...
--- Starting simulation: 'What is the meaning of life' ---
Step 1: 3 active paths
Step 2: 9 active paths
Step 3: 10 active paths
Step 4: 10 active paths
Step 5: 10 active paths
╭──────────────────────────────────────────────────── Multiverse Tree ────────────────────────────────────────────────────╮
│ 🌌 'What is the meaning of life' │
│ ├── [-1.07] ██████████ '?' │
│ │ ├── [-2.31] █████████░ '\n' │
│ │ │ ├── [-2.31] █████████░ '\n' │
│ │ │ │ ├── [-4.50] █░░░░░░░░░ 'The' │
│ │ │ │ │ ├── [-6.29] ░░░░░░░░░░ ' meaning' │
│ │ │ │ │ ├── [-7.80] ░░░░░░░░░░ ' answer' │
│ │ │ │ │ └── [-7.95] ░░░░░░░░░░ ' word' │
│ │ │ │ ├── [-4.70] ░░░░░░░░░░ 'Life' │
│ │ │ │ │ ├── [-5.14] ░░░░░░░░░░ ' is' │
│ │ │ │ │ ├── [-8.33] ░░░░░░░░░░ ' has' │
│ │ │ │ │ └── [-8.69] ░░░░░░░░░░ ',' │
│ │ │ │ └── [-5.47] ░░░░░░░░░░ 'It' │
│ │ │ │ ├── [-6.45] ░░░░░░░░░░ ' is' │
│ │ │ │ ├── [-6.63] ░░░░░░░░░░ ''s' │
│ │ │ │ └── [-8.53] ░░░░░░░░░░ ' means' │
│ │ │ ├── [-9.83] ░░░░░░░░░░ 'The' │
│ │ │ └── [-10.26] ░░░░░░░░░░ 'A' │
│ │ ├── [-3.69] ██░░░░░░░░ ' What' │
│ │ │ ├── [-4.55] █░░░░░░░░░ ' is' │
│ │ │ │ ├── [-5.84] ░░░░░░░░░░ ' the' │
│ │ │ │ │ ├── [-7.02] ░░░░░░░░░░ ' meaning' │
│ │ │ │ │ ├── [-8.18] ░░░░░░░░░░ ' purpose' │
│ │ │ │ │ └── [-9.69] ░░░░░░░░░░ ' nature' │
│ │ │ │ ├── [-7.14] ░░░░░░░░░░ ' it' │
│ │ │ │ └── [-7.36] ░░░░░░░░░░ ' a' │
│ │ │ ├── [-5.78] ░░░░░░░░░░ ' does' │
│ │ │ │ ├── [-6.40] ░░░░░░░░░░ ' it' │
│ │ │ │ │ ├── [-6.67] ░░░░░░░░░░ ' mean' │
│ │ │ │ │ ├── [-10.47] ░░░░░░░░░░ ' really' │
│ │ │ │ │ └── [-10.54] ░░░░░░░░░░ ' have' │
│ │ │ │ ├── [-8.30] ░░░░░░░░░░ ' life' │
│ │ │ │ └── [-8.40] ░░░░░░░░░░ ' the' │
│ │ │ └── [-6.09] ░░░░░░░░░░ ' are' │
│ │ └── [-4.15] █░░░░░░░░░ ' How' │
│ │ ├── [-5.57] ░░░░░░░░░░ ' does' │
│ │ │ ├── [-6.39] ░░░░░░░░░░ ' it' │
│ │ │ │ ├── [-8.26] ░░░░░░░░░░ ' relate' │
│ │ │ │ ├── [-8.47] ░░░░░░░░░░ ' work' │
│ │ │ │ └── [-8.85] ░░░░░░░░░░ ' feel' │
│ │ │ ├── [-7.99] ░░░░░░░░░░ ' one' │
│ │ │ └── [-8.27] ░░░░░░░░░░ ' the' │
│ │ ├── [-5.61] ░░░░░░░░░░ ' do' │
│ │ │ ├── [-6.40] ░░░░░░░░░░ ' we' │
│ │ │ │ ├── [-8.12] ░░░░░░░░░░ ' live' │
│ │ │ │ ├── [-9.18] ░░░░░░░░░░ ' know' │
│ │ │ │ └── [-9.60] ░░░░░░░░░░ ' get' │
│ │ │ ├── [-6.65] ░░░░░░░░░░ ' you' │
│ │ │ └── [-8.45] ░░░░░░░░░░ ' I' │
│ │ └── [-6.09] ░░░░░░░░░░ ' can' │
│ │ ├── [-7.23] ░░░░░░░░░░ ' we' │
│ │ ├── [-8.16] ░░░░░░░░░░ ' you' │
│ │ └── [-8.70] ░░░░░░░░░░ ' it' │
│ ├── [-2.11] ██████████ '?"' │
│ │ ├── [-3.28] ███░░░░░░░ '\n' │
│ │ │ ├── [-3.28] ███░░░░░░░ '\n' │
│ │ │ │ ├── [-4.62] ░░░░░░░░░░ '"' │
│ │ │ │ │ ├── [-6.97] ░░░░░░░░░░ 'I' │
│ │ │ │ │ ├── [-7.10] ░░░░░░░░░░ 'Life' │
│ │ │ │ │ └── [-7.28] ░░░░░░░░░░ 'It' │
│ │ │ │ ├── [-6.20] ░░░░░░░░░░ 'The' │
│ │ │ │ │ ├── [-8.40] ░░░░░░░░░░ ' answer' │
│ │ │ │ │ ├── [-9.02] ░░░░░░░░░░ ' question' │
│ │ │ │ │ └── [-10.36] ░░░░░░░░░░ ' first' │
│ │ │ │ └── [-6.79] ░░░░░░░░░░ 'I' │
│ │ │ ├── [-10.67] ░░░░░░░░░░ 'The' │
│ │ │ └── [-10.67] ░░░░░░░░░░ '"' │
│ │ ├── [-5.29] ░░░░░░░░░░ ' he' │
│ │ │ ├── [-5.83] ░░░░░░░░░░ ' asked' │
│ │ │ │ ├── [-6.38] ░░░░░░░░░░ '.' │
│ │ │ │ │ ├── [-7.15] ░░░░░░░░░░ ' "' │
│ │ │ │ │ ├── [-7.39] ░░░░░░░░░░ '\n' │
│ │ │ │ │ └── [-10.29] ░░░░░░░░░░ ' He' │
│ │ │ │ ├── [-8.37] ░░░░░░░░░░ ',' │
│ │ │ │ └── [-9.14] ░░░░░░░░░░ ' me' │
│ │ │ ├── [-6.68] ░░░░░░░░░░ ' asks' │
│ │ │ └── [-8.12] ░░░░░░░░░░ ' said' │
│ │ └── [-5.47] ░░░░░░░░░░ ' "' │
│ │ ├── [-7.96] ░░░░░░░░░░ 'I' │
│ │ ├── [-8.09] ░░░░░░░░░░ 'It' │
│ │ └── [-8.41] ░░░░░░░░░░ 'The' │
│ └── [-2.58] ███████░░░ ' in' │
│ ├── [-4.15] █░░░░░░░░░ ' the' │
│ │ ├── [-6.08] ░░░░░░░░░░ ' Bible' │
│ │ │ ├── [-6.43] ░░░░░░░░░░ '?' │
│ │ │ ├── [-8.17] ░░░░░░░░░░ '?"' │
│ │ │ └── [-9.32] ░░░░░░░░░░ ',' │
│ │ ├── [-7.27] ░░░░░░░░░░ ' world' │
│ │ └── [-8.12] ░░░░░░░░░░ ' Qur' │
│ ├── [-4.70] ░░░░░░░░░░ ' this' │
│ │ ├── [-6.08] ░░░░░░░░░░ ' world' │
│ │ │ ├── [-6.63] ░░░░░░░░░░ '?' │
│ │ │ ├── [-7.79] ░░░░░░░░░░ '?"' │
│ │ │ └── [-9.05] ░░░░░░░░░░ ',' │
│ │ ├── [-7.68] ░░░░░░░░░░ ' country' │
│ │ └── [-8.03] ░░░░░░░░░░ ' age' │
│ └── [-5.92] ░░░░░░░░░░ ' a' │
│ ├── [-8.32] ░░░░░░░░░░ ' world' │
│ ├── [-9.33] ░░░░░░░░░░ ' post' │
│ └── [-9.61] ░░░░░░░░░░ ' universe' │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Tree Analysis │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
📊 Convergence Score: 15.0%
🎯 Dominant Path Probability: 15.7%
🌿 Total Paths Explored: 67
📈 Entropy: 5.16 bits
🔀 Key Bifurcation Points (where model hesitated):
• 'The' vs 'Life' (Δ=0.19)
• 'is' vs ''s' (Δ=0.19)
• 'does' vs 'do' (Δ=0.04)