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.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 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 β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
measurement_source: nvml_real, tdp_proxy, or synthetic_simulation) so real and estimated numbers are never silently blended without a way to tell them apartphi3.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.:: 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.)
# 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
| Metric | Description | Formula |
|---|---|---|
| PEC | Prompt Entropy Coefficient | Spearman Ο(SII, EPT) |
| EPT | Energy Per Token (mJ) | total_energy_joules / output_tokens Γ 1000 |
| SII | Semantic Instability Index | hand-tuned base score per mutation type + readability/lexical/sentence-length adjustments |
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).
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.
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.
@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}
}
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.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 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 β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
measurement_source: nvml_real, tdp_proxy, or synthetic_simulation) so real and estimated numbers are never silently blended without a way to tell them apartphi3.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.:: 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.)
# 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
| Metric | Description | Formula |
|---|---|---|
| PEC | Prompt Entropy Coefficient | Spearman Ο(SII, EPT) |
| EPT | Energy Per Token (mJ) | total_energy_joules / output_tokens Γ 1000 |
| SII | Semantic Instability Index | hand-tuned base score per mutation type + readability/lexical/sentence-length adjustments |
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).
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.
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.
@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}
}