技能潮 SkillTide 提交收录
官方说明开源项目7 天前
zencefilefendi/kadi

zencefilefendi/kadi

⚖️ Kadı — a calibrated judge in front of your frontier LLM
在 GitHub 查看 ↗直链 · 无中转页
官方说明⚖️ Kadı — a calibrated judge in front of your frontier LLM. Routine decisions answered locally with a conformal-prediction guarantee (≤ α disagreement with the oracle); everything else escalated and learned from. Zero-dependency Python.
★ 数取值
25 ★ · zencefilefendi/kadi · 取自 GitHub 搜索 API · (2026-10-16 20:00:20 核对)
来源明细
从该仓库的 GitHub 页面直接读取 · 条目类型:开源项目
收录与活跃
收录于 2026-10-10 · 最近见到 2026-10-16 · 共见到 11 次 · 被 1 个来源列出
评分构成
综合分 103 · 25 ★ · 1 个来源 · repo
常见问题(答案都来自我们的记录)
怎么安装?
我们【没有】从该仓库取到安装命令(我们的 install 覆盖率只有约 4%)。请看它的 README 或 releases 页。
它适合谁 / 用来做什么?
我们把它归在这些标签下: 开源项目。标签来自条目自身,不是我们强加的分类。
谁维护它、还在更新吗?
仓库 zencefilefendi/kadi;我们收录于 2026-10-10;最近见到 2026-10-16。这里没有"官方认证"或"质量评级"——我们只记录来源与时间。
第三方质量标记

Kadı ⚖︎

以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →

**A calibrated judge in front of your frontier model.**
Routine decisions are answered locally, with a distribution-free bound on how often they disagree with the oracle.
Everything else is escalated, and every escalation teaches the local judge.
Roadmap · Engineering report · Theory · Threat model · MCP server · Türkçe · TypeScript client
---
Abstract
LLM-based agents and applications make large numbers of small, schema-shaped decisions: route a ticket, flag spam, pick the next tool, approve a change. Sending each one to a frontier model is accurate but slow and expensive. Sending each one to a small model is cheap, but its error rate is unknown.
Kadı is a three-tier cascade: exact memory → local reflex → oracle. The middle tier answers **only when a statistical certificate allows it**: either a split-conformal prediction set with at most one label, or a Learn-then-Test threshold. Under exchangeability, this bounds the probability that a returned decision disagrees with the oracle by a user-chosen α. The bound can be marginal or per label (Mondrian). With Learn then Test it holds **with probability ≥ 1 − δ, uniformly over time**.
Doing this in an *online* system takes four mechanisms (v0.6):
- **Frozen model versions.** A live model learns from every oracle label, but only frozen snapshots answer, and each is certified on calibration samples drawn *after* its freeze. So the scored model is genuinely independent of its calibration data, with no re-scoring and no leakage.
- **Random calibration samples.** The sampling coin never depends on the input. Calibrating on escalated examples is never done; §5 of the theory notes shows how that shortcut breaks the bound.
- **Anytime-valid certification.** Betting e-processes with Ville's inequality, and an error budget δ shared across versions, so every certificate ever issued holds at every point in time.
- **An e-detector on the deployed risk.** It has a bounded false-alarm rate (ARL), and on an alarm the served version is re-certified.
Kadı adds a novelty guard against out-of-distribution and adversarial inputs, shadow-mode deployment, PII redaction, a tamper-evident ledger and a hardened HTTP/MCP service. It is written in pure standard-library Python with zero dependencies.
How it works
| Tier | Latency | Cost | Answers when |
|---|---|---|---|
| **Memory** | µs | $0 | the exact input was judged before |
| **Reflex** | ms | $0 | the served frozen version's certificate allows it (and the guards pass) |
| **Oracle** | s | $$ | anything else; its verdict calibrates frozen versions and trains the live model |
| **Fallback** | ms | $0 | the oracle is down and on_oracle_error = "best_guess"; flagged, no guarantee |
The guarantee in one line
$$
\Pr\big(\hat{y} \neq O(x)\big) \;\le\; \Pr\big(O(x) \notin C(x)\big) \;\le\; \alpha
$$
A disagreement requires a local answer, and a local answer requires |C(x)| ≤ 1 (an empty set answers the argmax, which is already counted as a miscoverage). The full statement, its assumptions, the Mondrian variant, the ACI bound and **what is not guaranteed** are in docs/THEORY.md.
Two policies
| policy | Answers locally when | Guarantee | Best for |
|---|---|---|---|
| "conformal" (default) | the conformal set has at most one label | Pr(disagree) ≤ α **in expectation**; ACI adapts to drift; optional **per-label** bound (conditional=true) | the most local answers at a given α; rare-but-critical labels |
| "ltt" | max p ≥ λ̂, where λ̂ is certified by **anytime-valid Learn then Test** | **with probability ≥ 1 − δ, at every point in time**, Pr(disagree) ≤ α | when you need a high-probability, time-uniform guarantee (audits, regulated use) |
Why not just a confidence threshold?
| | Confidence threshold / vendor router | Kadı |
|---|---|---|
| When it answers locally | Uncalibrated score > hand-tuned cut-off | A frozen model version's certificate allows it (conformal set ≤ 1 label, or LTT threshold) |
| Error statement | Benchmark accuracy on someone else's data | **Disagreement with *your* oracle ≤ α**, per question, optionally per label |
| Under drift | Silent degradation | ACI re-tunes α t ; an e-detector with bounded false-alarm rate re-certifies, escalates and alerts |
| Evidence | Offline eval | Continuous random audits on live traffic, shown on the dashboard |
来源
github · https://github.com/zencefilefendi/kadi
按领域浏览
开源项目
Traction
25 ★
收录于
昨天

更多开源项目

查看开源项目全部 731 条 →

所属领域与标签

每个标签都能点进去看同类的全部条目。数字是当前库里的真实条数。

浏览全部领域 →

← 返回索引