Record Class Config
java.lang.Object
java.lang.Record
com.apple.foundationdb.async.hnsw.Config
- Record Components:
metric- the metric used to determine distances between vectorsnumDimensions- the number of dimensions; all vectors must have exactly this many dimensionsuseInlining- whether layers above 0 use inlined storage (vectors stored with neighbor links)m- the target connectivity for each node (named M in the HNSW paper)mMax- the maximum connectivity for nodes on layers above 0 (M_max in the paper)mMax0- the maximum connectivity for nodes on layer 0 (M_max0 in the paper)efConstruction- the search queue size during insertion (higher = more accurate but slower)efRepair- the candidate set size during delete repairextendCandidates- whether to extend the candidate set with neighbors-of-neighbors during insertkeepPrunedConnections- whether to re-add pruned candidates to pad underconnected nodessampleVectorStatsProbability- probability of sampling a vector write for statistics computationmaintainStatsProbability- probability of aggregating sampled vectors during insertstatsThreshold- number of sampled vectors that triggers centroid computationuseRaBitQ- whether to use RaBitQ quantizationraBitQNumExBits- number of extra bits per dimension for RaBitQ encodingmaxNumConcurrentNodeFetches- maximum concurrent node fetches during search and modificationmaxNumConcurrentNeighborhoodFetches- maximum concurrent neighborhood fetches during pruningmaxNumConcurrentDeleteFromLayer- maximum concurrent delete operations per layer
- All Implemented Interfaces:
VectorEncodingConfig
public record Config(@Nonnull Metric metric, int numDimensions, boolean useInlining, int m, int mMax, int mMax0, int efConstruction, int efRepair, boolean extendCandidates, boolean keepPrunedConnections, double sampleVectorStatsProbability, double maintainStatsProbability, int statsThreshold, boolean useRaBitQ, int raBitQNumExBits, int maxNumConcurrentNodeFetches, int maxNumConcurrentNeighborhoodFetches, int maxNumConcurrentDeleteFromLayer)
extends Record
implements VectorEncodingConfig
Configuration settings for an
HNSW.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final booleanstatic final booleanstatic final intstatic final intstatic final intstatic final doublestatic final intstatic final intstatic final intstatic final Metricstatic final intstatic final doublestatic final intstatic final booleanstatic final boolean -
Constructor Summary
ConstructorsConstructorDescriptionConfig(Metric metric, int numDimensions, boolean useInlining, int m, int mMax, int mMax0, int efConstruction, int efRepair, boolean extendCandidates, boolean keepPrunedConnections, double sampleVectorStatsProbability, double maintainStatsProbability, int statsThreshold, boolean useRaBitQ, int raBitQNumExBits, int maxNumConcurrentNodeFetches, int maxNumConcurrentNeighborhoodFetches, int maxNumConcurrentDeleteFromLayer) Creates an instance of aConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theefConstructionrecord component.intefRepair()Returns the value of theefRepairrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of theextendCandidatesrecord component.final inthashCode()Returns a hash code value for this object.booleanReturns the value of thekeepPrunedConnectionsrecord component.intm()Returns the value of themrecord component.doubleReturns the value of themaintainStatsProbabilityrecord component.intReturns the value of themaxNumConcurrentDeleteFromLayerrecord component.intReturns the value of themaxNumConcurrentNeighborhoodFetchesrecord component.intReturns the value of themaxNumConcurrentNodeFetchesrecord component.metric()Returns the value of themetricrecord component.intmMax()Returns the value of themMaxrecord component.intmMax0()Returns the value of themMax0record component.intReturns the value of thenumDimensionsrecord component.intReturns the value of theraBitQNumExBitsrecord component.doubleReturns the value of thesampleVectorStatsProbabilityrecord component.intReturns the value of thestatsThresholdrecord component.toString()Returns a string representation of this record class.booleanReturns the value of theuseInliningrecord component.booleanReturns the value of theuseRaBitQrecord component.
-
Field Details
-
DEFAULT_METRIC
-
DEFAULT_USE_INLINING
public static final boolean DEFAULT_USE_INLINING- See Also:
-
DEFAULT_M
public static final int DEFAULT_M- See Also:
-
DEFAULT_M_MAX_0
public static final int DEFAULT_M_MAX_0- See Also:
-
DEFAULT_M_MAX
public static final int DEFAULT_M_MAX- See Also:
-
DEFAULT_EF_CONSTRUCTION
public static final int DEFAULT_EF_CONSTRUCTION- See Also:
-
DEFAULT_EF_REPAIR
public static final int DEFAULT_EF_REPAIR- See Also:
-
DEFAULT_EXTEND_CANDIDATES
public static final boolean DEFAULT_EXTEND_CANDIDATES- See Also:
-
DEFAULT_KEEP_PRUNED_CONNECTIONS
public static final boolean DEFAULT_KEEP_PRUNED_CONNECTIONS- See Also:
-
DEFAULT_SAMPLE_VECTOR_STATS_PROBABILITY
public static final double DEFAULT_SAMPLE_VECTOR_STATS_PROBABILITY- See Also:
-
DEFAULT_MAINTAIN_STATS_PROBABILITY
public static final double DEFAULT_MAINTAIN_STATS_PROBABILITY- See Also:
-
DEFAULT_STATS_THRESHOLD
public static final int DEFAULT_STATS_THRESHOLD- See Also:
-
DEFAULT_USE_RABITQ
public static final boolean DEFAULT_USE_RABITQ- See Also:
-
DEFAULT_RABITQ_NUM_EX_BITS
public static final int DEFAULT_RABITQ_NUM_EX_BITS- See Also:
-
DEFAULT_MAX_NUM_CONCURRENT_NODE_FETCHES
public static final int DEFAULT_MAX_NUM_CONCURRENT_NODE_FETCHES- See Also:
-
DEFAULT_MAX_NUM_CONCURRENT_NEIGHBOR_FETCHES
public static final int DEFAULT_MAX_NUM_CONCURRENT_NEIGHBOR_FETCHES- See Also:
-
DEFAULT_MAX_NUM_CONCURRENT_DELETE_FROM_LAYER
public static final int DEFAULT_MAX_NUM_CONCURRENT_DELETE_FROM_LAYER- See Also:
-
-
Constructor Details
-
Config
public Config(@Nonnull Metric metric, int numDimensions, boolean useInlining, int m, int mMax, int mMax0, int efConstruction, int efRepair, boolean extendCandidates, boolean keepPrunedConnections, double sampleVectorStatsProbability, double maintainStatsProbability, int statsThreshold, boolean useRaBitQ, int raBitQNumExBits, int maxNumConcurrentNodeFetches, int maxNumConcurrentNeighborhoodFetches, int maxNumConcurrentDeleteFromLayer) Creates an instance of aConfigrecord class.- Parameters:
metric- the value for themetricrecord componentnumDimensions- the value for thenumDimensionsrecord componentuseInlining- the value for theuseInliningrecord componentm- the value for themrecord componentmMax- the value for themMaxrecord componentmMax0- the value for themMax0record componentefConstruction- the value for theefConstructionrecord componentefRepair- the value for theefRepairrecord componentextendCandidates- the value for theextendCandidatesrecord componentkeepPrunedConnections- the value for thekeepPrunedConnectionsrecord componentsampleVectorStatsProbability- the value for thesampleVectorStatsProbabilityrecord componentmaintainStatsProbability- the value for themaintainStatsProbabilityrecord componentstatsThreshold- the value for thestatsThresholdrecord componentuseRaBitQ- the value for theuseRaBitQrecord componentraBitQNumExBits- the value for theraBitQNumExBitsrecord componentmaxNumConcurrentNodeFetches- the value for themaxNumConcurrentNodeFetchesrecord componentmaxNumConcurrentNeighborhoodFetches- the value for themaxNumConcurrentNeighborhoodFetchesrecord componentmaxNumConcurrentDeleteFromLayer- the value for themaxNumConcurrentDeleteFromLayerrecord component
-
-
Method Details
-
toBuilder
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
metric
Returns the value of themetricrecord component.- Specified by:
metricin interfaceVectorEncodingConfig- Returns:
- the value of the
metricrecord component
-
numDimensions
public int numDimensions()Returns the value of thenumDimensionsrecord component.- Specified by:
numDimensionsin interfaceVectorEncodingConfig- Returns:
- the value of the
numDimensionsrecord component
-
useInlining
public boolean useInlining()Returns the value of theuseInliningrecord component.- Returns:
- the value of the
useInliningrecord component
-
m
public int m()Returns the value of themrecord component.- Returns:
- the value of the
mrecord component
-
mMax
public int mMax()Returns the value of themMaxrecord component.- Returns:
- the value of the
mMaxrecord component
-
mMax0
public int mMax0()Returns the value of themMax0record component.- Returns:
- the value of the
mMax0record component
-
efConstruction
public int efConstruction()Returns the value of theefConstructionrecord component.- Returns:
- the value of the
efConstructionrecord component
-
efRepair
public int efRepair()Returns the value of theefRepairrecord component.- Returns:
- the value of the
efRepairrecord component
-
extendCandidates
public boolean extendCandidates()Returns the value of theextendCandidatesrecord component.- Returns:
- the value of the
extendCandidatesrecord component
-
keepPrunedConnections
public boolean keepPrunedConnections()Returns the value of thekeepPrunedConnectionsrecord component.- Returns:
- the value of the
keepPrunedConnectionsrecord component
-
sampleVectorStatsProbability
public double sampleVectorStatsProbability()Returns the value of thesampleVectorStatsProbabilityrecord component.- Returns:
- the value of the
sampleVectorStatsProbabilityrecord component
-
maintainStatsProbability
public double maintainStatsProbability()Returns the value of themaintainStatsProbabilityrecord component.- Returns:
- the value of the
maintainStatsProbabilityrecord component
-
statsThreshold
public int statsThreshold()Returns the value of thestatsThresholdrecord component.- Returns:
- the value of the
statsThresholdrecord component
-
useRaBitQ
public boolean useRaBitQ()Returns the value of theuseRaBitQrecord component.- Specified by:
useRaBitQin interfaceVectorEncodingConfig- Returns:
- the value of the
useRaBitQrecord component
-
raBitQNumExBits
public int raBitQNumExBits()Returns the value of theraBitQNumExBitsrecord component.- Specified by:
raBitQNumExBitsin interfaceVectorEncodingConfig- Returns:
- the value of the
raBitQNumExBitsrecord component
-
maxNumConcurrentNodeFetches
public int maxNumConcurrentNodeFetches()Returns the value of themaxNumConcurrentNodeFetchesrecord component.- Returns:
- the value of the
maxNumConcurrentNodeFetchesrecord component
-
maxNumConcurrentNeighborhoodFetches
public int maxNumConcurrentNeighborhoodFetches()Returns the value of themaxNumConcurrentNeighborhoodFetchesrecord component.- Returns:
- the value of the
maxNumConcurrentNeighborhoodFetchesrecord component
-
maxNumConcurrentDeleteFromLayer
public int maxNumConcurrentDeleteFromLayer()Returns the value of themaxNumConcurrentDeleteFromLayerrecord component.- Returns:
- the value of the
maxNumConcurrentDeleteFromLayerrecord component
-