This commit is contained in:
Daniel Bevenius 2025-02-08 13:19:56 +00:00 committed by GitHub
commit 79b81d9fa5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View file

@ -1652,7 +1652,7 @@ size_t common_lcs(const llama_tokens & a, const llama_tokens & b) {
size_t a_len = a.size();
size_t b_len = b.size();
// initialize the maximum length of the longest common subsequence (LCS)
// initialize the maximum length of the longest common substring (LCS)
size_t max_length = 0;
// use two rows instead of a 2D matrix to optimize space

View file

@ -562,7 +562,7 @@ void common_batch_add(
// longest common prefix
size_t common_lcp(const llama_tokens & a, const llama_tokens & b);
// longet common subsequence
// longest common substring
size_t common_lcs(const llama_tokens & a, const llama_tokens & b);
//

View file

@ -2008,10 +2008,10 @@ struct server_context {
continue;
}
// length of the Longest Common Subsequence between the current slot's prompt and the input prompt
// length of the Longest Common Substring between the current slot's prompt and the input prompt
int cur_lcs_len = common_lcs(slot.cache_tokens, task.prompt_tokens);
// fraction of the common subsequence length compared to the current slot's prompt length
// fraction of the common substring length compared to the current slot's prompt length
float cur_similarity = static_cast<float>(cur_lcs_len) / static_cast<int>(slot.cache_tokens.size());
// select the current slot if the criteria match