Pyramid Architecture

The geometric foundation of AletheionGuard's uncertainty quantification

The Pyramidal Model

★ Apex (Truth)
Height = 1
/ \
/ \
/ Q2 \ ← Epistemic
/ \
/____________\
/ \
/ Q1 \ ← Aleatoric
/ \
/____________________\
Base (Maximum Uncertainty)
Height = 0

Apex (Height = 1)

Perfect knowledge. Q1 = 0, Q2 = 0. Model is certain and correct.

Middle (0.3 < H < 0.7)

Moderate uncertainty. Some Q1 or Q2. Requires human review.

Base (Height = 0)

Maximum uncertainty. High Q1 and/or Q2. Cannot make reliable prediction.

Mathematical Foundation

The Height Formula

height = 1 - sqrt(Q1² + Q2²)
# Where:
# Q1 ∈ [0, 1] - Aleatoric uncertainty
# Q2 ∈ [0, 1] - Epistemic uncertainty
# height ∈ [0, 1] - Proximity to truth

Geometric Interpretation:

  • • The pyramid represents the uncertainty space
  • • Q1 and Q2 form the base dimensions (x, y axes)
  • • Height is the vertical distance from base to apex
  • • Pythagorean theorem: distance = √(Q1² + Q2²)
  • • Height = 1 - distance (inverted for proximity to truth)

Example: High Confidence

Q1 = 0.10 # Low aleatoric
Q2 = 0.08 # Low epistemic
height = 1 - sqrt(0.10² + 0.08²)
height = 1 - sqrt(0.01 + 0.0064)
height = 1 - 0.128
height = 0.872 ✓ High confidence

Example: Low Confidence

Q1 = 0.45 # High aleatoric
Q2 = 0.52 # High epistemic
height = 1 - sqrt(0.45² + 0.52²)
height = 1 - sqrt(0.2025 + 0.2704)
height = 1 - 0.688
height = 0.312 ✗ Low confidence

Architecture Levels

AletheionGuard implements a progressive architecture with 4 levels of increasing sophistication:

Level 0: Q1 + Q2 (Basic)

Foundation

Q1 and Q2 gates added only at the output layer. Basic uncertainty separation.

Components:
  • • Q1 Gate (output layer)
  • • Q2 Gate (output layer)
  • • Independent predictions
Performance:
  • • Q2 MSE: ~0.057
  • • ECE: ~0.10-0.15
  • • 100-200 hyperparameter trials

Level 1: Pyramidal + Q1 + Q2 (Current)

Production

Full pyramidal architecture with height gate, base forces, and epistemic softmax.

Components:
  • • Q1 Gate (independent)
  • • Q2 Gate (conditioned on Q1)
  • • Height Gate (neural)
  • • Base Forces (4 forces)
  • • Epistemic Softmax
  • • Temperature Modulation
Performance:
  • • Q2 MSE: ~0.045 (-23.3%)
  • • ECE: ~0.07-0.10 (-30 to -50%)
  • • 20-40 hyperparameter trials
  • 80% faster convergence

Level 2: Pyramidal + Attention Gates

Roadmap

Q1 and Q2 integrated into attention heads for fine-grained uncertainty.

Components:
  • • All Level 1 components
  • • Q1/Q2 in each attention head
  • • Layer-wise uncertainty propagation
  • • Uncertainty-aware attention weights

Level 3: Full Fractal Q1 + Q2

Future

Meta-uncertainty and fractal gates at every layer with full uncertainty composition.

Components:
  • • All Level 2 components
  • • Meta-uncertainty (uncertainty about uncertainty)
  • • Fractal gates everywhere
  • • Hierarchical uncertainty composition

The Four Base Forces

Level 1 introduces 4 epistemic forces that balance at the pyramid base for stability:

🧠 Memory

Confidence in learned patterns from training data.

Ideal: ~0.25 (balanced)
High: Overconfidence in memorization
Low: Insufficient learning

⚠️ Pain

Signal of error and need for correction.

Ideal: ~0.25 (balanced)
High: Model knows it's wrong
Low: Overconfident when wrong

🎯 Choice

Active decision-making and selection between alternatives.

Ideal: ~0.25 (balanced)
High: Exploring many alternatives
Low: Rigid, single-path thinking

🔍 Exploration

Seeking new knowledge and venturing beyond training distribution.

Ideal: ~0.25 (balanced)
High: High uncertainty, OOD detection
Low: Conservative, staying in-distribution

Balance Principle

When all 4 forces are balanced (~0.25 each), the pyramid is stable. Imbalance indicates specific epistemic issues that can be addressed through targeted training or retrieval.

Epistemic Softmax

Level 1 uses adaptive temperature based on uncertainty to prevent overconfidence:

Traditional Softmax

p_i = exp(z_i / τ) / Σ exp(z_j / τ)
# Fixed temperature τ

Problem: Temperature is constant regardless of uncertainty.

Epistemic Softmax

τ_adaptive = τ_base × (1 + Q1 + Q2)
p_i = exp(z_i / τ_adaptive) / Σ exp(z_j / τ_adaptive)

Benefit: Higher uncertainty → Higher τ → Flatter distribution (less confident).

# Example: How temperature adapts
# Low uncertainty (high confidence)
Q1, Q2 = 0.10, 0.08
τ = 1.0 × (1 + 0.10 + 0.08) = 1.18 # Sharp distribution
# High uncertainty (low confidence)
Q1, Q2 = 0.45, 0.52
τ = 1.0 × (1 + 0.45 + 0.52) = 1.97 # Flat distribution

Pyramidal VARO Loss

Level 1 training optimizes multiple objectives simultaneously:

L = λ₁ × MSE(q1, q1_true) + # Q1 accuracy
λ₂ × MSE(q2, q2_true) + # Q2 accuracy
λ_base × MSE(forces, ideal_forces) + # Force balance
λ_height × MSE(height_pred, height_true) + # Height accuracy
λ_q2_gated × MSE(q2_gated, q1_error) + # Q2 conditioning
λ_fractal × MSE(height, 1-√(q1²+q2²)) + # Geometric constraint
λ_RCE × binned_calibration_loss(...) # Calibration

Accuracy Terms

  • • Q1 MSE
  • • Q2 MSE
  • • Height MSE

Structural Terms

  • • Force balance
  • • Q2 gating
  • • Fractal constraint

Calibration Terms

  • • RCE loss
  • • ECE minimization
  • • Brier score

Practical Benefits

1. Faster Convergence

Level 1 converges 80% faster than Level 0 (20-40 trials vs 100-200 trials).

The structural constraints guide optimization to better regions of the loss landscape.

2. Better Calibration

Q2 MSE improves by 23.3%, ECE by 30-50% compared to Level 0.

Conditioning Q2 on Q1 and enforcing geometric constraints improves uncertainty estimates.

3. Interpretable Structure

The pyramid provides a clear geometric interpretation of uncertainty.

Height = proximity to truth. Base forces reveal epistemic issues. Q1/Q2 separate uncertainty types.

4. Compositional Reasoning

Fractal structure enables hierarchical composition (Level 2+).

Decompose complex claims into sub-claims, propagate uncertainty through the pyramid.

Code Example

from aletheion_guard import EpistemicAuditor
auditor = EpistemicAuditor()
result = auditor.evaluate("Paris is the capital of France")
# Access pyramid metrics
print(f"Q1 (aleatoric): {result.q1:.3f}")
print(f"Q2 (epistemic): {result.q2:.3f}")
print(f"Height: {result.height:.3f}")
# Derived metrics
total_uncertainty = (result.q1**2 + result.q2**2)**0.5
print(f"Total uncertainty: {total_uncertainty:.3f}")
print(f"Height (formula): {1 - total_uncertainty:.3f}")
# Verdict based on pyramid position
print(f"Verdict: {result.verdict}") # ACCEPT/MAYBE/REFUSED

Next Steps

Want to Learn More?

Explore the technical architecture documentation and research paper