Skip to main content
QUICK REVIEW

[论文解读] Prompto: An open source library for asynchronous querying of LLM endpoints

Ryan Sze-Yin Chan, Federico Nanni|arXiv (Cornell University)|Aug 12, 2024
Power Systems and TechnologiesEngineering被引用 3
一句话总结

Prompto 是一个开源的 Python 库,支持异步、并发地查询多个 LLM 接口——包括专有服务(如 OpenAI、Gemini)和自托管服务(如 Ollama、Hugging Face)——以加速对比性 LLM 研究。通过利用异步 I/O 和每接口速率限制管理,其性能相比同步查询最高可提升 36.55 倍,显著提升了大规模 LLM 评估工作流中的效率与可复现性。

ABSTRACT

Recent surge in Large Language Model (LLM) availability has opened exciting avenues for research. However, efficiently interacting with these models presents a significant hurdle since LLMs often reside on proprietary or self-hosted API endpoints, each requiring custom code for interaction. Conducting comparative studies between different models can therefore be time-consuming and necessitate significant engineering effort, hindering research efficiency and reproducibility. To address these challenges, we present prompto, an open source Python library which facilitates asynchronous querying of LLM endpoints enabling researchers to interact with multiple LLMs concurrently, while maximising efficiency and utilising individual rate limits. Our library empowers researchers and developers to interact with LLMs more effectively and allowing faster experimentation, data generation and evaluation. prompto is released with an introductory video (https://youtu.be/lWN9hXBOLyQ) under MIT License and is available via GitHub (https://github.com/alan-turing-institute/prompto).

研究动机与目标

  • 解决在对比性研究中手动编写多个 LLM API 交互代码所导致的低效与工程开销问题。
  • 使研究人员能够同时查询多个 LLM 接口,同时遵守各自的速率限制,从而减少空闲等待时间。
  • 通过将提示和输入集中存储于单一 JSONL 文件中,并以结构化格式存储输出,提升 LLM 评估的可复现性。
  • 通过模块化、可扩展的架构,同时支持专有 LMaaS 和自托管模型,包括 Llama 和 Gemma 等开源模型。
  • 通过并行处理不同接口上的多样化模型,简化大规模 LLM 实验流程。

提出的方法

  • 使用 Python 的 async/await 语法,实现对多个 LLM 接口的并发请求,避免阻塞。
  • 动态管理每接口的速率限制,确保合规性并最大化吞吐量。
  • 通过 JSON Lines(JSONL)支持统一输入格式,实现在单个实验文件中混合查询不同模型和 API。
  • 与第三方 LMaaS(如 OpenAI、Anthropic、Google Gemini)以及自托管推理服务器(如 Ollama、Hugging Face text-generation-inference)集成。
  • 提供模块化、可扩展的代码库,便于轻松添加新的 API 接口和模型配置。
  • 提供 Jupyter Notebook 教程和 CLI 工具,用于生成输入文件并支持自动化评估工作流。
Figure 1: Illustration of the folder structure of the pipeline data folder after a exp_1.jsonl experiment file has been processed while exp_2.jsonl and exp_3.jsonl are experiment files yet to be processed in the input folder. After processing exp_1.jsonl , a exp_1 folder is created in the output fol
Figure 1: Illustration of the folder structure of the pipeline data folder after a exp_1.jsonl experiment file has been processed while exp_2.jsonl and exp_3.jsonl are experiment files yet to be processed in the input folder. After processing exp_1.jsonl , a exp_1 folder is created in the output fol

实验结果

研究问题

  • RQ1研究人员如何在一个可扩展的流水线中高效查询具有不同速率限制的多个 LLM 接口?
  • RQ2与同步方法相比,异步查询在多大程度上减少了整体实验运行时间?
  • RQ3统一的、可复现的输入格式是否能提升 LLM 评估实验的透明度与共享性?
  • RQ4当在同一个 API(如 OpenAI)上并行查询多个模型时,Prompto 的性能如何扩展?
  • RQ5Prompto 对涉及专有模型和自托管模型的对比性 LLM 研究效率有何影响?

主要发现

  • 在三个不同 LLM 接口(OpenAI、Gemini、Anthropic)上并行查询每个模型 100 个提示时,Prompto 相较于同步处理实现了 2.08 倍的性能提升。
  • 当在同一个 OpenAI API 上并行查询三个不同模型(gpt-3.5-turbo、gpt-4、gpt-4o)时,Prompto 相较于同步基线实现了 36.55 倍的性能提升。
  • 使用并行处理的 Prompto 运行时间主要由最慢的模型(gpt-4)决定,证实性能受限于最慢的接口,而非并发请求数量。
  • 当以 500 QPM 的速率在 OpenAI API 上查询三个模型时,实验总时间从同步的 705.38 秒减少至异步的 19.30 秒。
  • 使用单一 JSONL 输入文件,实现了在不同模型和 API 之间的一致、可复现的实验定义,输出以结构化 JSONL 格式存储,便于共享与分析。
  • Prompto 的架构具备良好的可扩展性,原生支持 LMaaS 和自托管模型,且设计上易于扩展以支持新 API 和多模态模型集成。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。