Introduction¶
DeepSeek’s output often reads with high confidence, but token-level probabilities reveal a different truth: some sentences are essentially guesses. This plugin explicitly marks those portions, letting you decide whether to review them—it’s not an error detector; a red sentence only indicates “branching occurred here.”
What It Is¶
Logprobs Highlighter is a DSH plugin that highlights high-uncertainty portions in DeepSeek’s output. It uses token-level logprobs to flag the sentences the model is least confident about in red, and retains each token’s probability locally for your review. The plugin is in Preview status (features may change) and targets the dsh 0.2.2 series (tested on 0.2.2-rc.5; peer declared as >=0.2.2-rc.1 <0.3.0; earlier versions unverified). Red annotations are only visible under the web profile. It connects directly to api.deepseek.com using your own DEEPSEEK_API_KEY and does not reuse a logged-in DeepSeek account or subscription within dsh.
Installation & Activation¶
Install from npm:
dsh plugin --profile web add dsh-logprobs-highlighter
Or install directly from GitHub:
dsh plugin --profile web add github:tojunkan/dsh-logprobs-highlighter
After installation, you need to:
- Provide dsh with a valid DeepSeek key — set DEEPSEEK_API_KEY in the environment where dsh runs, or write it into dsh’s credential service (
apiKeyEnvchanges the reference name, not the key itself). - Start
dsh --profile web, and confirm the bundle is enabled on the Plugins page (installation enables it by default). - Select DeepSeek (logprobs) in the model selector. Collection and red highlighting only occur when this provider is selected; the plugin is bypassed when using the standard DeepSeek account channel.
Local source development (requires a rebuild after modifying the client side):
pnpm install
dsh plugin --profile web add "link:<absolute-path-to-this-repo>"
pnpm run build:client # Must run after modifying src/client/*
dsh --profile web
Core Features¶
After a response completes, sentences where the minimum confidence of any content word falls below redThreshold (default 0.05) receive a red background. The original DOM is not modified—only CSS.highlights are layered on top. A hover tooltip displays the original text fragment, exact positions of content tokens, actual / alternative / confidence / category, and four annotation buttons. Annotations include highlighter_correct (genuinely wrong), reasonable_ambiguity (reasonable ambiguity, not an error), highlighter_misjudge (pure false positive), and unsure (uncertain). The current UI renders everything in red; the yellow tier is not yet implemented, but the data is already recorded semantically. Toggle “Annotation: On/Off” at the bottom-right of the content area, or press Alt+L. This only disables front-end rendering and does not affect server-side collection. Open /plugins/logprobs-highlighter/status in your browser—if version, configuration, and collection stats are visible, the host side is ready.
Configuration¶
Defaults are in cordis.patch.yml; they can also be overridden in the profile’s patch or via the dsh settings UI.
| Config | Default | Description |
|---|---|---|
enabled |
true |
Whether to register the provider / collect data |
baseUrl |
https://api.deepseek.com |
OpenAI-compatible base URL |
apiKeyEnv |
DEEPSEEK_API_KEY |
Credential reference name |
topLogprobs |
5 |
0 / 2 / 5 / 20 |
thinking |
true |
thinking.type=enabled |
reasoningEffort |
high |
low / high / max |
maxTokens |
8192 |
Default output limit |
defaultContextWindow |
1000000 |
Claimed value used by dsh for capacity checks |
ringSize |
20 |
In-memory capture count |
ringTtlMs |
3600000 |
In-memory capture TTL |
redThreshold |
0.05 |
Sentence red threshold (candidate if exp(logprob) is below this) |
annotationEnabled |
true |
Generate red-sentence annotations / accept feedback |
annotationStoreText |
sentence |
sentence stores original text; none stores only hash/offset |
annotationMaxSentenceChars |
500 |
Sentence text truncation length |
annotationMaxFileBytes |
10485760 |
Rotation size for annotations / feedback |
annotationKeepFiles |
20 |
Number of annotations / feedback files retained |
recordFull |
true |
Whether captures write full text and every token |
outputDir |
empty | Empty = $DSH_HOME/logprobs-highlighter |
Items like redThreshold and annotationMaxSentenceChars that are not listed in cordis.patch.yml take effect via Config defaults; add them to your patch if needed.
Data & Privacy¶
All data is written locally to $DSH_HOME/logprobs-highlighter (typically C:\Users\<user>\.dsh\logprobs-highlighter on Windows) and is never uploaded. With recordFull: true, captures.jsonl contains the full response text and every token; with annotationStoreText: sentence, annotations.jsonl contains the original sentence text. If that’s a concern, set them to false / none respectively. No external requests are made other than to api.deepseek.com; the server side exposes only local read and feedback endpoints under /plugins/logprobs-highlighter/*. Correlation uses only session / turn / step identifiers and does not read anything outside the conversation. To shut it down completely: disable the bundle on the Plugins page, or set enabled to false.
Known Limitations¶
- Excessive red sentences: function words, sentence-initial tokens, and formatting tokens cause false positives; the threshold is still relatively loose.
- No logprobs for tool-call arguments: only
logprobs.contentandlogprobs.reasoning_contentare collected. - Code blocks are not highlighted: code is better judged by compilers / linters / tests.
- No false-negative metrics: you can only see what’s flagged, not what’s missed.
- No history browsing page: red marks can be recovered from
annotations.jsonlafter a restart, but the annotation UI for old sessions is not accessible. - Yellow tier not rendered:
reasonable_ambiguityis in the label schema, but the UI still displays in red. - Focus not yet in the UI: the server supports character ranges, but the client currently sends primarily single-token indices.
- Human verdicts are not ground truth: they record your judgment.
HTTP API¶
Prefix: /plugins/logprobs-highlighter:
| Method | Path | Purpose |
|---|---|---|
| GET | /status |
Version, configuration, collection / persistence / annotation stats |
| GET | /tokens?session=&turn=&step= |
Retrieve red-sentence annotations for a turn |
| POST | /feedback |
Submit or modify a human verdict |
| GET | /debug |
Recent capture summary |
| GET | /captures |
Recent raw captures |
See docs/MAINTAINER.md for field definitions and verdict / reason enums.
Development¶
pnpm install
pnpm test # Backend and annotation self-tests
pnpm run check # Syntax check
pnpm run build:client
- Modify
lib/*.js(host side) → restart dsh. - Modify
src/client/*.js→ you must runpnpm run build:clientto regeneratelib/client.js, then refresh the page;lib/client.jsis a generated file—do not edit it manually. - Directory structure:
lib/host-side code and generated client;src/client/client source;scripts/build and analysis;test/self-tests;docs/research / historical documents (some are outdated).
The dsh service contract, upgrade checklist, and module responsibility table are in docs/MAINTAINER.md.
Use Cases & Notes¶
Suitable for DSH developers who need to review the model’s uncertain outputs, particularly in scenarios using the DeepSeek (logprobs) provider. The plugin runs with the current dsh process’s permissions; review the source code and license before installing. Be aware of limitations such as excessive red highlighting, no highlighting in code blocks, and missing logprobs for tool-call arguments.
Summary¶
Logprobs Highlighter uses token-level logprobs to explicitly mark sentences the model is uncertain about, and provides hover tooltips, annotation, and toggle features to facilitate developer review and labeling. All data is stored locally and never uploaded, keeping privacy under your control. It is well-suited for debugging and auditing model output uncertainty within a DeepSeek Harness setup.