- Area: Intelligence
- Path:
services/ai/classify
- Kind: Classification / NLU service (intent, sentiment, topic, language, multi-label)
- Status: v0.1.0 — foundation + intent recognition shipped (2026-05-28); Provider interface, sentimentlanguagemultilabelzero-shot, per-tenant versioned intent taxonomies + few-shotzero-shot routing + feedback/quality (CLASSIFY-003), Bearer + Go SDK
Role in the stack
classify provides the right tool for a small job. Classification is a classical ML primitive that LLMs handle badly and expensively — routing a chat message to the right product is not a billion-parameter problem; a 5MB fastText model nails it in 3ms with 95%+ accuracy. Today every consumer that needs intentsentimenttopic calls gateway/ with a giant LLM and pays full token cost. This sector hosts the small-model path (fastText, BGE, BERT-tiny) with LLM fallback only for novel labels and tail cases.
It is the Koder analog of Cohere Classify, scoped generically. Distinct from guard/ — guard handles safety/policy classification, classify handles everything else.
Boundary vs neighbors
services/ai/guard is also a classifier but scoped to safety/policy; sibling, not duplicate.
services/ai/runtime serves the small classification models.
services/ai/gateway provides the LLM fallback path for zero-shot.
services/ai/embed provides similarity backbone for label-free flows.
services/ai/training will own custom-classifier training in future (out of v1 scope).
services/ai/chat-adapter is the largest single intent consumer.
Features (v1 target)
- Language detection (fastText lid.176)
- Sentiment (BGE-class encoder + linear head, multilingual)
- Multi-label classification with auto-routing (small-model | embed-similarity | LLM)
- Zero-shot via NLI (BART-MNLI or LLM)
- Intent recognition with per-tenant taxonomies (kdb-doc, versioned)
- Few-shot when ≥5 examples per intent; zero-shot otherwise
- Batch endpoint with true model batching for high-throughput ingest
- Confusion-matrix endpoint per taxonomy for quality tracking
- Feedback loop (correction → cache + routing improvement)
Primary couplings
| Producer |
Relationship |
services/ai/runtime |
Serves fastText / BGE / BERT-tiny models |
services/ai/gateway |
LLM fallback for zero-shot |
services/ai/embed |
Similarity backbone |
| Consumer |
Relationship |
services/ai/chat-adapter |
Intent recognition for chat routing |
services/ai/agents |
Tool selection helper |
services/ai/rag, services/ai/recsys |
Topic + language tags during ingest |
services/ai/dataset |
Auto-label of bootstrap datasets |
| Product backends |
Per-tenant taxonomies |
RFC and bootstrap
- RFC:
classify-RFC-001-foundations.kmd — accepted 2026-05-09
- Bootstrap ticket:
services/ai/backlog/done/133-classify-bootstrap.md
- Implementation tickets:
001 languagesentiment, 002 multilabelzero-shot, 004 batch, 005 SDK+chat-adapter — DONE. 003 intent recognition + per-tenant taxonomy management — DONE 2026-05-28: internal/taxonomy (per-tenant versioned store — UpdateAddExample bump version, prior versions resolvable; audit trail; feedback + confusion matrix; cross-tenant→not-found), `internalintent (few-shot token-Jaccard over examples when every intent has ≥5 examples, else zero-shot via #002 provider; {intent,confidence,alternatives,method}), endpoints v1classify{intent,feedback,taxonomies…quality,…intents{slug}examples} with CLASSIFY-* errors; corrected the Stub ZeroShot threshold coercion (0.0 was silently bumped to 0.5) so zero-shot returns all scored labels; -race` tests across storerecognizerHTTP. Residual: real few-shotzero-shot model (CLASSIFY-006), persistence, live Koder ID auth (CLASSIFY-008). Pending: 006 real models, 007 async batch, 008 Dart binding.
Self-hosted-first analysis (5 gates)
| Gate |
Status |
Notes |
| G1 Feature parity |
pending |
fastTextBGEBART-MNLI cover Cohere Classify surface |
| G2 Performance |
pending |
Targets: 20ms language, 80ms sentiment, 100-300ms multi-label, 1.5s LLM zero-shot (p95) |
| G3 Stability |
pending |
Pre-MVP |
| G4 Capability |
pending |
Custom training out of v1 (deferred to training/) |
| G5 Critical-path readiness |
pending |
Unblocks chat routing + ingest tagging at ~100x cost reduction |