Skip to content
News

What is a vector database? How AI finds related information

Learn how vector databases find related information, when exact search still matters and how to keep retrieval useful as sources, permissions and decisions change.

Nested metallic crystal steps reflect restrained plum, copper, blue and peacock colours.

A vector database stores numerical representations of information and retrieves items that are close to a query in that representation. It helps applications find related documents, images or other records even when the search uses different wording from the source.

For a software team, that could mean finding an earlier incident about delayed event delivery when someone asks why customer updates are arriving late. The earlier report might use the terms queue backlog or retry exhaustion. A useful search needs to connect those descriptions without losing the details that make the incident relevant.

Vector search is one part of that job. The application still needs to establish which records the person can access, whether the information is current and what the retrieved material actually supports. Understanding these boundaries makes it easier to choose a database and build an AI system that people can rely on.

How does a vector database work?

An embedding model converts an item into a list of numbers called a vector. Within a useful embedding space, related items tend to appear near each other. The database compares the query vector with stored vectors and returns nearby candidates. AWS describes this combination of embedding storage and efficient similarity retrieval in its vector database introduction.

For text, a typical retrieval path has five stages:

  1. Select and prepare the source material.

  2. Divide long sources into passages that remain understandable on their own.

  3. Generate an embedding for each passage and retain its source reference.

  4. Embed the query using a compatible model and search the collection.

  5. Fetch the permitted source passages for the application to inspect or use.

The vector is a representation used for matching. The original text, image or record remains important. A support agent needs to read what an incident report says, including its limitations, before proposing that it explains a new problem.

The embedding configuration also belongs in the data record. A collection built with one model should not silently receive query vectors from an unrelated embedding space. Changing that configuration can require regenerating the stored embeddings. Google's embedding migration guidance provides a concrete example of models with incompatible spaces. Plan the migration as a change to retrieval behavior, with a comparison against representative questions.

Fine strands pass through ceramic guides and precise metal stages in a tall manufacturing line.

How is vector search different from keyword search?

Keyword search is useful when the wording matters. An incident number, an error code, a customer identifier or a particular configuration key should usually remain available as an exact constraint.

Vector search helps when the wording varies. A person might describe a symptom in everyday language while the source uses technical terminology. The two methods can work together through hybrid retrieval. Metadata can also narrow the search to an appropriate product, period or document type.

Consider three requests:

  • “Find incident INC742.” The identifier should lead directly to the record.

  • “Have we seen customer updates arrive hours late?” Similarity search can suggest relevant investigations.

  • “Find confirmed delivery incidents for the current connector version.” Exact filters and a semantic query can contribute different parts of the answer.

A useful system does not force all three into the same search strategy. Evaluate the mix against the questions people actually ask, including requests where the correct result depends on a single exact value.

A similarity score is not a confidence score

A nearby vector means an item ranks as similar under the chosen representation and distance measure. It does not establish that the item is true, current or sufficient to answer the question.

Two incident reports can describe the same symptom with different causes. A speculative note can resemble the query more closely than the final investigation. A policy from last year can be easier to find than its replacement.

Treat a search result as a candidate for inspection. Useful questions include:

  • Does the source describe the same product and operating conditions?

  • Was the explanation confirmed or left as a hypothesis?

  • Has a later record changed the conclusion?

  • Can the requester access both the result and the evidence needed to understand it?

There is no useful universal similarity threshold that turns all retrieved text into verified evidence. If a team introduces a threshold, it should test that decision against its own material and expected failure cases.

Do you need a separate vector database?

Not every application needs another database service. Vector search can be a capability inside an existing database. The pgvector project, for example, adds vector similarity search to PostgreSQL.

Start with the operational question: where can the team keep the data correct and the service understandable? An existing database may make access rules, transactions, backups and ownership easier to maintain. A dedicated service may be appropriate when measured retrieval requirements or operating constraints justify it.

A small collection can also provide a useful baseline before an approximate index is introduced. Pgvector supports exact nearest neighbor search and approximate indexes such as HNSW and IVFFlat. Approximate search trades some retrieval recall for speed. That trade needs to be assessed on the application workload.

Here, recall means recovering the relevant neighbors that the comparison is expected to find. It does not mean the language model remembers a fact correctly.

The database choice should follow evidence about the workload. A product comparison based only on vector count or a generic latency chart will leave important questions unanswered: how updates arrive, how restrictive filters behave, how deletions propagate and who will investigate a missing result.

Example: finding a relevant past incident

Imagine a software company investigating delayed customer notifications. Support has a ticket, engineering has recent logs and several earlier investigations may contain useful context. This is an illustrative design, not a customer case study or a report of an executed Swarm Run.

The team wants an agent to answer a focused question: “Which previous investigations could help explain this delay, and what still needs checking?”

Establish the permitted scope

The search is limited to the relevant product and records the requester is allowed to read. Customer boundaries are enforced by the application and its data access controls. An instruction asking the model to respect those boundaries is not sufficient enforcement.

The retrieval collection retains a stable source identifier, revision, record type and the status of the investigation. Those fields make it possible to distinguish a confirmed explanation from an early working note.

Retrieve several plausible explanations

The current error code is checked directly. A semantic search also looks for comparable descriptions of delayed delivery. The results might include a queue backlog, a customer endpoint returning errors and a historical rate limit change.

The application does not need to treat the highest ranked item as the answer. It can compare the conditions under which each earlier problem occurred. A candidate that involved a retired connector may still be informative, but its relevance should be qualified.

Produce an investigation brief

The output separates three things: what is observed in the current case, what the earlier sources establish and what the agent recommends checking next.

For example, an earlier report might show that a particular retry setting amplified a backlog. The brief can identify that mechanism and link the report. It cannot claim that the same setting caused this incident until the current configuration and logs support that conclusion.

Preserve the result of the investigation

Once the team resolves the new incident, the confirmed explanation should remain distinguishable from the original proposal. A later search should lead to the final record without erasing the earlier reasoning that explains how the team arrived there.

This is where retrieval becomes part of a continuing work process. Finding an old passage is useful; maintaining a dependable history of decisions makes the next investigation easier to inspect.

Uneven mineral bands in smoke grey, pale blue and warm neutral tones cross a polished stone section.

What should you test before relying on retrieval?

Build a small review set from real question types, using material the team is permitted to process. Include the source records that a knowledgeable reviewer would expect the system to consider. Some questions should have no adequate answer in the collection.

The incident example suggests several useful tests:

  • A known incident identifier returns the correct record.

  • A symptom described in different words finds a relevant confirmed investigation.

  • A restricted customer report stays outside another customer's results.

  • A superseded explanation does not silently displace the final conclusion.

  • A query with insufficient evidence produces a qualified result or a request for clarification.

  • A deleted or inaccessible source is not delivered through an old cached excerpt.

Inspect the retrieved passages before judging the final generated answer. If the right evidence was never supplied, rewriting the answer prompt may leave the underlying problem unchanged. If the evidence was supplied but misread, the next investigation belongs elsewhere in the application.

Filters need explicit testing too. Pgvector documents that filtering with approximate indexes can reduce the number of returned matches, depending on the query and index settings. A result list with too few items can reflect retrieval behavior, not an empty source collection.

Keep the review set stable when comparing a retrieval change. Record the embedding configuration, preparation rules, filters and source revisions. Change one component deliberately and inspect which cases improved or regressed. The goal is a justified decision about this application, not a claim that one database wins every workload.

Keeping an index useful as information changes

A retrieval index needs an owner and an update policy. Without them, a successful first demonstration can become a search over stale assumptions.

For each source, decide what happens when it changes, is withdrawn or becomes inaccessible. The answer may involve updating its passages, regenerating embeddings, removing cached content and checking dependent summaries. The exact process depends on the application, but the responsibilities should be explicit.

Preserve a link between a retrieved passage and the source revision used. If a person later asks why the agent reached a conclusion, “the document changed” should not make the original evidence impossible to identify.

It is also useful to separate retrieval material from accepted decisions. A draft, an observation and an approved policy can all be searchable while carrying different authority. Similarity does not settle those differences.

For a broader treatment of source maintenance and ownership, see what a knowledge base should contain.

How does a vector database relate to RAG and AI memory?

Retrieval augmented generation, or RAG, supplies relevant external information to a model during a request. Vector search is one possible retrieval mechanism. Keyword search, structured queries and explicit source selection can also contribute. Our guide to RAG and AI memory explains the wider process.

AI memory is a broader application concern. It includes what should be retained, how it changes, who can read it and which parts reach a later model request. An embedding index addresses matching. It does not by itself define that lifecycle.

The incident team needs both. Search can find a similar report. A continuing project also needs the current objective, permitted evidence, completed work, open questions and human decisions to remain coherent across attempts.

Where does Swarm fit?

Swarm provides Spaces where people and agents can keep shared context, discussion, outputs and the history of work. In the incident scenario, a Space can hold the investigation brief, source references, proposed explanations and the team's later decisions.

Connected clients still choose what reaches their model. They need an available, permitted execution route to do work, and they must respect the source access rules. A link to an incident does not grant permission to read it.

Swarm's public interface is useful for carrying a reviewable investigation between tools and participants. This does not require a claim about which vector database Swarm uses internally. A stored output or successful Run also does not independently prove that an external issue was fixed; the investigation should retain the relevant confirmation.

An angular communications instrument sits in a sheltered alcove above a misty coastal forest.

Common questions about vector databases

Is a vector database the same as an LLM?

No. A language model generates or processes language. A vector database stores representations and retrieves nearby items. An application can use both, with separate responsibilities for finding information and producing an answer.

Does a vector database replace a relational database?

It depends on the application. Relational systems remain useful for exact relationships, transactions and structured queries. Some support vector search directly. Choose an arrangement that meets the workload and can be operated reliably.

Will adding vector search stop AI hallucinations?

No. Retrieval can provide relevant evidence, but a model can still misinterpret it or make unsupported claims. Test whether the application retrieves the right material, uses it correctly and handles missing evidence honestly.

What is the best first step?

Choose a real recurring question and a bounded source collection. Establish which records should be found, which must remain inaccessible and when no answer is justified. That gives the team a useful basis for comparing retrieval approaches before committing to more infrastructure.

Swarm | What is a vector database? A practical guide