让 deepseek R1 大模型写一篇符合字数要求的文章,但是字数总是超标 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
请不要在回答技术问题时复制粘贴 AI 生成的内容
dong706

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

  •  
  •   dong706 2025 年 2 月 17 日 2746 次点击
    这是一个创建于 431 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

    dong706
        1
    dong706  
    OP
       2025 年 2 月 17 日
    这是 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
        2
    ziyeziye  
       2025 年 2 月 17 日
    不管是哪个模型,无论是中文还是英文都很难做到准确字数
    AoEiuV020JP
        3
    AoEiuV020JP  
       2025 年 2 月 17 日
    讲道理 AI 数数都不一定能数清,你想要严格限制字数为难 AI 了,
    另外不要粘贴 AI 回复到这里,小心 404 ,
    8355
        4
    8355  
       2025 年 2 月 17 日
    把你的提示词法出来大家来优化一下咯
    0o0o0o0
        5
    0o0o0o0  
       2025 年 2 月 17 日
    ai 的回答可以考虑用分享链接替代,不然很容易被封号
    GiantHard
        6
    GiantHard  
       2025 年 2 月 17 日
    告诉 LLM ,「在输出的时候,每字一行,并在行首写上行号。」

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

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

    还嫌不够准就让他和楼上说的那样每一个字都记录一下
    dong706
        12
    dong706  
    OP
       2025 年 2 月 18 日
    @GiantHard 哇!你这招厉害,学习啦!感谢~
    dong706
        13
    dong706  
    OP
       2025 年 2 月 19 日
    版主能否帮我删除 1 楼的回复,谢谢!
    关于     帮助文档   自助推广系统     博客     API     FAQ     Solana     903 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 76ms UTC 19:57 PVG 03:57 LAX 12:57 JFK 15:57
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86