Skip to content

Feature: Metrics cheatsheet in the docs #668

Closed

Description

@tnibler

Describe what you are looking for

I regularly need to come back and check exact behavior/definitions of metrics, notably IP, cos, L2 (which are kindof the same, but also not quite). There's a couple of other issues (#13, #258) where some details were unclear to others too.

A tiny table summarizing how inputs should be normalized, how they are normalized internally and the formula for the Match.distance you get back (just dot product? normalized then dot? 1 - dot?) would be super handy.

Thank you :)

Can you contribute to the implementation?

  • I can contribute

Is your feature request specific to a certain interface?

It applies to everything

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    enhancement
    on Oct 26, 2025
  2. ashvardanian commented on Oct 26, 2025

    @ashvardanian
    Member

    Thanks for suggestion, @tnibler! I'll try to make the docs of v3 clearer about the metrics, but feel free to suggest docs patches in the meantime - I'm ready to merge 😉

  3. DiscoMenon commented on Oct 19, 2026

    @DiscoMenon
    Contributor

    Hi, I'd like to take this. I have implemented HNSW myself, and so I know the relationships between cosine, L2 and inner product. I checked the README file and the docs/ folder, and I couldn't find a summary of the metrics. My idea is to read how each metric is calculated in the code, and make a small table, with the expected input normalization, what happens internally, and what is the formula of Match.distance. Is a patch to the docs still welcome, and do you prefer a new page in docs/ or a section in the README?

  4. ashvardanian commented on Oct 19, 2026

    @ashvardanian
    Member

    A patch on existing pages is better, especially if it's not too intrusive and uses supported $$ math notation. Thanks 🤗

  5. DiscoMenon commented on Oct 19, 2026

    @DiscoMenon
    Contributor

    Thanks. I’ll add the metrics table to an existing docs page and use the supported $$ notation for the formulas. I’ll verify them against the implementation first, then open a PR linking this issue.

  6. added 2 commits that reference this issue on Oct 24, 2026
    30068d7
    3ea3624
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions