返回模型
说明文档
CharBoundary medium (default) ONNX 模型
这是 CharBoundary 库(v0.5.0)的 medium(默认)ONNX 模型,一个针对法律文本优化的快速基于字符的句子和段落边界检测系统。
模型详情
- 尺寸:medium(默认)
- 模型大小:2.6 MB(ONNX 压缩后)
- 内存占用:1897 MB 运行时(非 ONNX 版本)
- 训练数据:来自 KL3M 数据集 的法律文本,约 500,000 个样本
- 模型类型:随机森林(64 棵树,最大深度 20)转换为 ONNX
- 格式:针对推理优化的 ONNX
- 任务:用于文本分割的字符级边界检测
- 许可证:MIT
- 吞吐量:约 587K 字符/秒(基础模型;ONNX 通常快 2-4 倍)
使用方法
安全优势: 与 SKOPS 模型相比,此 ONNX 模型格式提供了增强的安全性,因为它不需要使用
trust_model=True来绕过安全措施。ONNX 模型是安全敏感环境的推荐选择。
# 确保安装时包含 onnx 扩展以获得 ONNX 运行时支持
# pip install charboundary[onnx]
from charboundary import get_medium_onnx_segmenter
# 首次加载可能较慢
segmenter = get_medium_onnx_segmenter()
# 使用模型
text = "This is a test sentence. Here's another one!"
sentences = segmenter.segment_to_sentences(text)
print(sentences)
# 输出:['This is a test sentence.', " Here's another one!"]
# 分割为跨度
sentence_spans = segmenter.get_sentence_spans(text)
print(sentence_spans)
# 输出:[(0, 24), (24, 44)]
性能
ONNX 模型在保持相同准确度指标的同时,相比标准 scikit-learn 模型提供了显著更快的推理速度。不同模型尺寸之间的性能差异如下所示。
基础模型性能
| 数据集 | 精确率 | F1 | 召回率 |
|---|---|---|---|
| ALEA SBD 基准 | 0.631 | 0.722 | 0.842 |
| SCOTUS | 0.938 | 0.775 | 0.661 |
| 网络犯罪 | 0.961 | 0.853 | 0.767 |
| BVA | 0.957 | 0.875 | 0.806 |
| 知识产权 | 0.948 | 0.889 | 0.837 |
大小和速度对比
| 模型 | 格式 | 大小 (MB) | 内存占用 | 吞吐量 (字符/秒) | F1 分数 |
|---|---|---|---|---|---|
| Small | SKOPS / ONNX | 3.0 / 0.5 | 1,026 MB | ~748K | 0.773 |
| Medium | SKOPS / ONNX | 13.0 / 2.6 | 1,897 MB | ~587K | 0.779 |
| Large | SKOPS / ONNX | 60.0 / 13.0 | 5,734 MB | ~518K | 0.782 |
论文和引用
此模型是以下论文中研究的一部分:
@article{bommarito2025precise,
title={Precise Legal Sentence Boundary Detection for Retrieval at Scale: NUPunkt and CharBoundary},
author={Bommarito, Michael J and Katz, Daniel Martin and Bommarito, Jillian},
journal={arXiv preprint arXiv:2504.04131},
year={2025}
}
有关模型架构、训练和评估的更多详情,请参阅:
- 论文:"Precise Legal Sentence Boundary Detection for Retrieval at Scale: NUPunkt and CharBoundary"
- CharBoundary GitHub 仓库
- 标注的训练数据
联系方式
此模型由 ALEA Institute 开发和维护。
如需技术支持、合作机会或一般咨询:
- GitHub:https://github.com/alea-institute/kl3m-model-research
- 邮箱:hello@aleainstitute.ai
- 网站:https://aleainstitute.ai
如有任何问题,请联系 ALEA Institute,邮箱 hello@aleainstitute.ai,或在此仓库或 GitHub 上创建 issue。

alea-institute/charboundary-medium-onnx
作者 alea-institute
text-classification
charboundary
↓ 0
♥ 0
创建时间: 2025-04-11 13:13:42+00:00
更新时间: 2025-04-11 13:30:29+00:00
在 Hugging Face 上查看文件 (3)
.gitattributes
README.md
model.onnx.xz