{"title":"Faster and space efficient indexing for locality sensitive hashing","authors":"Bhisham Dev Verma , Rameshwar Pratap","doi":"10.1016/j.tcs.2025.115479","DOIUrl":null,"url":null,"abstract":"<div><div>This work suggests faster and space-efficient index construction algorithms for LSH for Euclidean distance (<em>a.k.a.</em> E2LSH) and cosine similarity (<em>a.k.a.</em> SRP). The index construction step of these LSHs relies on grouping data points into several bins of hash tables based on their hashcode. To generate an <em>m</em>-dimensional hashcode of the <em>d</em>-dimensional data point, these LSHs first project the data point onto a <em>d</em>-dimensional random Gaussian vector and then discretise the resulting inner product. The time and space complexity of both E2LSH and SRP for computing an <em>m</em>-sized hashcode of a <em>d</em>-dimensional vector is <span><math><mi>O</mi><mo>(</mo><mi>m</mi><mi>d</mi><mo>)</mo></math></span>, which becomes impractical for large values of <em>m</em> and <em>d</em>. To overcome this problem, we propose two alternative LSH hashcode generation algorithms both for Euclidean distance and cosine similarity, namely, CS-E2LSH, HCS-E2LSH and CS-SRP, HCS-SRP, respectively. CS-E2LSH and CS-SRP are based on count sketch <span><span>[1]</span></span> and HCS-E2LSH and HCS-SRP utilize higher-order count sketch <span><span>[2]</span></span>. These proposals significantly reduce the hashcode computation time from <span><math><mi>O</mi><mo>(</mo><mi>m</mi><mi>d</mi><mo>)</mo></math></span> to <span><math><mi>O</mi><mo>(</mo><mi>d</mi><mo>)</mo></math></span>. Additionally, both CS-E2LSH and CS-SRP reduce the space complexity from <span><math><mi>O</mi><mo>(</mo><mi>m</mi><mi>d</mi><mo>)</mo></math></span> to <span><math><mi>O</mi><mo>(</mo><mi>d</mi><mo>)</mo></math></span>; and HCS-E2LSH, HCS-SRP reduce the space complexity from <span><math><mi>O</mi><mo>(</mo><mi>m</mi><mi>d</mi><mo>)</mo></math></span> to <span><math><mi>O</mi><mo>(</mo><mi>N</mi><mroot><mrow><mi>d</mi></mrow><mrow><mi>N</mi></mrow></mroot><mo>)</mo></math></span> respectively, where <span><math><mi>N</mi><mo>≥</mo><mn>1</mn></math></span> denotes the size of the input/reshaped tensor. Our proposals are backed by strong mathematical guarantees, and we validate their performance through simulations on various real-world datasets.</div></div>","PeriodicalId":49438,"journal":{"name":"Theoretical Computer Science","volume":"1055 ","pages":"Article 115479"},"PeriodicalIF":0.9000,"publicationDate":"2025-07-21","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Theoretical Computer Science","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0304397525004177","RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, THEORY & METHODS","Score":null,"Total":0}
引用次数: 0
Abstract
This work suggests faster and space-efficient index construction algorithms for LSH for Euclidean distance (a.k.a. E2LSH) and cosine similarity (a.k.a. SRP). The index construction step of these LSHs relies on grouping data points into several bins of hash tables based on their hashcode. To generate an m-dimensional hashcode of the d-dimensional data point, these LSHs first project the data point onto a d-dimensional random Gaussian vector and then discretise the resulting inner product. The time and space complexity of both E2LSH and SRP for computing an m-sized hashcode of a d-dimensional vector is , which becomes impractical for large values of m and d. To overcome this problem, we propose two alternative LSH hashcode generation algorithms both for Euclidean distance and cosine similarity, namely, CS-E2LSH, HCS-E2LSH and CS-SRP, HCS-SRP, respectively. CS-E2LSH and CS-SRP are based on count sketch [1] and HCS-E2LSH and HCS-SRP utilize higher-order count sketch [2]. These proposals significantly reduce the hashcode computation time from to . Additionally, both CS-E2LSH and CS-SRP reduce the space complexity from to ; and HCS-E2LSH, HCS-SRP reduce the space complexity from to respectively, where denotes the size of the input/reshaped tensor. Our proposals are backed by strong mathematical guarantees, and we validate their performance through simulations on various real-world datasets.
期刊介绍:
Theoretical Computer Science is mathematical and abstract in spirit, but it derives its motivation from practical and everyday computation. Its aim is to understand the nature of computation and, as a consequence of this understanding, provide more efficient methodologies. All papers introducing or studying mathematical, logic and formal concepts and methods are welcome, provided that their motivation is clearly drawn from the field of computing.