LOTUS: Optimized Agentic and LLM Bulk Processing
A Python library from Stanford and Berkeley that adds LLM-based map, reduce and filter operators to bulk-process large datasets with agents, optimizing for accuracy and cost.
LOTUS, which stands for LLMs Over Text, Unstructured and Structured Data, introduces semantic operators, LLM-based versions of map, reduce and filter, that let a developer process large datasets with natural-language instructions instead of hand-written logic for each row. Its optimizer decides how to run these operators efficiently: batching calls, applying model cascades and proxies, and planning the whole pipeline lazily for higher accuracy at lower cost.
Typical uses include running a sandboxed, tool-using agent over every file or record in a codebase and reducing the results to one answer, fanning out over a document corpus for research and synthesis, mining agent logs for failure patterns, extracting structured fields from unstructured text, scoring model outputs for evaluation, and retrieval-augmented generation. It installs from PyPI as lotus-ai, and shards a corpus, runs an agent per shard in parallel with its own sandboxed Python interpreter, and reduces the per-shard findings into a single answer.