目 录CONTENT

文章目录

DSPy应用实战:如何让大模型自动优化提示词,将POI数据匹配准确率从60%提升至82%

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

📢 转载信息

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

原文作者:Simon Willison’s Weblog


重磅:让大模型自己写提示词——深入理解DSPy在复杂AI管道中的应用

最近,我发现了一段关于 DSPy 的绝佳讲解。这段时长半小时的演讲来自 Drew Breunig 在最近的 Databricks Data + AI Summit 上的分享,它比我之前看到的任何解释都更清晰地阐述了 DSPy 能够解决哪些难题。

如果你想看演讲的文字版本,可以访问 Drew 的 博文

GIS领域的终极挑战:POI数据融合(Conflation)

Drew 参与的 Overture Maps 项目,其核心任务是将来自众多供应商的兴趣点(POI)数据整合起来,创建一个统一的 POI 数据库。这正是地理信息系统(GIS)中一个出了名难搞的任务——数据融合(Conflation),即对多源数据集进行去重和合并。

DSPy如何优化本地小模型的性能

Drew 的实践案例非常具有代表性:他使用一个低成本的本地模型 Qwen3-0.6B,来比对多达7000万条地址记录,以识别匹配项。例如,判断地址为 Place(address="3359 FOOTHILL BLVD", name="RESTAURANT LOS ARCOS")Place(address="3359 FOOTHILL BLVD", name="Los Arcos Taqueria'") 是否指向同一个地点。

提示词优化立竿见影

DSPy 在这里的核心作用是:优化用于这个小型模型的提示词(Prompt)。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

评论区