Skip to content

HAIKU-3.5 llm response is sometimes i dont know but sometimes gives proper answer

0

hi, i have a created a policy retrieval chat system out of open search index. my query is returning the documents and sometimes llm is generating ' i dont know answer' but to the same question in another chat gives proper answer. how can we fix this.

regards, shermin

2 Answers
0

The inconsistent behavior you're experiencing with your policy retrieval chat system is a known challenge with large language models. Here are several approaches to help address this issue:

1. Improve Context Relevance and Coverage Ensure that the documents retrieved from your OpenSearch index are highly relevant to the user's question. The quality and relevance of the retrieved context directly impacts the model's ability to generate consistent, accurate responses. Review your retrieval mechanism to ensure it's returning the most pertinent documents.

2. Adjust Your Prompt Engineering The way you structure your prompts can significantly impact response consistency. Consider:

  • Being more explicit in your instructions about when the model should say "I don't know"
  • Providing clear guidelines about how to use the retrieved context
  • Adding examples of desired responses in your prompt template

3. Review Temperature and Sampling Parameters Lower temperature settings (closer to 0) generally produce more deterministic and consistent outputs, while higher temperatures introduce more randomness. If you're using default or high temperature settings, reducing them may help with consistency.

4. Implement Response Validation Consider adding a validation layer that checks if the response contains sufficient information from the retrieved context. If the model responds with "I don't know" but relevant documents were retrieved, you could retry the generation with a modified prompt.

5. Evaluate Completeness and Faithfulness Ensure your system is designed to encourage the model to fully utilize the provided context. The model should be instructed to answer based on the retrieved documents and only say "I don't know" when the context genuinely doesn't contain the answer.

6. Consider Multiple Attempts For critical queries, you might implement a retry mechanism that attempts generation multiple times and selects the most complete response, though this increases latency and costs.

The key is ensuring that your retrieval system consistently provides relevant context and your prompts clearly guide the model on how to use that context effectively.
Sources
Anthropic Claude 3.5 Haiku - Amazon Bedrock
Anthropic Claude 3.5 Haiku - Amazon Bedrock

answered 2 months ago

AWS
SUPPORT ENGINEER

reviewed 2 months ago

0

I can think of a couple of reasons why this query could fail in one chat but work in another.

First, check your conversation history. If you're passing prior turns back to Haiku, those earlier messages will anchor the model. It can lose focus on the new retrieval context or get tripped up by perceived contradictions, causing it to fall back on an "I don't know" response even with relevant docs in hand. See if this failure happens mostly later in the session. If it does, try capping the history length or testing a fresh session. Long-term, you might want to look into a two-step query rewriting pattern to completely decouple your chat history from the search index retrieval.

Second, if this is happening on identical single-turn prompts, you might be dealing with non-deterministic retrieval or generation. Turn your logging up and check if OpenSearch is actually returning the exact same document chunks both times. If it isn't, check your temperature. Anything above 0 introduces randomness you might not want.

To pin this down, what does your setup look like? Are you using managed Bedrock Knowledge Bases or a custom RAG stack? Let us know your temperature, top-k settings, and if you're passing history.

AWS

answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.