{"id":21530,"library":"lit-nlp","title":"Learning Interpretability Tool (LIT)","description":"LIT (Learning Interpretability Tool) is an open-source platform from PAIR (People + AI Research) at Google for visualizing and understanding machine learning models. Version 1.3.1 supports interpretability of generative AI, including sequence salience for LLMs, and can be deployed on Google Cloud with public container images. Releases occur approximately every 6 months.","status":"active","version":"1.3.1","language":"python","source_language":"en","source_url":"https://github.com/PAIR-code/lit","tags":["interpretability","machine learning","nlp","visualization","google"],"install":[{"cmd":"pip install lit-nlp","lang":"bash","label":"Standard install"}],"dependencies":[{"reason":"LIT requires a relatively recent version of pip to resolve complex dependencies.","package":"pip","optional":false}],"imports":[{"note":"The correct module is dev_server (not developer_server). Using the wrong name will cause ImportError.","wrong":"from lit_nlp import developer_server","symbol":"LitApp","correct":"from lit_nlp import dev_server"},{"note":"The types module is under lit_nlp.api, not lit_nlp.lib. Incorrect import leads to ModuleNotFoundError.","wrong":"from lit_nlp.lib.types import SimpleMultilabelPreds","symbol":"SimpleMultilabelPreds","correct":"from lit_nlp.api.types import SimpleMultilabelPreds"}],"quickstart":{"code":"import lit_nlp\nfrom lit_nlp import dev_server\nfrom lit_nlp.examples.datasets import CoSEDataset\nfrom lit_nlp.examples.models import BertClassifier\n\ndatasets = {'cose': CoSEDataset()}\nmodels = {'bert': BertClassifier(version='bert-base-uncased')}\n\ndev_server.serve(datasets, models, port=5432)","lang":"python","description":"Launches LIT server with a CoSE dataset and a BERT classifier. Open http://localhost:5432 to interact."},"warnings":[{"fix":"Replace calls to predict_with_metadata() with separate calls to predict() and get_metadata().","message":"As of v1.0, the Model class has been refactored: _with_metadata methods are removed. Subclasses must implement get_metadata() directly.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"If migrating from v0.4, update imports to use the new lit_nlp namespace and check for removed functions.","message":"In v0.5, the package name was changed from LIT to LIT (Learning Interpretability Tool). Some internal module paths may differ from older v0.4.x versions.","severity":"breaking","affected_versions":">=0.5"},{"fix":"Use 'gradient' or 'attention' salience methods instead of 'transformer' when calling model.salience().","message":"The 'transformer' salience method is deprecated in favor of 'gradient' and 'attention' for sequence salience.","severity":"deprecated","affected_versions":">=1.1"},{"fix":"Run LIT on a machine with GPU. For development, reduce the dataset size or model complexity.","message":"LIT's default salience computation can be slow on CPU for large models. Users often report that the UI appears frozen.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use: pip install lit-nlp and then import lit_nlp (underscore). Or check installation with: pip list | grep lit","cause":"The package was installed as 'lit-nlp' but Python expects 'lit_nlp' (underscore).","error":"ImportError: No module named 'lit_nlp'"},{"fix":"Use correct import paths, e.g., from lit_nlp.api.types import ...","cause":"After v1.0, some internal modules were moved; 'lit_nlp.lib' no longer exists.","error":"ModuleNotFoundError: No module named 'lit_nlp.lib'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}