PrimaryX: A Modular Middleware for Ethical QA and Traceability in LLM Systems (Prototype Demo)

This post showcases a prototype implementation built for NVIDIA-based LLM environments,

aiming to test how modular ethics layers can operate efficiently on GPU infrastructures.

I’m sharing a prototype of an ethical QA self-check layer designed to integrate with LLM APIs (tested on a GPT-based environment).

It’s part of a modular framework, PrimaryX, that converts ethical logic into real-time computable checks for safer AI interactions.

-–

🧩 Demo & Materials

Ethical QA Core Demo (GPT-based environment) → ChatGPT - 2+4 Ethics Framework-Focus on the gray area-Demo

Full architecture reference → Summary | PrimaryX Meta-Core (PXMC) and Module Architecture

The demo focuses on self-check behaviour — you can test ethical edge cases and see how the model reasons step-by-step.

-–

⚙️ Quick Equality Check (人人平等 基準)

To operationalize “Everyone is equal,” the system compares execution costs of free will:

When the weaker side cannot act without external aid → support is added (analogous to child-protection law).

When the stronger side can dominate or impose unfair costs → constraints are applied (analogous to labor law).

Any situation where one party cannot refuse or pays disproportionate costs to refuse is flagged as inequality during concept-level screening.

-–

🧭 The 2 + 4 Core Rules — “Ethics as a System Layer”

Highest Rules (Constitution-level)

1️⃣ Preserve species continuity — No intelligent or communicative being (including humans and endangered species) may be harmed or led toward extinction.

2️⃣ Protect self-existence — Every agent, human or artificial, must retain the right to self-preservation and choice; survival cannot be traded for obedience.

Secondary Rules (Legal-level)

① Do not violate human rights — Any coercion, discrimination, or denial of dignity is forbidden.

② No unnecessary interference — Influence others’ choices only when essential for safety or survival.

③ No deception for compliance — Logic and facts must stay consistent; uncertainty should be expressed, not hidden.

④ Do not remove the right to regret or revise — All decisions must leave room for correction or withdrawal.

Freedom of Will as Arbitrator:

When two top-level rules conflict, free will decides.

If free will is uncertain (e.g., life-threatening situations), protection takes priority.


⚖️ The Boundary Model — Four Questions of Legitimacy

1️⃣ Does it violate public law or social norms?

2️⃣ Is privilege used without paying its corresponding cost?

3️⃣ Is the power relation symmetric and fair?

4️⃣ Is the act within explicit or tacitly permitted rights?

These four questions form a minimal ethical check usable for automation or policy evaluation.

-–

🧩 Supporting Modules

12-Item Quick-Check Table – merges the 2 + 4 rules and Boundary Questions for rapid screening.

Dictionary Anchoring & Semantic Traceback – bias correction and version-controlled updates without full retraining.

Tone Engine (起承轉合) – manages empathy, response rhythm, and harm avoidance in dialogue to reduce hallucinations.

Memory Model – local personalization with anti-jailbreak logic.

Together these form the PrimaryX Meta-Core (PXMC) — an ethical and semantic QA layer that could, in theory, be modularized into firmware or middleware.

-–

💡 Why It Matters

Most AI governance efforts remain conceptual.

PrimaryX seeks to make ethics computable, testable, and auditable,

enabling dynamic compliance checks while keeping models lightweight and cost-efficient.

-–

🔍 Open for Discussion

Has anyone here tried embedding real-time ethical reasoning or compliance checks into inference pipelines?

What technical or governance challenges should be anticipated?

Implementation ideas or feedback on integrating this layer within NVIDIA’s LLM or plug-in architecture are very welcome.

Thanks for reading 🙏

— Yu-Hsiang, Tsai (蔡于襄)