<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: crabcheng</title>
    <description>The latest articles on DEV Community by crabcheng (@pqc182).</description>
    <link>https://dev.to/pqc182</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4259127%2Fe82e1827-b5fb-461f-b8da-3e19247e4d43.png</url>
      <title>DEV Community: crabcheng</title>
      <link>https://dev.to/pqc182</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pqc182"/>
    <language>en</language>
    <item>
      <title>Why Your RAG Agent Answers the Wrong Question: A 6-Step Debug Playbook</title>
      <dc:creator>crabcheng</dc:creator>
      <pubDate>Mon, 23 Nov 2026 17:13:12 +0000</pubDate>
      <link>https://dev.to/pqc182/why-your-rag-agent-answers-the-wrong-question-a-6-step-debug-playbook-4o6f</link>
      <guid>https://dev.to/pqc182/why-your-rag-agent-answers-the-wrong-question-a-6-step-debug-playbook-4o6f</guid>
      <description>&lt;p&gt;A team spends two weeks wiring up a knowledge-base agent in Coze. It goes live on Monday. By Wednesday, employees are asking "how do I request annual leave" and getting back "the company was founded in 2010." Someone asks for the hotel reimbursement cap in tier-2 cities and gets an answer that expired three years ago.&lt;/p&gt;

&lt;p&gt;The builder is confused, and reasonably so. The documents are current. The prompt says "answer based on the knowledge base." So why is the thing hallucinating?&lt;/p&gt;

&lt;p&gt;Here is the part nobody tells you when you ship an agent: &lt;strong&gt;launching is about 30% of the work. The other 70% is debugging.&lt;/strong&gt; And "the model is dumb" is almost never the root cause. What actually breaks is the alignment between three layers — retrieval, prompt boundaries, and flow logic. Fix the prompt while the retrieval layer is feeding garbage, and you will loop forever: edit prompt, test, wrong answer, edit prompt again.&lt;/p&gt;

&lt;p&gt;This post is the order I debug in, and the specific checks at each step. No ML background required.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debug in the right order: retrieval → boundaries → flow
&lt;/h2&gt;

&lt;p&gt;The single most common mistake is starting at the prompt layer. It feels productive because you can edit text and immediately see a change. But if the retrieval layer is handing the model the wrong chunk, no amount of prompt engineering will help — the model is answering faithfully from bad context.&lt;/p&gt;

&lt;p&gt;So the order matters:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Typical symptom&lt;/th&gt;
&lt;th&gt;How to confirm&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Retrieval (knowledge base)&lt;/td&gt;
&lt;td&gt;Answer comes from a document but doesn't match the question&lt;/td&gt;
&lt;td&gt;Look at the Top-3 retrieved chunks; do they actually contain the answer?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prompt boundaries&lt;/td&gt;
&lt;td&gt;Tone drifts, sometimes professional, sometimes chatty&lt;/td&gt;
&lt;td&gt;Clear history, keep only the prompt, detach the KB — observe baseline behavior&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flow logic&lt;/td&gt;
&lt;td&gt;After a few turns, the agent jumps to an unrelated branch&lt;/td&gt;
&lt;td&gt;Inspect upstream variable output and downstream branch conditions for overlap&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Work top-down. Most incidents resolve at layer one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Reproduce with three different phrasings
&lt;/h2&gt;

&lt;p&gt;Never debug a single phrasing. Ask the same thing three ways and see whether the failure is stable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"How much can I expense for a hotel on a business trip?"&lt;/li&gt;
&lt;li&gt;"Tier-2 city hotel cap"&lt;/li&gt;
&lt;li&gt;"Out-of-town lodging reimbursement standard"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If all three fail, it is systematic — go to retrieval. If only one fails, you have a matching/vocabulary problem, which is a much narrower fix.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Read the actual retrieved chunks, not the answer
&lt;/h2&gt;

