BBS-NewWordFind
基于 Qwen3.5-0.8B-Base 微调的中文论坛新词发现分类模型。用于判定语境中的候选词是否具备独立、稳定的语义,过滤残片(Fragment)、乱码(Garbled)与高频虚词(Too Common)。
架构说明
本模型采用定制化的特征池化策略与损失函数:
- 特征提取:截取基座模型 Layer 19 的输出,对全句非填充(Non-pad)Token 执行 Global Sentence Mean Pooling。
- 损失函数:引入 Focal Loss (gamma=2.0) 处理类别不平衡与困难噪声样本(Hard Example Re-weighting)。
- 分类网络:对 1024 维度的全局特征进行 LayerNorm -> Linear -> SiLU -> Dropout -> Linear 降维处理,输出二分类概率。
性能指标
测试集指标:
- F1-Score: 0.8532
- Accuracy: 89.50%
- Precision: 82.63%
- Recall: 88.19%
使用方式
推荐使用 uv 进行依赖管理与执行。
1. 环境准备
uv venv
source .venv/bin/activate
uv add torch transformers huggingface_hub loguru tqdm scikit-learn accelerate
2. 执行推理
下载仓库内的 inference.py 脚本,执行批量推理:
uv run inference.py --input data.json
脚本默认指向本仓库拉取权重(包含定制的 classifier_head.pt),并在当前目录输出 accepted_words.json 与 rejected_words.json。
3. 数据格式参考 (data.json)
输入必须包含候选词及其关联语境列表:
{
"io_uring": {
"contexts": [
"Linux 6.12 对 io_uring 做了深度优化。",
"推荐使用 io_uring 替代传统的 epoll。"
]
}
}
- Downloads last month
- 67
Model tree for Saniter/BBS-NewWordFind
Base model
Qwen/Qwen3.5-0.8B-Base