Skip to content

Conversation

@AlSchlo
Copy link
Contributor

@AlSchlo AlSchlo commented Nov 20, 2025

As title, this PR reverts the prior revert PR.

@mnorris11 is this fix OK? Please feel free to push your test in here.

Summary:
This PR introduces **Panorama** into `HNSWFlat`, following our [paper](https://arxiv.org/pdf/2510.00566). Panorama achieves up to **4× lower latency** on higher-dimensional data, making it a great option for medium-sized datasets that don't benefit much from quantization.

Below are some benchmarks on **SIFT-128**, **GIST-960**, and **synthetic 2048-dimensional** data. I recommend checking out the paper for more results. As expected, Panorama is not a silver bullet when combined with HNSW—it’s only worthwhile for high-dimensional data.

It might be worth considering, in the future, adding a function that dynamically sets the number of levels. However, this would require reorganizing the cumulative sums.

## SIFT-128

**Note:** SIFT-128 performs slightly worse here than in our paper because we use 8 levels, whereas the paper explored several level configurations. Eight levels introduce quite a bit of overhead for 128-dimensional data, but I kept it consistent across all benchmarks for comparison.

<img width="788" height="435" alt="bench_hnsw_flat_panorama_SIFT1M" src="https://github.com/user-attachments/assets/5004dee4-de0a-44e5-9031-582f7738a348" />

## GIST-960
<img width="787" height="435" alt="bench_hnsw_flat_panorama_GIST1M" src="https://github.com/user-attachments/assets/ba73d062-be14-44b0-9c46-ac1dafbfaed2" />

## Synthetic-2048
<img width="794" height="435" alt="bench_hnsw_flat_panorama_Synthetic2048D" src="https://github.com/user-attachments/assets/acf6233c-185b-4295-9c63-7a4b5b037619" />

Pull Request resolved: facebookresearch#4621

Reviewed By: mdouze

Differential Revision: D85902427

Pulled By: mnorris11

fbshipit-source-id: 4db9e950ce0c532494fa99ae93d39ccf06779b5d
@meta-cla meta-cla bot added the CLA Signed label Nov 20, 2025
@AlSchlo
Copy link
Contributor Author

AlSchlo commented Nov 20, 2025

Also, @mnorris11 take a look at: #4691

@pankajsingh88
Copy link
Contributor

@mnorris11 is out of office for a week. Assigning him to take a look when he's back.

@mnorris11
Copy link

@AlSchlo @aknayar I am trying to get a test for backwards compatible index serialization out, but right now the Github Actions CI is frozen. After it's unfrozen, I will aim to land that test (maybe a few days of effort e2e), then we can import this.

@meta-codesync
Copy link
Contributor

meta-codesync bot commented Dec 4, 2025

@mnorris11 has imported this pull request. If you are a Meta employee, you can view this in D88390767.

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.

3 participants