Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize MLLM ambiguity calculation #825

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

osma
Copy link
Member

@osma osma commented Dec 20, 2024

This PR is an attempt to optimize the calculation of the ambiguity feature in MLLM. In cases of extremely many matches, the ambiguity calculation can take a long time, as reported by @RietdorfC in #822.

This PR changes the calculation so that it will first group together TokenSets with the same tokens; for example, all concepts with the same (or very similar) label can be considered together instead of calculating ambiguity for each of them separately. Due to the quadratic nature of the ambiguity calculation (it's O(N^2) where N is the number of matches found in a piece of text), reducing N by grouping TokenSets may reduce the amount of necessary comparisons quite drastically.

I'm leaving this as a draft PR because this needs to be tested further. I'm not yet 100% sure that the calculation result matches the original.

Closes #822

@osma osma added this to the 1.3 milestone Dec 20, 2024
@osma osma self-assigned this Dec 20, 2024
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.63%. Comparing base (8f13d7d) to head (5163ae3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #825   +/-   ##
=======================================
  Coverage   99.63%   99.63%           
=======================================
  Files          95       95           
  Lines        7171     7182   +11     
=======================================
+ Hits         7145     7156   +11     
  Misses         26       26           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slow calculation of ambiguity feature in MLLM
1 participant