Skip to content

[CI][Bugfix] Improve cosine similarity calculation by incorporating length harmony adjustment in text comparison#2964

Merged
hsliuustc0106 merged 1 commit into
vllm-project:mainfrom
yenuo26:bugfix
Apr 21, 2026
Merged

[CI][Bugfix] Improve cosine similarity calculation by incorporating length harmony adjustment in text comparison#2964
hsliuustc0106 merged 1 commit into
vllm-project:mainfrom
yenuo26:bugfix

Conversation

@yenuo26

@yenuo26 yenuo26 commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

PLEASE FILL IN THE PR DESCRIPTION HERE ENSURING ALL CHECKLIST ITEMS (AT THE BOTTOM) HAVE BEEN CONSIDERED.

Purpose

To address the insensitivity issue in similarity calculation exposed by #2953 and #2812 when dealing with repeated text patterns in test case.

Problem Analysis:
The n-gram counting cosine similarity treats multiple occurrences of "ABC" in "ABCABCABC" as part of the vector, still considering it "directionally similar" to a single "ABC". This results in an inflated similarity score where length differences are not properly reflected, making it difficult to flag as anomalous.

Solution:
In cosine_similarity_text, introduce a length-imbalance-sensitive factor (e.g., F1-style harmonic mean of lengths) multiplied by the original cosine similarity. This approach keeps the behavior unchanged for equal-length texts while suppressing similarity scores in such repetitive cases.

Test Plan

  1. run cosine_similarity_text in local
cosine_similarity_text("Beijing, the capital of China, is a city where millennia of history seamlessly blend with breathtaking modernity. As one of the world's oldest continuously inhabited cities, it serves as the nation's political, cultural, and educational heart.Beijing, the capital of China, is a city where millennia of history seamlessly blend with breathtaking modernity. As one of the world's oldest continuously inhabited cities, it serves as the nation's political, cultural, and educational heart.", "Beijing, the capital of China, is a city where millennia of history seamlessly blend with breathtaking modernity. As one of the world's oldest continuously inhabited cities, it serves as the nation's political, cultural, and educational heart.")

2.run test case in CI

Test Result

1.local

  • before
c0296c12c310b54181060ae1dd991603
  • after
48457558cecd908331535603842eff6b

2.ci


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan. Please provide the test scripts & test commands. Please state the reasons if your codes don't require additional test scripts. For test file guidelines, please check the test style doc
  • The test results. Please paste the results comparison before and after, or the e2e results.
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model. Please run mkdocs serve to sync the documentation editions to ./docs.
  • (Optional) Release notes update. If your change is user-facing, please update the release notes draft.

BEFORE SUBMITTING, PLEASE READ https://github.com/vllm-project/vllm-omni/blob/main/CONTRIBUTING.md (anything written below this line will be removed by GitHub Actions)

…length harmony adjustment in text comparison

Signed-off-by: wangyu <410167048@qq.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@yenuo26

yenuo26 commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator Author

@amy-why-3459 PTAL

@yenuo26 yenuo26 added omni-test label to trigger buildkite omni model test in nightly CI tts-test label to trigger buildkite tts models test in nightly CI labels Apr 21, 2026
@amy-why-3459

Copy link
Copy Markdown
Contributor

Thank you so much for your quick fix. To prevent CI from continuing to fail, we need to merge the bug fix before merging this change.

@hsliuustc0106 hsliuustc0106 merged commit de4e472 into vllm-project:main Apr 21, 2026
5 of 6 checks passed
nainiu258 pushed a commit to nainiu258/vllm-omni that referenced this pull request Apr 21, 2026
…ength harmony adjustment in text comparison (vllm-project#2964)

Signed-off-by: wangyu <410167048@qq.com>
Signed-off-by: nainiu258 <cperfect02@163.com>
qinganrice pushed a commit to qinganrice/vllm-omni that referenced this pull request Apr 23, 2026
…ength harmony adjustment in text comparison (vllm-project#2964)

Signed-off-by: wangyu <410167048@qq.com>
lengrongfu pushed a commit to lengrongfu/vllm-omni that referenced this pull request May 1, 2026
…ength harmony adjustment in text comparison (vllm-project#2964)

Signed-off-by: wangyu <410167048@qq.com>
clodaghwalsh17 pushed a commit to clodaghwalsh17/nm-vllm-omni-ent that referenced this pull request May 12, 2026
…ength harmony adjustment in text comparison (vllm-project#2964)

Signed-off-by: wangyu <410167048@qq.com>
daixinning pushed a commit to daixinning/vllm-omni that referenced this pull request May 28, 2026
…ength harmony adjustment in text comparison (vllm-project#2964)

Signed-off-by: wangyu <410167048@qq.com>
quyifei23 pushed a commit to quyifei23/vllm-omni that referenced this pull request Jun 6, 2026
…ength harmony adjustment in text comparison (vllm-project#2964)

Signed-off-by: wangyu <410167048@qq.com>
@yenuo26 yenuo26 deleted the bugfix branch June 9, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

omni-test label to trigger buildkite omni model test in nightly CI tts-test label to trigger buildkite tts models test in nightly CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants