Definition

Aggregated Distance Calculation for k-NN Vocabulary Distribution

In determining the retrieval-based distribution for a kk-nearest neighbors (kk-NN) language model, a distance metric, dvd_v, is defined relative to the vocabulary, VV. For a query's hidden state, hi\mathbf{h}_i, and a retrieved datastore key-value pair, (zj,wj)(\mathbf{z}_j, w_j), the value dvd_v equals the distance between hi\mathbf{h}_i and zj\mathbf{z}_j if the token wjw_j corresponds to the vv-th entry of the vocabulary VV. If wjw_j does not match the vv-th entry, dvd_v is set to 0{}0.

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