This demo simulates how an AI "pays attention" to different words.
Query (Q): The word we are currently focusing on (e.g., "Apple").
Keys (K): The "labels" of other words in the database ("Fruit", "Tech", "River"). We calculate the Dot Product (similarity) between Q and each K.
Softmax: Converts raw similarity scores into probabilities (Weights) that sum to 1. High score = High attention.
Values (V): The actual content (represented here as colors). We calculate a Weighted Sum of Values based on the attention weights.
Result: If "Apple" is the query, it matches "Fruit" (Key 1) strongly. The output will be mostly Red (Value 1). If "Code" is the query, it matches "Tech" (Key 2), outputting Green.