<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: LLM API Returning Inconsistent Responses When Using RAG in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/llm-api-returning-inconsistent-responses-when-using-rag/m-p/167110#M12060</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/250041"&gt;@soumitradutta2&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue is likely driven by the parameters specifically temperature. Any temperature value above 0 introduces stochastic sampling during token generation that leads to non deterministic outputs even when the prompt and retrieved documents are identical. You can enforce consistency by setting &lt;A href="https://docs.databricks.com/aws/en/agents/custom-agents/model-serving/author-agent-model-serving/" target="_self"&gt;temperature&lt;/A&gt; low between 0 and 0.3 if feasible and configuring bounds like max_tokens either directly at inference or inside the model definition using model_config if using ML serving. You can verify the upstream retrieval configuration. Upstream factors like document chunk size, inconsistent chunk formatting, top k selection and similarity threshold cutoffs heavily influence the density and relevance of the context passed to the prompt. If the retrieved chunks are fragmented, inconsistent or border on token limits, the LLM will generally struggle with context adherence and often hallucinate details outside the source data.&lt;/P&gt;&lt;P&gt;You can use tracing to check if the breakdown is happening in retrieval or generation. Trace captures the payload, retrieved document chunks and model outputs for each execution so you can inspect where the variance is. You can also use ML flow Evaluation with RAG judges (Retrieval Relevance, Retrieval Grounded ness and Retrieval Sufficiency) alongside other &lt;A href="https://docs.databricks.com/aws/en/mlflow3/genai/eval-monitor/third-party-scorers/ragas/" target="_self"&gt;metrics&lt;/A&gt; to objectively score the pipeline. Evaluating the retrieval and LLM generation stages independently against a curated evaluation dataset of expected facts will help you systematically catch hallucinations, context insufficiency and benchmark output stability.&lt;/P&gt;</description>
    <pubDate>Tue, 01 Sep 2026 09:36:42 GMT</pubDate>
    <dc:creator>balajij8</dc:creator>
    <dc:date>2026-09-01T09:36:42Z</dc:date>
    <item>
      <title>LLM API Returning Inconsistent Responses When Using RAG</title>
      <link>https://community.databricks.com/t5/get-started-discussions/llm-api-returning-inconsistent-responses-when-using-rag/m-p/167093#M12058</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I am Soumitra Dutta,&lt;/P&gt;&lt;P&gt;I have an issue with LLM API and Retrieval-Augmented Generation (RAG). Sometimes the same query returns different answers even if the retrieved documents and the prompt are the same.&lt;/P&gt;&lt;P&gt;The retrieval results are useful, but sometimes the model does not include information from the context that was provided or generates information that does not appear in the source documents.&lt;/P&gt;&lt;P&gt;Have you had any problems with RAG? May it be structure, temperature, token limits or retrieval configuration?&lt;/P&gt;&lt;P&gt;If you have any tips for debugging and making the response be more consistent, it's appreciated.&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Soumitra Dutta&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2026 07:00:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/llm-api-returning-inconsistent-responses-when-using-rag/m-p/167093#M12058</guid>
      <dc:creator>soumitradutta2</dc:creator>
      <dc:date>2026-09-01T07:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: LLM API Returning Inconsistent Responses When Using RAG</title>
      <link>https://community.databricks.com/t5/get-started-discussions/llm-api-returning-inconsistent-responses-when-using-rag/m-p/167110#M12060</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/250041"&gt;@soumitradutta2&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue is likely driven by the parameters specifically temperature. Any temperature value above 0 introduces stochastic sampling during token generation that leads to non deterministic outputs even when the prompt and retrieved documents are identical. You can enforce consistency by setting &lt;A href="https://docs.databricks.com/aws/en/agents/custom-agents/model-serving/author-agent-model-serving/" target="_self"&gt;temperature&lt;/A&gt; low between 0 and 0.3 if feasible and configuring bounds like max_tokens either directly at inference or inside the model definition using model_config if using ML serving. You can verify the upstream retrieval configuration. Upstream factors like document chunk size, inconsistent chunk formatting, top k selection and similarity threshold cutoffs heavily influence the density and relevance of the context passed to the prompt. If the retrieved chunks are fragmented, inconsistent or border on token limits, the LLM will generally struggle with context adherence and often hallucinate details outside the source data.&lt;/P&gt;&lt;P&gt;You can use tracing to check if the breakdown is happening in retrieval or generation. Trace captures the payload, retrieved document chunks and model outputs for each execution so you can inspect where the variance is. You can also use ML flow Evaluation with RAG judges (Retrieval Relevance, Retrieval Grounded ness and Retrieval Sufficiency) alongside other &lt;A href="https://docs.databricks.com/aws/en/mlflow3/genai/eval-monitor/third-party-scorers/ragas/" target="_self"&gt;metrics&lt;/A&gt; to objectively score the pipeline. Evaluating the retrieval and LLM generation stages independently against a curated evaluation dataset of expected facts will help you systematically catch hallucinations, context insufficiency and benchmark output stability.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2026 09:36:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/llm-api-returning-inconsistent-responses-when-using-rag/m-p/167110#M12060</guid>
      <dc:creator>balajij8</dc:creator>
      <dc:date>2026-09-01T09:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: LLM API Returning Inconsistent Responses When Using RAG</title>
      <link>https://community.databricks.com/t5/get-started-discussions/llm-api-returning-inconsistent-responses-when-using-rag/m-p/167551#M12078</link>
      <description>&lt;P&gt;This is quite a common problem with RAG systems in general, and it's why monitoring and observability are so important. In terms of the generation step, setting the temperature to zero, as the previous commenter suggested, is a strong approach. However, that will not completely guarantee identical outputs. Now with rag systems, depending on the complexity, there are lots of different things that can go wrong.&lt;/P&gt;&lt;P&gt;The issue that they have is that those errors can then compound. So you've got to look at your retrieval accuracy, and test that in isolation. And with your retrieval accuracy, obviously, you've also got to consider how you've chunked your documents.&lt;/P&gt;&lt;P&gt;If that's not the issue, if we're saying all of that is held constant, then the problem is likely with your gen step.&lt;/P&gt;&lt;P&gt;What I'd suggest doing there is running a series of experiments in MLFlow using various prompts for your gen stap to see which one produces the most consistent answers.&lt;/P&gt;&lt;P&gt;Specifically, I'd follow these steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Set&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;temperature=0&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for deterministic output&lt;/LI&gt;&lt;LI&gt;Strengthen the system prompt with explicit boundaries: "Answer only using provided context. Cite sources. If the answer isn't in the context, say 'I don't have that information.'"&lt;/LI&gt;&lt;LI&gt;Optimise retrieval: reduce chunk size to 500-800 tokens, add metadata filtering, consider hybrid search (vector + BM25)&lt;/LI&gt;&lt;LI&gt;Add reranking or similarity thresholds to filter low-quality retrieved documents&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Log prompts, retrieved context, and responses for debugging; track consistency metrics with MLflow&lt;/STRONG&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Fri, 04 Sep 2026 15:23:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/llm-api-returning-inconsistent-responses-when-using-rag/m-p/167551#M12078</guid>
      <dc:creator>GuyBourne</dc:creator>
      <dc:date>2026-09-04T15:23:25Z</dc:date>
    </item>
  </channel>
</rss>