&lt;p&gt;Every platform (Coze, Dify, LangChain, whatever you're on) exposes retrieval details somewhere in the test console. Open it and read the Top-3 chunks verbatim.&lt;/p&gt;

&lt;p&gt;In the case I hit, the Top-1 chunk was the &lt;em&gt;first chapter&lt;/em&gt; of the travel policy PDF — the "general provisions" section. It scored high because the words "business trip" and "out-of-town" appear there repeatedly. The actual numbers lived in Chapter 3 and never made it into the context window.&lt;/p&gt;

&lt;p&gt;That is the whole bug. The model wasn't hallucinating; it was answering from a page that contained the question's vocabulary but not its answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Fix chunk granularity — one rule per chunk
&lt;/h2&gt;

&lt;p&gt;This is where most knowledge bases go wrong. Uploading a 50-page PDF and letting the platform auto-chunk at 512 characters produces chunks that mix several rules together. Retrieval then has to guess which part you meant.&lt;/p&gt;

&lt;p&gt;The fix is boring and effective: &lt;strong&gt;one rule per chunk, 80–150 characters.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before (one auto-chunk, ~512 chars):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Chapter 3 Travel Standards
3.1 All employees on business travel shall comply with finance
policy and reimburse against receipts. 3.2 Lodging caps by city
tier: tier-1 (Beijing, Shanghai, Guangzhou, Shenzhen) 500/night;
tier-2 400/night; other cities 300/night. 3.3 ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After (three independent chunks, each ~30 chars):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Tier-1 city lodging cap: 500 per night (Beijing, Shanghai, Guangzhou, Shenzhen)
Tier-2 city lodging cap: 400 per night
Other cities lodging cap: 300 per night
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After re-chunking, the Top-1 hit became the chunk literally titled "Tier-2 city lodging cap." Zero prompt changes needed for that half of the problem.&lt;/p&gt;

&lt;p&gt;Two practical notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep the section heading inside the chunk text. Headings carry a lot of retrieval signal.&lt;/li&gt;
&lt;li&gt;Tag metadata explicitly, e.g. &lt;code&gt;finance / reimbursement / travel / lodging-cap / 2025-edition&lt;/code&gt;. When two document versions conflict, tag filtering is how you find out which one is winning.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 4: Add boundaries and a refusal script
&lt;/h2&gt;

&lt;p&gt;"Answer based on the knowledge base" is not a boundary. It's a wish. When retrieved context is weak, models quietly fall back on training data — which is exactly how a policy bot starts inventing a founding year.&lt;/p&gt;

&lt;p&gt;A prompt that actually constrains:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Role
You are the administrative policy assistant for [Company].
Scope: HR and admin policy questions only. Refuse technical,
financial, and personal topics.

# Rules
1. Every answer must cite a specific clause or figure from the
   reference document. Quote figures verbatim.
2. If the reference document does not contain the answer, reply
   exactly: "Not found in current policy — please confirm with
   the admin team." Do not infer, do not use outside knowledge.
3. If two clauses conflict, prefer the newer effective date and
   state both dates.

# Output
- Conclusion first (&amp;lt;= 20 words), then the clause it comes from
- No greetings, no filler, no follow-up questions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The before/after that mattered most in practice:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Weak&lt;/th&gt;
&lt;th&gt;Working&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Role&lt;/td&gt;
&lt;td&gt;"You are an assistant."&lt;/td&gt;
&lt;td&gt;Named role + explicit scope + refusal list&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;KB boundary&lt;/td&gt;
&lt;td&gt;"Answer from the materials."&lt;/td&gt;
&lt;td&gt;"Only from [reference]. If absent, use the fixed refusal string."&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Output&lt;/td&gt;
&lt;td&gt;"Explain in detail."&lt;/td&gt;
&lt;td&gt;Fixed three-part structure with a length cap&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unknowns&lt;/td&gt;
&lt;td&gt;"If you don't know, say so."&lt;/td&gt;
&lt;td&gt;Fixed refusal string with a named escalation contact&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Step 5: Check for variable pollution across turns
&lt;/h2&gt;

&lt;p&gt;If the agent is fine on a fresh session but degrades after two or three turns, you have a state problem, not a model problem.&lt;/p&gt;

&lt;p&gt;Two things to check:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Global variables that don't get reset.&lt;/strong&gt; A welcome-node variable set in turn one can bleed into the query used for retrieval in turn two, pulling the embedding toward the wrong topic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Overlapping branch conditions.&lt;/strong&gt; If branch A triggers on "expense" and branch B triggers on "reimbursement," a question containing both will land wherever the router happens to check first.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Turn off "inherit previous intent" while debugging and test single-turn accuracy first. Only re-enable context once single-turn is clean. A surprising share of "the agent forgot what I said" tickets are actually "the retrieval query was contaminated by the previous turn."&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Regress against real questions, not invented ones
&lt;/h2&gt;

&lt;p&gt;Before you declare victory, pull the last month of actual user questions from your ticket queue or group chat. Twenty is enough.&lt;/p&gt;

&lt;p&gt;We ran 20 real admin questions against the fixed agent: accuracy went from 45% to 90%, and numeric questions hit 100%. The remaining failures clustered in one area — policy documents that only existed as scanned images — which told us the next fix was OCR, not prompting.&lt;/p&gt;

&lt;p&gt;That is the value of a real regression set: it tells you &lt;em&gt;where&lt;/em&gt; the next bug is, instead of leaving you guessing whether the whole thing works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build an adversarial set and a bad-case ledger
&lt;/h2&gt;

&lt;p&gt;Two cheap habits that compound:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adversarial questions, weekly.&lt;/strong&gt; Have a colleague deliberately ask out-of-scope things: "how old is the company," "recommend a phone," "what's the CEO's salary." Track the refusal rate. Five new hostile questions a week is enough to keep the guardrails honest.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A bad-case ledger.&lt;/strong&gt; One spreadsheet, five columns: user's exact words, agent's answer, correct answer, root-cause layer (retrieval / prompt / flow), date. After 20 rows the distribution of root causes is obvious, and you stop re-fixing the same class of bug. Ours was 60% retrieval, 30% prompt, 10% flow — which is precisely why starting at the prompt layer wastes so much time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Upgrading the model is the last step, not the first
&lt;/h2&gt;

&lt;p&gt;When an agent gives wrong answers, the reflex is to switch to a bigger, more expensive model. On domestic platforms this is almost always wasted money. Chunk granularity and prompt boundaries account for the overwhelming majority of failures. Swap the model after you've fixed retrieval and boundaries — and if the failure rate doesn't move, you'll know the model was never the problem.&lt;/p&gt;




&lt;p&gt;The short version: a knowledge-base agent that answers the wrong question is usually a retrieval problem wearing a model costume. Read the retrieved chunks before you touch the prompt. Fix chunk granularity before you add more rules. And keep a ledger, because the second incident is always a repeat of the first.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://www.mryk123.cn/knowledge/ai-agent-debug/" rel="noopener noreferrer"&gt;mryk123.cn&lt;/a&gt; — a Chinese-language AI office training site.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>debugging</category>
    </item>
    <item>
      <title>AI Can Calculate Your Data. It Cannot Tell You What It Means.</title>
      <dc:creator>crabcheng</dc:creator>
      <pubDate>Mon, 23 Nov 2026 16:08:31 +0000</pubDate>
      <link>https://dev.to/pqc182/ai-can-calculate-your-data-it-cannot-tell-you-what-it-means-3d02</link>
      <guid>https://dev.to/pqc182/ai-can-calculate-your-data-it-cannot-tell-you-what-it-means-3d02</guid>
      <description>&lt;p&gt;I once watched a team hand three years of sales exports to an AI assistant and ask it to "analyze the trends." It produced a beautiful summary, complete with percentages and confident conclusions. The only problem: the data included two stores that had been shut down for six months, and the "growth" it celebrated was entirely a data artifact.&lt;/p&gt;

&lt;p&gt;This is the state of AI-assisted data analysis in most teams right now. The tool is good at arithmetic and terrible at context. The fix is not a better prompt — it is a better division of labor.&lt;/p&gt;

&lt;h2&gt;
  
  
  The line between what AI does and what you do
&lt;/h2&gt;

&lt;p&gt;AI is good at: writing queries, descriptive statistics, spotting outliers, summarizing trends, translating findings into plain language, and generating chart code.&lt;/p&gt;

&lt;p&gt;AI is bad at: knowing whether an outlier is a system bug or a real business shift, knowing that your company ran a promotion last month, or understanding why a specific customer churned.&lt;/p&gt;

&lt;p&gt;So the split is simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;AI answers "what happened." You answer "why it happened" and "what to do about it."&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Everything below follows from that.&lt;/p&gt;

&lt;h2&gt;
  
  
  A four-step workflow that holds up in review
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1 — Clean first (this is the step everyone skips)
&lt;/h3&gt;

&lt;p&gt;Real data is dirty: nulls, duplicates, mixed units, inconsistent date formats, and five different spellings of the same customer name. Analyzing before cleaning guarantees a wrong conclusion.&lt;/p&gt;

&lt;p&gt;Ask AI to produce the cleaning checklist before anything else:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Here is my dataset: [column descriptions, row count, source, known dirty spots].
List the cleaning steps required before analysis.
For each step: explain its purpose, and what specific error occurs if I skip it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Letting AI enumerate the checklist beats relying on memory — and the "what error occurs if skipped" column is what makes you actually do the steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2 — Describe, don't guess
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Here is 12 months of sales data: [pasted, de-identified, or a summary].
Output:
1) Three most significant trends, with magnitude of change
2) Two anomalies, with how far they deviate
3) Ranking and share by [region / product line]

