Repository navigation
llmpdf v0.3.0
This experimental release adds an embedded Chinese Wikipedia knowledge base with deterministic local retrieval. Factual hits are answered directly from embedded knowledge cards; other prompts fall back to the existing 27M Gemma 4-distilled chat model.
What changed
- embedded 3,943 compact Chinese knowledge cards derived from the Chinese Wikipedia vital-article lists;
- added simplified/traditional and redirect aliases such as
珠穆朗玛峰/珠峰,爱因斯坦,中国, and北京; - implemented a pure-JavaScript local retriever inside the PDF payload;
- added query-aware extraction for capitals, river length, elevation, population, definitions, and summary-style questions;
- added Chinese boundary and intent checks so prompts such as
什么是通货膨胀and神经网络的权重是什么do not false-hit short encyclopedia titles; - knowledge hits bypass generation and return quickly; misses still use the normal incremental model generation path;
- added visible
Chinese Wikipedia (CC BY-SA 4.0)attribution inside the PDF; - updated the demo landing page for the knowledge-enabled release.
Evaluation
Node.js retrieval evaluation (eval/eval_kb.js):
world knowledge: 23/23
correct non-KB routing: 14/14
total: 37/37
Representative answers:
长江有多长? -> 长江全长6300公里。
黄河有多长? -> 黄河全长5464千米。
亚马逊河有多长? -> 亚马逊河全长6,437公里。
中国的首都是哪里? -> 中国的首都是北京市。
珠穆朗玛峰有多高? -> 珠穆朗玛峰海拔8848.86米。
Prompts such as arithmetic, Python/SQL/Git how-to questions, translation, writing, and multi-step reasoning are intentionally routed back to the language model.
Verified
- reproducible PDF build;
- Node.js runtime and KB smoke tests;
- existing model regression tests;
- Chromium PDFium interactive test:
中国的首都是哪里?returns中国的首都是北京市。without token generation; - Chromium PDFium fallback test:
你好still produces a model-generated answer with the livetok/sdisplay.
SHA256
65f374cdb855f26a829e9cfac3908a05f10fd3354021bafcb56b867ed67afa4d llmpdf.pdf
77c6e564745645b0e99973ccc91a8c56919e6780a4ed85fa37b45298a819c8b3 tinygpt27_final.tgq
e288f911f5567283391d6d4344019308541bef63e26552220b5fd2163426e82e kb_zhwiki_vital.jsonl
Licensing note
Unlike the trained weights, the knowledge-base cards directly reproduce Chinese Wikipedia text. The embedded knowledge text is therefore distributed under the applicable CC BY-SA 4.0 attribution/share-alike obligations. The broader model/PDF artifact remains a conservative non-commercial research/demo artifact because parts of the original model-training mixture have restricted or unclear upstream terms. See NOTICE.md and MODEL_CARD.md.