Query: use the query to match the key.
Key: label of each data slice.
Value: the data itself.
1. Compute the similarity between query and key.
query [1 2 3 ...]
key [4 5 6 ...]
score
这道题核心是在给定 query、key 和 value 的情况下,先计算 query 与 key 之间的相似度得分,再据此得到最终的匹配结果。题面虽然很简短,但明显对应的是一种基于向量相关性的打分机制,常见做法是将 query 和 key 视为数值序列,使用点积或归一化后的相似度来衡量两者相关性,然后用这个 score 决定后续的加权或检索结果。做题时要特别注意输入的向量长度、是否需要逐元素对齐,以及 score 的含义是否只是中间量。
正文完