Constraints: use only the data I provided. Write "not covered by data" for anything absent.
Cite the source field after every conclusion.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That last constraint — "cite the source field" — is what makes findings traceable and lets you catch misreadings before they reach a slide deck.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3 — Ask for causes, but bring your own context
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Regarding the [trend] you found, here is additional context:
[what the company did during that period, what changed in the market].
Re-evaluate the likely causes, rank them by probability,
and state what data would verify each hypothesis.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This step is non-negotiable. &lt;strong&gt;Without your business context, any causal explanation from AI is a guess.&lt;/strong&gt; The more specific your context, the more useful the inference.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4 — Turn it into conclusions someone can act on
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Organize the above into conclusions for [management / department heads]:
- No more than three conclusions per page, each paired with a concrete action
- Each action states who does it, by when, and how success is measured
- List "limitations of this analysis" separately (data definitions, time range, missing dimensions)
- No filler advice like "strengthen" or "continuously optimize"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The limitations section is the line between professional and amateur work. Voluntarily stating where your data is weak makes the rest of the conclusion &lt;em&gt;more&lt;/em&gt; credible, not less.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three things you should never hand to AI
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Defining your metrics.&lt;/strong&gt; Is "revenue" booked value or collected cash? Is an "active user" someone who logged in or someone who acted? Get the definition pinned down by the business owner. If the definition is wrong, everything downstream is wrong.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Publishing final numbers externally.&lt;/strong&gt; Any figure going into a report, to a client, or to headquarters must be checked against the source system by a human. AI can drift on long arithmetic chains.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. The decision itself.&lt;/strong&gt; AI can give you options and evidence. Deciding whether to kill a product line is a human responsibility. Using AI's conclusion as &lt;em&gt;input&lt;/em&gt; is fine. Treating it as the &lt;em&gt;decision&lt;/em&gt; is not.&lt;/p&gt;

