← All Projects/AI Retrieval Core

Systems Engineering · Retrieval Architecture

AI Retrieval Core

A C++ experiment comparing float32 and int8 brute-force vector search on a synthetic embedding workload.

What changed

Implemented both scan paths and runtime timing reports. Int8 reduces raw vector storage by 75%; the repository does not yet provide repeated latency or recall results.

Status
built
My role
Systems Engineering · Retrieval Architecture
Language
C++
Year
2026
Category
systems, ai
GitHub ↗

Case study at a glance

The problem, the decision, and the work.

Problem
Retrieval design involves memory, latency, and ranking-quality tradeoffs that are easy to obscure behind a vector database API.
Product decision
Building the search loop exposes the questions a product decision must answer: how much storage is saved, how timing changes on the target machine, and whether quantization preserves useful rankings.
What I built
A C++ benchmark program comparing multithreaded float32 and int8 brute-force top-K search over 100,000 synthetic vectors at 768 dimensions.
Illustrated benchmark path for the synthetic vector workload. This is not a latency or recall result.
Illustrated benchmark path for the synthetic vector workload. This is not a latency or recall result.
01Overview

I built a CPU vector-search experiment to inspect the storage and latency tradeoffs behind retrieval. The current code generates 100,000 synthetic vectors at 768 dimensions, scores them with dot products, and keeps the top five matches with per-thread heaps. It runs multithreaded scans over float32 vectors and separately quantized int8 vectors, then prints timing and raw vector-memory estimates. The code does not implement approximate indexing or measure retrieval quality.

02Key Objectives
  1. 1.
    Controlled Workload: Use a seeded 100,000-vector, 768-dimension dataset and the same query for float32 and int8 search.
  2. 2.
    Top-K Search: Scan vectors across hardware threads, retain each thread's five best matches, and merge them into a final top five.
  3. 3.
    Compare Storage Formats: Quantize each database vector and the query to int8 with scales, then compare the search timing and raw vector-memory footprint.
  4. 4.
    Keep Claims Testable: Print elapsed time and estimated bandwidth at runtime. The current experiment does not include repeated trials, recall measurement, or an approximate-search baseline.
03Methodology
  • ◆
    Float32 Path: Compute brute-force dot products over the generated float32 database using a multithreaded scan and per-thread top-K heaps.
  • ◆
    Int8 Path: Quantize vectors with a per-vector scale, compute int8 dot products, rescale scores, and use the same top-K selection pattern.
  • ◆
    Memory Comparison: The raw vector array is 307.2 MB as float32 and 76.8 MB as int8, a 75% reduction before scale-array overhead.
  • ◆
    Benchmark Boundary: The program reports timings for one seeded synthetic run. It does not establish a general speedup or quantify ranking accuracy after quantization.
04What This Changes About Product Decisions

The experiment makes a useful tradeoff visible: int8 cuts raw vector storage by 75%, but lower precision can change rankings, and smaller storage does not by itself guarantee lower latency. A production retrieval choice needs repeated timing runs, recall measurements, and realistic embeddings before it can be justified.

05What the C++ Code Contains

The repository implements float32 and int8 dot-product functions, per-vector quantization, multithreaded brute-force scans, per-thread top-K heaps, and runtime timing and memory reports. Approximate indexes and hand-written SIMD are not part of the current code.

← Previous
LLM System Reliability
Next →
Incident Command