# Technical Document Extraction: Softmax Calculation Flowchart
## Overview
The image depicts a two-part computational flowchart for calculating **softmax(x)v<sup>T</sup>** and **softmax(y)v<sup>T</sup>**, with a focus on numerical stability in part (b). Key components include matrix operations, exponentiation, and overflow handling.
---
## Part (a): Calculate softmax(x)v<sup>T</sup>
### Inputs
- **X**: `[x₁=4, x₂=5, x₃=6, x₄=7]` (highlighted in blue)
- **V**: `[V₁, V₂, V₃, V₄]` (highlighted in yellow)
### Steps
1. **Retrieve x₁, x₂ from Q, K**
- Compute exponents: `e^(4-6) = e⁻²`, `e^(5-6) = e⁻¹`
2. **Numerator Calculation**
- `numerator += e⁻²·V₁ + e⁻¹·V₂`
3. **Denominator Calculation**
- `denominator += e⁻² + e⁻¹`
4. **Final Output**
- `numerator ÷ denominator`
---
## Part (b): Calculate softmax(y)v<sup>T</sup>
### Inputs
- **Y**: `[y₁=3, y₂=6, y₃=9, y₄=6]` (highlighted in cyan)
- **V**: `[V₁, V₂, V₃, V₄]` (same as part (a))
### Steps
1. **Retrieve y₁, y₂ from Q, K**
- Compute exponents: `e^(3-6) = e⁻³`, `e^(6-6) = e⁰`
2. **Numerator Calculation**
- `numerator += e⁻³·V₁ + e⁰·V₂`
3. **Denominator Calculation**
- `denominator += e⁻³ + e⁰`
4. **Recomputation Process (Overflow Handling)**
- **Trigger**: `y₃=9` causes `e^(9-6) = e³` (red dashed box)
- **Actions**:
- Compute `softmax₁` for `y₁, y₂`
- Compute `softmax₂` for `y₃, y₄`
- Update `softmax₁` and `softmax₂` iteratively
### Critical Note
- **Overflow Warning**: `9-5=2` (red text) indicates numerical instability due to large exponent values.
---
## Key Observations
1. **Spatial Grounding**:
- **X/Y Values**: Left side (blue/cyan boxes)
- **V Values**: Right side (yellow boxes)
- **Computation Blocks**: Gray rectangles with mathematical operations
2. **Legend & Labels**:
- No explicit legend present; colors denote input types:
- Blue: X values
- Cyan: Y values
- Yellow: V values
3. **Trend Verification**:
- **Part (a)**: Exponents increase monotonically (`e⁻² → e¹`), ensuring stable softmax.
- **Part (b)**: `y₃=9` introduces `e³`, dominating the denominator and causing overflow.
---
## Data Table Reconstruction
| Component | Part (a) | Part (b) |
|-----------|----------|----------|
| **X/Y** | [4,5,6,7] | [3,6,9,6] |
| **V** | [V₁,V₂,V₃,V₄] | [V₁,V₂,V₃,V₄] |
| **Critical Operation** | `e^(x_i-6)·V_i` | `e^(y_i-6)·V_i` + Recomputation |
---
## Conclusion
The flowchart emphasizes numerical stability in softmax calculations, particularly for large input values (e.g., `y₃=9`). Part (b) introduces a recomputation mechanism to mitigate overflow risks, highlighting the importance of exponent normalization in machine learning operations.