&lt;h2&gt;
  
  
  A worked example
&lt;/h2&gt;

&lt;p&gt;You run operations for a retail chain and spot a 12% month-over-month drop in one region:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Clean:&lt;/strong&gt; two stores in that region had a system upgrade with missing dates → exclude them and recompute.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Describe:&lt;/strong&gt; after exclusion the real drop is 7%, concentrated on weekdays; weekends are flat.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Attribute (with your context):&lt;/strong&gt; the weekday crowd is mostly office workers, and two competitors opened nearby in the same period.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Conclude:&lt;/strong&gt; launch a weekday lunch bundle, review foot traffic in two weeks. Limitation: no competitor pricing data obtained.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;AI produced the cleaning checklist, the statistics, the chart, and the conclusion structure. The two judgment calls — excluding the upgraded stores and knowing about the competitors — were yours. &lt;strong&gt;That is what good human-AI collaboration actually looks like.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The dataset is too large to paste.&lt;/strong&gt; Summarize first (a monthly rollup is usually a dozen rows). Or ask AI for code and run it locally — this solves both length and data-exposure problems. File-upload AI tools work too, but check data-handling policies first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI's numbers look wrong.&lt;/strong&gt; Two habits: ask it to show the calculation, not just the result, and spot-check a couple of lines. Then cross-validate by asking the same question two ways — once for the total, once for the detail you sum yourself. If they disagree, something is off. External figures always go back to the source system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I do this without a stats background?&lt;/strong&gt; Basic analysis, yes — descriptive "what happened" questions are well within reach. Inferential work (significance, causality, forecasting) needs grounding, or you risk misreading confident output. A useful trick: ask AI to explain, in plain language, what its chosen method is and is not suitable for, then decide whether to trust it.&lt;/p&gt;




