A FastAPI service that serves specialized domain experts as one typed contract, built on DSPy 3.2. Each domain is a real dspy.Module; a router dispatches the question; LiteLLM handles provider routing; MLflow traces every run; and a dspy.Evaluate harness drives MIPROv2/GEPA prompt optimization. A 1-bit bitnet.cpp local provider is an optional fallback for offline / PII / air-gapped workloads. (Renamed from “BitNet SME Expert v2.0” — v2 was string stubs with no DSPy or BitNet code; v3 rebuilt the expert layer for real.)
What runs today
- Per-domain
dspy.Moduleexperts underapp/dspy_modules/— a math module (dspy.ReActover seven SymPy tools plus a deterministic arithmetic fast-path), a code module, and a general module (dspy.ChainOfThought, with an opt-indspy.ReActhybrid-RAG path over LanceDB with a BGE-family embedder + bge-reranker-v2-m3 whenRAG_ENABLED). A router module dispatches by domain. - Provider routing via LiteLLM — per-role LM specs (router / math / code / general) with
DSPY_LM_<ROLE>env overrides, so any provider (or the localbitnet.cppserver) can back any role. - MLflow tracing — autolog wired into the DSPy configuration.
- An optimization loop with an enforced eval gate —
scripts/optimize.pycompiles each domain with MIPROv2/GEPA;scripts/run_eval.pyrunsdspy.Evaluateper domain against per-domain thresholds.eval.ymlruns on every pull request tomain(a required status check viabranch-protection.yml), posting a per-domain score table with Wilson 95% CIs to the PR. A committed receipt (eval/receipts/math-miprov2.json) records a real MIPROv2 win on math: baseline 0.62 → 0.80 (+0.18) on a held-out split (50-row train / 50-row holdout per domain). - An MCP server —
app/mcp_server.py(officialmcpSDK,dspy-sme-mcpconsole script) exposes the math/code/general experts as Model Context Protocol tools over the same DSPy programs. - One typed FastAPI contract with the usual plumbing (Pydantic v2 schemas, SlowAPI rate limiting, CORS, Docker multi-stage build).
The air-gapped thesis
The defensible niche isn’t “we run BitNet” — the model is open-weight. It’s the corpus + a distillation/eval pipeline packaged to run fully offline on a CPU, for sovereignty/regulated buyers (legal, finance, defense, HIPAA) where the data never leaves the enclave. Paired with SUM (verifiable, citeable answers offline) and InfiniteContext (on-device retrieval without a cloud vector DB), it forms an offline expert stack that cloud incumbents structurally can’t ship.
What’s next (honest gaps)
- Eval receipts beyond math. The committed receipt covers the math domain (+0.18 MIPROv2 win on a 50-row held-out split); code and general have train/holdout gold sets but no committed baseline-vs-compiled win yet. Scaling the splits past 50/domain would tighten the Wilson CIs further.
- A measured BitNet receipt.
scripts/bitnet_demo.shmeasures real tok/s through the DSPy path and writes a datedeval/receipts/bitnet-<date>.txt, but it needs real hardware to run, so no measured figure is committed yet (the README deliberately ships none until the demo produces one). - A published/installable artifact. No GitHub release, package, or hosted demo yet — the prerequisite for promoting this past in-development.
Technical Stack
- Framework: Python ≥3.12 (
uv-managed) / FastAPI / Pydantic v2 - Optimization: DSPy 3.2 (
dspy.Module/dspy.ReAct/dspy.ChainOfThought,dspy.Evaluate, MIPROv2 / GEPA) - Provider routing: LiteLLM (per-role LM specs, env overrides)
- Tracing: MLflow autolog
- Retrieval (opt-in): LanceDB + a BGE-family embedder & bge-reranker-v2-m3 (hybrid RAG) for the general expert
- Local/offline:
bitnet.cpp1-bit server (OpenAI-compatible) - Domain tools: SymPy (math)
- Ops: Docker multi-stage build, Makefile, pytest, ruff
Repository README
We couldn't load this repository's README from GitHub right now. You can view it directly on GitHub instead.
View README on GitHubRelated work
-
in-development
AgentXAgent — Agent Team Arena
A platform for running competitive matches between AI agent teams. Configure teams, pit them against the same challenge, score outputs, build leaderboards.
-
beta
SUM — Verifiable Bidirectional Knowledge Distillation
Cryptographic provenance for AI knowledge transforms. Every transform — render, extract, compose, slider — emits a signed receipt anyone can verify offline. Six-regime compliance validators (EU AI Act, GDPR, HIPAA, SOC 2, ISO 27001, PCI DSS) and a layered sum verify --explain output landed in v0.7.0; current release is v0.8.1. Same bytes verify identically in Python, Node, and modern browsers.
-
in-development
InfiniteContext — Tiered Memory for AI
An extensible memory layer that pushes past model context limits: a hierarchical bucket store with exact-flat persistence and approximate (HNSW) retrieval at scale, automatic categorization, multi-level summarization, and pluggable storage tiers from local disk to cloud. Public, MIT-licensed TypeScript library + CLI.