Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

//
Expand Down
4 changes: 2 additions & 2 deletions examples/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down