A newer version of the Gradio SDK is available:
6.1.0
title: Explainability Tool For Aa
emoji: π₯
colorFrom: green
colorTo: red
sdk: gradio
sdk_version: 5.42.0
python_version: 3.11.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: Interpreting the latent space of Authorship Attribution
Authorship Attribution Explainability Tool
An interactive demo for visualizing and explaining authorship attribution (AA) models. The tool shows how sentence-transformer models interpret writing style using two separate explanation types:
- LLM-based stylistic features
- Gram2Vec linguistic features
It also provides an interactive latent-space view of authors to support deeper analysis of stylistic similarity and attribution behavior.
π― What This Demo Does
Given:
- a mystery document, and
- a set of candidate authors,
the tool:
- Embeds all documents with a sentence-transformer model
- Visualizes author neighborhoods in a 2D latent space
- Shows LLM-derived stylistic cues and Gram2Vec linguistic features separately
- Highlights influential spans in the text for each explanation
This helps you understand why the model prefers one author over another.
π‘ Key Features
Two Feature Types
- LLM Features: semantic, discourse, and stylistic cues from LLMs
- Gram2Vec Features: n-grams, POS patterns, and stylistic markers
Latent Space Visualization
- Explore global author clusters
- Zoom into local neighborhoods
- Filter explanations to authors visible in the zoom region
Span-Level Highlighting
- View the exact text segments most influential for attribution for each feature type.
Model-Agnostic
- Use any sentence-transformer model by entering its Hugging Face model name.
Custom Data Upload
- Upload your own mystery and candidate texts for personalized analysis.
π₯ How to Use This Demo
Choose a Model
- Select one of the provided embedding models or enter a custom HF model name.
Provide Input Texts
- Upload:
- mystery author texts
- multiple candidate author texts
- Or use the predefined the reddit task
- Upload:
Load tasks and visualizations
- The tool computes embeddings,
- and displays the latent space.
Explore the Results
- Inspect author clusters
- Zoom into local regions
- Load the feature lists for your chosen zoomed region
- Compare LLM vs Gram2Vec explanations
- View highlighted spans in each document
π Source Code & Development
The full implementation, including preprocessing scripts and development tools, is available on GitHub:
π https://github.com/MiladAlshomary/explainability-for-style-analysis-demo
Funding Acknowledgment
This research is supported in part by the Office of the Director of National Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA), via the HIATUS Program contract #2022-22072200005. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies, either expressed or implied, of ODNI, IARPA, or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for governmental purposes notwithstanding any copyright annotation therein.