deepopen README

项目的 README,来自 github.com/deepopen-com/deepopen。合并为一个 markdown 文件:README.md。

DeepOpen

English | 简体中文

DeepOpen

An intent-classification framework and non-autoregressive SDK for structured decisions.

DeepOpen evaluates predefined questions over text or JSON and returns labels, scores, and probabilities. It does not generate free-form text. Output types are constrained; predictions can still be wrong, and probabilities require validation on your own data.

DeepOpen combines a decision SDK, dataset-specific training strategies, and reproducible Banking77 and CLINC150 evaluations. See Resources and attribution for the upstream foundations and this repository's contributions.

Benchmark highlights

Dataset DeepOpen test accuracy Configuration Correct / total
BANKING77 94.1234% Single classifier, SAM seed 13 2,899 / 3,080
CLINC150 98.0222% Four-encoder ensemble 4,411 / 4,500

Explore both benchmark comparisons, predictions, and evaluation evidence on Hugging Face.

BANKING77

BANKING77 benchmark comparison: DeepOpen SAM 94.1234%, alongside selected published reference results

CLINC150

CLINC150 benchmark comparison: DeepOpen ensemble 98.0222%, alongside selected published reference results

These screenshots show the selected references in the HF evaluation page (reference snapshot: 7 October 2026); they do not assign an official leaderboard rank. BANKING77 displays the best test result of three SAM seeds, selected after evaluation; the three-seed mean is 94.0368%, with no statistically established improvement over the replayed baseline. CLINC150 covers 150 in-scope intents only, without OOS detection, and combines one Laya-based specialist with three DeBERTa-v3-large models. Full protocol, execution caveats, and prediction files are available on the linked page.

Installation

Use Python 3.10 or newer and Git. Install from this repository; the installation instructions do not depend on a PyPI release named deepopen.

python -m pip install "git+https://github.com/deepopen-com/deepopen.git"
python -c "import deepopen; print(deepopen.__version__)"

For a CPU-only environment, install CPU PyTorch before the SDK:

python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
python -m pip install "git+https://github.com/deepopen-com/deepopen.git"

GPU users should install a PyTorch build compatible with their driver and CUDA environment. The benchmark training scripts have separate dependencies and instructions in their respective directories.

Quick start

This example loads the English upstream checkpoint and answers one classification question. The first call downloads weights and initializes the model; it is not a warm-inference latency measurement.

import deepopen

agent = deepopen.load("convaiinnovations/laya", device="cpu")
questions = {
    "department": {
        "type": "choice",
        "instructions": "Which department should handle this request?",
        "criteria": {
            "billing": "invoices, payments, refunds",
            "technical": "bugs, outages, system errors",
            "sales": "pricing, new contracts",
            "other": "everything else",
        },
    }
}
result = agent.predict(
    {"body": "I was charged twice. Please refund the duplicate payment."},
    questions,
)
print(result["answers"]["department"])

The answer includes choice, probabilities, and confidence. Results depend on the checkpoint and input; a high confidence score is not a guarantee of correctness. Use device="cuda" with a compatible GPU environment. A local checkpoint directory can replace the Hub ID.

Routing and model loading

from deepopen import Router

router = Router(device="cpu")
# Inspect routing without downloading weights or running inference.
print(router.route({"body": "Please refund the duplicate charge."}, questions))

# The first prediction loads the selected checkpoint.
result = router.predict({"body": "Please refund the duplicate charge."}, questions)

# Select the workflow-specific checkpoint explicitly when appropriate.
# result = router.predict(state, questions, model="typed-decisions")

Language routing uses script and language heuristics, not an accuracy oracle. The typed-decisions checkpoint is not automatically selected by default. Select it explicitly, or opt in to task detection with auto_task_detection=True after validating the behavior on your workload.

