commit e5ae995659728a3d03b89027647cfadc2775574e Author: ModelHub XC Date: Wed Sep 2 06:08:16 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: overthelex/qwen2.5-14b-edrsr-legal-uk Source: Original Platform diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..52373fe --- /dev/null +++ b/.gitattributes @@ -0,0 +1,36 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text +tokenizer.json filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md new file mode 100644 index 0000000..66423c4 --- /dev/null +++ b/README.md @@ -0,0 +1,82 @@ +--- +license: apache-2.0 +language: +- uk +base_model: Qwen/Qwen2.5-14B +tags: +- legal +- ukrainian +- continued-pretraining +- court-decisions +datasets: +- overthelex/edrsr-court-decisions +library_name: transformers +pipeline_tag: text-generation +--- + +# Qwen2.5-14B-EDRSR-Legal-UK + +Ukrainian legal domain model obtained by continued pretraining (CPT) of [Qwen/Qwen2.5-14B](https://huggingface.co/Qwen/Qwen2.5-14B) on the EDRSR corpus of Ukrainian court decisions. + +Part of a scaling experiment (0.5B / 1.5B / 3B / 14B) for the PhD dissertation at Glushkov Institute of Cybernetics, NAS of Ukraine. + +## Training Data + +- **Corpus:** Unified State Register of Court Decisions of Ukraine (EDRSR) +- **Documents:** 33.9M court decisions (after dedup + quality filtering from 38.5M) +- **Tokens:** 161.4B tokens (Qwen2 BPE tokenizer, fertility = 0.515 for Ukrainian legal text) +- **Sequence length:** 8,192 tokens +- **Shards:** 1,233 pre-packaged numpy shards + +## Training Details + +- **Hardware:** 8x NVIDIA H100 SXM 80GB (NVIDIA Innovation Lab via Brev) +- **Framework:** HuggingFace Trainer + DeepSpeed ZeRO-3 +- **Precision:** bfloat16 +- **Global batch size:** 128 sequences (1.05M tokens/step) +- **Total steps:** 9,536 (10B tokens processed) +- **Training time:** 44 hours +- **Throughput:** 22K tokens/sec, 44.9 sec/step + +## Results + +| Metric | Value | +|--------|-------| +| Initial loss (step 10) | 0.84 | +| Final loss (step 9,536) | 0.22 | +| Loss reduction | -74% | +| Base perplexity | 2.84 | +| **CPT perplexity** | **1.28** | +| **Perplexity reduction** | **-54.8%** | + +## Scaling Law + +All four models in the series converge to similar perplexity after CPT: + +| Model | Base PPL | CPT PPL | Reduction | +|-------|----------|---------|-----------| +| [0.5B](https://huggingface.co/overthelex/qwen2.5-0.5b-edrsr-legal-uk) | 6.83 | 1.35 | -80% | +| [1.5B](https://huggingface.co/overthelex/qwen2.5-1.5b-edrsr-legal-uk) | 4.61 | 1.31 | -72% | +| [3B](https://huggingface.co/overthelex/qwen2.5-3b-edrsr-legal-uk) | 3.83 | 1.30 | -66% | +| [14B](https://huggingface.co/overthelex/qwen2.5-14b-edrsr-legal-uk) | 2.84 | 1.28 | -55% | + +## Intended Use + +This is a **base model** (not instruction-tuned). It is intended for: +- Research on domain adaptation of LLMs for low-resource legal languages +- Downstream fine-tuning for Ukrainian legal NLP tasks +- Scaling law analysis of continued pretraining +- Perplexity evaluation on Ukrainian legal text + +## Limitations + +- Not instruction-tuned; will not follow instructions or chat +- Trained on Ukrainian court decisions only; may not generalize to other legal systems + +## Related Resources + +- [EDRSR Court Decisions Dataset](https://huggingface.co/datasets/overthelex/edrsr-court-decisions) +- [Tokenizer Fertility Paper (arXiv:2605.14890)](https://arxiv.org/abs/2605.14890) +- [Citation Graph Paper (arXiv:2605.15362)](https://arxiv.org/abs/2605.15362) +- [Statute Retrieval Paper (arXiv:2605.17639)](https://arxiv.org/abs/2605.17639) +- [UA-StatuteRetrieval Benchmark](https://huggingface.co/datasets/overthelex/ua-statute-retrieval) diff --git a/config.json b/config.json new file mode 100644 index 0000000..aee27c8 --- /dev/null +++ b/config.json @@ -0,0 +1,81 @@ +{ + "architectures": [ + "Qwen2ForCausalLM" + ], + "attention_dropout": 0.0, + "bos_token_id": 151643, + "dtype": "bfloat16", + "eos_token_id": 151643, + "hidden_act": "silu", + "hidden_size": 5120, + "initializer_range": 0.02, + "intermediate_size": 13824, + "layer_types": [ + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention" + ], + "max_position_embeddings": 131072, + "max_window_layers": 48, + "model_type": "qwen2", + "num_attention_heads": 40, + "num_hidden_layers": 48, + "num_key_value_heads": 8, + "pad_token_id": null, + "rms_norm_eps": 1e-05, + "rope_parameters": { + "rope_theta": 1000000.0, + "rope_type": "default" + }, + "sliding_window": null, + "tie_word_embeddings": false, + "transformers_version": "5.9.0", + "use_cache": false, + "use_sliding_window": false, + "vocab_size": 152064 +} diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..7d60750 --- /dev/null +++ b/generation_config.json @@ -0,0 +1,7 @@ +{ + "bos_token_id": 151643, + "do_sample": false, + "eos_token_id": 151643, + "max_new_tokens": 2048, + "transformers_version": "5.9.0" +} diff --git a/model.safetensors b/model.safetensors new file mode 100644 index 0000000..508c2e0 --- /dev/null +++ b/model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:834185445d6e3c77d6517040eb6198cac6b91cabf96f71b9c60ed5302957a506 +size 29540134824 diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..34510ff --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3fd169731d2cbde95e10bf356d66d5997fd885dd8dbb6fb4684da3f23b2585d8 +size 11421892 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..df536e9 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,30 @@ +{ + "add_prefix_space": false, + "backend": "tokenizers", + "bos_token": null, + "clean_up_tokenization_spaces": false, + "eos_token": "<|endoftext|>", + "errors": "replace", + "extra_special_tokens": [ + "<|im_start|>", + "<|im_end|>", + "<|object_ref_start|>", + "<|object_ref_end|>", + "<|box_start|>", + "<|box_end|>", + "<|quad_start|>", + "<|quad_end|>", + "<|vision_start|>", + "<|vision_end|>", + "<|vision_pad|>", + "<|image_pad|>", + "<|video_pad|>" + ], + "is_local": false, + "local_files_only": false, + "model_max_length": 131072, + "pad_token": "<|endoftext|>", + "split_special_tokens": false, + "tokenizer_class": "Qwen2Tokenizer", + "unk_token": null +}