1. Structure
  2. AI & ML
  3. Vector Search
  4. Foundation
  5. Data Model
  • Home
  • What is TileDB?
  • Get Started
  • Explore Content
  • Accounts
    • Individual Accounts
      • Apply for the Free Tier
      • Profile
        • Overview
        • Cloud Credentials
        • Storage Paths
        • REST API Tokens
        • Credits
    • Organization Admins
      • Create an Organization
      • Profile
        • Overview
        • Members
        • Cloud Credentials
        • Storage Paths
        • Billing
      • API Tokens
    • Organization Members
      • Organization Invitations
      • Profile
        • Overview
        • Members
        • Cloud Credentials
        • Storage Paths
        • Billing
      • API Tokens
  • Catalog
    • Introduction
    • Data
      • Arrays
      • Tables
      • Single-Cell (SOMA)
      • Genomics (VCF)
      • Biomedical Imaging
      • Vector Search
      • Files
    • Code
      • Notebooks
      • Dashboards
      • User-Defined Functions
      • Task Graphs
      • ML Models
    • Groups
    • Marketplace
    • Search
  • Collaborate
    • Introduction
    • Organizations
    • Access Control
      • Introduction
      • Share Assets
      • Asset Permissions
      • Public Assets
    • Logging
    • Marketplace
  • Analyze
    • Introduction
    • Slice Data
    • Multi-Region Redirection
    • Notebooks
      • Launch a Notebook
      • Usage
      • Widgets
      • Notebook Image Dependencies
    • Dashboards
      • Dashboards
      • Streamlit
    • Preview
    • User-Defined Functions
    • Task Graphs
    • Serverless SQL
    • Monitor
      • Task Log
      • Task Graph Log
  • Scale
    • Introduction
    • Task Graphs
    • API Usage
  • Structure
    • Why Structure Is Important
    • Arrays
      • Introduction
      • Quickstart
      • Foundation
        • Array Data Model
        • Key Concepts
          • Storage
            • Arrays
            • Dimensions
            • Attributes
            • Cells
            • Domain
            • Tiles
            • Data Layout
            • Compression
            • Encryption
            • Tile Filters
            • Array Schema
            • Schema Evolution
            • Fragments
            • Fragment Metadata
            • Commits
            • Indexing
            • Array Metadata
            • Datetimes
            • Groups
            • Object Stores
          • Compute
            • Writes
            • Deletions
            • Consolidation
            • Vacuuming
            • Time Traveling
            • Reads
            • Query Conditions
            • Aggregates
            • User-Defined Functions
            • Distributed Compute
            • Concurrency
            • Parallelism
        • Storage Format Spec
      • Tutorials
        • Basics
          • Basic Dense Array
          • Basic Sparse Array
          • Array Metadata
          • Compression
          • Encryption
          • Data Layout
          • Tile Filters
          • Datetimes
          • Multiple Attributes
          • Variable-Length Attributes
          • String Dimensions
          • Nullable Attributes
          • Multi-Range Reads
          • Query Conditions
          • Aggregates
          • Deletions
          • Catching Errors
          • Configuration
          • Basic S3 Example
          • Basic TileDB Cloud
          • fromDataFrame
          • Palmer Penguins
        • Advanced
          • Schema Evolution
          • Advanced Writes
            • Write at a Timestamp
            • Get Fragment Info
            • Consolidation
              • Fragments
              • Fragment List
              • Consolidation Plan
              • Commits
              • Fragment Metadata
              • Array Metadata
            • Vacuuming
              • Fragments
              • Commits
              • Fragment Metadata
              • Array Metadata
          • Advanced Reads
            • Get Fragment Info
            • Time Traveling
              • Introduction
              • Fragments
              • Array Metadata
              • Schema Evolution
          • Array Upgrade
          • Backends
            • Amazon S3
            • Azure Blob Storage
            • Google Cloud Storage
            • MinIO
            • Lustre
          • Virtual Filesystem
          • User-Defined Functions
          • Distributed Compute
          • Result Estimation
          • Incomplete Queries
        • Management
          • Array Schema
          • Groups
          • Object Management
        • Performance
          • Summary of Factors
          • Dense vs. Sparse
          • Dimensions vs. Attributes
          • Compression
          • Tiling and Data Layout
          • Tuning Writes
          • Tuning Reads
      • API Reference
    • Tables
      • Introduction
      • Quickstart
      • Foundation
        • Data Model
        • Key Concepts
          • Indexes
          • Columnar Storage
          • Compression
          • Data Manipulation
          • Optimize Tables
          • ACID
          • Serverless SQL
          • SQL Connectors
          • Dataframes
          • CSV Ingestion
      • Tutorials
        • Basics
          • Ingestion with SQL
          • CSV Ingestion
          • Basic S3 Example
          • Running Locally
        • Advanced
          • Scalable Ingestion
          • Scalable Queries
      • API Reference
    • AI & ML
      • Vector Search
        • Introduction
        • Quickstart
        • Foundation
          • Data Model
          • Key Concepts
            • Vector Search
            • Vector Databases
            • Algorithms
            • Distance Metrics
            • Updates
            • Deployment Methods
            • Architecture
            • Distributed Compute
          • Storage Format Spec
        • Tutorials
          • Basics
            • Ingestion & Querying
            • Updates
            • Deletions
            • Basic S3 Example
            • Running Locally
          • Advanced
            • Versioning
            • Time Traveling
            • Consolidation
            • Distributed Compute
            • RAG LLM
            • LLM Memory
            • File Search
            • Image Search
            • Protein Search
          • Performance
        • API Reference
      • ML Models
        • Introduction
        • Quickstart
        • Foundation
          • Basics
          • Storage
          • Cloud Execution
          • Why TileDB for Machine Learning
        • Tutorials
          • Ingestion
            • Data Ingestion
              • Dense Datasets
              • Sparse Datasets
            • ML Model Ingestion
          • Management
            • Array Schema
            • Machine Learning: Groups
            • Time Traveling
    • Life Sciences
      • Single-cell
        • Introduction
        • Quickstart
        • Foundation
          • Data Model
          • Key Concepts
            • Data Structures
            • Use of Apache Arrow
            • Join IDs
            • State Management
            • TileDB Cloud URIs
          • SOMA API Specification
        • Tutorials
          • Data Ingestion
          • Bulk Ingestion Tutorial
          • Data Access
          • Distributed Compute
          • Basic S3 Example
          • Multi-Experiment Queries
          • Appending Data to a SOMA Experiment
          • Add New Measurements
          • SQL Queries
          • Running Locally
          • Shapes in TileDB-SOMA
          • Drug Discovery App
        • Spatial
          • Introduction
          • Foundation
            • Spatial Data Model
            • Data Structures
          • Tutorials
            • Spatial Data Ingestion
            • Access Spatial Data
            • Manage Coordinate Spaces
        • API Reference
      • Population Genomics
        • Introduction
        • Quickstart
        • Foundation
          • Data Model
          • Key Concepts
            • The N+1 Problem
            • Architecture
            • Arrays
            • Ingestion
            • Reads
            • Variant Statistics
            • Annotations
            • User-Defined Functions
            • Tables and SQL
            • Distributed Compute
          • Storage Format Spec
        • Tutorials
          • Basics
            • Basic Ingestion
            • Basic Queries
            • Export to VCF
            • Add New Samples
            • Deleting Samples
            • Basic S3 Example
            • Basic TileDB Cloud
          • Advanced
            • Scalable Ingestion
            • Scalable Queries
            • Query Transforms
            • Handling Large Queries
            • Annotations
              • Finding Annotations
              • Embedded Annotations
              • External Annotations
              • Annotation VCFs
              • Ingesting Annotations
            • Variant Statistics
            • Tables and SQL
            • User-Defined Functions
            • Sample Metadata
            • Split VCF
          • Performance
        • API Reference
          • Command Line Interface
          • Python API
          • Cloud API
      • Biomedical Imaging
        • Introduction
        • Foundation
          • Data Model
          • Key Concepts
            • Arrays
            • Ingestion
            • Reads
            • User Defined Functions
          • Storage Format Spec
        • Quickstart
        • Tutorials
          • Basics
            • Ingestion
            • Read
              • OpenSlide
              • TileDB-Py
          • Advanced
            • Batched Ingestion
            • Chunked Ingestion
            • Machine Learning
              • PyTorch
            • Napari
    • Files
  • API Reference
  • Self-Hosting
    • Installation
    • Upgrades
    • Administrative Tasks
    • Image Customization
      • Customize User-Defined Function Images
      • AWS ECR Container Registry
      • Customize Jupyter Notebook Images
    • Single Sign-On
      • Configure Single Sign-On
      • OpenID Connect
      • Okta SCIM
      • Microsoft Entra
  • Glossary

