Recently, Google Research open-sourced a platform for visualisation and understanding of natural language processing (NLP) models known as Language Interpretability Tool (LIT). LIT integrates local explanations, aggregate analysis and counterfactual generation into a streamlined, browser-based interface to enable rapid exploration and error analysis.
Natural Language Processing technique has made several outstanding contributions in recent years. However, the NLP models suffer from several biases, which include the behaviour of these models under domain shift, adversarial settings, tendencies to behave according to social prejudices, shallow heuristics and more.
Despite the recent explosion of work on language model understanding and evaluation, specific issues limit the models from being robust. To mitigate such problems, researchers often experiment with many techniques, looking at local explanations, aggregate metrics, and counterfactual variations of the input to build a full understanding of model behaviour and other such.
Certain tools claim to assist with these processes. For instance, TensorFlow Model Analysis (TFMA) open-source library that provides only aggregate metrics, interactive frontends that focus on the single-datapoint explanation and more integrated tools. However, switching between tools or adopting a new method from research code can be time-consuming as well as distracting from the real task of error analysis. This is why google researchers introduced the LIT tool.
Language Interpretability Tool (LIT), a toolkit and browser-based user interface (UI) for NLP model understanding supports various tasks, such as local explanations, salience maps, rich visualisations of model prediction as well as aggregate analysis including metrics, embedding spaces, and flexible slicing.
The LIT UI is written in TypeScript language and communicates with a Python backend that hosts models, datasets, counterfactual generators, and other interpretation components. The browser-based UI is a single-page web app, built with lit-element and MobX. The Python backend serves models, data, and interpretation components.
The tool allows the users to seamlessly hop between them to test local hypotheses and validate them over a dataset. LIT also provides support for a counterfactual generation, such as new data points can be added on the fly, and their effect on the model visualised immediately.
As mentioned above, LIT has a browser-based UI composed of modules which contain controls and visualisations for specific tasks such as confusion matrix, data table, salience maps, scalar plot, attention. embeddings, and much more. It can work as a simple demo server, where one can enter text, press a button, and see the model’s predictions.
Features of LIT
- Flexible: LIT supports a wide range of NLP tasks, including classification, seq2seq, language modelling, and structured prediction.
- Extensible: This platform is designed for experimentation and can be reconfigured and extended for novel workflows.
- Modular: Here, the components are self-contained, portable and straightforward to implement.
- Framework Agnostic: This tool works with any model that can run from Python, including TensorFlow, PyTorch, among others.
- Easy to Use: LIT includes a low barrier to entry, with only a small amount of code needed to add models and data along with an easy path to access sophisticated functionality.
Benefits of LIT
There are several ways the LIT tool can assist an NLP developer. Some of them are mentioned below-
- Explore the dataset: With LIT, users can interactively explore datasets using different criteria across modules like the data table and the embeddings module.
- Find interesting data points: This tool allows developers to identify interesting data points for analysis, cycle through them, and save selections for future use.
- Explain local behaviour: Developers can now easily deep-dive into model behaviour on selected individual data points using a variety of modules depending on the model task and type.
- Generate new data points: Using LIT, developers can create new data points based on data points of interest either manually through edits, or with a range of automatic counterfactual generators, such as back-translation, nearest-neighbour retrieval, among others.
- Compare side-by-side: LIT allows developers to compare two or more models on the same data, or a single model on two data points simultaneously.
- Compute metrics: LIT calculates and displays metrics for the whole dataset, the current selection, as well as on manual or automatically generated slices to easily find patterns in model performance.
If you loved this story, do join our Telegram Community.
Also, you can write for us and be one of the 500+ experts who have contributed stories at AIM. Share your nominations here.
What's Your Reaction?
A Technical Journalist who loves writing about Machine Learning and Artificial Intelligence. A lover of music, writing and learning something out of the box. Contact: firstname.lastname@example.org