Skip to main content

02 / projects / vera-engine

Vera AI Engine

Resilient 4-Tier AI Orchestrator & Cascade. A deterministic AI orchestration engine with a 4-tier fail-fast fallback cascade (NVIDIA NIM → Groq → Gemini → Local Qwen via llama-cpp-python), dynamic time budgeting, and sub-millisecond context distillation.

Python 3.10FastAPIllama-cpp-pythonLlamaGrammarDockerUvicorn
01Context

Problem & hardware constraints

A deterministic AI orchestration engine with a 4-tier fail-fast fallback cascade (NVIDIA NIM → Groq → Gemini → Local Qwen via llama-cpp-python), dynamic time budgeting, and sub-millisecond context distillation.

02Layers

System architecture & pipeline

The runtime is structured into decoupled execution layers to avoid latency jitter and unpredictable heap fragmentation:

01/Tier 1: High-Speed Cloud Inference

Routes latency-sensitive queries to Groq or NVIDIA NIM endpoints with strict 800ms timeouts.

02/Tier 2: High-Context Cloud Fallback

Falls back to Gemini for complex queries or when Tier 1 endpoints rate-limit.

03/Tier 3: In-Process Local Fallback

Launches a 4-bit quantized Qwen SLM running locally through llama-cpp-python with constrained BNF grammar output.

03Decisions

Engineering trade-offs & alternatives rejected

Strict time-budgeted cascade instead of retries

Retrying a failing cloud API three times wastes 6 seconds of user time. Failing fast to local hardware guarantees a response within 1.2 seconds every time.

04Field Notes

Field notes & edge cases

  • 01Grammar constraints via llama-cpp-python ensure the model output is always valid JSON. You never have to parse broken markdown backticks again.

— / deploy

Explore source & live runtime

Source code, static headers, and benchmarks are open for review on GitHub.

Other systems

Keep exploring