febinrenu/comp_entropy

TypeScript

0

3 commits

updated Aug 1, 2026

See the code

README

πŸ”¬ Computational Entropy Lab

Quantifying the Energy Cost of Semantic Instability in Large Language Models

Python 3.9+ FastAPI React License: MIT


🎯 Research Abstract

This research platform investigates a hypothesis: semantic instability in natural language prompts is associated with measurable differences in LLM inference energy.

We introduce the Prompt Entropy Coefficient (PEC) β€” a metric quantifying the relationship between linguistic clarity and computational efficiency, via the Semantic Instability Index (SII), a composite score computed by the app's mutation engine.


πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        COMPUTATIONAL ENTROPY LAB                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”‚
β”‚  β”‚   React      β”‚    β”‚   FastAPI    β”‚    β”‚   LLM        β”‚                   β”‚
β”‚  β”‚   Dashboard  │◄──►│   Backend    │◄──►│   Engine     β”‚                   β”‚
β”‚  β”‚   (Frontend) β”‚    β”‚   (API)      β”‚    β”‚  (Ollama by  β”‚                   β”‚
β”‚  β”‚              β”‚    β”‚              β”‚    β”‚   default)   β”‚                   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β”‚         β”‚                   β”‚                   β”‚                            β”‚
β”‚         β–Ό                   β–Ό                   β–Ό                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”‚
β”‚  β”‚   Real-time  β”‚    β”‚   Analysis   β”‚    β”‚   Energy     β”‚                   β”‚
β”‚  β”‚   Charts     β”‚    β”‚   Engine     β”‚    β”‚   Monitor    β”‚                   β”‚
β”‚  β”‚   (Recharts) β”‚    β”‚   (SciPy)    β”‚    β”‚ (real NVML   β”‚                   β”‚
β”‚  β”‚              β”‚    β”‚              β”‚    β”‚ GPU + TDP    β”‚                   β”‚
β”‚  β”‚              β”‚    β”‚              β”‚    β”‚ CPU proxy)   β”‚                   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚                     PostgreSQL / SQLite Database                     β”‚    β”‚
β”‚  β”‚  β€’ Experiments β€’ Prompts β€’ Mutations β€’ Measurements β€’ Analytics     β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Key Features

πŸ–₯️ Interactive Research Dashboard

  • Real-time experiment monitoring over a real WebSocket connection
  • Recharts-based visualizations
  • Comparative analysis across mutation types
  • CSV / JSON / LaTeX / reproducibility-package (ZIP) export
  • Dark/Light theme support

🧬 Advanced Mutation Engine

  • 9 mutation conditions (including baseline): Typo Noise, Verbosity, Semantic Ambiguity, Contradiction, Negation, Reordering, Formality Shift, Code-Switching
  • Configurable intensity (0.0–1.0)
  • Integrated readability/complexity scoring (Flesch reading ease, lexical diversity)
  • Optional length-matched control per mutation, to separate a prompt-length confound from the mutation-type effect itself
  • Seeded, reproducible mutations

πŸ“Š Statistical Analysis Suite

  • Correlation analysis (Pearson, Spearman, Kendall) with confidence intervals
  • ANOVA + Kruskal-Wallis (non-parametric alternative)
  • Effect size calculations (Cohen's d, Hedges' g, Ξ·Β², ω²)
  • Publication-ready LaTeX tables

⚑ Energy Monitoring

  • Real GPU power via NVIDIA NVML when a GPU is present -- genuine hardware wattage, not an estimate
  • CPU and RAM power are always modeled estimates (TDP Γ— utilization, and a flat per-GB heuristic respectively) -- there is no RAPL or other real CPU hardware-energy access on this platform
  • Every measurement records which of these applied (measurement_source: nvml_real, tdp_proxy, or synthetic_simulation) so real and estimated numbers are never silently blended without a way to tell them apart
  • Per-token energy efficiency metrics (EPT, mJ/token)
  • Optional CodeCarbon cross-check

πŸ“ Research Tools

  • LaTeX report/table export
  • Reproducibility package export (raw data + protocol + environment info, as a ZIP)

πŸš€ Quick Start

Prerequisites

  • Python 3.9+
  • Node.js 18+
  • Ollama running locally, with at least one model pulled (default: phi3.5:3.8b) β€” this is the default generation backend. Without it, the app falls back to OpenAI/Anthropic (with your own API key) or an explicit synthetic simulation mode.
  • NVIDIA GPU + driver (optional) β€” enables real NVML-measured GPU energy instead of an estimate

