Skip to content

--prompt biases tokens, not phrases: compounds still split #23

Description

@drycode

whisper.prompt seeds whisper-server's decoder and fixes most jargon — MergeTree and Alembic come back correct with it set, and come back as "merge tree" and "a lambic" without it.

It does not hold a compound together when the compound's parts are ordinary English words. With ReplacingMergeTree listed in the prompt, dictating it still yields:

replacing MergeTree

MergeTree is fused correctly; Replacing is not, because "replacing" is a high-probability word on its own in that position. An initial prompt shifts token probabilities — it cannot enforce a phrase boundary.

What would actually fix it

A post-transcription phrase-repair pass in Sanitize.swift: an ordered map of literal phrases to replacements, applied after the decode and before the paste.

"replacing MergeTree" -> "ReplacingMergeTree"
"merge tree"          -> "MergeTree"

This reaches cases the decoder prompt structurally cannot, and it is deterministic.

Open questions worth settling before building it

  • Where does the map live? config.toml alongside whisper.prompt is the obvious home, and keeps it personal — but that means a fresh install gets nothing, same as the prompt (see the sibling issue on shipping a default vocabulary).
  • Case sensitivity. "replacing" at the start of a sentence is capitalised; a case-sensitive map misses it, a case-insensitive one may rewrite prose that legitimately said "replacing merge tree".
  • Word boundaries. Naive substring replacement will corrupt a longer word that contains the pattern. Needs boundary-anchored matching.
  • Ordering. "merge tree" -> "MergeTree" applied before "replacing merge tree" prevents the longer rule from ever matching. Longest-first, or explicit ordering.

None of these are hard, but they are decisions, not defaults — which is why this is an issue rather than a patch.

Related: the --prompt flag was missing from the rendered launchd plist entirely until 6a55ca8; this issue is about the residual behavior with it correctly set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions