Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

PRDE — Parallel Reality Decision Engine

Adversarial Decision-Making with Quantitative Argumentation and Real-Time Convergence Detection

🎯 What is PRDE?

PRDE is a formal decision engine that uses adversarial disagreement across simulated future worlds to derive stable decisions. Unlike typical AI chatbots that provide single-perspective answers, PRDE:

  1. Generates 5 parallel world models — each representing a distinct future scenario
  2. Deploys 5 reality-bound AI agents (🌟 OPTIMIST, ⚖️ PRAGMATIST, 📊 ANALYST, 🎯 STRATEGIST, 🔍 SKEPTIC)
  3. Runs adversarial debates using QBAF (Quantitative Bipolar Argumentation Frameworks)
  4. Detects convergence using Wald SPRT (Sequential Probability Ratio Tests)
  5. Returns a robust verdict only when evidence survives cross-reality stress testing

If the system cannot converge, it refuses to decide — an epistemic safety feature that prevents overconfident outputs.


🚀 Quick Start

Prerequisites

  • Python 3.10+
  • Gemini API key (for live mode)

Installation

pip install -r requirements.txt

Option 1: Web UI (Recommended)

python server.py
# Open http://localhost:5000 in your browser

Option 2: Terminal CLI

# Mock mode (no API key needed)
python run_prde.py

# Live mode with Gemini
set GOOGLE_API_KEY=your-api-key
python run_prde.py --live --query "Your decision question here"

�️ Web Interface

The web frontend provides a rich, interactive experience:

  • Query Input — Enter any high-stakes decision question
  • Parallel World Explorer — See how each of the 5 agents models the future
  • Adversarial Debate — Watch agents attack and support arguments in real-time
  • SPRT Convergence — Track the statistical test as it converges (or refuses)
  • Final Verdict — Robust/Fragile/Refused outcome with convergence indicators

�📊 Terminal Demo Output

======================================================================
PRDE — Parallel Reality Decision Engine
======================================================================

LLM MODE: MOCK
MODEL: mock-deterministic

Query: Should India invest 2 trillion rupees in nuclear energy by 2035?

[PHASE 1] WORLD GENERATION
  🌟 OPTIMIST: Best-case analysis indicates strong potential for success...
  ⚖️ PRAGMATIST: Realistic analysis based on execution constraints...
  📊 ANALYST: Economic analysis confirms positive ROI under most scenarios...
  🎯 STRATEGIST: Strategic value extends beyond immediate economic returns...
  🔍 SKEPTIC: Stress-test of worst-case scenarios and failure modes...

[PHASE 2] AGENT INITIALIZATION
  ✓ Agent OPTIMIST bound to FAVORS stance
  ✓ Agent PRAGMATIST bound to CONDITIONAL stance
  ✓ Agent ANALYST bound to FAVORABLE stance
  ✓ Agent STRATEGIST bound to STRATEGIC stance
  ✓ Agent SKEPTIC bound to OPPOSES stance

[PHASE 3] ADVERSARIAL DEBATE (10 rounds)
  Round 1: 🌟 OPTIMIST [SUPPORT] ✅
    ├─ Policy framework enables capital multiplier effect...
    └─ Weight: 0.91
  Round 2: 🔍 SKEPTIC [ATTACK] ❌
    ├─ Solar+Storage LCOE declining faster than projected...
    └─ Weight: 0.74
  ...

[PHASE 4] SPRT CONVERGENCE
  LLR accumulated: -3.847
  Lower threshold: -4.595 (H0: ROBUST)
  Upper threshold: +4.595 (H1: FRAGILE)
  ✓ CONVERGED at Round 10

======================================================================
FINAL VERDICT
======================================================================

  ✅ CONVERGED_ROBUST

  Final QBAF Strength: 0.7680
  Debate Rounds: 10
  Parallel Realities: 5
  Evidence Citations: 10

  ═══ CROSS-WORLD SUMMARY ═══
  🌟 OPTIMIST      │ STRONG SUPPORT   │ Strong evidence accumulation under this world model
  ⚖️ PRAGMATIST    │ CONDITIONAL      │ Achievable with risk mitigation
  📊 ANALYST       │ FAVORABLE        │ Net positive economic value confirmed
  🎯 STRATEGIST    │ STRATEGIC        │ Strategic value beyond economics
  🔍 SKEPTIC       │ OPPOSES          │ Downside manageable with hedging

  Evidence Level: [████████████████████████████░░] 86.8%

🏗️ Architecture

┌──────────────────────────────────────────────────────────────┐
│                      PRDE Orchestrator                        │
├──────────────────────────────────────────────────────────────┤
│  Decision Compiler  │  World Generator (5)  │  Agent Binder  │
├──────────────────────────────────────────────────────────────┤
│  QBAF Graph Engine  │  SPRT Convergence     │  Debate Engine │
├──────────────────────────────────────────────────────────────┤
│               Gemini 2.5 Flash / Mock Client                  │
└──────────────────────────────────────────────────────────────┘

✨ Gemini Features Used

Feature Implementation
Structured JSON All outputs are schema-validated JSON
Thought Signatures State persistence across debate rounds
Thinking Levels Architecture-locked reasoning depth per pipeline stage
Long Context Multi-turn adversarial debates

📁 Project Structure

gEMINI/
├── server.py              # Flask API server (Web UI backend)
├── frontend.html          # Interactive web interface
├── run_prde.py            # CLI runner (terminal interface)
├── requirements.txt       # Python dependencies
├── prde_formal_paper.md   # Formal research paper
├── README.md
│
├── prde/                  # Core engine
│   ├── orchestrator.py    # Main pipeline controller
│   ├── agent.py           # Reality-bound Gemini agents
│   ├── debate_engine.py   # Adversarial debate runner
│   ├── qbaf.py            # Quantitative Bipolar Argumentation
│   ├── sprt.py            # Sequential Probability Ratio Tests
│   ├── decision_compiler.py
│   ├── world_generator.py
│   └── llm/
│       ├── gemini_live.py # Live Gemini client
│       ├── rate_limit.py  # API quota management
│       └── preflight.py   # Validation layer
│
├── tests/                 # Test suite (1047 tests)
│
└── docs/
    ├── architecture.md    # System architecture & data flow
    ├── gemini_integration.md  # Gemini API integration guide
    └── safety_model.md    # Safety layers & audit model

🔒 Safety & Audit

  • Epistemic Safety — The system refuses to decide when evidence is inconclusive
  • Tamper-evident audit logs with hash chains
  • Rate limiting with configurable delays
  • Preflight validation before live API calls
  • Single-run enforcement in live mode

⚠️ About the Evidence Indicator

The evidence bar shown in PRDE outputs does NOT represent probability of correctness, recommendation strength, or likelihood of success.

It is a normalized visualization of SPRT evidence accumulation — i.e., how far the debate process has progressed toward a statistical convergence boundary.

Key properties:

  • It is NOT a probability
  • It does NOT imply correctness
  • It does NOT authorize action
  • It cannot override a FAILED_UNCERTAIN verdict

A value of 86.8% means:

"86.8% of the required statistical evidence threshold has been accumulated — not that the decision is 86.8% likely to be correct."

PRDE decisions are governed exclusively by SPRT threshold crossings, not by this indicator.


🧪 Testing

python -m pytest tests/ -v
# ========================= 1047 passed in 2.98s =========================

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages