mahwizzzz commited on
Commit
9ae456b
·
verified ·
1 Parent(s): 2897994

Add PakMosaic-Small research-preview weights, training summary, and diagnostic evals

Browse files
README.md ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: pytorch
3
+ license: apache-2.0
4
+ pipeline_tag: fill-mask
5
+ language:
6
+ - ur
7
+ - ps
8
+ - pa
9
+ - sd
10
+ - skr
11
+ - ks
12
+ - gu
13
+ tags:
14
+ - pakmosaic
15
+ - pakistan
16
+ - multilingual
17
+ - encoder
18
+ - research-preview
19
+ - sota-target
20
+ - fill-mask
21
+ ---
22
+
23
+ # PakMosaic-Small
24
+
25
+ **Pakistan NLP Suite** · published by [Proxima AI](https://huggingface.co/ProximaAI)
26
+
27
+ **Status:** research preview · **SOTA-target** · not a factual SOTA claim
28
+ `SOTA_VERIFIED = false`
29
+
30
+ This is the finished **~67M** PakMosaic encoder after a **2B-token** serious train on the clean scale mix. It is not PakMosaic-Base-132M (that run is still in progress). It is not a published SOTA model.
31
+
32
+ ## Training result
33
+
34
+ | item | value |
35
+ | --- | --- |
36
+ | run | `pakmosaic-small_20260925T090924Z` |
37
+ | last step | 2,904,769 |
38
+ | tokens seen | 2,000,000,068 / 2,000,000,000 |
39
+ | last-500 mean MLM loss | 1.958 |
40
+ | last-500 mean masked accuracy | 0.640 |
41
+ | hardware | NVIDIA GeForce RTX 4060 8GB (solo) |
42
+ | objective | masked language modeling, mask prob 0.15 |
43
+ | seq length | 512 |
44
+ | tokenizer | PakMosaic-Tokenizer-32k (`hf_byte_bpe_32k_identity`) |
45
+
46
+ Last-batch loss jumps by language. The 500-step mean is the number to quote.
47
+
48
+ ## Diagnostic evals (not PakBench)
49
+
50
+ These are engineering sanity checks from `python -m paknlp_registry encoder evaluate`. They are **not** frozen benchmark scores.
51
+
52
+ | check | result |
53
+ | --- | ---: |
54
+ | Same Urdu sentence vs spacing/punctuation noise (cosine) | 0.760 |
55
+ | Near paraphrase pair (cosine) | 0.900 |
56
+ | Unrelated pair (cosine) | 0.689 |
57
+ | Urdu vs Pashto mean-pool centroid cosine | 0.890 |
58
+
59
+ Near > far is the expected direction. Centroid cosine is **not** a language-ID score.
60
+
61
+ SOTA gate (required PakBench evidence): **failed closed**. Missing frozen evaluation, contamination certificate, multi-language task results, macros, and contemporary baselines. Do not write SOTA on this card until that gate returns true.
62
+
63
+ ## Architecture
64
+
65
+ Encoder-only MLM: pre-norm, RoPE, GeGLU, full attention, tied embeddings.
66
+
67
+ | | |
68
+ | --- | ---: |
69
+ | hidden size | 512 |
70
+ | layers | 12 |
71
+ | heads | 8 |
72
+ | intermediate | 2048 |
73
+ | vocab | 32,000 |
74
+
75
+ This is a custom `PakEncoderForMLM` checkpoint (`model.safetensors` + `config.json`). It is **not** a drop-in `AutoModel` BERT.
76
+
77
+ ## How to load
78
+
79
+ ```python
80
+ import json
81
+ from pathlib import Path
82
+ import torch
83
+ from huggingface_hub import hf_hub_download
84
+ from safetensors.torch import load_file
85
+
86
+ # Install the Pakistan NLP Suite package, then:
87
+ from paknlp_registry.encoder.config import EncoderConfig, SamplingConfig, MaskingConfig, TrainConfig
88
+ from paknlp_registry.encoder.model import PakEncoderForMLM
89
+
90
+ repo = "ProximaAI/PakMosaic-Small"
91
+ cfg_path = hf_hub_download(repo, "config.json")
92
+ raw = json.loads(Path(cfg_path).read_text(encoding="utf-8"))
93
+ raw.pop("algebraic_parameters", None)
94
+ if isinstance(raw.get("sampling"), dict):
95
+ raw["sampling"] = SamplingConfig(**raw["sampling"])
96
+ if isinstance(raw.get("masking"), dict):
97
+ raw["masking"] = MaskingConfig(**raw["masking"])
98
+ if isinstance(raw.get("train"), dict):
99
+ raw["train"] = TrainConfig(**raw["train"])
100
+ model = PakEncoderForMLM(EncoderConfig(**raw))
101
+ weights = load_file(hf_hub_download(repo, "model.safetensors"))
102
+ model.load_state_dict(weights)
103
+ model.eval()
104
+ ```
105
+
106
+ Tokenizer artifact: `hf_byte_bpe_32k_identity` (hash `0f55e47920211588e6985172cd71338c8aff6226fe912c9668055b44bacc7ce7`). Frozen Urdu fertility 1.250 vs XLM-R 1.382 is a **tokenizer** metric, not model SOTA.
107
+
108
+ ## Data
109
+
110
+ Training mix is Wikimedia plus third-party web crawls used under their original terms. **Only Wikimedia / CC BY-SA is redistributed on the Hub:** [PakMosaic-Wikimedia-v0.2](https://huggingface.co/datasets/ProximaAI/PakMosaic-Wikimedia-v0.2).
111
+
112
+ FineWeb2, HPLT 2.0, and Common Voice are **not** re-uploaded here. Get those from the original steward.
113
+
114
+ Languages actually sampled in this run: Pashto, Urdu, Punjabi Shahmukhi, Saraiki, Sindhi, Kashmiri, Gujarati. 66 registered identities are not 66 trained languages.
115
+
116
+ ## Intended use
117
+
118
+ Research on Pakistan-language representation learning and reproduction of the public Wikimedia subset.
119
+
120
+ ## Out of scope
121
+
122
+ Production deployment, surveillance, claiming 66-language training, or calling this model SOTA.
123
+
124
+ ## Family
125
+
126
+ | model | params | this release |
127
+ | --- | ---: | --- |
128
+ | PakMosaic-Micro | ~26.6M | earlier engineering run |
129
+ | **PakMosaic-Small** | **~67M** | **this repo, 2B tokens** |
130
+ | PakMosaic-Base-132M | ~132.5M | training, not published |
131
+
132
+ Project landing: [ProximaAI/PakMosaic](https://huggingface.co/ProximaAI/PakMosaic)
133
+
134
+ ## Citation
135
+
136
+ Cite the Pakistan NLP Suite / PakMosaic repository version until a paper exists.
137
+
138
+ ## Acknowledgements
139
+
140
+ Wikipedia volunteer editors, native reviewers, and [Proxima AI](https://huggingface.co/ProximaAI).
config.json ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "pakmosaic_small",
3
+ "hidden_size": 512,
4
+ "num_hidden_layers": 12,
5
+ "num_attention_heads": 8,
6
+ "intermediate_size": 2048,
7
+ "vocab_size": 32000,
8
+ "max_position_embeddings": 512,
9
+ "rope_theta": 10000.0,
10
+ "attention_dropout": 0.0,
11
+ "hidden_dropout": 0.0,
12
+ "ffn_activation": "geglu",
13
+ "attention_kind": "full",
14
+ "local_window": 128,
15
+ "global_every": 3,
16
+ "use_bias": false,
17
+ "tie_word_embeddings": true,
18
+ "pad_token_id": 0,
19
+ "bos_token_id": 1,
20
+ "eos_token_id": 2,
21
+ "unk_token_id": 3,
22
+ "mask_token_id": 4,
23
+ "layer_norm_eps": 1e-05,
24
+ "initializer_range": 0.02,
25
+ "tokenizer_id": "hf_byte_bpe_32k_identity",
26
+ "public_name": "PakMosaic-Small",
27
+ "script_signal": "none",
28
+ "sampling": {
29
+ "kind": "temperature",
30
+ "temperature": 3.0,
31
+ "anneal_start_temperature": 5.0,
32
+ "anneal_end_temperature": 1.0,
33
+ "min_language_prob": 0.01,
34
+ "languages": [
35
+ "pus_Arab",
36
+ "urd_Arab",
37
+ "pnb_Arab",
38
+ "skr_Arab",
39
+ "snd_Arab",
40
+ "kas_Arab",
41
+ "guj_Gujr"
42
+ ]
43
+ },
44
+ "masking": {
45
+ "kind": "fixed",
46
+ "mask_prob": 0.15,
47
+ "scheduled_peak": 0.3,
48
+ "replace_prob": 0.8,
49
+ "random_prob": 0.1,
50
+ "keep_prob": 0.1
51
+ },
52
+ "train": {
53
+ "max_seq_len": 512,
54
+ "smoke_seq_len": 128,
55
+ "token_budget": 2000000000,
56
+ "micro_batch_size": 2,
57
+ "grad_accum": 8,
58
+ "learning_rate": 0.0003,
59
+ "weight_decay": 0.01,
60
+ "warmup_steps": 50,
61
+ "max_grad_norm": 1.0,
62
+ "seed": 42,
63
+ "log_every": 10,
64
+ "checkpoint_every": 20000,
65
+ "keep_last_checkpoints": 2,
66
+ "require_expensive_confirm": true
67
+ },
68
+ "algebraic_parameters": {
69
+ "embeddings": 16384000,
70
+ "layers": 50343936,
71
+ "mlm_head": 263168,
72
+ "total": 66991616,
73
+ "trainable": 66991616
74
+ }
75
+ }
evals.json ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "public_name": "PakMosaic-Small",
3
+ "run_id": "pakmosaic-small_20260925T090924Z",
4
+ "step": 2904769,
5
+ "tokens_seen_checkpoint": 2000000068,
6
+ "parameter_count": {
7
+ "total": 67037952,
8
+ "trainable": 67037952
9
+ },
10
+ "training": {
11
+ "step": 2904769,
12
+ "tokens_seen": 2000000068,
13
+ "token_budget": 2000000000,
14
+ "last_loss": 3.107429265975952,
15
+ "last_masked_accuracy": 0.4583333432674408,
16
+ "mean_loss_last_500": 1.9579948586970568,
17
+ "mean_masked_accuracy_last_500": 0.6402293934822082,
18
+ "n": 500
19
+ },
20
+ "diagnostic_eval": {
21
+ "checkpoint": "/home/mahwiz/ai-workspace/mahwiz/pakmosaic/runs/pakmosaic-small_20260925T090924Z/final.pt",
22
+ "step": 2904769,
23
+ "perturbation": {
24
+ "label": "DIAGNOSTIC_NOT_PAKBENCH",
25
+ "kind": "same_sentence_perturbation",
26
+ "cosine": 0.7603878974914551,
27
+ "note": "Engineering sanity only. Not a semantic benchmark."
28
+ },
29
+ "urdu_pairs": {
30
+ "label": "DIAGNOSTIC_NOT_PAKBENCH",
31
+ "kind": "urdu_pair_sanity",
32
+ "pairs": [
33
+ {
34
+ "tag": "near",
35
+ "cosine": 0.9000482559204102
36
+ },
37
+ {
38
+ "tag": "far",
39
+ "cosine": 0.6890260577201843
40
+ }
41
+ ]
42
+ },
43
+ "language_centroids": {
44
+ "label": "DIAGNOSTIC_NOT_PAKBENCH",
45
+ "kind": "language_clustering_diagnostic",
46
+ "pairwise_cosine": {
47
+ "urd_Arab__pus_Arab": 0.8904119729995728
48
+ },
49
+ "note": "Untrained or barely-trained centroids are not language-ID scores."
50
+ },
51
+ "label": "DIAGNOSTIC_NOT_PAKBENCH"
52
+ },
53
+ "sota_gate": {
54
+ "SOTA_VERIFIED": false,
55
+ "checkpoint": "/home/mahwiz/ai-workspace/mahwiz/pakmosaic/runs/pakmosaic-small_20260925T090924Z/final.pt",
56
+ "missing_evidence": [
57
+ "frozen_evaluation",
58
+ "contamination_zero",
59
+ "multiple_pakistan_languages",
60
+ "contemporary_baselines",
61
+ "task_level_results",
62
+ "macro",
63
+ "low_resource_macro",
64
+ "worst_language",
65
+ "not_tokenizer_fertility_only"
66
+ ],
67
+ "public_label": "research preview",
68
+ "note": "A tokenizer fertility win is not model SOTA. Do not write SOTA on a model card until this gate returns true."
69
+ },
70
+ "SOTA_VERIFIED": false,
71
+ "label": "research preview",
72
+ "note": "Diagnostic evals are not PakBench. Weights are inference safetensors only.",
73
+ "safetensors": {
74
+ "path": "/home/mahwiz/ai-workspace/mahwiz/pakmosaic/release/hf_small_staging/model.safetensors",
75
+ "sha256": "209c1aa99ff759ffdad62f38467ff4a8945c7a94397a7440ab815ba9e47529b7"
76
+ },
77
+ "not_uploaded": [
78
+ "FineWeb2",
79
+ "HPLT",
80
+ "Common Voice",
81
+ "optimizer .pt"
82
+ ]
83
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:209c1aa99ff759ffdad62f38467ff4a8945c7a94397a7440ab815ba9e47529b7
3
+ size 333698800
tokenizer/meta.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": "hf_byte_bpe_32k_identity",
3
+ "status": "trained",
4
+ "normalization": "identity",
5
+ "normalization_note": "identity leaves original code points unchanged; nfc recomposes canonical equivalents",
6
+ "training_manifest_hash": "1abe78dd7c9dc9f93ac65bce02fb0c5d8ea501c65c12d4f3d660024935174319",
7
+ "n_train_lines": 24683,
8
+ "config": {
9
+ "id": "hf_byte_bpe_32k_identity",
10
+ "family": "hf_byte_bpe",
11
+ "vocab_size": 32000,
12
+ "normalization": "identity",
13
+ "seed": 42
14
+ },
15
+ "embedding_cost": {
16
+ "vocab_size": 32000,
17
+ "parameters": {
18
+ "384": 12288000,
19
+ "768": 24576000,
20
+ "1024": 32768000
21
+ },
22
+ "fp32_bytes": {
23
+ "384": 49152000,
24
+ "768": 98304000,
25
+ "1024": 131072000
26
+ },
27
+ "bf16_bytes": {
28
+ "384": 24576000,
29
+ "768": 49152000,
30
+ "1024": 65536000
31
+ }
32
+ },
33
+ "artifact_bytes": 2884675,
34
+ "reload_reproduced_first_example": true,
35
+ "vocab_collapsed": false,
36
+ "vocab_collapse_note": null,
37
+ "family": "hf_byte_bpe",
38
+ "model_path": "tokenizer\\artifacts\\open_release\\hf_byte_bpe_32k_identity\\tokenizer.json",
39
+ "requested_vocab_size": 32000,
40
+ "actual_vocab_size": 32000,
41
+ "artifact_hash": "0f55e47920211588e6985172cd71338c8aff6226fe912c9668055b44bacc7ce7",
42
+ "byte_fallback": true,
43
+ "seed": 42
44
+ }
tokenizer/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
training_summary.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "step": 2904769,
3
+ "tokens_seen": 2000000068,
4
+ "token_budget": 2000000000,
5
+ "last_loss": 3.107429265975952,
6
+ "last_masked_accuracy": 0.4583333432674408,
7
+ "mean_loss_last_500": 1.9579948586970568,
8
+ "mean_masked_accuracy_last_500": 0.6402293934822082,
9
+ "n": 500
10
+ }