ONNX 模型库
返回模型

说明文档

CharBoundary 大型 ONNX 模型

这是 CharBoundary 库(v0.5.0)的大型 ONNX 模型,一个针对法律文本优化的快速基于字符的句子和段落边界检测系统。

模型详情

  • 规格: large(大型)
  • 模型大小: 12.0 MB(ONNX 压缩后)
  • 内存占用: 5734 MB(非 ONNX 版本运行时)
  • 训练数据: 来自 KL3M 数据集的法律文本,约 5,000,000 个样本
  • 模型类型: 随机森林(100 棵树,最大深度 24)转换为 ONNX
  • 格式: ONNX,针对推理优化
  • 任务: 用于文本分割的字符级边界检测
  • 许可证: MIT
  • 吞吐量: ~518K 字符/秒(基础模型;ONNX 通常快 2-4 倍)

使用方法

安全优势: 与 SKOPS 模型相比,此 ONNX 模型格式提供更高的安全性,因为它不需要使用 trust_model=True 来绕过安全措施。ONNX 模型是安全敏感环境的推荐选择。

# 确保安装时包含 onnx 附加组件以获得 ONNX 运行时支持
# pip install charboundary[onnx]
from charboundary import get_large_onnx_segmenter

# 首次加载可能较慢
segmenter = get_large_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.637 0.727 0.847
SCOTUS 0.950 0.778 0.658
网络犯罪 0.968 0.853 0.762
BVA 0.963 0.881 0.813
知识产权 0.954 0.890 0.834

大小和速度对比

模型 格式 大小 (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。

https://aleainstitute.ai

alea-institute/charboundary-large-onnx

作者 alea-institute

text-classification charboundary
↓ 0 ♥ 0

创建时间: 2025-04-11 13:15:29+00:00

更新时间: 2025-04-11 13:30:39+00:00

在 Hugging Face 上查看

文件 (3)

.gitattributes
README.md
model.onnx.xz