Concept Beginner · 3 min read

What is a vector in AI

Quick answer
A vector in AI is a numeric array that represents data points in a multi-dimensional space, enabling machines to process and compare complex information. Vectors are fundamental for tasks like similarity search, embeddings, and neural network inputs.
Vector in AI is a numeric array that encodes data features to represent information in a multi-dimensional space for computation and comparison.

How it works

A vector in AI works like a coordinate in a multi-dimensional space, where each dimension corresponds to a feature or attribute of the data. Imagine a point on a map with latitude and longitude; similarly, a vector might have hundreds or thousands of dimensions representing text, images, or other data. This allows AI models to measure distances or angles between vectors to find similarities or patterns.

For example, in natural language processing, words or sentences are converted into vectors called embeddings. These embeddings capture semantic meaning so that similar words have vectors close to each other in this high-dimensional space.

Concrete example

Here is a simple Python example using numpy to create and compare vectors representing two points in 3D space:

python
import numpy as np

# Define two vectors
vector_a = np.array([1, 2, 3])
vector_b = np.array([4, 5, 6])

# Calculate Euclidean distance between vectors
distance = np.linalg.norm(vector_a - vector_b)

print(f"Distance between vectors: {distance}")
output
Distance between vectors: 5.196152422706632

When to use it

Use vectors when you need to represent complex data in a form that AI models can process, such as text embeddings for semantic search, image feature vectors for classification, or user behavior vectors for recommendation systems. Avoid using raw text or categorical data directly without vectorization, as models require numeric input.

Vectors enable efficient similarity calculations, clustering, and machine learning model inputs, making them essential for modern AI workflows.

Key terms

TermDefinition
VectorA numeric array representing data in multi-dimensional space.
EmbeddingA vector that encodes semantic meaning of text or other data.
Euclidean distanceA measure of straight-line distance between two vectors.
DimensionAn individual feature or coordinate in a vector space.

Key Takeaways

  • Vectors convert complex data into numeric form for AI processing.
  • Similarity between data points is computed by measuring distances between vectors.
  • Embeddings are specialized vectors that capture semantic meaning.
  • Use vectors as inputs for machine learning and retrieval tasks.
Verified 2026-04 · gpt-4o, claude-3-5-sonnet-20241022
Verify ↗