让 deepseek R1 大模型写一篇符合字数要求的文章,但是字数总是超标

41 天前
dong706  dong706

比如我让 deepseek R1 大模型指定主题写一篇 30-40 字的短文。它总是写出五六七十个字来。

该怎么写提示词,让大模型的输出内容符合字数要求呢?求大佬们指教~

1311 次点击
所在节点   程序员  程序员
13 条回复
dong706
dong706
41 天前
这是 R1 自己的答案:

要实现大模型生成英语作文时精准控制单词数量在 30-40 词范围内,可以尝试以下结构化方法(附示例):
精确指令法(成功率 80%)
提示词示例:
"Write a 35-word English essay about summer vacation. Use exactly 6 sentences: 1 opening (5 words), 4 body sentences (6-8 words each), and 1 closing (5 words. Count words meticulously before responding."
输出示例:
Summer brings bright sunshine. Children play at sandy beaches. Families picnic under shady trees. Ice cream melts in warm hands. Fireworks light up night skies. These moments create lasting memories. (35 words)
分步控制法(成功率 90%)
提示词结构:
[主题]:Spring Festival
[要求]:
总词数:35±2
段落结构:
Opening: 1 句 (5-7 词)
3 个要点句:每句 8-10 词
Closing: 1 句 (6-8 词)
使用基数词代替序数词
避免从句结构
自我检查法(成功率 95%)
提示词示例:
"Generate a 38-word essay about online learning. After drafting, perform these steps:
Remove all adjectives
Replace phrasal verbs with single verbs
Count words and adjust sentence length
Final output in this format: [Essay] [Word count: X]"
输出示例:
Online learning offers flexibility. Students access courses anywhere. Teachers upload materials digitally. Discussions happen via forums. Tests are taken online. This method saves commute time. [Word count: 37]
示例引导法(成功率 85%)
提供模板:
"Follow this exact structure:
Sentence 1: 5-word topic introduction
Sentence 2-4: 8-word explanations
Sentence 5: 7-word conclusion
Example:
Pets teach responsibility. Children feed them daily. They learn cleaning habits. Walking dogs builds discipline. Caring develops lifelong skills. (35 words)"
注意事项:
使用短句结构(平均 6-8 词 / 句)
避免缩略形式和所有格符号
优先使用单音节词汇
用分号替代连接词( and/but )
指定具体主题(如 "My Last Birthday" 而非 "An Event")
调试技巧:
若输出超限,可追加指令:
"Condense by:
Removing all adverbs
Converting phrases to single words (e.g. 'students who study' → 'studying students')
Using numerals instead of words (3→three)"
ziyeziye
ziyeziye
41 天前
不管是哪个模型,无论是中文还是英文都很难做到准确字数
AoEiuV020JP
AoEiuV020JP
41 天前
讲道理 AI 数数都不一定能数清,你想要严格限制字数为难 AI 了,
另外不要粘贴 AI 回复到这里,小心 404 ,
8355
8355
41 天前
把你的提示词法出来大家来优化一下咯
0o0o0o0
0o0o0o0
41 天前
ai 的回答可以考虑用分享链接替代,不然很容易被封号
GiantHard
GiantHard
41 天前
告诉 LLM ,「在输出的时候,每字一行,并在行首写上行号。」

GiantHard
41 天前
英文也是同理,只要规定输出的时候,每词一行,行首标明行号就行。
coolfan
41 天前
@GiantHard #6 聪明
GiantHard
41 天前
我发现其实不用我在上面介绍的技巧,deepseek r1 其实不太容易写出太超长的句子,可能跟你的提示词有关?
cheng6563
41 天前
准确不了的,可以试着这样稍微优化。

总字数约为 500 字,在每句话结束时使用 xml 标签标出当前字数和总字数,示例如下:<total_words current="5" max="50"/>

还嫌不够准就让他和楼上说的那样每一个字都记录一下
qiaofanxing
41 天前
dong706
40 天前
@GiantHard 哇!你这招厉害,学习啦!感谢~
dong706
39 天前
版主能否帮我删除 1 楼的回复,谢谢!

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1112013

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX