Repository navigation
Offline AI: chat format for Qwen and LFM2 models, no texts in the log - #888
Merged
LeanBitLab merged 1 commit intoNov 22, 2026
Merged
Conversation
Chat models expect their chat format. With the plain "Instruction/Input/Output" prompt they answer badly, take the few-shot examples as part of the text, and Qwen3 first "thinks" and uses up the available tokens. Qwen and LFM2 models (detected by the model file name) now get the instruction as system message and the text as user message; for Qwen an empty think block switches thinking off, unless "show thinking" is enabled. Other models get the prompt as before. The log now contains only the lengths of input and output: the texts are private, and the system log can be read by other tools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VuiaMhLXwhErf9shhrr1uD
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.
Local chat models answer much better with their own chat format:
{text}and an empty field (e.g. a custom key working on the clipboard) is sent as the request itself.Also, the log no longer contains the input and the generated text, only their lengths: the texts are private, and the system log can be read by other tools (like #825 for typed words).
Tested with Qwen3-4B-Instruct-2507 Q4_0 and LFM2; in daily use in my fork for some weeks.
🤖 Generated with Claude Code