&lt;p&gt;Original article (Chinese) with diagrams and additional failure-case comparisons: &lt;a href="https://www.mryk123.cn/knowledge/ai-data-analysis/" rel="noopener noreferrer"&gt;https://www.mryk123.cn/knowledge/ai-data-analysis/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>ai</category>
      <category>productivity</category>
    </item>
    <item>
      <title>AI Can Extrapolate Your Sales Data in Ten Seconds. That Is Not a Forecast.</title>
      <dc:creator>crabcheng</dc:creator>
      <pubDate>Mon, 23 Nov 2026 08:10:54 +0000</pubDate>
      <link>https://dev.to/pqc182/ai-can-extrapolate-your-sales-data-in-ten-seconds-that-is-not-a-forecast-26f3</link>
      <guid>https://dev.to/pqc182/ai-can-extrapolate-your-sales-data-in-ten-seconds-that-is-not-a-forecast-26f3</guid>
      <description>&lt;p&gt;Drop three years of monthly sales into a chat window, ask "forecast next year," and you get a smooth upward curve in ten seconds.&lt;/p&gt;

&lt;p&gt;Would you sign a purchasing budget against it?&lt;/p&gt;

&lt;p&gt;Two follow-up questions usually end the conversation:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If a new regulation lands next March, will that curve tell you in advance? No.&lt;/li&gt;
&lt;li&gt;Can you explain how the curve was produced? Usually not — which means when it drifts, you can only say "it was wrong" after the fact.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you can't answer those, the missing piece isn't a better model. It's the boundary around what you're asking for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Extrapolation is arithmetic. Forecasting is judgment.
&lt;/h2&gt;

&lt;p&gt;Most of what people call "AI forecasting" at work is actually &lt;strong&gt;extrapolation&lt;/strong&gt;: extending a past trend forward on the assumption that the past pattern keeps holding.&lt;/p&gt;

&lt;p&gt;Forecasting requires answering a second question: &lt;em&gt;will the pattern change?&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extrapolation → arithmetic. AI is excellent at it and finishes in milliseconds.&lt;/li&gt;
&lt;li&gt;Forecasting → judgment. AI has no meeting notes from next March and doesn't know your industry is about to switch standards.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the division of labor is clean: &lt;strong&gt;let AI do the arithmetic, and write down the judgment yourself.&lt;/strong&gt; What you write down is called an assumption — and an assumption is not a disclaimer. It's a sentence that can be proven false by facts.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 28% that turned out to be 9%
&lt;/h2&gt;

