Spaces:
Runtime error
Runtime error
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,12 +1,50 @@
|
|
| 1 |
---
|
| 2 |
-
title: Markov
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
-
pinned:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Markov Chain Language Model
|
| 3 |
+
emoji: 🔗
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.0
|
| 8 |
app_file: app.py
|
| 9 |
+
pinned: true
|
| 10 |
+
license: mit
|
| 11 |
+
models:
|
| 12 |
+
- OpenTransformer/markov-5gram-500m
|
| 13 |
+
short_description: N-gram LM with Kneser-Ney smoothing
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# Markov Chain Language Model
|
| 17 |
+
|
| 18 |
+
Interactive demo of a classical n-gram language model with Modified Kneser-Ney smoothing.
|
| 19 |
+
|
| 20 |
+
**No neural network** — this is pure statistical language modelling using n-gram counts and interpolated backoff.
|
| 21 |
+
|
| 22 |
+
## Architecture
|
| 23 |
+
|
| 24 |
+
- **Model**: 5-gram with Modified Kneser-Ney smoothing
|
| 25 |
+
- **Training data**: 500M tokens from web crawl datasets
|
| 26 |
+
- **Storage**: GPU hash tables (sorted int64 keys + `torch.searchsorted`)
|
| 27 |
+
- **Inference**: Batch-parallel probability computation via binary search
|
| 28 |
+
|
| 29 |
+
## How It Works
|
| 30 |
+
|
| 31 |
+
1. **Count**: Track how often every sequence of 1-5 tokens appears in training data
|
| 32 |
+
2. **Smooth**: Apply Modified Kneser-Ney smoothing to handle unseen n-grams
|
| 33 |
+
3. **Predict**: For a given context, compute P(next_token | context) across all orders
|
| 34 |
+
4. **Sample**: Draw from the smoothed distribution with temperature/top-k/top-p
|
| 35 |
+
|
| 36 |
+
## Performance
|
| 37 |
+
|
| 38 |
+
| Metric | Value |
|
| 39 |
+
|--------|-------|
|
| 40 |
+
| Perplexity (Pile) | 46,047 |
|
| 41 |
+
| Top-1 Accuracy (Pile) | 15.14% |
|
| 42 |
+
| N-gram entries | 61.6M |
|
| 43 |
+
| Memory | 1.83 GB |
|
| 44 |
+
|
| 45 |
+
## Links
|
| 46 |
+
|
| 47 |
+
- Model weights: [OpenTransformer/markov-5gram-500m](https://huggingface.co/OpenTransformer/markov-5gram-500m)
|
| 48 |
+
- Organisation: [OpenTransformer](https://huggingface.co/OpenTransformer)
|
| 49 |
+
|
| 50 |
+
Built by OpenTransformers Ltd. Part of AGILLM research.
|