Skip to main content

Vision-Language Model Interpretability Analysis - One Token at a Time

Project description

Interpretability Core

Vision-Language Model Interpretability Analysis toolkit for analyzing attention patterns in models like LLaVA and Qwen-VL.

Installation

From PyPI (when published)

pip install otat

From GitHub

pip install git@github.com:varungupta31/otat_api.git

Local Development

git clone https://github.com/varungupta31/otat_api.git
cd otat_api
pip install -e .

Quick Start

from interpretability.api.wrapper import InterpretabilityAnalyzer

# Initialize analyzer
analyzer = InterpretabilityAnalyzer(
    model_type="llava_onevision",
    model_id="llava-hf/llava-onevision-qwen2-0.5b-ov-hf"
)

# Run analysis
result = analyzer.analyze(
    image_path="path/to/image.jpg",
    task_text="What is in this image?",
    instruction="Answer briefly.",
    blocking_mode="none",
    num_tokens=20
)

print(result['output_tokens'])
print(result['series'])  # Attention patterns

Features

  • ๐Ÿ” Attention pattern analysis for VLMs
  • ๐ŸŽฏ Support for LLaVA, Qwen-VL, and Qwen2-LLM
  • ๐Ÿšซ Attention blocking experiments
  • ๐Ÿ“Š Token-level attention aggregation

License

MIT

3. Verify Your Project Structure

Make sure it looks like this:

otat_api/  (or interpretability-core/)
โ”œโ”€โ”€ pyproject.toml          # โœ… Just created
โ”œโ”€โ”€ README.md               # โœ… Just created
โ”œโ”€โ”€ LICENSE                 # Optional but recommended
โ”œโ”€โ”€ .gitignore             # Recommended
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ interpretability/
โ”‚       โ”œโ”€โ”€ __init__.py    # โš ๏ธ Make sure this exists!
โ”‚       โ”œโ”€โ”€ api/
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ””โ”€โ”€ wrapper.py
โ”‚       โ”œโ”€โ”€ models/
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”œโ”€โ”€ base_handler.py
โ”‚       โ”‚   โ”œโ”€โ”€ llava_onevision.py
โ”‚       โ”‚   โ”œโ”€โ”€ qwen2_llm.py
โ”‚       โ”‚   โ””โ”€โ”€ qwen_25_vl.py
โ”‚       โ”œโ”€โ”€ tasks/
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”œโ”€โ”€ base_task.py
โ”‚       โ”‚   โ”œโ”€โ”€ web_api_task.py
โ”‚       โ”‚   โ””โ”€โ”€ ...
โ”‚       โ”œโ”€โ”€ analysis/
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”œโ”€โ”€ extractor_aggregated.py
โ”‚       โ”‚   โ””โ”€โ”€ ...
โ”‚       โ”œโ”€โ”€ utils/
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ””โ”€โ”€ ...
โ”‚       โ””โ”€โ”€ prompts/
โ”‚           โ””โ”€โ”€ ...
โ””โ”€โ”€ scripts/
    โ””โ”€โ”€ run_analysis.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

otat-0.1.1.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

otat-0.1.1-py3-none-any.whl (33.7 kB view details)

Uploaded Python 3

File details

Details for the file otat-0.1.1.tar.gz.

File metadata

  • Download URL: otat-0.1.1.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for otat-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e09016ae0c68f460b4cde53979642a7114de0ef9418c8d0a523d8b1bfdebc7c9
MD5 a4e78593ae3641a29bf8ea25b7cf2047
BLAKE2b-256 c1881a073276605f37f0dcf5ea8fb85824dcd95aff2f1b3b215e00fdeb91bcca

See more details on using hashes here.

File details

Details for the file otat-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: otat-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 33.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for otat-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2df3c895a2567a49cce2483afbe6a1f5b3c6bb15bf9b7520caef4e5ff9c05f97
MD5 3d21c30f3e10791e215678ccd5610a22
BLAKE2b-256 b4450b426a9ea7a8b17cb864c66aeefe01994c5152089c7d0fed4bf689fe2a34

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page