# US 2021/0173896 A1 · Incremental updates for nearest neighbor search

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0173896 A1
- Document ID: US20210173896A1
- Status: Published application
- Kind: A1
- Application number: 15/934,277
- Filed: 2018-03-23
- Published: 2021-06-10
- Earliest claimed: 2018-03-23
- Assignees: Amazon Technologies, Inc.
- Applicants: Amazon Technologies, Inc.
- Inventors: Poorna Chand Srinivas PERUMALLA; Pracheer GUPTA; Stefano STEFANI
- Web page: https://patentgrep.com/patent/US20210173896A1

## CPC

- G06F 16/23: Updating
- G06F 16/24542: {Plan optimisation}
- G06F 16/2237: {Vectors, bitmaps or matrices}
- G06F 16/2343: {Locking methods, e.g. distributed locking or locking implementation details}
- G06F 16/2379: {Updates performed during online database operations; commit processing}
- G06F 16/38: Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
- G06F 16/9024: {Graphs; Linked lists (G06F16/9027 takes precedence)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Techniques are described for a nearest neighbor search service that enables users to perform nearest neighbor searches. The nearest neighbor search service includes an interface that enables users to create collections of searchable vectors, add and update vectors to a collection, delete vectors from a collection, and perform searches for nearest neighbors to a given vector. The nearest neighbor search service enables users to add, update, and delete vectors of a collection in real-time while also enabling users to perform searches at the same time.

## Claims

### Claim 1

A computer-implemented method comprising:
receiving a request to update a node associated with a vector in a graph at a frontend, the request to include a collection identifier and the vector;
querying a collection metadata database to determine an address of a shard housing a collection of vectors including the graph based on the collection identifier;
updating a vector database to reflect the vector being a part of the collection of vectors;
identifying which stream of a streaming service to send the request;
sending the request to an indexing service and a checkpointing service using the identified stream; and
updating the graph using the indexing service.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, the indexing service and the checkpointing service are container instances.

### Claim 3 (depends on 2)

The computer-implemented method of claim 2, wherein the vector database includes all vectors of the collection.

### Claim 4

A computer-implemented method comprising:
receiving a request to perform an action on a vector in a collection of vectors at a frontend, the request to include a collection identifier and the vector;
querying a collection metadata database to determine an address of a shard housing the collection of vectors based on the collection identifier;
updating a vector database to reflect a status of the vector with respect to the collection of vectors;
sending the request to an indexing service implemented by one or more computing devices; and
performing an action on the vector of the collection of vectors using the indexing service.

### Claim 5 (depends on 4)

The computer-implemented method of claim 4, wherein the action is to update a node in a graph and performing the action comprises:
obtaining a lock for an entry for the vector in a node data structure;
updating node associated with the vector in the graph;
recalculating edge values for nodes impacted by the updating of the node; and
releasing a lock for the entry for the vector in a node data structure.

### Claim 6 (depends on 4)

The computer-implemented method of claim 4, wherein the request to update a node associated with a vector in a graph includes an identifier of the vector and a collection including the vector.

### Claim 7 (depends on 4)

The computer-implemented method of claim 4, wherein the action is to add a node in a graph and performing the action comprises:
determining there is not an entry for the vector in the node data structure;
adding a node associated with the vector to the graph;
recalculating edge values for nodes impacted by the updating of the node; and
adding an entry for the vector into the node data structure.

### Claim 8 (depends on 7)

The computer-implemented method of claim 7, wherein the request to add a node associated with a vector in a graph includes an identifier of the vector and a collection including the vector.

### Claim 9 (depends on 4)

The computer-implemented method of claim 4, wherein the action is to get a node in a graph and performing the action comprises:
obtaining a read lock associated with the node in the node data structure;
reading the node from the graph; and
releasing the read lock associated with the node in the node data structure.

### Claim 10 (depends on 9)

The computer-implemented method of claim 9, wherein the request to get a node associated with a vector in a graph includes an identifier of the vector.

### Claim 11 (depends on 4)

The computer-implemented method of claim 4, wherein the action is to delete a node in a graph and performing the action comprises:
determining there are no locks set associated with an entry for the node in the node data structure;
deleting the node from the graph;
recalculating edge values for nodes impacted by the deleting of the node; and
updating the entry for the node in the node data structure to have a null pointer for the node.

### Claim 12 (depends on 11)

The computer-implemented method of claim 11, wherein the request to delete a node associated with a vector in a graph includes an identifier of the vector.

### Claim 13 (depends on 4)

The computer-implemented method of claim 4, further comprising taking a snapshot of a graph and persisting the graph.

### Claim 14 (depends on 4)

The computer-implemented method of claim 4, further comprising updating the collection metadata database upon a change to the shard address.

### Claim 15

An apparatus, comprising:
a processor;
a non-transitory machine-readable storage medium storing instructions which, when executed by the processor, causes the apparatus to:
receive a request to perform an action on a vector in a collection of vectors, the request to include a collection identifier and the vector;
query a collection metadata database to determine an address of a shard housing the collection of vectors based on the collection identifier;
update a vector database to reflect a status of the vector with respect to the collection of vectors; and
send the request to an indexing service; and
perform an action on the vector of the collection of vectors using the indexing service.

### Claim 16 (depends on 15)

The apparatus of claim 15, wherein the action is to update a node in the graph, and wherein to perform the action, the indexing service is to:
obtain a lock for an entry for the vector in a node data structure;
update a node associated with the vector in the graph;
recalculate edge values for nodes impacted by the update of the node; and
release a lock for the entry for the vector in a node data structure.

### Claim 17 (depends on 15)

The apparatus of claim 15, wherein the request to update a node associated with a vector in a graph is to include an identifier of the vector and a collection including the vector.

### Claim 18 (depends on 15)

The apparatus of claim 15, wherein the action is to add a node in a graph, and wherein to perform the action, the indexing service is to:
determine there is not an entry for the vector in the node data structure;
add a node associated with the vector to the graph;
recalculate edge values for nodes impacted by the updating of the node; and
add an entry for the vector into the node data structure.

### Claim 19 (depends on 15)

The apparatus of claim 15, wherein the request to add a node associated with a vector in a graph includes an identifier of the vector and a collection including the vector.

### Claim 20 (depends on 15)

The apparatus of claim 15, wherein the action is to get a node in the graph, and wherein to perform the action, the indexing service is to:
obtain a read lock associated with the node in the node data structure;
read the node from the graph; and
release the read lock associated with the node in the node data structure.