The default cache keeps one model loaded. For repeated multilingual traffic, use Router(max_loaded=2) and router.preload(["english", "multilingual"]). Router(preload=True) loads all three models and needs memory for all of them. Preloading avoids repeated model loads; it does not guarantee a fixed inference latency.

Router key Default Hub location Encoder Default context
english Laya repository root ModernBERT-large 512
multilingual Laya / multilingual mmBERT-base 1,024
typed-decisions Laya / typed-decisions ModernBERT-large 1,024

The Python package is named deepopen; upstream model IDs retain laya so they match the loader configuration.

Decision types and workflow presets

Type Output Example
choice Label, option probabilities, confidence Department or intent classification
score Expected ordinal level and distribution Urgency scoring
noul Estimated probability that a statement is true Refund request detection

The SDK provides router_questions(), guard_questions(), moderation_questions(), triage_questions(), and email_questions(). These are question templates, not production safety guarantees. Validate accuracy and calibrate confidence before automating consequential decisions.

Earlier intent-classification experiments

The table below preserves earlier local evaluations and training recipes. The HF highlights above additionally include the later BANKING77 SAM continuation result (94.1234%); the older 94.0909% result is a different training and execution configuration. These are not confirmed official leaderboard placements. They require task-specific training; installing the SDK does not reproduce these scores automatically.

Dataset Configuration Test accuracy Scope
Banking77 Laya encoder + classification head, 7 training epochs + 4 continuation epochs 94.0909% 3,080 test examples, 77 classes
CLINC150 Validation-selected R-Drop single model 97.7556% 4,500 in-scope test examples, 150 classes
CLINC150 Laya + three DeBERTa-v3-large models 98.0222% Four-model ensemble; same in-scope test

CLINC150 results exclude out-of-scope detection. The Banking77 headline is the ordinary classification-head continuation result, not a prototype-branch gain. The ensemble uses four encoders and its latency must not be represented by the single-checkpoint measurements below.

Upstream checkpoint measurements and limitations

The benchmark report describes separate checkpoint experiments. Do not combine the following rows into a single configuration's performance claim.

Measurement Configuration and conditions Historical result
Single-question latency Multilingual checkpoint, warm inference, NVIDIA T4 32.8 ms
Ten-question latency Multilingual checkpoint, one batched call, NVIDIA T4 72.3 ms total; 7.2 ms/question
Typed-decisions accuracy Task-fine-tuned checkpoint; 400 cases / 2,000 decisions 0.766
Mean ECE after temperature refitting English base checkpoint, calibration experiment 0.081
Multilingual coverage evaluation 51 MASSIVE languages, 20 options 45 / 51 exceed 3× random accuracy

The encoder's advertised 100+ language coverage does not establish equal quality in every language. Base checkpoints are near chance on the typed-decisions zero-shot task and below its majority-class baseline. Both base checkpoints are overconfident as shipped; temperature fitting must use a separate calibration split. Held-out moderation accuracy is only 0.530 in the reported experiment. Large option sets compete for a shared prompt budget, and ordinal scoring remains a weak point.

Jev comparisons in the historical report use third-party published results, with different prompts and sample sizes. They are indicative comparisons, not a controlled head-to-head evaluation. Self-hosting avoids per-token API fees but still incurs hardware, electricity, and operating costs.

Resources and attribution

The SDK and base model architecture derive from Laya. This repository provides DeepOpen packaging and documentation, Banking77 adaptation experiments, and CLINC150 R-Drop/SupCon and heterogeneous-ensemble reproduction workflows. See the Banking77 source manifest and CLINC150 source manifest for pinned source provenance. SDK defaults continue to load upstream checkpoints; the experiment guides explain how to train and export task-specific models.

Development

python -m pip install -e .
python tests/test_router.py
python tests/test_criteria.py

These tests cover routing and input handling without downloading model weights. tests/test_local_e2e.py additionally requires local checkpoints; its module documentation describes the directory layout. CI also checks lint, package builds, and the installed wheel. The SDK version is defined once in deepopen/_version.py.

