Prompt engineering for RAG // customize prompts for complex LLM apps (RAG/agents)

sbagency
3 min readOct 25, 2023

--

Update from OpenAI DevDay (How OpenAI improved RAG):

https://www.linkedin.com/feed/update/urn:li:activity:7127563601300606976/
https://www.linkedin.com/posts/llamaindex_easy-prompt-engineering-for-rag-problem-activity-7122609691205017602-HWSQ

Accessing/Customizing Prompts within Higher-Level Modules Retrieval Augmented Generation (RAG)

https://github.com/YiVal/YiVal
https://www.anyscale.com/blog/a-comprehensive-guide-for-building-rag-based-llm-applications-part-1
https://towardsdatascience.com/forget-rag-the-future-is-rag-fusion-1147298d8ad1

However, as a product manager who has been recently putting RAG products into a production environment, I believe RAG is still too limited to meet users’ needs and needs an upgrade.

https://github.com/langchain-ai/langchain/blob/master/cookbook/rag_fusion.ipynb
https://www.linkedin.com/feed/update/urn:li:activity:7122978999038857216/

Twist for better reasoning

https://www.deeplearning.ai/the-batch/iterative-bootstrapping-a-new-method-to-improve-chain-of-thought-prompting/

Key insight: Researchers have developed a few ways to prompt a large language model to apply a chain of thought (CoT). The typical method is for a human to write an example CoT for inclusion in a prompt. A faster way is to skip the hand-crafted example and simply instruct the model to “think step by step,” prompting it to generate not only a solution but its own CoT (this is called zero-shot CoT). To improve zero-shot CoT, other work both (i) asked a model to “think step by step” and (ii) provided generated CoTs (auto-CoT). The weakness of this approach is that the model can generate fallacious CoTs and rely on them when responding to the prompt at hand, which can lead to incorrect responses. To solve this problem, we can draw example prompts from a dataset that includes correct responses, and the model can check its responses against the dataset labels. If it’s wrong, it can try repeatedly until it answers correctly. In this way, it generates correct CoT examples to use in solving other problems.

// save for future hacks…

--

--

sbagency
sbagency

Written by sbagency

Tech/biz consulting, analytics, research for founders, startups, corps and govs.