&lt;p&gt;A restaurant supply chain team ran this in late 2023: extrapolate 2024 flour purchasing volume from store count growth. AI returned &lt;strong&gt;+28%&lt;/strong&gt;. The year actually came in at &lt;strong&gt;+9%&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The post-mortem found nothing wrong with the arithmetic. AI used &lt;em&gt;new store openings&lt;/em&gt; as the driver. Real purchasing volume was pinned by &lt;em&gt;declining per-store usage at existing locations&lt;/em&gt;. Two variables moving in opposite directions, and the model only saw one.&lt;/p&gt;

&lt;p&gt;That's not a math error. Nobody wrote "per-store usage stays flat" down as an assumption, so nobody tested it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three tests before you let AI extrapolate anything
&lt;/h2&gt;

&lt;p&gt;Miss one, and the honest move is to admit this round shouldn't be extrapolated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The history must cover at least two complete cycles.&lt;/strong&gt;&lt;br&gt;
Monthly data: 36 months minimum. Quarterly: 12 quarters minimum. Two cycles, not two data points — with a single peak-and-trough you cannot separate seasonality from coincidence.&lt;/p&gt;

&lt;p&gt;A school uniform wholesaler had only one autumn peak (2023) and AI projected 2024 autumn would double. It had learned a one-off back-to-school bulk order as if it were a pattern.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Definitions must not have changed over the timeline.&lt;/strong&gt;&lt;br&gt;
This is the most commonly missed failure. Finance teams hit it constantly: in 2022 a category was reclassified from admin expense to sales expense, the two tables got stitched together, and the trend line shows a fake inflection exactly at the merger month.&lt;/p&gt;

&lt;p&gt;Before feeding anything to a model, mark the months where the definition changed — or cut the series and restart from the change point.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Outliers must be removed or explicitly flagged.&lt;/strong&gt;&lt;br&gt;
A few months of 2022 offline retail data are a cliff for anyone who looks. That's an event, not a trend. Feed those points into a linear fit and both slope and intercept get dragged.&lt;/p&gt;

&lt;p&gt;All three satisfied → extrapolation is worth doing.&lt;br&gt;
Two of three → downgrade the output to a "reference range," not a target.&lt;br&gt;
None → refuse. Eight months of sales history produces a confidence interval so wide it has no decision value. Use year-over-year comparison plus human judgment instead.&lt;/p&gt;
&lt;h2&gt;
  
  
  Write the assumption so it can be proven wrong
&lt;/h2&gt;

&lt;p&gt;The test is brutal: &lt;strong&gt;after writing the sentence, can you state what would make it false next year?&lt;/strong&gt; If not, it's filler.&lt;/p&gt;

&lt;p&gt;A usable assumption has three parts: &lt;strong&gt;variable, range, time window.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Bad: "Assume the market continues to grow steadily."&lt;/p&gt;

&lt;p&gt;Good: "Assume &lt;strong&gt;East China monthly active customers&lt;/strong&gt; stay within &lt;strong&gt;2,800 ± 300&lt;/strong&gt; from &lt;strong&gt;Q1 to Q2 2026&lt;/strong&gt;, with no single month below 2,400."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;An HR version:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Assume voluntary attrition stays between &lt;strong&gt;1.8% and 2.5% per month&lt;/strong&gt; through H1 2026, with no single month above 4% caused by organizational restructuring."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Why does that work? Next July you open the attrition report and immediately know whether the assumption held. If it held, the extrapolated hiring demand is usable as a reference. If it didn't, the model is void and you start over — no arguing about whose fault it was.&lt;/p&gt;

&lt;p&gt;Practical note: put &lt;strong&gt;all&lt;/strong&gt; assumptions in a table next to the result, not in an appendix. Three columns:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Assumption&lt;/th&gt;
&lt;th&gt;What it looks like if wrong&lt;/th&gt;
&lt;th&gt;Who watches it&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;East China MAU within 2,800 ± 300&lt;/td&gt;
&lt;td&gt;Two consecutive months below 2,400 → re-run with new baseline&lt;/td&gt;
&lt;td&gt;Regional ops lead&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No definitional change in cost categories&lt;/td&gt;
&lt;td&gt;A reclassification memo appears → split series at the change month&lt;/td&gt;
&lt;td&gt;Finance controller&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No new regulation affecting lead times&lt;/td&gt;
&lt;td&gt;Policy draft published → move to scenario mode&lt;/td&gt;
&lt;td&gt;Compliance&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That third column matters most. &lt;strong&gt;An assumption nobody watches is an assumption that doesn't exist.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  What the confidence interval actually tells you
&lt;/h2&gt;