Windows One-Click Setup

:: From the repo root
setup.bat        REM creates venvs, installs backend + frontend deps
run_all.bat      REM starts backend (port 8000) and frontend (port 3000) together

(setup.py/run.py do not exist in this repo -- setup.bat/run_backend.bat/run_frontend.bat/run_all.bat are the real entry points, Windows-only.)

Manual Installation (any OS)

# Backend setup
cd backend
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt

# Frontend setup
cd ../frontend
npm install

# Start backend
cd ../backend
uvicorn app.main:app --reload --port 8000

# Start frontend (new terminal)
cd ../frontend
npm start

Open your browser to http://localhost:3000


πŸ“ˆ Key Metrics

MetricDescriptionFormula
PECPrompt Entropy CoefficientSpearman ρ(SII, EPT)
EPTEnergy Per Token (mJ)total_energy_joules / output_tokens Γ— 1000
SIISemantic Instability Indexhand-tuned base score per mutation type + readability/lexical/sentence-length adjustments

πŸ“ Project Structure

comp_ent/
β”œβ”€β”€ backend/                 # FastAPI Backend
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/            # REST API endpoints
β”‚   β”‚   β”œβ”€β”€ core/           # Core configuration, DB, logging
β”‚   β”‚   β”œβ”€β”€ models/         # SQLAlchemy models
β”‚   β”‚   β”œβ”€β”€ schemas/        # Pydantic schemas
β”‚   β”‚   β”œβ”€β”€ services/       # Mutation engine, energy monitor, LLM service,
β”‚   β”‚   β”‚                   # experiment runner, analysis engine, corpus
β”‚   β”‚   └── main.py         # FastAPI application
β”‚   β”œβ”€β”€ data/                # SQLite DB + settings.json (created at runtime)
β”‚   β”œβ”€β”€ logs/                 # App logs (created at runtime)
β”‚   β”œβ”€β”€ results/exports/      # Export output (created at runtime)
β”‚   └── requirements.txt
β”œβ”€β”€ frontend/                # React Dashboard
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”œβ”€β”€ pages/           # Page components
β”‚   β”‚   β”œβ”€β”€ services/        # API client (api.ts)
β”‚   β”‚   └── App.tsx          # Main app
β”‚   └── package.json
β”œβ”€β”€ sii_ept_research/        # Standalone real-hardware SII/EPT research pipeline
β”‚                            # (separate from the web app; see its own README.md)
β”œβ”€β”€ setup.bat / run_all.bat / run_backend.bat / run_frontend.bat
β”œβ”€β”€ render.yaml               # Backend deployment config (Render)
└── DEPLOYMENT.md

No top-level research/, data/, models/, or tests/ directories, and no backend/alembic/ migrations exist in this repo -- schema changes are applied via SQLAlchemy's create_all (new tables only; existing tables need a manual migration, see git history for an example).


πŸ§ͺ Running Experiments

Via Dashboard

  1. Navigate to "New Experiment"
  2. Configure parameters (provider defaults to Ollama)
  3. Click "Run Experiment"
  4. Monitor real-time results (progress + live SII/EPT arrive over the dashboard WebSocket)

Via API

import requests

experiment = {
    "name": "Semantic Ambiguity Study",
    "mutation_types": ["ambiguity_semantic", "ambiguity_contradiction"],
    "num_prompts": 20,
    "runs_per_prompt": 5,
    "config": {"provider": "ollama"}
}

response = requests.post("http://localhost:8000/api/experiments/", json=experiment)
run = requests.post(f"http://localhost:8000/api/experiments/{response.json()['id']}/run")

num_prompts is capped at the real 60-prompt corpus size (app/services/corpus.py) and the schema's own advertised limit (50); runs_per_prompt is capped at 10.


πŸ“Š Demo Data

POST /api/demo/seed populates the database with illustrative demo experiments using a synthetic energy heuristic (generate_realistic_measurement in demo.py) β€” useful for exploring the dashboard UI without running a real experiment, but these numbers are not from a real model or real hardware measurement. Look for measurement_source: "synthetic_simulation" (or the demo endpoint itself) to distinguish demo/simulated rows from real ones.


πŸ“„ Citation

@article{computational_entropy_2025,
  title={Computational Entropy: Quantifying the Energy Cost of
         Semantic Instability in Large Language Models},
  author={[Your Name]},
  journal={[Target Conference/Journal]},
  year={2025},
  note={Available at: https://github.com/yourusername/comp_ent}
}

febinrenu/comp_entropy

TypeScript

0

3 commits

updated Aug 1, 2026

See the code

README

πŸ”¬ Computational Entropy Lab

Quantifying the Energy Cost of Semantic Instability in Large Language Models

Python 3.9+ FastAPI React License: MIT


🎯 Research Abstract

This research platform investigates a hypothesis: semantic instability in natural language prompts is associated with measurable differences in LLM inference energy.

We introduce the Prompt Entropy Coefficient (PEC) β€” a metric quantifying the relationship between linguistic clarity and computational efficiency, via the Semantic Instability Index (SII), a composite score computed by the app's mutation engine.


πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        COMPUTATIONAL ENTROPY LAB                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”‚
β”‚  β”‚   React      β”‚    β”‚   FastAPI    β”‚    β”‚   LLM        β”‚                   β”‚
β”‚  β”‚   Dashboard  │◄──►│   Backend    │◄──►│   Engine     β”‚                   β”‚
β”‚  β”‚   (Frontend) β”‚    β”‚   (API)      β”‚    β”‚  (Ollama by  β”‚                   β”‚
β”‚  β”‚              β”‚    β”‚              β”‚    β”‚   default)   β”‚                   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β”‚         β”‚                   β”‚                   β”‚                            β”‚
β”‚         β–Ό                   β–Ό                   β–Ό                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”‚
β”‚  β”‚   Real-time  β”‚    β”‚   Analysis   β”‚    β”‚   Energy     β”‚                   β”‚
β”‚  β”‚   Charts     β”‚    β”‚   Engine     β”‚    β”‚   Monitor    β”‚                   β”‚
β”‚  β”‚   (Recharts) β”‚    β”‚   (SciPy)    β”‚    β”‚ (real NVML   β”‚                   β”‚
β”‚  β”‚              β”‚    β”‚              β”‚    β”‚ GPU + TDP    β”‚                   β”‚
β”‚  β”‚              β”‚    β”‚              β”‚    β”‚ CPU proxy)   β”‚                   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚                     PostgreSQL / SQLite Database                     β”‚    β”‚
β”‚  β”‚  β€’ Experiments β€’ Prompts β€’ Mutations β€’ Measurements β€’ Analytics     β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Key Features

πŸ–₯️ Interactive Research Dashboard

  • Real-time experiment monitoring over a real WebSocket connection
  • Recharts-based visualizations
  • Comparative analysis across mutation types
  • CSV / JSON / LaTeX / reproducibility-package (ZIP) export
  • Dark/Light theme support

🧬 Advanced Mutation Engine

  • 9 mutation conditions (including baseline): Typo Noise, Verbosity, Semantic Ambiguity, Contradiction, Negation, Reordering, Formality Shift, Code-Switching
  • Configurable intensity (0.0–1.0)
  • Integrated readability/complexity scoring (Flesch reading ease, lexical diversity)
  • Optional length-matched control per mutation, to separate a prompt-length confound from the mutation-type effect itself
  • Seeded, reproducible mutations

πŸ“Š Statistical Analysis Suite

  • Correlation analysis (Pearson, Spearman, Kendall) with confidence intervals
  • ANOVA + Kruskal-Wallis (non-parametric alternative)
  • Effect size calculations (Cohen's d, Hedges' g, Ξ·Β², ω²)
  • Publication-ready LaTeX tables

⚑ Energy Monitoring

  • Real GPU power via NVIDIA NVML when a GPU is present -- genuine hardware wattage, not an estimate
  • CPU and RAM power are always modeled estimates (TDP Γ— utilization, and a flat per-GB heuristic respectively) -- there is no RAPL or other real CPU hardware-energy access on this platform
  • Every measurement records which of these applied (measurement_source: nvml_real, tdp_proxy, or synthetic_simulation) so real and estimated numbers are never silently blended without a way to tell them apart
  • Per-token energy efficiency metrics (EPT, mJ/token)
  • Optional CodeCarbon cross-check

πŸ“ Research Tools

  • LaTeX report/table export
  • Reproducibility package export (raw data + protocol + environment info, as a ZIP)

πŸš€ Quick Start

Prerequisites

  • Python 3.9+
  • Node.js 18+
  • Ollama running locally, with at least one model pulled (default: phi3.5:3.8b) β€” this is the default generation backend. Without it, the app falls back to OpenAI/Anthropic (with your own API key) or an explicit synthetic simulation mode.
  • NVIDIA GPU + driver (optional) β€” enables real NVML-measured GPU energy instead of an estimate

Windows One-Click Setup

:: From the repo root
setup.bat        REM creates venvs, installs backend + frontend deps
run_all.bat      REM starts backend (port 8000) and frontend (port 3000) together

(setup.py/run.py do not exist in this repo -- setup.bat/run_backend.bat/run_frontend.bat/run_all.bat are the real entry points, Windows-only.)

Manual Installation (any OS)

# Backend setup
cd backend
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt

# Frontend setup
cd ../frontend
npm install

# Start backend
cd ../backend
uvicorn app.main:app --reload --port 8000

# Start frontend (new terminal)
cd ../frontend
npm start

Open your browser to http://localhost:3000


πŸ“ˆ Key Metrics

MetricDescriptionFormula
PECPrompt Entropy CoefficientSpearman ρ(SII, EPT)
EPTEnergy Per Token (mJ)total_energy_joules / output_tokens Γ— 1000
SIISemantic Instability Indexhand-tuned base score per mutation type + readability/lexical/sentence-length adjustments

πŸ“ Project Structure

comp_ent/
β”œβ”€β”€ backend/                 # FastAPI Backend
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/            # REST API endpoints
β”‚   β”‚   β”œβ”€β”€ core/           # Core configuration, DB, logging
β”‚   β”‚   β”œβ”€β”€ models/         # SQLAlchemy models
β”‚   β”‚   β”œβ”€β”€ schemas/        # Pydantic schemas
β”‚   β”‚   β”œβ”€β”€ services/       # Mutation engine, energy monitor, LLM service,
β”‚   β”‚   β”‚                   # experiment runner, analysis engine, corpus
β”‚   β”‚   └── main.py         # FastAPI application
β”‚   β”œβ”€β”€ data/                # SQLite DB + settings.json (created at runtime)
β”‚   β”œβ”€β”€ logs/                 # App logs (created at runtime)
β”‚   β”œβ”€β”€ results/exports/      # Export output (created at runtime)
β”‚   └── requirements.txt
β”œβ”€β”€ frontend/                # React Dashboard
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”œβ”€β”€ pages/           # Page components
β”‚   β”‚   β”œβ”€β”€ services/        # API client (api.ts)
β”‚   β”‚   └── App.tsx          # Main app
β”‚   └── package.json
β”œβ”€β”€ sii_ept_research/        # Standalone real-hardware SII/EPT research pipeline
β”‚                            # (separate from the web app; see its own README.md)
β”œβ”€β”€ setup.bat / run_all.bat / run_backend.bat / run_frontend.bat
β”œβ”€β”€ render.yaml               # Backend deployment config (Render)
└── DEPLOYMENT.md

No top-level research/, data/, models/, or tests/ directories, and no backend/alembic/ migrations exist in this repo -- schema changes are applied via SQLAlchemy's create_all (new tables only; existing tables need a manual migration, see git history for an example).


πŸ§ͺ Running Experiments

Via Dashboard

  1. Navigate to "New Experiment"
  2. Configure parameters (provider defaults to Ollama)
  3. Click "Run Experiment"
  4. Monitor real-time results (progress + live SII/EPT arrive over the dashboard WebSocket)

Via API

import requests

experiment = {
    "name": "Semantic Ambiguity Study",
    "mutation_types": ["ambiguity_semantic", "ambiguity_contradiction"],
    "num_prompts": 20,
    "runs_per_prompt": 5,
    "config": {"provider": "ollama"}
}

response = requests.post("http://localhost:8000/api/experiments/", json=experiment)
run = requests.post(f"http://localhost:8000/api/experiments/{response.json()['id']}/run")

num_prompts is capped at the real 60-prompt corpus size (app/services/corpus.py) and the schema's own advertised limit (50); runs_per_prompt is capped at 10.


πŸ“Š Demo Data

POST /api/demo/seed populates the database with illustrative demo experiments using a synthetic energy heuristic (generate_realistic_measurement in demo.py) β€” useful for exploring the dashboard UI without running a real experiment, but these numbers are not from a real model or real hardware measurement. Look for measurement_source: "synthetic_simulation" (or the demo endpoint itself) to distinguish demo/simulated rows from real ones.


πŸ“„ Citation

@article{computational_entropy_2025,
  title={Computational Entropy: Quantifying the Energy Cost of
         Semantic Instability in Large Language Models},
  author={[Your Name]},
  journal={[Target Conference/Journal]},
  year={2025},
  note={Available at: https://github.com/yourusername/comp_ent}
}