{"id":50768059,"url":"https://github.com/marianoviola/reim","last_synced_at":"2026-06-11T15:30:39.980Z","repository":{"id":362790931,"uuid":"1199962787","full_name":"marianoviola/reim","owner":"marianoviola","description":"🕸️ A Computational Framework for Inferring System Truth from Distributed Noisy Observations","archived":false,"fork":false,"pushed_at":"2026-06-05T22:33:18.000Z","size":97,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-06T00:13:55.636Z","etag":null,"topics":["fastapi","numpy","pandas","python3","scipy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marianoviola.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-02T22:25:16.000Z","updated_at":"2026-06-05T22:30:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/marianoviola/reim","commit_stats":null,"previous_names":["marianoviola/reim"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/marianoviola/reim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marianoviola%2Freim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marianoviola%2Freim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marianoviola%2Freim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marianoviola%2Freim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marianoviola","download_url":"https://codeload.github.com/marianoviola/reim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marianoviola%2Freim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34206487,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","numpy","pandas","python3","scipy"],"created_at":"2026-06-11T15:30:39.065Z","updated_at":"2026-06-11T15:30:39.966Z","avatar_url":"https://github.com/marianoviola.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# REIM\n\n**Reticular Epistemic Inference Model.** A framework for inferring the true properties of a system from distributed, noisy, partial observations, by weighting each observation according to the inferred reliability of its source.\n\n---\n\n## The problem\n\nWhenever many observers report on the same thing (product ratings, sensor readings, evaluations, survey responses, model judgements) the naive answer is to average them. Averaging assumes every observer is equally reliable. They never are. Some are consistent and well calibrated, some are vague, some are adversarial, and some are reporting on a version of the system that no longer exists.\n\nREIM replaces the average with statistical inference. It estimates jointly the true property of each system and the reliability of each observer, then uses the second to weight the first. A reading from a consistently reliable source counts for more; a reading from a noisy or adversarial source counts for less. The model discovers which is which without being told.\n\n## Why not a simple average\n\nA simple average gives every voice equal weight, so a handful of careless or malicious observers can move the result at will. REIM instead learns a precision for each observer from the consistency of their observations, corrects for the age of an observation, and propagates estimates across a system hierarchy when one exists. Reliability is inferred from behaviour, not declared in advance.\n\n## Origins: the Reticular Theory of Reality\n\nREIM is derived from the Reticular Theory of Reality, a framework of ten axioms describing how an observer located inside a complex system must infer the system's properties from incomplete, local observations. The premise is general: every observer is internal to what they describe, their view is partial and noisy, and truth has to be reconstructed from the interaction of many limited viewpoints. The same condition holds for cosmological observation, scientific measurement, distributed sensing, and collective evaluation.\n\nThe full derivation, from the ten axioms to the computational model, is in the technical report (see [Documentation](#documentation)).\n\n## How it works\n\nEach observer `u` reports `r = θ + noise`, where `θ` is the system's true property and the observer's reliability is the inverse of their noise variance. The algorithm alternates two closed-form steps until convergence:\n\n```\nθ_p   = Σ( α_u · r_u,p ) / Σ( α_u )      # precision-weighted estimate of the system's truth\nσ²_u  = mean( (r_u,p − θ_p)² )           # observer noise, so reliability is α_u = 1 / σ²_u\n```\n\nConvergence is guaranteed: each step is a closed-form maximiser of the log-likelihood, so the likelihood is monotonically non-decreasing and the process reaches a stationary point. A Bayesian variant adds priors, giving regularisation for sparsely observed systems and an uncertainty estimate per result.\n\n## Variants\n\n| Variant | For |\n|---|---|\n| Base (MLE / Bayesian) | standard batch estimation, with uncertainty quantification |\n| H-REIM | hierarchical systems, with bottom-up emergence and directional observability |\n| Online | real-time, incremental `O(1)` updates per new observation |\n| MultiDimensional | multi-phase, multi-criteria analysis with temporal decay |\n| AuditREIM (design) | AI governance and audit of model/agent judgments |\n\n## Validated results\n\nOn synthetic data with known ground truth:\n\n- Up to **93% RMSE reduction** versus simple averaging with 20% adversarial observers. As the adversarial share rises to 40% the REIM error stays nearly flat while simple averaging degrades linearly.\n- **Fake-source detection F1 of 85.7%** (100% precision, 75% recall) on the review-platform demo.\n- The online variant processes roughly **16,000 observations per second**.\n\nFull tables, baselines, and methodology are in the technical report.\n\n## Documentation\n\nThe complete framework, from the ten axioms through the mathematics, the hierarchical extension, the online and multidimensional variants, and the experimental results, is documented in the technical report:\n\n\u003e [Reticular Epistemic Inference Model (REIM): full technical report](\u003cdocs/Reticular Epistemic Inference Model (REIM).md\u003e)\n\nA proposed governance extension is documented separately:\n\n\u003e [AuditREIM: Governance and AI Judgment Audit](\u003cdocs/AuditREIM - Governance and AI Judgment Audit.md\u003e)\n\n## Quick start\n\n```bash\n# With Docker Compose\ndocker compose up --build\n\n# Without Docker\npip install -r requirements.txt\nuvicorn app.main:app --host 0.0.0.0 --port 8000\n```\n\nAPI docs at `http://localhost:8000/docs`. Tests with `pytest tests/ -v`.\n\n## API\n\n**Batch** (fit a model on a complete set of observations; best for periodic recalculation):\n\n```bash\ncurl -X POST http://localhost:8000/api/v1/batch/fit \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"observations\":[{\"observer\":\"u1\",\"system\":\"a\",\"value\":4.5},\n                       {\"observer\":\"u2\",\"system\":\"a\",\"value\":5.0}],\n       \"method\":\"bayesian\"}'\n```\n\n**Online** (real-time, each observation updates estimates in `O(1)`):\n\n```bash\ncurl -X POST http://localhost:8000/api/v1/online/init    -d '{\"instance_id\":\"my-platform\"}'\ncurl -X POST http://localhost:8000/api/v1/online/observe -d '{\"instance_id\":\"my-platform\",\"observer\":\"u1\",\"system\":\"a\",\"value\":4.5}'\ncurl      http://localhost:8000/api/v1/online/my-platform/state\n```\n\n**Multi-dimensional** (structured, multi-phase analysis; `phase_type` is a free-form domain label):\n\n```bash\ncurl http://localhost:8000/api/v1/multidim/phase-types   # example product-review lifecycle\ncurl -X POST http://localhost:8000/api/v1/multidim/fit -H \"Content-Type: application/json\" -d '{ ... }'\n```\n\n## Configuration\n\nConfigured through environment variables (see `.env.example`). Key values:\n\n| Variable | Default | Description |\n|---|---|---|\n| `PORT` | `8000` | Service port |\n| `MAX_ONLINE_INSTANCES` | `100` | Max concurrent online models |\n| `MAX_BATCH_OBSERVATIONS` | `1000000` | Max observations per batch |\n| `REIM_VALUE_MIN` / `REIM_VALUE_MAX` | `1.0` / `5.0` | Observation value bounds (domain-dependent) |\n| `CORS_ORIGINS` | `*` | Allowed CORS origins |\n| `ALLOWED_HOSTS` | `*` | Access control (IPs, CIDR, hostnames, domains, `docker`) |\n\n**Access control.** The service restricts connections via `ALLOWED_HOSTS`. Set it explicitly in production (for example `docker,yourdomain.com`) so only your application reaches the API; external requests receive `403`. The `/health` endpoint and loopback are always allowed. For defence in depth, combine with network-level restrictions.\n\n## Project structure\n\n```\nreim/\n├── app/         # FastAPI: endpoints, schemas, access-control middleware\n├── reim/        # model: base, online, hierarchical, multidim, metrics, baselines\n├── tests/       # library, API, and middleware tests\n├── docs/        # technical report (the full framework)\n├── INTEGRATION.md\n└── Dockerfile / docker-compose.yml\n```\n\n## License\n\nREIM uses a dual licensing structure:\n\n- Source code is licensed under the **GNU Affero General Public License v3.0 or later**. See [LICENSE](LICENSE).\n- Documentation, technical reports, diagrams, and explanatory theory text are licensed under **Creative Commons Attribution-NonCommercial 4.0 International** unless otherwise stated. See [LICENSE-DOCS.md](LICENSE-DOCS.md).\n\nCommercial licensing is available separately by written agreement with the author.\n\n## Author\n\nREIM is designed and built by Mariano Viola, as part of ongoing work on inference and governance for AI-native systems. The theory behind it is the author's own.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarianoviola%2Freim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarianoviola%2Freim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarianoviola%2Freim/lists"}