Activity (Process)

Retrieving Reference Tokens in k-NN LM Inference

During inference in a kk-nearest neighbors (kk-NN) language model, the process begins with the model's hidden state representation for a given prefix, denoted as hi\mathbf{h}_i. This representation is used to search the datastore for the kk closest matching data items, which take the form of key-value tuples: {(z1,w1),,(zk,wk)}\lbrace (\mathbf{z}_1,w_1),\dots,(\mathbf{z}_k,w_k) \rbrace. The retrieved values {w1,,wk}\lbrace w_1,\dots,w_k \rbrace serve as reference tokens, guiding the model's prediction of the subsequent token based on the prefix representation hi\mathbf{h}_i.

0

1

Updated 2026-04-23

Contributors are:

Who are from:

Tags

Ch.2 Generative Models - Foundations of Large Language Models

Foundations of Large Language Models

Foundations of Large Language Models Course

Computing Sciences