Hello Mason,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that your RAG model giving non-deterministic answer to same question.
The issue seems the issue might be deeper, possibly related to how the model processes the context provided by Azure AI Search.
To address the inconsistency, I will advise you do the followings:
- You will need to Refine Prompt Engineering by making sure the prompt explicitly and unambiguously defines the conditions for when the model should respond with "I don't know the answer. For example:
Context: {retrieved_context}
Question: {user_question}
If the context contains information to answer the question, provide the answer. Otherwise, respond with "I don't know the answer." Do not guess.
- Log the context retrieved from Azure AI Search for every query and compare these logs across iterations to confirm consistency.
- Validate Determinism by enabling and log the
seed
in API responses. This ensures the same configuration is applied across all iterations, and if available, comparesystem_fingerprint
to rule out backend discrepancies. - Also, unlikely, but make sure that your VM environment has no variability in computational precision. Switching to a higher-performance VM or a managed Azure service like Azure OpenAI could eliminate potential VM-related variability.
- Use an intermediary logging mechanism to observe how the model processes the retrieved context and determines whether the answer is present. This might reveal issues with the classification step.
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.