oliverzh2000 commited on
Commit
206e693
·
verified ·
1 Parent(s): 4f7675c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +33 -22
README.md CHANGED
@@ -1,14 +1,19 @@
1
  ---
2
- license: apache-2.0
3
  language:
4
- - zh
5
  tags:
6
- - chinese
7
- - word-segmentation
8
- - word-sense-disambiguation
9
- - coreml
10
- - ios
11
- - epub-reader
 
 
 
 
 
12
  ---
13
 
14
  # Wen Reader — On-Device Chinese NLP Models
@@ -43,7 +48,7 @@ Smaller/faster variant of the above for lower-end devices.
43
  Word Sense Disambiguation bi-encoder for selecting the correct dictionary definition in context.
44
 
45
  - **Architecture:** BERT-base fine-tuned as a bi-encoder (SentenceTransformers)
46
- - **Base model:** [Alibaba-NLP/gte-zh](https://huggingface.co/Alibaba-NLP/gte-zh) (GTE Chinese base)
47
  - **Parameters:** ~110M
48
  - **Task:** Encode context sentence and candidate sense labels, rank by cosine similarity
49
  - **Eval:** Top-1 accuracy 88.7%, Top-3 99.6%, MRR 0.936 on 239 hand-curated disambiguation examples
@@ -58,22 +63,28 @@ uv run python scripts/export_coreml.py span --model-dir models/cws_span_scorer_e
58
  uv run python scripts/export_coreml.py wsd --model-dir models/wsd_biencoder_gte_base/final
59
  ```
60
 
61
- To download these models for local development:
62
-
63
- ```bash
64
- cd ml
65
- uv run python scripts/download_models.py
66
- ```
67
-
68
  ## Training
69
 
70
- - **CWS:** Fine-tuned on a custom dataset combining SIGHAN/CKIP segmentation corpora with LLM-generated literary Chinese annotations. Uses a span-scoring objective where the model scores all candidate spans and a dynamic programming decoder finds the optimal segmentation.
71
- - **WSD:** Fine-tuned on CC-CEDICT sense clusters with LLM-generated Chinese sense labels and context examples. Uses contrastive learning to align context embeddings with correct sense embeddings.
 
 
 
 
72
 
73
- ## License
 
 
 
74
 
75
- Model weights are released under Apache 2.0, same as the app.
76
 
77
- ## Citation
 
 
 
78
 
79
- If you use these models, a link back to the [Wen Reader repo](https://github.com/oliverzh2000/wen-reader) is appreciated.
 
 
 
 
1
  ---
2
+ license: mit
3
  language:
4
+ - zh
5
  tags:
6
+ - chinese
7
+ - word-segmentation
8
+ - word-sense-disambiguation
9
+ - coreml
10
+ - ios
11
+ - epub-reader
12
+ datasets:
13
+ - wyy209/MiCLS
14
+ base_model:
15
+ - hfl/chinese-electra-180g-small-discriminator
16
+ - thenlper/gte-base-zh
17
  ---
18
 
19
  # Wen Reader — On-Device Chinese NLP Models
 
48
  Word Sense Disambiguation bi-encoder for selecting the correct dictionary definition in context.
49
 
50
  - **Architecture:** BERT-base fine-tuned as a bi-encoder (SentenceTransformers)
51
+ - **Base model:** [thenlper/gte-base-zh](https://huggingface.co/thenlper/gte-base-zh) (GTE Chinese base)
52
  - **Parameters:** ~110M
53
  - **Task:** Encode context sentence and candidate sense labels, rank by cosine similarity
54
  - **Eval:** Top-1 accuracy 88.7%, Top-3 99.6%, MRR 0.936 on 239 hand-curated disambiguation examples
 
63
  uv run python scripts/export_coreml.py wsd --model-dir models/wsd_biencoder_gte_base/final
64
  ```
65
 
 
 
 
 
 
 
 
66
  ## Training
67
 
68
+ ### CWS Span Scorer
69
+
70
+ Fine-tuned on a custom dataset (~914k span-scoring examples from ~104k sentences) built from:
71
+ - [ICWB2](https://github.com/yuikns/icwb2-data) segmentation corpus (MSR, auto-matched and LLM-annotated disagreements)
72
+ - LLM-annotated Chinese from ebooks (Claude Sonnet)
73
+ - LLM-annotated wiki/subtitle data (Claude Opus)
74
 
75
+ The model scores all candidate word spans at each position using a span scoring MLP head
76
+ (taking span boundary representations + width embeddings as input). A dynamic programming decoder
77
+ finds the optimal segmentation at inference time. Training uses cross-entropy loss over candidate
78
+ spans at each ambiguous position. Encoder and head use discriminative learning rates.
79
 
80
+ ### WSD Bi-encoder
81
 
82
+ Fine-tuned on CC-CEDICT sense clusters built from:
83
+ - [MiCLS](https://huggingface.co/datasets/wyy209/MiCLS) WSD corpus
84
+ - Chinese sense labels generated by LLM translation of English CEDICT definitions
85
+ - Context examples generated by LLM for each sense cluster
86
 
87
+ Training uses grouped cross-entropy loss: contexts and sense labels are encoded by the same model,
88
+ cosine similarity is computed between context embeddings and sense embeddings, and the loss is
89
+ cross-entropy over the similarity scores (with temperature scaling). Contexts are grouped by word
90
+ in each batch so sense embeddings are encoded once and reused across all contexts for that word.