On this page

  • Cross-algorithm data model
    • Updates
    • Object metadata
  • Algorithm-specific storage format
    • FLAT
      • Vectors
      • External IDs
    • IVF_FLAT
      • Partition centroids
      • Partition indexes
      • Shuffled vectors
      • Shuffled IDs
    • Vamana
      • Vectors
      • External IDs
      • Adjacency row indices
      • Adjacency IDs
      • Adjacency scores
  1. Structure
  2. AI & ML
  3. Vector Search
  4. Foundation
  5. Data Model

Vector Search Data Model

ai/ml
vector search
foundation
data model
Learn about the vector search data model in TileDB.

TileDB-Vector-Search implements different indexing algorithms that store the vector search data using different storage formats. Conceptually, TileDB-Vector-Search is storing and offering search functionalities for:

  • A set of vectors: All vectors should have the same dimensionality and data type. This is essentially a 2D array of [size, dimensions].
  • External IDs: Each vector can be associated with an external_id that is used to identify the vector.
  • Metadata: Each vector can also be associated with a set of metadata attributes. This is a set of user defined attributes of any of the attribute types supported by TileDB arrays.

A user can perform the following types of queries:

  • Similarity: Given a query vector, TileDB-Vector-Search returns the \(k\) most similar vectors, along with their external_ids and metadata values.
  • Similarity with structured filters: Given a query vector and a set of metadata filters, TileDB-Vector-Search returns the \(k\) most similar vectors that match the metadata filters, along with their external_ids and metadata values.

