ReadOnce:減少重讀,並保留模型錯誤供檢視
ReadOnce: I wanted less rereading, so I kept the model's mistake visible
ReadOnce 以本地 MiniLM 比較前後筆記,標示可能重複的內容,並保留原文、參照、模型分數及理由供檢視。在合成測試中,模型在 4/4 個校準案例及 12/12 個留出案例符合預期;只比對完全相同文字的基線則分別符合 0/4 及 10/12。角色對調的句子仍被錯誤標示為可能重複,這項失誤也保留在證據頁面。
This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady.
What I Built
Two status updates can tell almost the same story without sharing a sentence. A text diff highlights the new wording. A summary might remove the very detail I need to check.
ReadOnce takes a smaller job: compare an earlier set of notes with a current one and suggest which lines might repeat earlier meaning. It keeps every current line, its earlier reference, the actual model score and a reason. Nothing is deleted or rewritten.
The interface has two boxes, a local-model comparison and an exact-text baseline. The sample is synthetic: a checklist instruction is rephrased, a budget changes from 50 to 75 USD, a publishing instruction loses “not,” and a new question appears. The point is to make those changes easy to inspect alongside the familiar material.
I started this application on 21 October 2026, inside the Week 3 entry period. Its comparison engine, interface and fixtures are new. I reused licensed general-purpose MiniLM and browser-runtime files already available locally, with their notices and exact hashes retained. I did not rename or submit an earlier application.
Demo
Try ReadOnce in your browser. Load the synthetic example, compare with the local model, then inspect or download the audit. The actual-model checks page lets you run the frozen cases yourself.
Code
Read the source on GitHub. The repository includes the pinned dependencies, license notices, synthetic fixtures, actual run records and the retained known failure.
How I Built It
The functional core is an open-weight sentence embedding model, Xenova/all-MiniLM-L6-v2. Transformers.js runs its q8 ONNX weights through CPU WebAssembly in the browser. No hosted completion service, API key or account is needed to compare the included sample.
Each note becomes a 384-dimensional vector. Cosine similarity finds a possible earlier reference even when the words have moved around. That is work an exact comparison does not do: in the held-out fixtures, the exact baseline catches only the literal repeats, while the model also finds two paraphrases.
The part I did not let the model decide
Similarity is not agreement. A model can give almost identical vectors to “50 USD” and “75 USD.” ReadOnce adds a plain lexical check for changed quantities, recognized dates and weekdays, negation, selected status words and uppercase identifiers. A difference prevents a semantic-repeat label.
The matching rule is deliberately visible: cosine at least 0.82, a best-versus-runner-up gap of at least 0.06, and equal protected lexical facts. Ties and reused references remain reviewable. Each earlier note can be reserved once, in current-note order; there is no global alignment optimizer hiding behind the interface.
An exact match only folds whitespace and case. Other matches are called “possible repeat,” because that is all the evidence supports. Every current note is still rendered in its original position. The audit JSON includes the original text, references, scores, reasons, settings and timings.
What the actual tests showed
I wrote four calibration examples, twelve held-out cases and an adversarial role swap before the first inference run. The threshold and runner-up margin were fixed in advance. Fourteen separate engine tests exercise invalid vectors, changed details, ambiguity, reuse, input limits and original-line preservation.
The final actual browser-model run matched the authored expectations in 4/4 calibration cases and 12/12 held-out cases. The exact-only baseline matched 0/4 and 10/12 respectively. The held-out set has thirteen current notes because one case tests reusing a prior reference. These small synthetic results do not establish real-document accuracy or human time saved.
One miss is more informative than the totals. The model assigned these two sentences a cosine similarity of about 0.979:
Alice reviews the report written by Bob.
Bob reviews the report written by Alice.
That is an incorrect possible-repeat suggestion. The people swapped roles, but the lexical guards contain the same facts. I kept this failure in the evidence page and the README. A sentence model and a handful of regular expressions do not establish who did what.
I also kept the first batched run. Its scores differed when unrelated notes changed the inference batch, and one calibration paraphrase stayed below the threshold. The final loader embeds one note at a time, which made the same pairs consistent between the app sample and validation run. I did not adjust thresholds or remove the failed role-swap case. Both run records remain available.
The interface was checked on a desktop viewport and in a 390 CSS-pixel frame. A synthetic HTML/script-shaped note stayed plain text; the downloaded audit preserved all three test originals. The local timing record separates model wait/loading from inference. It is one run with retained assets, not a first-download benchmark or a physical-phone test.
Why Does Open Innovation Matter?
Open innovation matters here in a concrete way. The model can be pinned to an immutable revision, its files can be inspected and hashed, and the same inference can be rerun without sending notes to a model provider. The application is small enough to read: a pure comparison module, a model loader, rendering code and a separate evidence page. The original code is MIT licensed; the Apache-2.0 model/runtime and MIT ONNX notices stay with their dependencies.
That does not make a hosted copy magically private. Its host and the user's browser still matter. This version has no upload endpoint, analytics or note storage, disables remote model loading and limits connections to its own origin. I verified the code/configuration and local requests, not an independent network packet capture. I used only synthetic inputs during development.
Slow and steady, with a boundary
The lazy part is asking a small model to find familiar wording. The steady part is keeping enough evidence to disagree with it.
ReadOnce supports short English notes, up to fifty per side. The model sees at most 256 tokens per note. Names, relationships, causality, subtle modality and unrecognized identifiers remain weaknesses; lexical guards can also reject harmless paraphrases. There is no automatic hiding, approval or deletion. It is not a tool for financial, legal or safety decisions.
My useful result is a modest application that makes its suggestions inspectable, including a wrong one. I would rather read two quotes than quietly lose a changed responsibility.
來源:DEV Community · dev.to