Contributors

License

Apache License 2.0. Retain upstream attribution and review the separate model and dataset licenses for your intended use.

deepopen (deepopen-com/deepopen)

正在搜索数据库…

这是什么?DeepOpen 是一个开源的非自回归「系统 1」决策引擎:它不像 LLM 那样逐个 token 地生成文本,而是在一次前向传播中对文本、邮件、工单或 JSON 做出类型化决策(选择、分数或布尔值),覆盖 100 多种语言,最快只需 33 毫秒。
它是像 LLM 那样生成文本的聊天机器人,还是别的东西?不是——它是一个 BERT 家族的编码器模型(基于 ModernBERT/mmBERT),从不生成文本;每个输出都是预定义的结构化类型(选择、分数或布尔值),因此既不需要解析,也没有它可以产生幻觉的地方。
我该怎么开始使用它?拉取三个已发布的 Hugging Face 检查点(convaiinnovations/deepopen)之一,并在 Python 中调用内置的 Router——它会自动检测输入的文字系统/语言并分派到最合适的检查点,一次前向传播就返回类型化结果和路由元数据。
运行它需要自己的 GPU 或 API 密钥吗?不需要 API 密钥——权重以 Apache-2.0 发布,自托管成本标注为 $0,但要想拿到宣传中的延迟数字,你需要一块 CUDA GPU,因为所有基准测试都是在 Tesla T4 上测得的。
它开箱即用效果好吗?对困难的任务来说并不好——基础检查点在 typed-decisions 基准上的得分接近随机水平;0.766 这个亮眼的准确率只有在你自己的数据上微调之后才会出现,所以 deepopen 的定位是供专门化的基座,而不是零样本引擎。
我能在不调用任何外部 API 的情况下运行它吗?可以——检查点从 Hugging Face 下载完成后,推理就完全在本地运行,不调用任何 API,这也是为什么 README 把成本列为「$0 自托管」,以对比 Jev 按 token 计费的 API 定价。
它真的可以免费商用吗?可以——所有检查点都以 Apache 2.0 发布,不同于它所对标的封闭 API 模型 Jev,所以你可以以 $0 自托管,而不必为类似服务按 token 付费。
这些速度数字是在什么硬件上测得的?所有延迟数字(单个问题 33 毫秒,批量为每题 7.2 毫秒)都是在单块 Nvidia Tesla T4 GPU 上测得的,批量吞吐量达到每秒 103-332 个问题。
Router 模式是什么?它为什么重要?Router 会在亚毫秒级检测输入的文字系统和语言,并自动从三个检查点中挑选对它表现最好的一个;这一点很重要,因为纯英文检查点在处理高棉语这类非拉丁文字系统时依然信心十足却完全答错(95% 置信度下准确率为 0%)。
deepopen 和 TypeSafe 的 Jev 模型相比如何?deepopen 回答单个问题快约 6-7 倍(32.8 毫秒对 Jev 的 236-276 毫秒),并且在大多数受测任务上准确率超过 Jev(例如 typed-decisions 0.766 对 0.727),但在选项超过 20 个的高基数任务上 Jev 仍然占优,比如 Banking77 的 77 个标签。
它为什么在 Banking77 上输给 Jev?Banking77 有 77 个答案选项,但 deepopen 默认的 token 预算只给每个标签分配约 3-4 个 token,导致这些标签几乎无法区分;调大 headmaxlen 设置,或把选择拆成两步的层级结构,就能解决这个问题。
我能用自己的数据微调 deepopen 吗?可以——项目提供了一个 Kaggle notebook,可在免费的 dual-T4 GPU 上运行,覆盖整个流程:构建数据集、用 RLCD(基于合理评分规则的强化学习)训练、拟合校准温度、评估,并把结果推送到 Hugging Face Hub。
大小
3 MB
星标
3.1K
更新
提交Nov 03
时长
2个月
提交 · 90 天