五個基本的 LLM workflow design pattern

1. Prompt chaining

把一個 task 拆解成 N 次 LLM calls,其中第 N 次 LLM calls 是基於第 N-1 次 LLM calls 的 output。

2. Routing

根據第一次的 LLM call 的 output,決定下一步要呼叫哪一種 LLM。

主要的考量是不同的 LLM,擅長處理不同的任務。

3. Parallelization

拆解 task,讓多個 LLM 同時處理。

4. Orchestrator-workers

Orchestrator LLM 自行拆解任務,讓多個 worker LLMs 同時處理,由 Synthesizer LLM 自行整合結果。

5. Evaluator-optimizer

Generator LLM 生成 solution,由 Evaluator LLM 檢查 solution 的品質。若品質不符預期,提供反饋給 Generator LLM 再度生成 solution。

參考資料:

Building effective agents (Anthropic)
https://www.anthropic.com/engineering/building-effective-agents

AI Engineer Agentic Track: The Complete Agent and MCP Course, Ed Donner