| --- |
| license: apache-2.0 |
| language: |
| - vi |
| task_categories: |
| - text-ranking |
| tags: |
| - reranker |
| - cross-encoder |
| - legal |
| - vietnamese |
| - vlsp |
| - hard-negatives |
| pretty_name: VLSP Vietnamese Legal Reranker — Train + Eval |
| size_categories: |
| - 1K<n<10K |
| configs: |
| - config_name: train |
| data_files: train.jsonl |
| default: true |
| - config_name: eval |
| data_files: eval.json |
| --- |
| |
| # VLSP Vietnamese Legal Reranker — Training + Eval data |
|
|
| Bộ dữ liệu **listwise reranking** cho truy hồi điều luật tiếng Việt (VLSP). Đây **chính xác** là |
| dữ liệu đã dùng để fine-tune 2 model reranker: |
|
|
| - 🤗 [`hoailebads/Qwen3-Reranker-8B-VLSP-Legal-LoRA`](https://huggingface.co/hoailebads/Qwen3-Reranker-8B-VLSP-Legal-LoRA) (bản chính, vượt SOTA VLSP) |
| - 🤗 [`hoailebads/Qwen3-Reranker-0.6B-VLSP-Legal-LoRA`](https://huggingface.co/hoailebads/Qwen3-Reranker-0.6B-VLSP-Legal-LoRA) (bản nhẹ) |
|
|
| 📦 Code, pipeline & script tạo dữ liệu: **https://github.com/hoaileba/Qwen-Retrieval-Tuning** |
| (file gốc: `dataset/train_rankllama_hn23_v3.jsonl`, tạo bằng `data_prep/mine_hard_negatives_v3.py`). |
|
|
| --- |
|
|
| ## Nội dung |
|
|
| | File | Split | Số dòng | Định dạng | Mô tả | |
| |---|---|---|---|---| |
| | `train.jsonl` | train | **9,994** | JSONL | mỗi dòng = 1 query + 1 positive + tối đa 23 hard negative | |
| | `eval.json` | eval | **296** | JSON array | query + 1 positive (dedup theo `aid` còn **219** query unique) | |
|
|
| ### `train.jsonl` — schema mỗi dòng |
|
|
| ```json |
| { |
| "id": "d9189b1cc63747b4e879984e5a72d190", |
| "question": "Những trường hợp nào không tiếp tục sử dụng đối với công trình hết thời hạn...", |
| "positive": {"id": "06/2021/nđ-cp|41", "text": "Điều 41. Xử lý đối với công trình..."}, |
| "negatives": ["Điều 19. Vi phạm quy định về bảo hành...", "..."], |
| "_source": "zalo", |
| "_neg_source": "teacher_aiteamvn_v3" |
| } |
| ``` |
|
|
| - `positive` là **điều luật đúng** (index 0 khi train listwise). |
| - `negatives` là **hard negative** mine bằng dense retriever + teacher reranker (23/query cho |
| phần lớn mẫu). |
| - Loss listwise: positive ở vị trí 0, negatives là các lựa chọn còn lại (InfoNCE, không dùng |
| in-batch negative). |
|
|
| ### `eval.json` — schema mỗi record |
|
|
| ```json |
| {"id": "11075", "question": "Người đi xe máy đâm vào xe ôtô...", "positive": {"id": 56886, "text": "Luật quy định về giao thông..."}} |
| ``` |
|
|
| Query eval **chỉ có ground-truth positive**; ứng viên để rerank được sinh riêng bằng bi-encoder |
| (top-100), xem repo GitHub. |
|
|
| --- |
|
|
| ## Thống kê `train.jsonl` |
|
|
| | Thuộc tính | Giá trị | |
| |---|---| |
| | Tổng số mẫu | 9,994 | |
| | Nguồn (`_source`) | `synthetic` 5,530 · `zalo` 2,477 · `vlsp` 1,987 | |
| | Nguồn negative (`_neg_source`) | `teacher_aiteamvn_v3` (toàn bộ) | |
| | Số negative/mẫu | 23 (9,051 mẫu) · 19 (59) · các mức thấp hơn cho phần còn lại | |
|
|
| ## Cách nạp |
|
|
| ```python |
| from datasets import load_dataset |
| |
| train = load_dataset("hoailebads/VLSP-Legal-Reranker-Train", "train", split="train") |
| eval_ = load_dataset("hoailebads/VLSP-Legal-Reranker-Train", "eval", split="train") |
| print(train[0]["question"], train[0]["positive"]["id"], len(train[0]["negatives"])) |
| ``` |
|
|
| ## Giới hạn |
|
|
| - Miền hẹp: **điều luật tiếng Việt** (VLSP + Zalo legal). Không dùng cho miền khác mà không re-mine |
| hard negative. |
| - 55% mẫu train là `synthetic` (câu hỏi sinh tự động) — xem thảo luận về overfit/nhãn trong |
| [`results/`](https://github.com/hoaileba/Qwen-Retrieval-Tuning/tree/main/results) của repo. |
| - Hard negative là **teacher-mined**, có thể chứa false negative (điều luật thực ra liên quan). |
|
|
| ## License |
|
|
| Apache-2.0. Văn bản luật gốc thuộc phạm vi công (VLSP / Zalo legal corpus). |
|
|