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可推动可解释自然语言生成的未来发展,集中优质实践,并实现公平、可复现的模型评估。