Commit ·
222b911
1
Parent(s): e489f8c
Update readme
Browse files
README.md
CHANGED
|
@@ -20,14 +20,15 @@ A normalized semi-synthetic Python dataset for training small language models on
|
|
| 20 |
|
| 21 |

|
| 22 |
|
| 23 |
-
## Why
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
Small language models develop latent logical representations but struggle with syntactic overhead. NPset-2 addresses this through the **TinyDSL v2** specification, which strips syntactic noise and provides explicit logical anchors.
|
| 26 |
|
| 27 |
## The v2 Specification
|
| 28 |
|
|
|
|
| 29 |
|
| 30 |
-
NPset-2 introduces significant improvements over v1, designed to minimize "token tax" and maximize the model's ability to track long-range logical dependencies:
|
| 31 |
|
| 32 |
1. **Explicit Block Scoping**: All indented blocks (if, for, while, try, with) now use numbered/named anchors: `begin if 1` ... `end if 1`. This provides unambiguous attention anchors for small models.
|
| 33 |
2. **Natural Language Phrasing**:
|
|
@@ -43,14 +44,14 @@ NPset-2 introduces significant improvements over v1, designed to minimize "token
|
|
| 43 |
|
| 44 |
## Performance (Context Capacity)
|
| 45 |
|
| 46 |
-
When tested against standard tokenizers, TinyDSL v2 significantly expands the effective context window for logic-heavy training:
|
| 47 |
|
| 48 |
| Tokenizer | Reduction (Tokens) | Context Capacity (2048 window) |
|
| 49 |
| :--- | :--- | :--- |
|
| 50 |
-
| **GPTX (Custom 32k)** | **
|
| 51 |
-
| **GPT-2** | **
|
| 52 |
-
| Qwen 2.5 |
|
| 53 |
-
| Llama 3 |
|
| 54 |
|
| 55 |
*Note: While raw character counts increase by ~17%, the "Token Tax" for logical constructs is drastically reduced for models not pre-specialized for code syntax.*
|
| 56 |
|
|
@@ -67,9 +68,5 @@ Parquet format with the following schema:
|
|
| 67 |
|
| 68 |
## Sources
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
- `nomic-ai/cornstack-python-v1`
|
| 73 |
-
- `zaydzuhri/stack-edu-python`
|
| 74 |
-
- `jtatman/python-code-dataset-500k`
|
| 75 |
-
- And other curated sources.
|
|
|
|
| 20 |
|
| 21 |

|
| 22 |
|
| 23 |
+
## Why
|
| 24 |
+
|
| 25 |
+
Small language models trained on natural language corpora develop latent representations of logical constructs -- iteration, conditionals, data flow, function composition -- yet struggle to apply this reasoning to source code, where syntactic overhead (delimiters, indentation conventions, language-specific idioms) occupies a disproportionate share of the token budget, requires a vocabulary of code-specific tokens, and introduces a surface-form distribution shift relative to the model's prior knowledge. NPset-2 addresses this by normalizing Python source through an AST-based converter that strips syntactic noise while preserving the full logical structure of each program, producing a pseudocode representation composed entirely of natural language tokens that aligns more directly with the semantic representations already present in small models, allowing them to reason about what code *does* rather than expending capacity learning what it *looks like*.
|
| 26 |
|
|
|
|
| 27 |
|
| 28 |
## The v2 Specification
|
| 29 |
|
| 30 |
+
NPset-2 introduces significant improvements over v1, trading some relative token compression for far lower semantic overhead.
|
| 31 |
|
|
|
|
| 32 |
|
| 33 |
1. **Explicit Block Scoping**: All indented blocks (if, for, while, try, with) now use numbered/named anchors: `begin if 1` ... `end if 1`. This provides unambiguous attention anchors for small models.
|
| 34 |
2. **Natural Language Phrasing**:
|
|
|
|
| 44 |
|
| 45 |
## Performance (Context Capacity)
|
| 46 |
|
| 47 |
+
When tested against standard tokenizers, TinyDSL v2 significantly expands the effective context window for logic-heavy training with natural language tokenizers:
|
| 48 |
|
| 49 |
| Tokenizer | Reduction (Tokens) | Context Capacity (2048 window) |
|
| 50 |
| :--- | :--- | :--- |
|
| 51 |
+
| **GPTX (Custom 32k)** | **13.7%** | **7.1 -> 8.3 examples (+15.9%)** |
|
| 52 |
+
| **GPT-2** | **16.6%** | **7.4 -> 8.9 examples (+19.9%)** |
|
| 53 |
+
| Qwen 2.5 | 8.1% | 10.1 -> 9.3 examples (-7.5%) |
|
| 54 |
+
| Llama 3 | 2.2% | 8.3 -> 8.1 examples (-2.2%) |
|
| 55 |
|
| 56 |
*Note: While raw character counts increase by ~17%, the "Token Tax" for logical constructs is drastically reduced for models not pre-specialized for code syntax.*
|
| 57 |
|
|
|
|
| 68 |
|
| 69 |
## Sources
|
| 70 |
|
| 71 |
+
- `HuggingFaceTB/stack-edu (python)`
|
| 72 |
+
|
|
|
|
|
|
|
|
|
|
|
|