Past work in natural language processing interpretability focused mainly on popular classification tasks while largely overlooking generation settings, partly due to a lack of dedicated tools. In this work, we introduce Inseq, a Python library to democratize access to interpretability analyses of sequence generation models. Inseq enables intuitive and optimized extraction of models' internal information and feature importance scores for popular decoder-only and encoder-decoder Transformers architectures. We showcase its potential by adopting it to highlight gender biases in machine translation models and locate factual knowledge inside GPT-2. Thanks to its extensible interface supporting cutting-edge techniques such as contrastive feature attribution, Inseq can drive future advances in explainable natural language generation, centralizing good practices and enabling fair and reproducible model evaluations.
翻译:过去自然语言处理领域的可解释性研究主要聚焦于分类任务,而很大程度上忽视了生成任务场景,部分原因在于缺乏专用工具。本文介绍Python库Inseq,旨在普及序列生成模型可解释性分析的访问权。该工具能够实现对主流解码器-only与编码器-解码器Transformer架构模型内部信息及其特征重要性分数的直观高效提取。我们通过将其应用于凸显机器翻译模型中的性别偏见及定位GPT-2中的事实知识,展示了该工具的应用潜力。凭借支持对比特征归因等前沿技术的可扩展接口,Inseq将推动可解释自然语言生成的未来发展,集中优化实践标准,并促进公平可复现的模型评估。