anishabhatnagar
updated README
5e0b531

A newer version of the Gradio SDK is available: 6.1.0

Upgrade
metadata
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:

  1. LLM-based stylistic features
  2. 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:

  1. a mystery document, and
  2. a set of candidate authors,

the tool:

  1. Embeds all documents with a sentence-transformer model
  2. Visualizes author neighborhoods in a 2D latent space
  3. Shows LLM-derived stylistic cues and Gram2Vec linguistic features separately
  4. Highlights influential spans in the text for each explanation

This helps you understand why the model prefers one author over another.

πŸ’‘ Key Features

  1. Two Feature Types

    • LLM Features: semantic, discourse, and stylistic cues from LLMs
    • Gram2Vec Features: n-grams, POS patterns, and stylistic markers
  2. Latent Space Visualization

    • Explore global author clusters
    • Zoom into local neighborhoods
    • Filter explanations to authors visible in the zoom region
  3. Span-Level Highlighting

    • View the exact text segments most influential for attribution for each feature type.
  4. Model-Agnostic

    • Use any sentence-transformer model by entering its Hugging Face model name.
  5. Custom Data Upload

    • Upload your own mystery and candidate texts for personalized analysis.

πŸ“₯ How to Use This Demo

  1. Choose a Model

    • Select one of the provided embedding models or enter a custom HF model name.
  2. Provide Input Texts

    • Upload:
      • mystery author texts
      • multiple candidate author texts
    • Or use the predefined the reddit task
  3. Load tasks and visualizations

    • The tool computes embeddings,
    • and displays the latent space.
  4. 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.