TruLens:
Explainability for
Neural Networks

DOWNLOAD trulens 0.13.4 (Jul 14, 2023)

Introduction to TruLens

TruLens is a cross-framework library for deep learning explainability. It provides a uniform abstraction over a number of different neural network frameworks, including TensorFlow (versions 1.14+ and 2.4.1+), Pytorch (1.2+), and Keras (2.3+). TruLens also supports explanations of both model inputs and internals.

This paper is an introduction to the theoretical foundations of the library. At TruEra, We’ve been using TruLens to explain deep learning models across a wide range of real-world use cases, from time-series RNNs to image and NLP models. We released TruLens to share its awesomeness with the world!

Why use TruLens?

Universal, gradient-based explainability,
built on a solid foundation

Compatible with Pytorch and TensorFlow

Every framework handles gradients differently. We built TruLens with the goal of providing a consistent, well-documented, and flexible set of primitives across popular backends for deep learning. At present, TruLens is compatible with models built in TensorFlow (versions 1.14+ and 2.4.1+), Pytorch (1.2+) and Keras (2.3+). We welcome contributions from the community, and hope to incorporate new features and capabilities from users!

Faithful to actual model behavior

We believe that a good explanation must faithfully capture what the model actually does, instead of reinforcing preconceived ideas or intuition of how the model ought to behave. The foundations of TruLens are rooted in this principle, and backed by mathematical axioms to ensure that its attributions portray the model’s behavior faithfully. For more on this, have a look at the conference paper that introduced our approach to internal attribution.

Support and unify a broad range of explainability approaches

Using the TruLens interface, it is easy to apply a variety of different explainability techniques (e.g. IntegratedGradients, GradCAM, and more) with only a few lines of code. Beyond explainability, TruLens has been used in both academia and industry to help detect adversarial attacks on models, ensure model robustness, and validate model behavior.

How would you use TruLens?

TruLens was developed with the following use cases in mind:

    A variety of models.

  • Image classification and recognition models, such as object detection and recognition
  • Natural language processing models, such as machine translation or text summarization
  • Time-series models, such as recurrent neural networks
  • A variety of analyses.

  • Identify the difference in reasoning the model is using for class A over class B
  • Examine how explanations change with different baselines or segments of the population
  • Compare and contrast results from varying explanation techniques

Get started using TruLens today

You are critical to the ongoing success of TruLens. We encourage you to get started and provide ample feedback, so that TruLens improves over time.

Download

Get started with pip install trulens.

Documentation

Read about the library here, and play around with our intro notebooks.

Community

Join the TruLens community on Slack, and check out our blog posts on Medium.

TruLens is shepherded by TruEra

TruLens is a free, open source solution that helps explain neural networks. The core conceptual ideas behind TruLens were first developed from academic research at Carnegie Mellon University, but TruLens relies upon an active community of developers to thrive and improve.

TruEra is an AI Quality solutions company that helps organizations better explain, analyze, and improve their machine learning models. Although TruEra both actively oversees the distribution of TruLens and helps organize the community around it, TruLens remains an open-source community project, not a TruEra product.

About the TruEra Research Team

Members of the TruEra Research Team originally developed TruLens while they were conducting research at Carnegie Mellon University. They are passionate about the importance of explainability in machine learning and are involved in the development of the TruLens community.

You can learn more about TruEra Research here.

Why a colossal squid?

The colossal squid’s eyeball is about the size of a soccer ball, making it the largest eyeball of any living creature. In addition, did you know that its eyeball contains light organs? That means that colossal squids have automatic headlights when looking around. We're hoping to bring similar guidance to model developers when creating, introspecting, and debugging neural networks. Read more about the amazing eyes of the colossal squid.