目 录CONTENT

文章目录

告别手动调参!DSPy如何让LLM自动优化提示词,大幅提升地理信息匹配精度?

青云TOP
2025-10-05 / 0 评论 / 0 点赞 / 3 阅读 / 0 字

📢 转载信息

原文链接:https://simonwillison.net/2025/Oct/4/dspy/#atom-everything

原文作者:Simon Willison’s Weblog


让大型语言模型(LLM)为你编写提示词:DSPy在复合AI管线中的应用简介

我过去曾对 DSPy 感到困惑。然而,Drew Breunig在最近的Databricks数据与AI峰会上做的这个半小时的演讲,是我迄今为止见过的对DSPy能解决哪些问题的最清晰解释。

您可以观看演讲视频:Let the LLM Write the Prompts: An Intro to DSPy in Compound Al Pipelines

Drew 还提供了该演讲的书面版本

地理信息数据融合的挑战与DSPy的应用

Drew目前在Overture Maps工作,该项目旨在整合来自多个提供商的兴趣点(POI)数据,以创建一个统一的POI数据库。这是一个典型的数据融合(conflation)案例,在地理信息系统(GIS)领域,这是一个臭名昭著的难题,涉及到对多个数据集进行去重和合并。

Drew 使用了一个成本较低的本地模型——Qwen3-0.6B,来比较7000万个地址,以识别匹配项。例如,他需要判断以下两条记录是否指向同一个地点:

  • Place(address="3359 FOOTHILL BLVD", name="RESTAURANT LOS ARCOS")
  • Place(address="3359 FOOTHILL BLVD", name="Los Arcos Taqueria"')

DSPy如何实现提示词优化

DSPy 在这个场景中的作用,就是优化用于该小型模型的提示词。Drew使用了GPT-4.1和dspy.MIPROv2优化器,最终生成了一个700个Token的优化提示词,使匹配得分从60.7%提升到了82%。

Determine if two points of interest refer to the same place. Arrow to optimized prompt: Given two records representing places or businesses-each with at least a name and address-analyze the information and determine if they refer to the same real-world entity. Consider minor differences such as case, diacritics, transliteration, abbreviations, or formatting as potential matches if both the name and address are otherwise strongly similar. Only output "True" if both fields are a close match; if there are significant differences in either the name or address, even if one field matches exactly, output "False". Your decision should be robust to common variations and errors and should work across multiple languages and scripts.

优化带来的长期价值

为什么要做这些工作呢?Drew指出,拥有一个提示词优化管线后,未来如果出现了得分更高的其他模型,可以非常方便地进行评估和切换,而无需手动进行反复试验和调整提示词的过程。

发布于 2025年10月4日 晚上10:48




🚀 想要体验更好更全面的AI调用?

欢迎使用青云聚合API,约为官网价格的十分之一,支持300+全球最新模型,以及全球各种生图生视频模型,无需翻墙高速稳定,小白也可以简单操作。

青云聚合API官网https://api.qingyuntop.top

支持全球最新300+模型:https://api.qingyuntop.top/pricing

详细的调用教程及文档:https://api.qingyuntop.top/about

0

评论区