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.0.tar.gz (3.1 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.0-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for otat-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0800a940373b0671edec0c4d8e83ef53a1fd2c4b56e2d2065df0d4142061cc48
MD5 aa3a8c399b359dd6e7057b764e11c2a7
BLAKE2b-256 5ae781664372ccb41acae50d18468a909e5ecb9f12158ff631f1ff3002059f26

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for otat-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da7063942a896cf1c69abc5e5046a93e39d3475eeb34cbe453c7b02abc89e2f4
MD5 8c46680d4e5e7dace9da8bc474bf7b00
BLAKE2b-256 ad3f8e9665daeb793535c93922501fb45e2eba053f99b1a36b963dd78028f5d5

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