⚠️ This document is a historical archive. Current architecture diagrams and documentation live at docs.qwedai.com. The information below reflects an earlier (v2-v3 era) design with only 4 engines and no security guards.
QWED is a deterministic verification layer for AI systems. It verifies AI outputs using mathematics, symbolic reasoning, and formal methods (Z3, SMT, SymPy), creating an auditable trust boundary for agentic AI. Not generation. Verification.
The system operates in three layers:
- Translation Layer (Neural): LLMs convert natural language queries into structured intermediate representations (IR).
- Verification Layer (Symbolic): Specialized engines execute the IR deterministically to produce a result or proof.
- Cross-Validation Layer: Results are checked against constraints and safety policies before being returned.
graph TD
User[User/Application] --> API[QWED API / SDK]
API --> Controller[Control Plane]
subgraph "Neural Layer"
Controller --> Prompting[Prompt Engineering]
Prompting --> LLM[External LLM (OpenAI/Anthropic/Local)]
LLM --> Parser[Response Parser]
end
subgraph "Symbolic Layer"
Parser --> Math[Math Engine (SymPy)]
Parser --> Logic[Logic Engine (Z3)]
Parser --> SQL[SQL Engine (SQLGlot)]
Parser --> Code[Code Engine (AST Analysis)]
end
Math --> Verifier[Result Verifier]
Logic --> Verifier
SQL --> Verifier
Code --> Verifier
Verifier --> PII[PII / Safety Guard]
PII --> User
Orchestrates the request lifecycle. It identifies the query domain (Math, Code, SQL, etc.) and routes it to the appropriate engine.
Each domain has a dedicated engine:
- Math: Uses
SymPyfor symbolic mathematics. - Logic: Uses
Z3theorem prover for propositional and first-order logic. - Code: Uses Python's
astmodule for static analysis and safe execution environments. - SQL: Uses
SQLGlotandDuckDBfor schema-aware query verification.
- PII Masking: [Planned] Detects and obfuscates minimal PII using
Presidiobefore sending data to LLMs. - Injection Protection: Static analysis prevents prompt injection and code injection attacks.
- User sends a query (e.g., "What is the integral of x^2?").
- Control Plane detects "Math" domain.
- LLM is prompted to translate "integral of x^2" to SymPy code:
integrate(x**2, x). - Math Engine executes the SymPy code safely.
- Result (
x**3/3) is formatted and returned to the user.