Skip to content
프로젝트

소개

visualizing attention for LLM users

AI 및 머신러닝

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

attention

Visualizing attention weights is the easiest and most popular approach to interpret a model’s decisions and to gain insights about its internals. Although it is wrong to equate attention with explanation, it can offer plausible and meaningful interpretations. (Abnar and Zuidema, 2020)

Attention is the key mechanism of the transformer architecture that powers GPT and other LLMs. This project exposes the attention weights of an LLM run, aggregated into a single matrix by averaging across layers and attention heads.

Here's an example of what the matrix output of this project will look like:

attention matrix

Why model attention as a matrix? Given attention matrix m you can model a range of text as focus vector f and then multiply torch.matmul(f, m) to get the attention vector for that range.

When you run the flask app, you can use an interactive demo in which attention weights for selected text are visualized:

attention highlighting

How to Run

$ poetry install
$ poetry run flask --app attention run

Once it's running, you can access the demo at http://127.0.0.1:5000/static/index.html.

관련 프로젝트 살펴보기

불러오는 중…