# Technical Document Extraction: Particle Filtering for Mathematical Reasoning
This document describes a flowchart illustrating a multi-step reasoning process using a "particle filtering" approach to solve a word problem. The process involves generating steps, scoring them, and resampling based on those scores to reach a final answer.
## 1. Input Problem (Header/Left Region)
The process begins with a mathematical word problem contained in a speech bubble:
> "Jane has twice as many pencils as Mark. Together they have 9 pencils. How many pencils does Jane have?"
---
## 2. Process Flow Components
The diagram is organized into three main stages of generation and two intermediate resampling phases.
### Stage 1: Generate a 1st step / score (Pink Header)
Three initial "particles" (hypotheses) are generated:
| Particle | Content | Score |
| :--- | :--- | :--- |
| **Particle 1** | Step 1: Total parts = 2 (Jane) + 1 (Mark) = 3 | 0.3198 |
| **Particle 2** | Step 1: Total parts = 3 -> each part = 9/3 = 3 | 0.9453 |
| **Particle 3** | Step 1: Let J = x, M = 2x | 0.5898 |
### Phase 1: Resampling (Orange Header)
Based on the scores in Stage 1, the particles are redistributed:
* **Particle 2** (highest score) is resampled twice (indicated by black dotted lines leading to two different nodes).
* **Particle 1** is resampled once (indicated by a green dotted line).
* **Particle 3** is discarded (no lines lead from it).
---
### Stage 2: Generate a next step / score (Pink Header)
The resampled particles continue their reasoning:
| Particle | Content | Score | Notes |
| :--- | :--- | :--- | :--- |
| **Particle 1** | Step 2: Each part = 9 / 3 = 3 pencils | 0.9375 | Derived from previous Particle 1 |
| **Particle 2** | Step 2: Jane gets 1 part -> 3. Final Answer: 3 pencils. | 0.0133 | Completed its answer |
| **Particle 3** | Step 2: Mark = 1 part | 0.0392 | Derived from previous Particle 2 |
### Phase 2: Resampling (Orange Header)
* **Particle 1** (highest score in this stage) is resampled twice (indicated by a black dotted line and a green dotted line).
* The other particles are discarded or reach a terminal state with low scores.
---
### Stage 3: Generate a next step / score (Pink Header)
The final reasoning steps are generated:
| Particle | Content | Score | Notes |
| :--- | :--- | :--- | :--- |
| **Particle 1** | Step 3: Mark has 1 part = 3 pencils. Jane has other 6. Final Answer: 6 Pencils. | 0.8133 | Completed its answer |
| **Particle 3** | Step 3: Jane has 2 parts -> 2x3 = 6. Final Answer: 6 pencils. | 0.9883 | Completed its answer |
---
## 3. Final Selection (Green Region)
**Header:** "Select particle with highest reward as final answer"
The system selects the path with the highest final score (0.9883), which is highlighted by a green dotted line leading to the final consolidated solution block.
**Final Answer Content:**
* **Step 1:** Total parts = 2 (Jane) + 1 (Mark) = 3
* **Step 2:** Each part = 9 / 3 = 3 pencils
* **Step 3:** Jane has 2 parts -> 2x3 = 6
* **Final Answer:** 6 pencils
---
## 4. Visual Legend & Logic Summary
* **Color Coding:**
* **Pink Labels:** Action steps (Generation).
* **Orange Labels:** Selection steps (Resampling).
* **Blue Boxes:** Active reasoning particles. The saturation of blue roughly correlates with the confidence/score.
* **Green Box/Lines:** The "Winning" path and final output.
* **Trend Analysis:** The process filters out incorrect logic (like Particle 3's algebraic setup or Particle 2's incorrect Step 2 conclusion) by favoring paths with higher numerical scores during the resampling phases. The green dotted line traces the "optimal" path from Step 1 through to the final result.