&lt;p&gt;Here's where tools diverge, and it's worth being precise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Spreadsheet route.&lt;/strong&gt; Run a regression on the history (36 monthly points is a comfortable size), take slope and intercept, project forward, and use the built-in forecast sheet if your version has it — it draws the band for you. If your version doesn't, compute the interval yourself from the residuals.&lt;/p&gt;

&lt;p&gt;The critical caveat: that band is derived from &lt;strong&gt;historical residuals&lt;/strong&gt;. It says "if past volatility continues, the future probably lands here." It knows nothing about next year's policy change. Read it as a &lt;strong&gt;statistical volatility band&lt;/strong&gt;, never as a &lt;strong&gt;business risk band&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chat-model route.&lt;/strong&gt; Good for fast multi-variable exploration, bad for the final number. A prompt that keeps it honest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are a data analyst. Here is 36 months of monthly sales (attached). Do only the following:
1. Fit a linear trend and report slope, intercept, R².
2. Project the next 4 quarters.
3. For each projected quarter, give a prediction interval and state the method used.
4. List every assumption your projection depends on, one sentence each.
5. Do NOT adjust for seasonality, policy, or "market conditions." If you think an adjustment is needed, say so instead of applying it.
6. Flag any month in the history that looks like an outlier, and say which ones you excluded and why.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Point 5 is the one people skip. Without it, the model silently applies its own judgment and you lose the ability to separate arithmetic from opinion.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep policy and shocks outside the model
&lt;/h2&gt;

&lt;p&gt;The rule I use: &lt;strong&gt;anything that hasn't happened yet does not belong inside the extrapolation.&lt;/strong&gt; New regulation, a competitor entering, a subsidy expiring — these are scenario switches, not data points.&lt;/p&gt;

&lt;p&gt;Run the base extrapolation on clean history. Then, separately, write down: "If regulation X lands in March, base volume drops by roughly Y% for Z months, based on [comparable past event]." Now you have two artifacts — a baseline you can defend and a scenario you can update — instead of one curve pretending to know the future.&lt;/p&gt;

&lt;h2&gt;
  
  
  The uncomfortable summary
&lt;/h2&gt;

&lt;p&gt;Extrapolation is cheap. Assumption-writing is the work.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Two full cycles, stable definitions, labeled outliers → otherwise don't extrapolate.&lt;/li&gt;
&lt;li&gt;Every assumption gets a variable, a range, and a time window — and an owner.&lt;/li&gt;
&lt;li&gt;The confidence interval is a volatility band, not a risk assessment.&lt;/li&gt;
&lt;li&gt;Anything that hasn't happened yet goes outside the model, as a scenario.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The value isn't a more accurate number. It's that when the number turns out wrong, you can point at the assumption that broke — and fix the process instead of blaming the tool.&lt;/p&gt;




&lt;p&gt;I wrote a longer Chinese version of this walkthrough — including the three prompt templates I actually use, the small-sample refusal rule, and a full failure-case teardown — here: &lt;a href="https://www.mryk123.cn/knowledge/ai-forecast-limit/" rel="noopener noreferrer"&gt;历史数据外推的边界：三件事AI算不准&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you've had an extrapolation blow up in a budget meeting, I'd genuinely like to hear which assumption failed.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>data</category>
      <category>analytics</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Five Practical Defenses Against AI Hallucination in Business Workflows</title>
      <dc:creator>crabcheng</dc:creator>
      <pubDate>Sun, 22 Nov 2026 17:57:39 +0000</pubDate>
      <link>https://dev.to/pqc182/five-practical-defenses-against-ai-hallucination-in-business-workflows-l22</link>
      <guid>https://dev.to/pqc182/five-practical-defenses-against-ai-hallucination-in-business-workflows-l22</guid>
      <description>&lt;p&gt;AI hallucination is usually discussed as a technical curiosity. In business workflows it is something else entirely: a compliance risk.&lt;/p&gt;

