返回模型
说明文档
CharBoundary small ONNX 模型
这是 CharBoundary 库(v0.5.0)的小型 ONNX 模型,是一个针对法律文本优化的快速基于字符的句子和段落边界检测系统。
模型详情
- 规格: small(小型)
- 模型大小: 0.6 MB(ONNX 压缩后)
- 内存占用: 1026 MB 运行时(非 ONNX 版本)
- 训练数据: 来自 KL3M 数据集的法律文本,约 50,000 个样本
- 模型类型: 随机森林(32 棵树,最大深度 16)转换为 ONNX
- 格式: 针对推理优化的 ONNX
- 任务: 面向文本分割的字符级边界检测
- 许可证: MIT
- 吞吐量: ~748K 字符/秒(基础模型;ONNX 通常快 2-4 倍)
使用方法
安全优势: 与 SKOPS 模型相比,这种 ONNX 模型格式提供了更高的安全性,因为它不需要使用
trust_model=True来绕过安全措施。ONNX 模型是安全敏感环境的推荐选择。
# Make sure to install with the onnx extra to get ONNX runtime support
# pip install charboundary[onnx]
from charboundary import get_small_onnx_segmenter
# First load can be slow
segmenter = get_small_onnx_segmenter()
# Use the model
text = "This is a test sentence. Here's another one!"
sentences = segmenter.segment_to_sentences(text)
print(sentences)
# Output: ['This is a test sentence.', " Here's another one!"]
# Segment to spans
sentence_spans = segmenter.get_sentence_spans(text)
print(sentence_spans)
# Output: [(0, 24), (24, 44)]
性能
ONNX 模型在保持相同准确率指标的同时,提供了比标准 scikit-learn 模型显著更快的推理速度。不同模型规格之间的性能差异如下所示。
基础模型性能
| 数据集 | 精确率 | F1 | 召回率 |
|---|---|---|---|
| ALEA SBD 基准测试 | 0.624 | 0.718 | 0.845 |
| SCOTUS | 0.926 | 0.773 | 0.664 |
| Cyber Crime | 0.939 | 0.837 | 0.755 |
| BVA | 0.937 | 0.870 | 0.812 |
| 知识产权 | 0.927 | 0.883 | 0.843 |
规格与速度对比
| 模型 | 格式 | 大小 (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}
}
有关模型架构、训练和评估的更多详情,请参阅:
联系方式
本模型由 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-small-onnx
作者 alea-institute
text-classification
charboundary
↓ 0
♥ 0
创建时间: 2025-04-11 12:59:17+00:00
更新时间: 2025-04-11 13:30:23+00:00
在 Hugging Face 上查看文件 (4)
.gitattributes
README.md
model.onnx
ONNX
model.onnx.xz