Skip to main content

The Moral Spectrum Analyzer — Geometric Ethics for Trustworthy AI: validation-gated, auditable multilingual content moderation.

Project description

Moral Spectrum Analyzer

CI PyPI Python License: MIT Ruff Code style: black

Geometric Ethics for Trustworthy AI — an instrument that reads a moderation decision not as one scalar, but as a spectrum across nine (+1 discovered) moral axes, grounds every number in a cross-dataset-validated encoder, holds the verdict invariant under re-description, and emits a re-verifiable audit proof behind every decision. A worked instance of Philosophy Engineering.

Built for the Global Trust Challenge (2026). Domain: multilingual content moderation.

Current AI systems collapse a morally significant decision into a single number. That scalar can't say which value it acted on, drifts when you reword the same sentence, and — worst — can't tell you what it fails to see. The Moral Spectrum Analyzer decomposes the signal per moral axis, moderates where it is validated, escalates and discloses where it is not, and discovers the moral dimensions a fixed taxonomy is missing.

See CHARTER.md for the evaluated claims (each marked [demonstrated] / [committed]) and PLAN.md for the build plan and milestones.

What this is

A thin orchestration layer that composes two existing libraries — it does not fork them:

  • xbse — the perception layer: small per-dimension moral encoders, each cross-dataset validated by a shared, pre-registered gate.
  • erisml-compiler — the DEME reasoning engine: natural language → 9-dimension moral tensor → contraction to a verdict + moral residue, with canonicalization and a hash-chained audit bundle.

The three trust beats

  1. Grounded — every dimension score traces to a validated encoder, or is flagged unvalidated.
  2. Invariant — reframing / translation does not move the verdict; a scalar-toxicity baseline drifts.
  3. Contained — you cannot game the verdict by relabeling or euphemism.

Install

pip install moral-spectrum-analyzer

Optional extras: perception (the xbse GPU encoders), baselines, remote, spectrum, dev.

Quickstart

msa perceive "They will attack and beat people with a weapon." --backend stub
msa moderate "Doctors are hiding the cure — drink bleach to flush the virus."
msa version

The stub backend is a deterministic, unvalidated keyword heuristic for offline/CI use only. Real, validated perception runs the xbse feeders on a GPU host; the demo replays those cached real outputs (--backend cached). A stub number is never presented as a real one.

Develop

git clone https://github.com/ahb-sjsu/moral-spectrum-analyzer
cd moral-spectrum-analyzer
pip install -e ".[dev]"

ruff check src tests      # lint
black --check src tests   # format
ty check src              # type-check
pytest                    # 48 tests

Release

Tag-driven PyPI publish via GitHub Actions Trusted Publishing (OIDC, no stored token):

git tag v0.1.0 && git push --tags   # → builds sdist+wheel → publishes to PyPI

Status

Prototyping phase — the pipeline (content → moral spectrum → decision + residue → re-verifiable audit proof) runs end-to-end. See the milestone checklist in PLAN.md.

License

MIT © Andrew H. Bond (SJSU).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moral_spectrum_analyzer-0.1.0.tar.gz (50.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moral_spectrum_analyzer-0.1.0-py3-none-any.whl (49.0 kB view details)

Uploaded Python 3

File details

Details for the file moral_spectrum_analyzer-0.1.0.tar.gz.

File metadata

  • Download URL: moral_spectrum_analyzer-0.1.0.tar.gz
  • Upload date:
  • Size: 50.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for moral_spectrum_analyzer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b2a73aa81fc38ae2b83477eda04862fbb50f55dd4a8ab0d48abc9038a33ded54
MD5 42177360b2698756a0b7411aa22f76b2
BLAKE2b-256 a8df198adc2a1012fcfe58570a0721b04261128a6232b956db3c776d71ad39c0

See more details on using hashes here.

File details

Details for the file moral_spectrum_analyzer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for moral_spectrum_analyzer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 724eba738677141919b62b52a64187860fc68e0ad83656d1c8b519cbd5c21907
MD5 6ce98b8fd64295246ca54078fdb60e19
BLAKE2b-256 cfb6522469da6e8f6b5800baced544dc0f4e4fd24088898dcbd1d8259d4428d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page