2-Tier Architecture

Deterministic data.
LLM reasoning. Never mixed up.

Data lookup goes through traditional, 100% reliable database queries — SQL, JSONB, NoSQL, or a Rule Engine. The LLM only ever reasons over that verified data. No hallucinated facts, no vector database required.

How It Works Where It Applies Works Without a Local Model
How It Works

Two tiers, one clean
separation of concerns

Data lookup and reasoning are two different jobs. TotalApp never lets an LLM do both at once — Tier 1 finds the exact data, Tier 2 reasons over what Tier 1 already verified.

  • Tier 1 — filters records by exact match using SQL, PostgreSQL JSONB, NoSQL, or a Rule Engine
  • Tier 2 — the exact JSON from Tier 1 is passed to the LLM as context
  • The LLM interprets, audits (like a linter), or decides — never invents facts
  • Zero chance of wrong data retrieval — nothing is fetched by approximation
See It in TotalApp
totalapp.app / two-tier-architecture
Tier 1 · Deterministic invoices WHERE status='overdue'
"Which invoices are overdue and is the late fee calculated correctly?"
1 SQL returns 3 exact-match rows — no approximation
2 Verified JSON passed to LLM as context
LLM reply: "Invoice #4021's late fee is off by $12 — recalculated per your 1.5%/month policy." Facts came from Tier 1; the LLM only reasoned over them.
No vector search involved · exact match only
Where It Applies

Structured data, not
free-text search

This architecture is built for data with a defined schema and clear rules — an invoice, a tax calculation, a permission check. For unstructured documents and open-ended text, Semantic Search is the right tool instead.

  • Best fit: ERP/CRM modules, invoice & tax calculations, RBAC permission checks
  • Not a fit alone: free-text search over documents with no fixed schema
  • Vector search isn't required for Tier 2 — structured JSON goes straight to the LLM as context
  • Combine with Semantic Search when a workflow needs both an exact check and similarity search
See Semantic Search
totalapp.app / two-tier-vs-semantic
2-Tier Architecture
Exact match · SQL/JSONB/NoSQL
Semantic Search
Vector similarity · embeddings
"Show overdue invoices" — exact schema match
"Find contracts like this one" — similarity search
Same platform, different tool for the job — pick by the shape of the question, not by habit.
Both approaches available in TotalApp
Works Without a Local Model

No local model or GPU?
The screen still works

If a user's machine has no local model (Ollama or similar) and no GPU available, no screen locks up, crashes, or becomes unusable. Three architectural guarantees make that true.

  • Graceful fallback — no local model found means an automatic switch to keyword search, never a stopped system
  • Core operations are AI-independent — listing, filtering, forms, and saving are standard CRUD
  • The AI layer is flexible — falls back to a cloud service, or the screen just runs without the AI buttons
See It in TotalApp
totalapp.app / graceful-fallback
No local model detected
Table, forms & CRUD — fully available, AI-independent
AI diagnostic buttons — routed to cloud service instead
i No cloud service either? Screen stays fully usable minus AI buttons
Nothing about the core screen ever depends on a local model being present.
Graceful fallback active
Why It Matters

A hybrid approach built for reliability

Traditional queries own the facts. The LLM owns the reasoning. Neither one does the other's job.

Zero Wrong-Data Risk

Tier 1 uses exact-match queries against your real schema — there is no approximate or "close enough" result to get wrong.

Hallucination Blocked at the Data Level

The LLM only ever reasons over data already verified correct by Tier 1 — it cannot introduce facts that aren't there.

No Vector Database Complexity

No embedding pipeline, similarity index, or vector store to build, tune, or keep in sync for this class of query.

SQL, JSONB, NoSQL, or Rule Engine

Tier 1 works with whichever deterministic store fits the data — no lock-in to a single database technology.

Reasoning, Review, or Decisioning

Tier 2 can interpret data in plain language, audit it like a linter, or support a decision — always from verified facts.

Built for ERP/CRM Workflows

Invoice and tax calculations, RBAC permission checks — any operational workflow with a fixed schema and firm rules.

Complements Semantic Search

Use this architecture for structured records, Semantic Search for free-text discovery — combine both in one workflow.

No Local Model? No Problem

Core CRUD operations never depend on AI. Missing a local model just routes Tier 2 to a cloud service, or disables only the AI buttons.