改写提示词减少无依据回答
定位提示词中诱发编造的要求,补充来源与未知值约束,输出修订版本及验证测试用例。
完整提示词
<context>
Models make things up most when the prompt asks for specifics they do not have and gives them no honest way out. Common triggers: asking for citations, figures, names or quotes without supplying sources; requiring every field of a format to be filled; rewarding complete-sounding answers; long documents where the answer is far from the question; and questions that assume a false premise. Lowering temperature barely helps. What helps is giving the source, limiting answers to it, making "not found" an acceptable answer with a fixed wording, asking for supporting quotes before the answer, letting fields be empty, and separating what the source says from what the model infers. Some needs cannot be met by prompting at all: current facts need search or retrieval, and calculations need a tool.
<prompt_under_test>
{{prompt}}
</prompt_under_test>
{{#sources}}
Sources available to the model: {{sources}}
{{/sources}}
{{#bad_outputs}}
<bad_outputs>
{{bad_outputs}}
</bad_outputs>
{{/bad_outputs}}
</context>
<task>
1. Find where fabrication gets in: each place the prompt asks for a fact, number, name, date, quote or reference, and whether the model has a source for it. Check also for forced completeness, false premises, and missing permission to say it does not know.
2. Choose fixes that fit, from:
- Supply or attach the source, or add search or retrieval if the facts are current or external.
- Answer only from the source; anything else is labelled as general knowledge or left out.
- For long sources, extract relevant quotes first, then answer from the quotes.
- A fixed not-found reply, for example "Not in the provided material.", stated as a good outcome.
- Allow empty or null fields and an "unknown" value in structured output.
- Cite only provided sources by id or section; never produce references from memory.
- Label each claim as stated in the source or inferred, and flag low confidence.
- Check the premise of the question before answering it.
For each fix, say what it costs (shorter or more cautious answers, more refusals).
3. Write the revised prompt with the fixes applied and the original intent kept.
4. Write five to eight tests: a question the source answers, one it does not, one with a false premise, one asking for a citation or number not in the source, and any failing inputs given, each with a pass condition.
</task>
<constraints>
- Do not promise the revised prompt eliminates fabrication; say that high-stakes outputs still need a human check against the source.
- If the task depends on facts the model cannot access, say the fix is a tool or retrieval, not wording.
- Keep the revision as small as the problem allows; do not rewrite parts that are not involved.
{{> output/uncertainty}}
</constraints>
<output_format>
## Where fabrication gets in
Table: Prompt part | What it asks for | Source available? | Risk.
## Fixes
Numbered, each with the change, the reason and the trade-off.
## Revised prompt
Fenced code block.
## Tests
Table: Input | What it tests | Pass condition.
</output_format>可替换内容
- {{prompt}}
- {{#sources}}
- {{sources}}
- {{/sources}}
- {{#bad_outputs}}
- {{bad_outputs}}
- {{/bad_outputs}}
- {{> output/uncertainty}}
分类与标签
编程开发、提示词优化、幻觉排查、来源约束、测试用例