Adam Leary's picture
7 3

Adam Leary

aplrat
ยท

AI & ML interests

RL recommenders LLM

Recent Activity

updated a collection about 1 month ago
Video
upvoted a collection about 1 month ago
RL
updated a collection about 1 month ago
Video
View all activity

Organizations

None yet

aplrat's activity

reacted to anakin87's post with ๐Ÿ˜Ž๐Ÿ‘ 8 months ago
view post
Post
2143
โš™๏ธ Prompt Optimization with Haystack and DSPy

Experimental notebook: ๐Ÿงช๐Ÿ““ https://github.com/deepset-ai/haystack-cookbook/blob/main/notebooks/prompt_optimization_with_dspy.ipynb

When building applications with LLMs, writing effective prompts is a long process of trial and error. ๐Ÿ”„
Often, if you switch models, you also have to change the prompt. ๐Ÿ˜ฉ
What if you could automate this process?


๐Ÿ’ก That's where DSPy comes in - a framework designed to algorithmically optimize prompts for Language Models.
By applying classical machine learning concepts (training and evaluation data, metrics, optimization), DSPy generates better prompts for a given model and task.


Recently, I explored combining DSPy with the robustness of Haystack Pipelines.

Here's how it works:
โ–ถ๏ธ Start from a Haystack RAG pipeline with a basic prompt
๐ŸŽฏ Define a goal (in this case, get correct and concise answers)
๐Ÿ“Š Create a DSPy program, define data and metrics
โœจ Optimize and evaluate -> improved prompt
๐Ÿš€ Build a refined Haystack RAG pipeline using the optimized prompt
  • 1 reply
ยท