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.
翻译:过去的自然语言处理可解释性工作主要聚焦于流行的分类任务,而对生成场景关注较少,部分原因在于缺乏专用工具。本研究提出Inseq,一个旨在降低序列生成模型可解释性分析门槛的Python库。Inseq支持对流行的仅解码器与编码器-解码器Transformer架构,进行模型内部信息与特征重要性分数的直观且优化提取。我们通过将其应用于机器翻译模型中的性别偏见检测和GPT-2中的事实知识定位,展示了其潜力。借助支持对比特征归因等前沿技术的可扩展接口,Inseq能够推动可解释自然语言生成的未来进展,集中优化实践方法,并实现公平且可复现的模型评估。