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!
Universal, gradient-based explainability,
built on a solid foundation
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!
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.
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.
TruLens was developed with the following use cases in mind:
A variety of models.
A variety of analyses.
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.
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.
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.