← 返回日报
精读 预计 3 分钟

Lotus: Optimized Agentic and LLM Bulk Processing

摘要

文章介绍 LOTUS 框架:通过语义算子(LLM-based map、reduce、filter 等)用自然语言描述任务,框架分片数据并行运行 sandboxed Python REPL 工具代理,再聚合结果;支持 agentic 代码处理、深度研究合成、失败日志分析、文档抽取、RAG 等场景;安装方式包括 pip/uv/源代码;快速启动示例已给出;优化后可提升准确率并降低成本;列出语义算子文档、社区 Discord、相关项目及贡献方式。

荐读理由

照它给的 Agentic Map-Reduce 方式,配合 sandboxed Python REPL 和语义算子(sem map / sem filter / sem agg),就能一次批量处理代码库分析、研究合成、文档抽取、RAG 评测这些 AI 工程项目里的真实任务,省掉手动 shard 和并行调优

原文

LOTUS logo

LOTUS: Optimized Agentic and LLM Bulk Processing

Bulk process your datasets with agents and LLMs at scale, with higher accuracy and lower cost.

From Stanford University and UC Berkeley

PyPI PyPI - Python Version Arxiv Documentation Status Discord Colab Demo

What is LOTUS?InstallQuickstartSemantic OperatorsCommunityDocsCite


What is LOTUS?

LOTUS makes agentic and LLM bulk processing fast, easy, and robust. It introduces and optimizes semantic operators (e.g., LLM-based map, reduce, filter primitives) to let you process your large datasets with LLMs and natural language instructions. LOTUS optimizes these operations to help you get higher accuracy and lower cost.

What you can build:

  • Agentic code processing — run a tool-using agent (with a sandboxed Python REPL) over every file, document, or record, then reduce to one answer (codebase analysis, security sweeps, migrations).

  • Deep research & synthesis — fan out over a corpus, extract, and synthesize.

  • Agent-trace failure analysis — mine large volumes of agent logs for failure modes.

  • Document extraction & unstructured analysis — structured fields and insights from text.

  • LLM-judge evals & RAG — declarative pipelines that the engine optimizes for you.

LOTUS stands for LLMs Over Text, Unstructured and Structured Data.

Installation

pip install lotus-ai

Or with uv: uv add lotus-ai. For the latest features, install from source: pip install git+https://github.com/lotus-data/lotus.git@main.

See the docs for more.

Quickstart

Give LOTUS a corpus and a task. It shards the corpus, spawns an agent per shard in parallel (each with a sandboxed Python REPL for exact computation), and reduces the per-shard findings into one answer. The example below is fully self-contained — set your API key, paste, and run.

import lotus
from lotus.models import LM
from lotus.tools import PythonREPLTool

# Configure the LM — export your API key first (e.g. export OPENAI_API_KEY=sk-...)
lotus.settings.configure(lm=LM(model="gpt-5", reasoning_effort="low"))

# A corpus can be inline documents, a DataFrame, files, or one large text.
# Here: a few small functions, some of them subtly buggy.
snippets = [
    "def average(nums): return sum(nums) / (len(nums) - 1)",
    "def word_count(s): return len(s.split())",
    "def percent(part, whole): return part / whole",
    "def reverse(s): return s[::-1]",
]
corpus = lotus.Corpus.from_documents(snippets)

# Each agent actually *runs* its function in a sandboxed REPL to find bugs —
# then LOTUS reduces the per-function results into one report.
result = corpus.agentic_map_reduce(
    task="Test each function on example inputs and report which ones are buggy, "
         "with a counterexample for each bug.",
    tools=[PythonREPLTool()],
)

print(result.output)   # the reduced bug report

See the Agentic Map-Reduce docs and examples/agentic_map_reduce/ for more.

How it works

You express what you want over a dataset using high-level semantic operators (i.e., LLM-based map, reduce, filter); LOTUS' optimizer decides how to run it — batching calls, applying model cascades and proxies, and lazily planning the whole pipeline — for higher accuracy at lower cost.

LOTUS pipeline: Corpus → Declarative Programming → LOTUS Optimizer → Results

The Results: Across diverse tasks, LOTUS' optimized pipelines match or exceed the accuracy of high-quality baselines while running substantially faster and cheaper:

Results of LOTUS optimized pipelines

What are Semantic Operators

LOTUS introduced and optimizes semantic operators. Each operator implements an LLM-based transformation over your dataset, which you specify with a natural language instruction, and the operations can be transparently optimized. Here are a few examples:

Semantic operators: sem_map, sem_filter, sem_agg (reduce), and sem_join, each showing docs flowing through an LM to an output

See the documentation and the intro Colab tutorial for more on semantic operators that LOTUS serves.

Docs

For more, you can checkout the official docs, which includes more on:

Community

Join us on Discord to ask questions and share what you're building.

Check out these awesome projects that are building with LOTUS:

  • MAP: Measuring Agents in Production — a large-scale empirical study of deployed LLM agent systems across many domains (UC Berkeley, Intesa Sanpaolo, UIUC, Stanford, IBM Research; ICML 2026).

  • VibeCheck — discovers and quantifies qualitative differences between LLMs (UC Berkeley; ICLR 2025).

  • DeepScholar — generative research synthesis over the scientific literature, competitive with OAI DR (Stanford, UC Berkeley).

Using LOTUS in your project? Reach out to @semantic_operators on discord if you'd like it featured.

Contributing

We welcome all contributions! Read the Contributing Guide. For trouble-shooting or feature requests, open an issue and we'll get to it promptly.

References

Follow @lianapatel_ on X for updates. If you find LOTUS or semantic operators useful, please cite:

@article{patel2025semanticoptimization,
    title = {Semantic Operators and Their Optimization: Enabling LLM-Based Data Processing with Accuracy Guarantees in LOTUS},
    author = {Patel, Liana and Jha, Siddharth and Pan, Melissa and Gupta, Harshit and Asawa, Parth and Guestrin, Carlos and Zaharia, Matei},
    year = {2025},
    journal = {Proc. VLDB Endow.},
    url = {https://doi.org/10.14778/3749646.3749685},
}
@article{patel2024semanticoperators,
    title={Semantic Operators: A Declarative Model for Rich, AI-based Analytics Over Text Data},
    author={Liana Patel and Siddharth Jha and Parth Asawa and Melissa Pan and Carlos Guestrin and Matei Zaharia},
    year={2024},
    eprint={2407.11418},
    url={https://arxiv.org/abs/2407.11418},
}
@article{patel2026ainative,
    title = {Towards AI-Native Data Systems with the Semantic Operator Model and LOTUS},
    author = {Patel, Liana and Guestrin, Carlos and Zaharia, Matei},
    year = {2026},
    journal = {IEEE Data Engineering Bulletin},
    url = {http://sites.computer.org/debull/A26mar/A26MAR-CD.pdf#page=61},
}
Hacker News · 4 赞 · 0 评 讨论 → 阅读原文 →

这条对你有帮助吗?