Skip to content

HNSW default vector TYPE: documentation states F64 in three places, but v3.2.0 materialises TYPE F32 when TYPE is omitted #1871

Description

@RobertSigmundsson

Affected files: src/content/learn/data-models/vector-search/vector-indexes.mdx (parameter table + "Defaults to:" example), src/content/reference/query-language/statements/define/indexes.mdx

The documentation states in three places that the default vector element type for HNSW indexes is F64:

  1. vector-indexes.mdx, parameter table: | TYPE | F64 | F64, F32, I64, I32, I16 | Vector type
  2. vector-indexes.mdx, expanded-defaults example: DEFINE INDEX hnsw_idx ON pts FIELDS point HNSW DIMENSION 4 DIST EUCLIDEAN TYPE F64 EFC 150 M 12 M0 24 LM 0.402…;
  3. define/indexes.mdx: "In SurrealDB the default type for vectors is F64."

Observed on SurrealDB v3.2.0 (official Docker image): defining an HNSW index without TYPE and exporting the database shows the index materialised with TYPE F32:

DEFINE INDEX hx ON pts FIELDS point HNSW DIMENSION 4 DIST EUCLIDEAN EFC 150 M 12;

surreal export then contains:

DEFINE INDEX hx ON pts FIELDS point HNSW DIMENSION 4 DIST EUCLIDEAN TYPE F32 EFC 150 M 12 M0 24 LM 0.40242960438184466f;

Could you confirm which side reflects the intent?

  • If F32 is the intended default (it halves the resident memory of the in-RAM HNSW graph, which seems sensible), the three documentation spots should be updated to F32.
  • If F64 is intended, this looks like an engine defaulting bug and I would be happy to refile against surrealdb/surrealdb.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions