• Stars
    star
    182
  • Rank 211,154 (Top 5 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 2 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

飞桨可信AI

安装 | 快速开始 | 可信分析 | 可信增强 | 应用案例 | 评测榜单 | 学术文献

TrustAI是基于深度学习平台『飞桨』(PaddlePaddle)开发的集可信分析和增强于一体的可信AI工具集,助力NLP开发者提升深度学习模型效果和可信度,推动模型安全、可靠的落地于应用。


图 TrustAI提供能力概览

News 📢

  • 🔥 2022.12.27 TrustAI发布数据地图绘制能力,欢迎大家使用。
  • 🔥 2022.10.30 可解释评测数据集入驻千言,部分数据提供人工标注证据,欢迎大家使用。
  • 🔥 2022.8.29 PaddleNLP分类系统已经接入TrustAI能力,欢迎大家试用。
  • 🔥 2022.8.20 TrustAI发布可信增强能力及应用案例。
  • 🎉 2022.5.20 TrustAI首次发布

可信分析

TrustAI提供证据分析和数据分析能力。

证据分析

证据分析提供模型预测依赖的证据。TrustAI从特征级和实例级两种维度提供证据分析方法,全方位解释模型的预测,帮助开发者了解模型预测机制,以及协助使用者基于证据做出正确决策。

特征级证据分析

根据模型预测结果,从输入文本中提取模型预测所依赖的证据,即输入文本中支持模型预测的若干重要词。

应用示例见AI Studio - 基于TrustAI的特征级证据分析示例-中文情感分析任务

关于方法更多详细内容可参考 - 特征级证据分析文档

实例级证据分析

从训练数据中找出对当前预测文本影响较大的若干训练样本作为模型预测依赖证据。

应用示例见AI Studio - 基于TrustAI的实例级证据分析示例-中文情感分析任务

关于方法更多详细内容可参考 - 实例级证据分析文档

数据分析

数据分析能力旨在根据训练、预测信号绘制数据地图(见下图),并结合证据分析识别数据缺陷。当前,TrustAI针对三种数据缺陷提供了识别方法,三种缺陷分别是数据标注错误、数据标注不足(也称为数据覆盖不足)、数据分布偏置。


图 基于训练信号绘制的训练数据地图

数据标注错误识别

TrustAI提供了标注错误数据(即脏数据)自动识别功能,帮助降低人工检查数据的成本。

如下图所示,在两个公开数据集上,TrustAI自动识别的标注错误数据比例远高于随机选择策略。


图 不同策略的标注错误数据识别效果

应用示例见AI Studio - 训练数据中标注错误数据自动识别示例

数据覆盖不足识别

训练数据覆盖不足会导致模型在对应的测试数据上表现不好。基于实例级证据分析方法,TrustAI可识别训练数据覆盖不足的测试数据(这些数据构成的集合称为目标集),模型在目标集上效果降低20%左右。


图 模型在全部测试数据和覆盖不足测试数据上的效果

应用示例见AI Studio - 训练数据覆盖不足识别示例

数据分布偏置识别

神经网络模型会利用数据集中的偏置做预测,这会导致模型没有学会理解语言,鲁棒性差。TrustAI提供了基于统计的偏置识别和基于模型的偏置识别。

基于统计的偏置识别,见偏置识别

基于模型的偏置识别,待开源。

可信增强

TrustAI提供了针对识别缺陷的优化方案,即可信增强功能。当前,从训练数据和训练机制优化角度,TrustAI开源了针对3种数据缺陷的优化方案,希望能够帮助开发者以最小成本解决训练数据缺陷问题。同时,TrustAI开源了一种基于证据指导的预测机制优化方案,用来解决长文本理解问题。

针对数据标注错误的数据清洗

从训练数据角度,直接对TrustAI识别的标注错误数据进行人工修正,效果如下图所示。


图 在三个常见分类任务上针对标注错误的数据清洗效果

从训练机制角度,TrustAI也提供了缓解脏数据影响的策略,待开源。

针对数据覆盖不足的有效数据增强

针对训练数据覆盖不足常见做法是补充数据。为降低标注成本,TrustAI提供了有效数据增强策略,即从未标注数据中选择可以提高训练数据覆盖度和模型效果的数据进行标注。

如下图所示,在两个公开数据集上,TrustAI提供的有效数据增强策略对模型在目标数据上的效果提升远高于随机选择策略。


图 目标集提升的效果

应用示例见AI Studio - 针对训练数据覆盖不足的有效数据增强示例

针对数据分布偏置的偏置消除

TrustAI提供了分布修正和权重修正两种策略,在不需要人工介入的条件下,有效缓解数据偏置对模型训练的影响。

如下图所示,在两个公开的鲁棒性数据集上,TrustAI的权重修正和分布修正策略分别取得明显提升。


图 偏置修正后模型在鲁棒性数据集上的效果

应用示例见AI Studio - 数据分布偏置缓解策略-数据权重修正示例数据分布偏置缓解策略-数据分布修正示例

证据识别及基于证据的预测 - 预测机制优化

在长本文理解任务中,输入中的冗余信息往往会干扰模型预测,导致模型鲁棒性差。TrustAI提供了“证据识别-基于证据的预测”两阶段预测方案,显著提升长文本任务上的模型效果,尤其是模型的鲁棒性。

以DuReader-robust数据集的训练数据训练模型,在DuReader-robust验证集、测试集以及DuReader-checklist测试集上进行了效果验证,分别验证模型的基本效果、鲁棒性效果、领域泛化效果,各数据集上的答案精准匹配率均取得显著提升。


图 证据识别及基于证据预测的两阶段策略在阅读理解任务上的效果

应用示例见AI Studio - 证据识别及基于证据的预测示例-中文阅读理解任务

关于可信增强更多内容请阅读tutorials

安装

依赖

pip 安装

# 依赖paddlepaddle,推荐安装CUDA版本
pip install -U paddlepaddle-gpu
pip install -U trustai

源码编译

git clone [email protected]:PaddlePaddle/TrustAI.git
cd TrustAI
python setup.py install

快速开始

特征级证据分析

 以Integrated Gradient方法为例,其调用方法如下所示:
from trustai.demo import DEMO
from trustai.interpretation import IntGradInterpreter
from trustai.interpretation import visualize

demo = DEMO('chnsenticorp')
# init demo model
model = demo.get_model()
tokens, model_inputs = demo("这个宾馆比较陈旧了")
# tokens: List[List[str]], [['[CLS]', '这', '个', '宾', '馆', '比', '较', '陈', '旧', '了', '[SEP]']]
# model_inputs: List[Paddle.Tensor],满足`logits = model(*model_inputs)`
# init interpreter
interpreter = IntGradInterpreter(model)
result = interpreter(model_inputs)
# result: List[IGResult], result[0].attribtions与tokens[0]一一对应,表示每一个token对预测结果的支持程度,即证据的支持度分数。
# result[0].attributions: [ 0.04054353,  0.12724458, -0.00042592,  0.01736268,  0.07130871, -0.00350687,
#                           0.01605285,  0.04392833,  0.04841821, -0.00514487,  0.13098583]

# 可视化结果
html = visualize(result, words=tokens)
# TrustAI提供可视化输出,即根据输入特征的支持度,以不同颜色深度展示结果。颜色越深表示支持度越大,越浅表示支持度越小。

 更多详情 - 特征级证据分析文档

实例级证据分析

 以Feature Similarity方法为例,其调用方法如下所示:
from trustai.demo import DEMO
from trustai.interpretation import FeatureSimilarityModel
demo = DEMO('chnsenticorp')
# init demo model
model = demo.get_model()
tokens, model_inputs = demo("房间设备比较陈旧,没五星标准 客人非常不满意")
# tokens: List[List[str]]
# model_inputs: List[Paddle.Tensor],满足`logits = model(*model_inputs)`
# get dataloader of train data, 满足`logits = model(*next(train_data_loader))`
train_data, train_dataloader = demo.get_train_data_and_dataloader()
# init interpreter
interpreter = FeatureSimilarityModel(model, train_dataloader, classifier_layer_name='classifier')
result = interpreter(model_inputs)
# result: List[ExampleResult], [ExampleResult(pred_label=0, pos_indexes=(7112, 1757, 4487), neg_indexes=(8952, 5986, 1715), pos_scores=(0.9454082250595093, 0.9445762038230896, 0.9439479112625122), neg_scores=(-0.2316494882106781, -0.23641490936279297, -0.23641490936279297))]
# ExampleResult.pos_indexes: List[int], 支持当前预测的训练数据在训练集中的索引
# ExampleResult.neg_indexes: List[int], 不支持当前预测的训练数据在训练集中的索引
# ExampleResult.pos_scores: List[float], 支持当前预测的训练数据的支持度
# ExampleResult.neg_scores: List[float], 不支持当前预测的训练数据的支持度

 更多详情 - 实例级证据分析文档

关于接口使用的更多样例见examples目录

应用案例

 自动识别脏数据,降低人力检查成本

   训练数据中脏数据自动识别示例

 以一半标注成本,带来更大效果提升

   训练数据覆盖不足识别及有效数据增强示例

 缓解数据集偏置,提升模型鲁棒性

   数据集分布偏置缓解 - 数据权重修正策略示例

   数据集分布偏置缓解 - 数据分布修正策略示例

 证据识别及基于证据的预测,提升模型鲁棒性

   证据识别及基于证据的预测示例


关于应用案例的更多说明,请参考tutorials目录

评测榜单

评测数据集下载:千言数据集-可解释性评测

 限时赛
 常规赛

学术文献

 评测参考论文(数据集和评测指标)
 可信分析参考论文
 可信增强参考论文
  端到端可解释性模型参考论文
 进阶学习材料
 各赛事优秀方案分享

引用

要引用 TrustAI 进行研究,请使用以下格式进行引用。

@article{wang2022fine,
  title={A Fine-grained Interpretability Evaluation Benchmark for Neural NLP},
  author={Wang, Lijie and Shen, Yaozong and Peng, Shuyuan and Zhang, Shuai and Xiao, Xinyan and Liu, Hao and Tang, Hongxuan and Chen, Ying and Wu, Hua and Wang, Haifeng},
  journal={arXiv preprint arXiv:2205.11097},
  year={2022}
}

致谢

我们实现的可信分析方法参考和依赖了InterpretDL项目,在此向InterpretDL的作者表示感谢。

LICENSE

TrustAI遵循Apache-2.0开源协议

More Repositories

1

PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
Python
43,170
star
2

Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
C++
22,193
star
3

PaddleDetection

Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
Python
12,744
star
4

PaddleHub

Awesome pre-trained models toolkit based on PaddlePaddle. (400+ models including Image, Text, Audio, Video and Cross-Modal with Easy Inference & Serving)【安全加固,暂停交互,请耐心等待】
Python
12,704
star
5

PaddleNLP

👑 Easy-to-use and powerful NLP and LLM library with 🤗 Awesome model zoo, supporting wide-range of NLP tasks from research to industrial applications, including 🗂Text Classification, 🔍 Neural Search, ❓ Question Answering, ℹ️ Information Extraction, 📄 Document Intelligence, 💌 Sentiment Analysis etc.
Python
11,953
star
6

PaddleSpeech

Easy-to-use Speech Toolkit including Self-Supervised Learning model, SOTA/Streaming ASR with punctuation, Streaming TTS with text frontend, Speaker Verification System, End-to-End Speech Translation and Keyword Spotting. Won NAACL2022 Best Demo Award.
Python
11,053
star
7

PaddleSeg

Easy-to-use image segmentation library with awesome pre-trained model zoo, supporting wide-range of practical tasks in Semantic Segmentation, Interactive Segmentation, Panoptic Segmentation, Image Matting, 3D Segmentation, etc.
Python
8,601
star
8

PaddleGAN

PaddlePaddle GAN library, including lots of interesting applications like First-Order motion transfer, Wav2Lip, picture repair, image editing, photo2cartoon, image style transfer, GPEN, and so on.
Python
7,858
star
9

Paddle-Lite

PaddlePaddle High Performance Deep Learning Inference Engine for Mobile and Edge (飞桨高性能深度学习端侧推理引擎)
C++
6,953
star
10

models

Officially maintained, supported by PaddlePaddle, including CV, NLP, Speech, Rec, TS, big models and so on.
Python
6,897
star
11

ERNIE

Official implementations for various pre-training models of ERNIE-family, covering topics of Language Understanding & Generation, Multimodal Understanding & Generation, and beyond.
Python
6,300
star
12

PaddleClas

A treasure chest for visual classification and recognition powered by PaddlePaddle
Python
5,418
star
13

PaddleX

All-in-One Development Tool based on PaddlePaddle(飞桨低代码全流程开发工具)
Python
4,781
star
14

VisualDL

Deep Learning Visualization Toolkit(『飞桨』深度学习可视化工具 )
HTML
4,773
star
15

PaddleRec

Recommendation Algorithm大规模推荐算法库,包含推荐系统经典及最新算法LR、Wide&Deep、DSSM、TDM、MIND、Word2Vec、Bert4Rec、DeepWalk、SSR、AITM,DSIN,SIGN,IPREC、GRU4Rec、Youtube_dnn、NCF、GNN、FM、FFM、DeepFM、DCN、DIN、DIEN、DLRM、MMOE、PLE、ESMM、ESCMM, MAML、xDeepFM、DeepFEFM、NFM、AFM、RALM、DMR、GateNet、NAML、DIFM、Deep Crossing、PNN、BST、AutoInt、FGCNN、FLEN、Fibinet、ListWise、DeepRec、ENSFM,TiSAS,AutoFIS等,包含经典推荐系统数据集criteo 、movielens等
Python
4,273
star
16

PARL

A high-performance distributed training framework for Reinforcement Learning
Python
3,261
star
17

awesome-DeepLearning

深度学习入门课、资深课、特色课、学术案例、产业实践案例、深度学习知识百科及面试题库The course, case and knowledge of Deep Learning and AI
Jupyter Notebook
3,001
star
18

FastDeploy

⚡️An Easy-to-use and Fast Deep Learning Model Deployment Toolkit for ☁️Cloud 📱Mobile and 📹Edge. Including Image, Video, Text and Audio 20+ main stream scenarios and 150+ SOTA models with end-to-end optimization, multi-platform and multi-framework support.
C++
2,952
star
19

book

Deep Learning 101 with PaddlePaddle (『飞桨』深度学习框架入门教程)
Jupyter Notebook
2,735
star
20

Research

novel deep learning research works with PaddlePaddle
Python
1,715
star
21

PGL

Paddle Graph Learning (PGL) is an efficient and flexible graph learning framework based on PaddlePaddle
Python
1,572
star
22

PaddleSlim

PaddleSlim is an open-source library for deep model compression and architecture search.
Python
1,557
star
23

PaddleVideo

Awesome video understanding toolkits based on PaddlePaddle. It supports video data annotation tools, lightweight RGB and skeleton based action recognition model, practical applications for video tagging and sport action detection.
Python
1,512
star
24

PaddleHelix

Bio-Computing Platform Featuring Large-Scale Representation Learning and Multi-Task Deep Learning “螺旋桨”生物计算工具集
Python
1,007
star
25

Paddle.js

Paddle.js is a web project for Baidu PaddlePaddle, which is an open source deep learning framework running in the browser. Paddle.js can either load a pre-trained model, or transforming a model from paddle-hub with model transforming tools provided by Paddle.js. It could run in every browser with WebGL/WebGPU/WebAssembly supported. It could also run in Baidu Smartprogram and WX miniprogram.
JavaScript
980
star
26

Serving

A flexible, high-performance carrier for machine learning models(『飞桨』服务化部署框架)
C++
894
star
27

RocketQA

🚀 RocketQA, dense retrieval for information retrieval and question answering, including both Chinese and English state-of-the-art models.
Python
763
star
28

X2Paddle

Deep learning model converter for PaddlePaddle. (『飞桨』深度学习模型转换工具)
Python
727
star
29

Paddle2ONNX

ONNX Model Exporter for PaddlePaddle
Python
723
star
30

Paddle-Lite-Demo

lib, demo, model, data
C++
675
star
31

Knover

Large-scale open domain KNOwledge grounded conVERsation system based on PaddlePaddle
Python
674
star
32

Parakeet

PAddle PARAllel text-to-speech toolKIT (supporting Tacotron2, Transformer TTS, FastSpeech2/FastPitch, SpeedySpeech, WaveFlow and Parallel WaveGAN)
Python
600
star
33

FlyCV

FlyCV is a high-performance library for processing computer visual tasks.
C++
577
star
34

Paddle3D

A 3D computer vision development toolkit based on PaddlePaddle. It supports point-cloud object detection, segmentation, and monocular 3D object detection models.
Python
565
star
35

Quantum

Jupyter Notebook
564
star
36

PaddleYOLO

🚀🚀🚀 YOLO series of PaddlePaddle implementation, PP-YOLOE+, RT-DETR, YOLOv5, YOLOv6, YOLOv7, YOLOv8, YOLOv10, YOLOX, YOLOv5u, YOLOv7u, YOLOv6Lite, RTMDet and so on. 🚀🚀🚀
Python
551
star
37

Anakin

High performance Cross-platform Inference-engine, you could run Anakin on x86-cpu,arm, nv-gpu, amd-gpu,bitmain and cambricon devices.
C++
531
star
38

VIMER

视觉预训练基础模型仓库
Python
494
star
39

PaddleTS

Awesome Easy-to-Use Deep Time Series Modeling based on PaddlePaddle, including comprehensive functionality modules like TSDataset, Analysis, Transform, Models, AutoTS, and Ensemble, etc., supporting versatile tasks like time series forecasting, representation learning, and anomaly detection, etc., featured with quick tracking of SOTA deep models.
Python
481
star
40

PaddleFL

Federated Deep Learning in PaddlePaddle
Python
480
star
41

PaddleFleetX

飞桨大模型开发套件,提供大语言模型、跨模态大模型、生物计算大模型等领域的全流程开发工具链。
Python
436
star
42

ERNIE-SDK

ERNIE Bot Agent is a Large Language Model (LLM) Agent Framework, powered by the advanced capabilities of ERNIE Bot and the platform resources of Baidu AI Studio.
Jupyter Notebook
341
star
43

PaddleSpatial

PaddleSpatial is an open-source spatial-temporal computing tool based on PaddlePaddle.
GLSL
331
star
44

PaddleRS

Awesome Remote Sensing Toolkit based on PaddlePaddle.
Python
330
star
45

PaddleMIX

Paddle Multimodal Integration and eXploration, supporting mainstream multi-modal tasks, including end-to-end large-scale multi-modal pretrain models and diffusion model toolbox. Equipped with high performance and flexibility.
Python
308
star
46

PaddleCloud

PaddlePaddle Docker images and K8s operators for PaddleOCR/Detection developers to use on public/private cloud.
Go
284
star
47

MetaGym

Collection of Reinforcement Learning / Meta Reinforcement Learning Environments.
Python
276
star
48

PASSL

PASSL包含 SimCLR,MoCo v1/v2,BYOL,CLIP,PixPro,simsiam, SwAV, BEiT,MAE 等图像自监督算法以及 Vision Transformer,DEiT,Swin Transformer,CvT,T2T-ViT,MLP-Mixer,XCiT,ConvNeXt,PVTv2 等基础视觉算法
Python
273
star
49

PaddleScience

PaddleScience is SDK and library for developing AI-driven scientific computing applications based on PaddlePaddle.
Python
259
star
50

InterpretDL

InterpretDL: Interpretation of Deep Learning Models,基于『飞桨』的模型可解释性算法库。
Python
241
star
51

docs

Documentations for PaddlePaddle
Python
240
star
52

Paddle-Inference-Demo

C++
235
star
53

PaddleRobotics

PaddleRobotics is an open-source algorithm library for robots based on Paddle, including open-source parts such as human-robot interaction, complex motion control, environment perception, SLAM positioning, and navigation.
Python
215
star
54

PALM

a Fast, Flexible, Extensible and Easy-to-use NLP Large-scale Pretraining and Multi-task Learning Framework.
Python
176
star
55

ElasticCTR

ElasticCTR,即飞桨弹性计算推荐系统,是基于Kubernetes的企业级推荐系统开源解决方案。该方案融合了百度业务场景下持续打磨的高精度CTR模型、飞桨开源框架的大规模分布式训练能力、工业级稀疏参数弹性调度服务,帮助用户在Kubernetes环境中一键完成推荐系统部署,具备高性能、工业级部署、端到端体验的特点,并且作为开源套件,满足二次深度开发的需求。
Python
176
star
56

AutoDL

Python
158
star
57

PLSC

Paddle Large Scale Classification Tools,supports ArcFace, CosFace, PartialFC, Data Parallel + Model Parallel. Model includes ResNet, ViT, Swin, DeiT, CaiT, FaceViT, MoCo, MAE, ConvMAE, CAE.
Python
148
star
58

CINN

Compiler Infrastructure for Neural Networks
C++
142
star
59

LiteKit

Off-The-Shelf AI Development Kit for APP Developers based on Paddle Lite (『飞桨』移动端开箱即用AI套件, 包含Java & Objective C接口支持)
Objective-C
134
star
60

PaddleFlow

Go
113
star
61

PaddleSports

Python
101
star
62

PaddleDTX

Paddle with Decentralized Trust based on Xuperchain
Go
89
star
63

PaConvert

PaddlePaddle Code Convert Toolkit. 『飞桨』深度学习代码转换工具
Python
87
star
64

XWorld

A C++/Python simulator package for reinforcement learning
C++
85
star
65

community

PaddlePaddle Developer Community
Jupyter Notebook
83
star
66

PaddleSleeve

PaddleSleeve
Python
76
star
67

benchmark

Python
76
star
68

hapi

hapi is a High-level API that supports both static and dynamic execution modes
Jupyter Notebook
76
star
69

Mobile

Embedded and Mobile Deployment
Python
71
star
70

PaddleCustomDevice

PaddlePaddle custom device implementaion. (『飞桨』自定义硬件接入实现)
Python
68
star
71

PaddleDepth

Python
63
star
72

PaddlePaddle.org

PaddlePaddle.org is the repository for the website of the PaddlePaddle open source project.
CSS
48
star
73

PaDiff

Paddle Automatically Diff Precision Toolkits.
Python
46
star
74

EasyData

Python
46
star
75

PaddleTest

PaddlePaddle TestSuite
Python
44
star
76

epep

Easy & Effective Application Framework for PaddlePaddle
Python
34
star
77

paddle-ce-latest-kpis

Paddle Continuous Evaluation, keep updating.
Python
26
star
78

VisionTools

Python
21
star
79

PaddleCraft

Take neural networks as APIs for human-like AI.
Python
20
star
80

Contrib

contribution works with PaddlePaddle from the third party developers
Python
20
star
81

PaddleTransfer

飞桨迁移学习算法库
Python
19
star
82

continuous_evaluation

Macro Continuous Evaluation Platform for Paddle.
Python
19
star
83

recordio

An implementation of the RecordIO file format.
Go
19
star
84

Perf

SOTA benchmark
Python
17
star
85

Paddle-bot

Python
17
star
86

examples

Python
17
star
87

continuous_integration

Python
16
star
88

PaddleSOT

A Bytecode level Implementation of Symbolic OpCode Translator For PaddlePaddle
Python
15
star
89

tape

C++
14
star
90

paddle_upgrade_tool

upgrade paddle-1.x to paddle-2.0
Python
12
star
91

PaddleAPEX

PaddleAPEX:Paddle Accuracy and Performance EXpansion pack
Python
7
star
92

talks

Shell
6
star
93

CLA

5
star
94

any

Legacy Repo only for PaddlePaddle with version <= 1.3
C++
5
star