Repository navigation
Stop dialog replies from repeating their own openings - #257
Merged
Merged
Conversation
Since the dialog moved to NInfer Gemma, replies collapse into one template: the same opener with praise of the person, a paraphrase of their message, a promise and an emoji tail. NInfer ignores the DRY and repeat penalties the bot sends, and the bot's own replies in the history act as examples. - Rewrite the dialog style rules: no intro or outro, no praise or reading of the interlocutor, plain speech, length that fits the message. - Re-sample once a reply that opens like one of the bot's last three replies, or that announces a generation no tool call started. - Convert Markdown left in dialog replies to Telegram HTML at the send boundary. - Raise the default dialog model output retries from 1 to 5.
Owner
Author
|
Danger prompt warning: the change is intentional. Partial names ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Since the dialog moved to NInfer Gemma (2026-10-11), replies collapse into one template in every chat: an opener that praises the person («Имя, ну ты и мастер…! 😂»), a paraphrase of their message («это ты так намекаешь…?»), a recap and a promise with an emoji tail. In 48 h of production replies, 38% of Gemma replies open with such a reaction and 9.1% open like one of the bot's last three replies in the same chat (Qwen on the same contexts: 2.6%).
Causes:
dry_*andrepeat_penaltyfields the bot sends, and its frequency/presence penalties count only the current reply, so nothing penalises a template repeated across replies;Changes
prompts/chat/_shared_core.prompt: a reply has no intro or outro; no praise or evaluation of the person; no reading their message aloud; plain speech without literary padding; length that fits the message;varietyalso covers openings and endings.openplotva-dialog::reply_shape+aifarm.rs: a final reply that opens like one of the bot's last three replies (repeated_opening), or announces a drawing or generation that no call of the turn started (unexecuted_action), is rejected once per turn and re-sampled with a note. A re-sample is delivered as it is.openplotva-telegram::telegram_html_from_stray_markdown, called fromprepare_dialog_chat_response: Markdown left in a dialog reply (**bold**,*italic*at word edges,`code`, fences, headings, links,*bullets,***rules) becomes Telegram HTML. Text inside<code>/<pre>and tag markup stays as it is; censored words likeбл**ьstay literal.DEFAULT_DIALOG_MODEL_OUTPUT_RETRIES1 → 5.Measurement
Replay of 128 captured production dialog requests through the production Gemma (temperature 0.2; two baseline runs matched almost exactly):
On 2000 production replies with Markdown, the converter leaves visible Markdown in 5.
An earlier prompt draft with literal HTML tag examples, a new
final_checkand a newidentitymade Gemma wrap replies in tags, invent links, copy the transcript envelope and drop native tool calls; an ablation found these blocks, and they stay as they were.Deploy note
Production
.env.productionhadDIALOG_MODEL_OUTPUT_RETRIES=0; it is set to 5 on the server. With 0, a rejected reply would go to the Qwen/Luna fallbacks instead of a Gemma re-sample.Checks
cargo fmt --all --checkcargo clippy --workspace --all-targets -- -D warningscargo test -p openplotva-dialog,-p openplotva-llm,-p openplotva-prompts,-p openplotva-config,-p openplotva-telegram,-p openplotva-app --lib dialog_jobs