Stefano Fiorucci

anakin87

AI & ML interests

Contributing to Haystack, the LLM Framework ๐Ÿ—๏ธ. NLP / LLMs.

Organizations

Posts 2

view post
Post
1810
โš™๏ธ 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
view post
Post
1232
Do you want to play a game against Llama 3? ๐Ÿฆ™๐Ÿฆ™๐Ÿฆ™

Meet ๐Ÿง‘โ€๐Ÿซ ๐€๐ฎ๐ญ๐จ๐๐ฎ๐ข๐ณ๐ณ๐ž๐ซ, a new LLM application that you can use for learning or just for fun.

Try it out on Hugging Face Spaces ๐Ÿค— deepset/autoquizzer

๐‡๐จ๐ฐ ๐ข๐ญ ๐ฐ๐จ๐ซ๐ค๐ฌ
You provide an URL -> A multiple-choice quiz is instantly generated.

๐Ÿ”น You can play the quiz yourself.

๐Ÿ”น You can let the LLM play in two different ways
๐Ÿ“• Closed book: the LLM responds only by knowing the general topic and using its parametric knowledge and reasoning abilities.
๐Ÿ”Ž๐ŸŒ Web RAG: for each question, a Google search is done and the top 3 snippets are included in the prompt for the LLM.

๐’๐ญ๐š๐œ๐ค
๐Ÿ—๏ธ Haystack LLM framework https://haystack.deepset.ai/
๐Ÿฆ™ Llama 3 8B Instruct
โšก Groq

Original idea: @Tuana