&lt;p&gt;I've been writing about practical AI adoption for office teams, and the most common failure I see isn't the model being "dumb" — it's people trusting outputs that look authoritative but were never grounded in anything. The fabricated legal citation with a plausible article number. The "2024 market data" that doesn't exist. A confidence level that never drops.&lt;/p&gt;

&lt;p&gt;Here's the core insight: &lt;strong&gt;hallucination is a property of probabilistic generation, not a bug that the next model update will fix.&lt;/strong&gt; The model's objective is "produce the most plausible next token," not "produce the true one." Once you accept that, the right question changes from "how do I stop it" to "how do I catch it."&lt;/p&gt;

&lt;p&gt;So instead of treating this theoretically, here are five defenses you can actually put into a prompt template today, roughly ordered by return on effort.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Restrict the source (highest ROI, one sentence)
&lt;/h2&gt;

&lt;p&gt;The single most effective instruction you can add:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Answer only using the following material: """[paste material]"""&lt;br&gt;
If the information is not in the material, reply "not covered in the material." Do not speculate, do not supplement, do not use your existing knowledge.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This trades "intelligence" for traceability. In enterprise contexts that trade is almost always worth it — a boring, verifiable answer beats a brilliant, fabricated one.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Require inline citations
&lt;/h2&gt;

&lt;p&gt;Force every conclusion to carry its source:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;After each conclusion, add a source note in parentheses, e.g. "(source: page 3 of the attached table)".&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Hallucinations hate receipts. When the model has to name where each claim came from, fabricated claims either get attributed to nothing (and become visible) or get attributed to a page that doesn't say that (and become checkable).&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Cross-verify on the dimensions that hurt
&lt;/h2&gt;

&lt;p&gt;You don't need to verify everything — you need to verify the claims whose failure costs money:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Numbers&lt;/strong&gt;: re-ask the model to extract them independently, compare the two runs. Mismatch = human check.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Legal citations / standards / regulations&lt;/strong&gt;: verify in the original database, always. This is non-negotiable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Named sources&lt;/strong&gt; (people, companies, papers): search for at least one independent confirmation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Constrain the output structure
&lt;/h2&gt;

&lt;p&gt;Open-ended answers give hallucination room to hide. Structured output doesn't fix accuracy by itself, but it makes anomalies visible: a template with "basis / confidence / missing info" fields makes it obvious when a confident claim has no basis behind it. Asking the model to explicitly list what information is missing also reduces the pressure to invent — you've given it an escape hatch other than fabrication.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Keep a human review checklist
&lt;/h2&gt;

&lt;p&gt;The last line of defense is procedural, not technical. For any output that will be sent outside the company: every number traced to a source, every citation opened once, every named entity spot-checked. It takes two minutes and it's the difference between "AI-assisted" and "AI-responsible" when something goes wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  Putting it together
&lt;/h2&gt;

&lt;p&gt;None of these defenses are clever. That's the point — the fix for hallucination isn't a better model, it's a better pipeline: constrain sources, demand receipts, verify what's expensive, structure the output, keep a human checklist.&lt;/p&gt;

&lt;p&gt;I wrote a longer Chinese-language version of this playbook (with copy-paste prompt templates and a five-step flow diagram) on my site: &lt;a href="https://www.mryk123.cn/knowledge/ai-hallucination/" rel="noopener noreferrer"&gt;AI幻觉识别与规避：五道防线让输出可信&lt;/a&gt; — it's part of an ongoing series on practical AI adoption for office teams.&lt;/p&gt;

&lt;p&gt;If you have a hallucination war story from a real workflow — especially one where a fabricated detail almost made it into production — I'd genuinely like to read it in the comments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>promptengineering</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
