Conformal prediction (CP) is a powerful statistical framework that generates prediction intervals or sets with guaranteed coverage probability. While CP algorithms have evolved beyond traditional classifiers and regressors to sophisticated deep learning models like deep neural networks (DNNs), graph neural networks (GNNs), and large language models (LLMs), existing CP libraries often lack the model support and scalability for large-scale deep learning (DL) scenarios. This paper introduces TorchCP, a PyTorch-native library designed to integrate state-of-the-art CP algorithms into DL techniques, including DNN-based classifiers/regressors, GNNs, and LLMs. Released under the LGPL-3.0 license, TorchCP comprises about 16k lines of code, validated with 100\% unit test coverage and detailed documentation. Notably, TorchCP enables CP-specific training algorithms, online prediction, and GPU-accelerated batch processing, achieving up to 90\% reduction in inference time on large datasets. With its low-coupling design, comprehensive suite of advanced methods, and full GPU scalability, TorchCP empowers researchers and practitioners to enhance uncertainty quantification across cutting-edge applications.
翻译:共形预测(CP)是一种强大的统计框架,能够生成具有保证覆盖概率的预测区间或集合。尽管CP算法已从传统的分类器和回归器发展到复杂的深度学习模型,如深度神经网络(DNN)、图神经网络(GNN)和大语言模型(LLM),但现有的CP库往往缺乏对大规模深度学习(DL)场景的模型支持和可扩展性。本文介绍了TorchCP,这是一个基于PyTorch的原生库,旨在将最先进的CP算法集成到DL技术中,包括基于DNN的分类器/回归器、GNN和LLM。TorchCP以LGPL-3.0许可证发布,包含约16k行代码,并通过100%的单元测试覆盖率和详细文档进行了验证。值得注意的是,TorchCP支持CP特定的训练算法、在线预测和GPU加速的批处理,在大型数据集上推理时间最多可减少90%。凭借其低耦合设计、全面的先进方法套件以及完整的GPU可扩展性,TorchCP使研究人员和实践者能够在尖端应用中增强不确定性量化。