我的 LLM 內容管線未能通過自身測試,而這正是重點
My LLM Pipeline Failed Its Own Tests (and That Was the Point) published: true
作者測試自己建立的 LLM 內容管線時,發現草稿超出字數、護欄誤判,以及事實核查漏掉技術錯誤。原定 700 字的文章生成了 1,004 字,原因是每節段落要求與總字數預算不相容;作者改按各節字數預算調整段落規則,並加入硬性上限。
The setup
The outline stage returns validated JSON. The draft stage writes each section separately, passing in the previous text for flow. The refine stage edits for repetition and can fact-check against a source file. Four guardrails then check length, outline-copying, structure and repetition. Tone, audience and length are configurable, and I ran it on three different topics.
Failure 1: 700 words requested, 1,004 delivered
My first fix was to trim the draft afterwards, but each pass removed only 10 to 20 words. The real cause was my own draft prompt, which demanded 2 to 3 paragraphs of 3 to 5 sentences per section. Five sections of that can never fit in 700 words. Scaling the paragraph rules to each section's word budget and adding a hard ceiling fixed it at the source.
Failure 2: my guardrails were wrong
I tested the checks with deliberately bad input. A pasted outline must fail the "not just the outline" check, and it did (12 of 12 key points copied). But testing also showed that my structure check wrongly flagged the one-paragraph conclusion, and my outline-copy threshold was too strict for short posts. A check you haven't tested against both bad and good output only measures your assumptions.
Failure 3: the fact-checker missed a real error
I planted three errors in a test draft, such as "PostgreSQL cannot store vectors", and the fact-checker found and fixed all three from the source file. Then I ran it on the real Transformer post. It reported zero issues, yet the post said attention scores are divided by the "inverse square root" of the key dimension. The correct operation is dividing by the square root. I caught it by reading the post myself.
Takeaways
- Fix length and quality problems in the prompt, where the content is created, not afterwards.
- Test your guardrails with bad input, or they prove nothing.
- LLM fact-checkers catch blatant contradictions but can miss subtle technical wording, so human review stays in the loop.
Read more
- Full write-up: How to Build an AI Content Pipeline: Why One Prompt Isn't Enough
- Code and all three generated posts: github.com/KRISH18833/ai-content-pipeline
來源:DEV Community · dev.to