The underlying data model used for indexing vectors in TileDB-Vector-Search depends heavily on the indexing algorithm used. However, TileDB uses certain high level structures across algorithms.

Cross-algorithm data model

All data and metadata required for a TileDB-Vector-Search index are stored inside a TileDB group (index_uri). All the listed, named arrays below are stored under this URI.

Updates

TileDB-Vector-Search offers support for updates for all different index algorithms by recording updates outside the main indexing storage structure and periodically consolidating them. This implementation is using the updates array, a sparse 1D array with dimension the external_id of the vectors and 1 variable length attribute encoding the vector itself or an empty value if the vector is deleted.

Object metadata

The object_metadata array is a 1D sparse array with external_id as dimension and attributes the user defined metadata attributes for their respective objects. This array stores metadata for each vector that can be used to implement similarity queries with structured filters.

Algorithm-specific storage format

TileDB-Vector-Search indexing algorithms implement different data models to support storing and querying vectors efficiently.

FLAT

FLAT is a straightforward implementation used to provide exact vector similarity search by computing the distance of the query vector and all the dataset vectors. It stores all the vectors in a non-ordered TileDB array.

Vectors

The shuffled_vectors array is a 2D dense array that contains all the vectors with no specific ordering. It stores the vectors as columns of the array and has dimensions:

  • rows - Corresponds to the vector dimensions (0, dimensions).
  • cols - Corresponds to the vector position in the set of vectors (0, size).

External IDs

The shuffled_ids array is a 1D dense array that maps vector positions in the vectors array to the external_id of each vector.

IVF_FLAT

IVF_FLAT is based on \(k\)-means clustering. Effectively, TileDB computes \(k\) separate clusters (as well as their centroids) of the dataset vectors, shuffling them in a way such that vectors in the same cluster appear adjacent on storage (to minimize I/O when retrieving those vectors).

Partition centroids

The partition_centroids array is a 2D dense array, storing the \(k\)-means centroids for the different vector partitions. It stores the centroid vectors as columns of the array and has dimensions:

  • rows - Corresponds to the vector dimensions (0, dimensions).
  • cols - Corresponds to the partition ID (0, partitions).

Partition indexes

The partition_indexes array is a 1D dense array recording the start index of each partition of vectors in the shuffled vectors array. This array has one dimension corresponding to the partition ID for which we record the start index. The end index of each partition corresponds to the start index of the next partition.

Shuffled vectors

The shuffled_vectors array is a 2D dense array that contains all the dataset vectors shuffled based on their partition. Each vector partition is stored in a consecutive index range of this array. The vectors are stored as columns of the array which has dimensions:

  • rows - Corresponds to the vector dimensions (0, dimensions).
  • cols - Corresponds to the vector position in the set of vectors (0, size).

Shuffled IDs

The shuffled_ids array is a 1D dense array that maps vector indices in the shuffled vectors array to the external_id of each vector.

Vamana

VAMANA is a graph-based algorithm based on Microsoft’s DiskANN vector search library (Subramanya, Suhas Jayaram et al. “DiskANN : Fast Accurate Billion-point Nearest Neighbor Search on a Single Node.” NeurIPS (2019).). It stores all of the vectors in a non-ordered TileDB array, as well as a graph that is used for faster searching.

Vectors

The shuffled_vectors array is a 2D dense array that contains all the vectors with no specific ordering. It stores the vectors as columns of the array and has dimensions:

  • rows - Corresponds to the vector dimensions (0, dimensions).
  • cols - Corresponds to the vector position in the set of vectors (0, size).

External IDs

The shuffled_ids array is a 1D dense array that maps vector positions in the vectors array to the external_id of each vector.

Adjacency row indices

The adjacency_row_index_array_name is a 1D dense array that holds the edges for each node in the graph. Each value indicates where the neighbors (edges) for each successive node start in Adjacency IDs and Adjacency Scores. For example, you might have [0, 2, 8, 13], which indicates that the neighbors for node 0 start at index 0, the neighbors for node 1 start at index 2, and the neighbors for node 2 start at index 8. The final value is the end of the array, so the neighbors for node 2 end at index 13. With that information, you can look in Adjacency IDs to determine the destination node. The source node can be inferred by the index of the Adjacency Row Indices array. Once you know the source or destination node index, you can look at that index in Vectors or External IDs to get the vector or external ID for that node.

Adjacency IDs

The adjacency_ids array is a 1D dense array that holds the neighbors of the graph. Each value is an index into the Vectors and External IDs arrays. This only holds the destination nodes of the graph. The source node is in the Adjacency Row Indices array, which itself points to Adjacency IDs.

Adjacency scores

The adjacency_scores is a 1D dense array that follows the same pattern as Adjacency IDs, but holds the edge distance instead of the destination node.

Foundation
Key Concepts