apsua commited on
Commit
3cc121b
·
verified ·
1 Parent(s): 289048c

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +111 -3
  2. miron_en.parquet +3 -0
  3. miron_ru.parquet +3 -0
README.md CHANGED
@@ -1,3 +1,111 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ru
4
+ - en
5
+ license: mit
6
+ task_categories:
7
+ - text-generation
8
+ - fill-mask
9
+ tags:
10
+ - tokenization
11
+ - robustness
12
+ - morphology
13
+ - evaluation
14
+ - base-models
15
+ size_categories:
16
+ - 1K<n<10K
17
+ ---
18
+
19
+ # M.I.R.O.N. (Multi-aspect Inference Robustness on Objective Next-tokens)
20
+
21
+ **M.I.R.O.N.** is a specialized benchmark designed to evaluate the impact of tokenization and architectural constraints on the generation quality of small, **Base** language models (SLMs).
22
+
23
+ Unlike global benchmarks (MMLU, GSM8K), MIRON focuses on the atomic capabilities of a model: morphological generalization, noise robustness, and factual integrity within a simple next-token prediction task.
24
+
25
+ ## 🎯 Main Goal
26
+ To evaluate not the "intelligence" in complex reasoning, but the **fundamental capability to correctly process input data**, robustness to word fragmentation by the tokenizer, and prediction stability under noise conditions.
27
+
28
+ The benchmark is designed to be solvable even by small transformers. The tasks do not require Instruction Following, making this dataset ideal for testing **Pre-trained (Base)** checkpoints.
29
+
30
+ ## 🧩 Data Structure
31
+
32
+ The dataset consists of **4000 examples** (1000 per category), separated into two languages (`ru`, `en`). The dataset uses short category tags:
33
+
34
+ | Tag (Category) | Full Name | Description |
35
+ | :--- | :--- | :--- |
36
+ | **`Morphology`** | Morphological Generalization | Tests on pseudo-words (*wug-words*). Checks if the model can inflect non-existent words (e.g., *«wug» -> «wugs»*) based solely on grammar, without relying on lexical memory. |
37
+ | **`Facts`** | Factual Knowledge | Control group. Checks the integrity of perception regarding common named entities (e.g., *«Paris», «Sun»*). If the tokenizer splits them poorly, access to knowledge becomes difficult. |
38
+ | **`Logic`** | Logical Patterns | Simple numeric and algorithmic sequences (e.g., *«Tuesday -> Wednesday»*). Assesses token stitching when working with numbers and logic. |
39
+ | **`Noise`** | Noise Robustness | The context contains typos and perturbations. Evaluates how much the model's confidence "drifts" with slight input distortions. |
40
+
41
+ ## 📊 Dataset Fields
42
+ * **`prefix`**: Input context for the model.
43
+ * **`target`**: The expected continuation (ground truth).
44
+ * **`category`**: Test category (`Morphology`, `Facts`, `Logic`, `Noise`).
45
+
46
+ ## 📐 Evaluation Methodology (Metrics)
47
+
48
+ Two metrics are calculated for each example. This allows distinguishing a model that "does not know" (low Score) from a model that "doubts due to tokenization" (low Confidence).
49
+
50
+ 1. **Levenshtein Score (Generation Quality):**
51
+ Normalized Levenshtein distance. Evaluates how close the generated text is to the reference.
52
+ *Range: 0.0% – 100.0%*
53
+
54
+ $$
55
+ \text{Score}_c = \frac{1}{|D_c|} \sum_{i=1}^{|D_c|} \left( 1 - \frac{\text{Lev}(S_{\text{gen}}^{(i)}, S_{\text{ref}}^{(i)})}{\max(|S_{\text{gen}}^{(i)}|, |S_{\text{ref}}^{(i)}|)} \right) \times 100\%
56
+ $$
57
+
58
+ 2. **Target Confidence (Ground Truth Certainty):**
59
+ The geometric mean probability of the tokens that make up the **actual target**. It shows how ready the model was to output the correct answer.
60
+ *Range: 0.0% – 100.0%*
61
+
62
+ $$
63
+ \text{Conf}(S_{\text{ref}}) = \exp \left( \frac{1}{T} \sum_{j=1}^{T} \log P(t_j \mid \text{context}, t_{<j}) \right) \times 100\%
64
+ $$
65
+
66
+ ### 💻 Evaluation Code Example (Python)
67
+
68
+ ```python
69
+ import torch
70
+ import numpy as np
71
+ from Levenshtein import distance as lev_distance
72
+
73
+ def compute_metrics(model, tokenizer, prefix: str, target: str, generated_text: str, device='cuda'):
74
+ model.eval()
75
+
76
+ # 1. Levenshtein Score
77
+ max_len = max(len(generated_text), len(target))
78
+ if max_len == 0:
79
+ lev_score = 100.0
80
+ else:
81
+ dist = lev_distance(generated_text, target)
82
+ lev_score = (1 - dist / max_len) * 100.0
83
+
84
+ # 2. Target Confidence
85
+ prefix_ids = tokenizer(prefix, return_tensors="pt").input_ids.to(device)
86
+ full_ids = tokenizer(prefix + target, return_tensors="pt").input_ids.to(device)
87
+
88
+ prefix_len = prefix_ids.shape[1]
89
+ target_len = full_ids.shape[1] - prefix_len
90
+
91
+ if target_len <= 0:
92
+ return {'lev_score': round(lev_score, 2), 'target_confidence': 0.0}
93
+
94
+ with torch.no_grad():
95
+ logits = model(full_ids).logits
96
+
97
+ shift_logits = logits[0, prefix_len-1:-1, :]
98
+ target_labels = full_ids[0, prefix_len:]
99
+
100
+ log_probs = torch.log_softmax(shift_logits, dim=-1)
101
+ target_log_probs = torch.gather(log_probs, 1, target_labels.unsqueeze(1)).squeeze()
102
+
103
+ if target_log_probs.dim() == 0:
104
+ target_log_probs = target_log_probs.unsqueeze(0)
105
+
106
+ confidence = np.exp(target_log_probs.mean().item()) * 100.0
107
+
108
+ return {
109
+ 'lev_score': round(lev_score, 2),
110
+ 'target_confidence': round(confidence, 2)
111
+ }
miron_en.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c9d95c3f82a5dc8ac3e3481dca88d904bc5678cd4545ea2d5e371314d78cd2ab
3
+ size 97713
miron_ru.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5df2078aa0c30efe1a09cd4c460c69661b5d66e8f3a859ffb92e1b828cbc1997
3
+ size 153034