vector search with Cosine Distance, the recall rate of the returned results is very low.
abs2 in FVector is memory value, when we load data from disk, we need init abs2 = 1.0f
The fix code is as follows
Do you have a test case? Normally vec_ptr->abs2 should be 1.0f here already. What values of vec_ptr->abs2 do you see?
Sergei Golubchik
added a comment - Do you have a test case? Normally vec_ptr->abs2 should be 1.0f here already. What values of vec_ptr->abs2 do you see?
Yes, I've run ann-benchmarks with nytimes-256-angular. Is this patch your way of fixing zero-length vectors? Does it help to improve recall?
Sergei Golubchik
added a comment - Yes, I've run ann-benchmarks with nytimes-256-angular. Is this patch your way of fixing zero-length vectors? Does it help to improve recall?
I've tested your suggested change.
It has no effect on recall. Unexpectedly for me it affected the qps (the search speed). For low recall (<80%) it made the search slightly faster, for higher recall — somewhat slower. Because the effect was not very big (few %% faster, not few times) and recalls below 80% aren't practically useful anyway, I'm not going to apply this change for now.
Sergei Golubchik
added a comment - I've tested your suggested change.
It has no effect on recall. Unexpectedly for me it affected the qps (the search speed). For low recall (<80%) it made the search slightly faster, for higher recall — somewhat slower. Because the effect was not very big (few %% faster, not few times) and recalls below 80% aren't practically useful anyway, I'm not going to apply this change for now.
People
Sergei Golubchik
myx
Votes:
0Vote for this issue
Watchers:
3Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":887.2000000476837,"ttfb":251.20000004768372,"pageVisibility":"visible","entityId":133376,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"29ec63fd-385b-458c-bfc2-daebf98e4c5f","navigationType":0,"readyForUser":962.2000000476837,"redirectCount":0,"resourceLoadedEnd":630.2999999523163,"resourceLoadedStart":259.89999985694885,"resourceTiming":[{"duration":3.9000000953674316,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":259.89999985694885,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":259.89999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":263.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":4.099999904632568,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":260.2000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":260.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":264.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":228.60000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":260.39999985694885,"connectEnd":266,"connectStart":266,"domainLookupEnd":266,"domainLookupStart":266,"fetchStart":260.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":266.2000000476837,"responseEnd":489,"responseStart":287.89999985694885,"secureConnectionStart":266},{"duration":369.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":260.7999999523163,"connectEnd":260.7999999523163,"connectStart":260.7999999523163,"domainLookupEnd":260.7999999523163,"domainLookupStart":260.7999999523163,"fetchStart":260.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":267.09999990463257,"responseEnd":630.2999999523163,"responseStart":295.2000000476837,"secureConnectionStart":260.7999999523163},{"duration":45.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":260.89999985694885,"connectEnd":260.89999985694885,"connectStart":260.89999985694885,"domainLookupEnd":260.89999985694885,"domainLookupStart":260.89999985694885,"fetchStart":260.89999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":267.2999999523163,"responseEnd":306.2999999523163,"responseStart":302.5,"secureConnectionStart":260.89999985694885},{"duration":45.799999952316284,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":261,"connectEnd":261,"connectStart":261,"domainLookupEnd":261,"domainLookupStart":261,"fetchStart":261,"redirectEnd":0,"redirectStart":0,"requestStart":271.7999999523163,"responseEnd":306.7999999523163,"responseStart":304.09999990463257,"secureConnectionStart":261},{"duration":45.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":261.09999990463257,"connectEnd":261.09999990463257,"connectStart":261.09999990463257,"domainLookupEnd":261.09999990463257,"domainLookupStart":261.09999990463257,"fetchStart":261.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":269.5,"responseEnd":306.5,"responseStart":303.39999985694885,"secureConnectionStart":261.09999990463257},{"duration":8,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":261.2000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":261.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":269.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":55,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":261.2999999523163,"connectEnd":261.2999999523163,"connectStart":261.2999999523163,"domainLookupEnd":261.2999999523163,"domainLookupStart":261.2999999523163,"fetchStart":261.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":276.89999985694885,"responseEnd":316.2999999523163,"responseStart":313.7999999523163,"secureConnectionStart":261.2999999523163},{"duration":11.800000190734863,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":261.39999985694885,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":261.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":273.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":55.799999952316284,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":261.5,"connectEnd":261.5,"connectStart":261.5,"domainLookupEnd":261.5,"domainLookupStart":261.5,"fetchStart":261.5,"redirectEnd":0,"redirectStart":0,"requestStart":279.39999985694885,"responseEnd":317.2999999523163,"responseStart":314.39999985694885,"secureConnectionStart":261.5},{"duration":250.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":269.2000000476837,"connectEnd":269.2000000476837,"connectStart":269.2000000476837,"domainLookupEnd":269.2000000476837,"domainLookupStart":269.2000000476837,"fetchStart":269.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":292.39999985694885,"responseEnd":519.8999998569489,"responseStart":513.5,"secureConnectionStart":269.2000000476837},{"duration":250.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":269.2999999523163,"connectEnd":269.2999999523163,"connectStart":269.2999999523163,"domainLookupEnd":269.2999999523163,"domainLookupStart":269.2999999523163,"fetchStart":269.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":316.7000000476837,"responseEnd":520.2000000476837,"responseStart":514.2000000476837,"secureConnectionStart":269.2999999523163},{"duration":97.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":628.2999999523163,"connectEnd":628.2999999523163,"connectStart":628.2999999523163,"domainLookupEnd":628.2999999523163,"domainLookupStart":628.2999999523163,"fetchStart":628.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":695.5999999046326,"responseEnd":725.8999998569489,"responseStart":725.0999999046326,"secureConnectionStart":628.2999999523163},{"duration":135.39999985694885,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":842.5,"connectEnd":842.5,"connectStart":842.5,"domainLookupEnd":842.5,"domainLookupStart":842.5,"fetchStart":842.5,"redirectEnd":0,"redirectStart":0,"requestStart":946.5,"responseEnd":977.8999998569489,"responseStart":977.2999999523163,"secureConnectionStart":842.5},{"duration":68.89999985694885,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":879.2000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":879.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":948.0999999046326,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":91,"responseStart":251,"responseEnd":268,"domLoading":254,"domInteractive":1063,"domContentLoadedEventStart":1063,"domContentLoadedEventEnd":1111,"domComplete":1262,"loadEventStart":1262,"loadEventEnd":1263,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1039},{"name":"bigPipe.sidebar-id.end","time":1039.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1039.7999999523163},{"name":"bigPipe.activity-panel-pipe-id.end","time":1041.7999999523163},{"name":"activityTabFullyLoaded","time":1131.2000000476837}],"measures":[],"correlationId":"dcc02b13683f2","effectiveType":"4g","downlink":9.3,"rtt":0,"serverDuration":85,"dbReadsTimeInMs":13,"dbConnsTimeInMs":21,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Do you have a test case? Normally vec_ptr->abs2 should be 1.0f here already. What values of vec_ptr->abs2 do you see?