@pauliusztin_: I used to think ingesting 1,000,000 documents into an AI memory system was mostly a compute problem. But I've been prov…
Summary
The author discusses the architecture for scaling AI memory ingestion from thousands to millions of documents, emphasizing orchestration and parallelism over raw compute power, and using Prefect for workflow management.
View Cached Full Text
Cached at: 07/04/26, 08:53 PM
I used to think ingesting 1,000,000 documents into an AI memory system was mostly a compute problem. But I’ve been proven wrong…
This is an orchestration problem.
Throwing more GPUs at the pipeline won’t help much if your architecture still processes everything sequentially.
The system I’ve been designing separates ingestion into two independent work pools.
The first turns raw data into documents. The second turns those documents into memory.
Here’s the high-level architecture:
1/ Two levels of paralleism
Imagine ingesting 1,000,000 documents.
A @PrefectIO workflow shards them into 1,000-document jobs.
Each worker then processes those jobs in batches of 100.
That gives you two levels of parallelism:
- Pipeline parallelism → distribute shards across workers.
- Task parallelism → batch expensive operations inside each worker.
Need more throughput for LLMs or embeddings?
Swap in a Dask or Ray cluster without changing the architecture.
2/ Data work pool
The pipeline starts with:
Web URLs RSS feeds
A @PrefectIO workflow flattens every source into URLs, shards them into jobs, and pushes them into a queue.
Workers continuously pull jobs as capacity becomes available, making it easy to absorb traffic spikes by simply adding more workers.
Each worker:
Flattens URLs Scrapes 100 URLs concurrently Transforms content Batch-loads documents into storage
This stage is mostly network and database I/O.
Batching matters far more than compute.
3/ Memory work pool
Once documents reach the warehouse, a second @PrefectIO workflow repeats the pattern.
Each worker runs:
Chunking Batched LLM extraction Entity normalization Batched embeddings Knowledge graph generation
For example, 1,000 documents might become 10,000 chunks, processed in batches of 100.
Every stage has different bottlenecks.
LLM extraction → vLLM Entity normalization → database I/O Embeddings → often CPU
Treating them all the same leaves performance on the table.
Here’s the gist:
Scaling AI memory isn’t about adding GPUs.
It’s about designing an architecture where every bottleneck scales independently.
This is why I chose @PrefectIO.
It orchestrates both pipelines with sharding, queues, retries, scheduling, and durable execution, making it practical to scale from thousands to millions of documents.
P.S. What would stop your pipeline from ingesting one million documents today?
Similar Articles
@Oliviacoder1: MIT just made every AI company's billion dollar bet look embarrassing. They solved AI memory. Not by building a bigger …
MIT CSAIL researchers propose a novel approach to AI memory that avoids context rot by storing documents externally and having the AI navigate and query them, achieving 10 million token effective context at lower cost.
@tricalt: https://x.com/tricalt/status/2057173322924806651
A founder discusses the scaling challenges of using markdown files for AI agent memory in production, highlighting common pitfalls with permissions, multi-agent interaction, and temporal queries, and suggests that teams often end up patching around these issues without realizing they are rebuilding a more complex system.
@beamnxw: This paper is f*cking brilliant A computer science paper formalizes filesystem-based memory as the long-term storage ar…
A computer science paper formalizes filesystem-based memory as long-term storage for autonomous AI agents, showing that organizing memory as hierarchical markdown files can roughly halve retrieval costs compared to vector stores.
@Ryrenz: Incredible, packs the entire AI memory system into a single file. GitHub has reached legendary status with 16.2K stars. To build a knowledge base for AI, you typically need: a vector database service, a full-text search service, and store metadata in another database. During development, run Docker Compose, and during deployment, configure three components...
Memvid is a tool that compresses the AI memory system into a single file, supporting vector search and full-text retrieval, written in Rust, with high performance and portability.
@alex_prompter: The simplest AI agent memory system that actually works is four markdown files and zero databases. You don't need vecto…
The article describes a simple AI agent memory system using four markdown files, an index, and freshness-tracked caches, avoiding vector databases and retrieval pipelines.