File size: 2,006 Bytes
0b22c32
 
 
 
 
 
 
 
 
 
7e2be7f
0b22c32
7e2be7f
0b22c32
7e2be7f
0b22c32
7e2be7f
 
 
 
 
 
 
 
 
 
 
b33bdbc
7e2be7f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
license: mit
pretty_name: OpenWebText n-grams
size_categories:
- 100K<n<1M
tags:
- openwebtext
- gpt2
---

# Dataset Card for OpenWebText n-grams

## Dataset Summary

This dataset contains 246K of the most common token-based (GPT-2/GPT-3) n-grams (n=1 to n=6), in the [OpenWebText (OWT) dataset](https://huggingface.co/datasets/Skylion007/openwebtext).

For convenient searching, it provides full tokens/strings, as well as per-position tokens/strings.

## Usage

Generally, this dataset allows identifying the most common n-grams in a text corpus.

When researching LLMs [tokenized similarly to GPT-2/GPT-3](https://platform.openai.com/tokenizer), it allows:
- Constructing intermediate vectors spanning the most common short phrases (n-grams), e.g. for similarity sampling.
- Fast searches for common phrases containing particular tokens or substrings (and in particular sequence positions).
- Showing the effects of training set n-gram frequency.

The authors (Thomas Dooms and Dan Wilhelm) used this dataset to show that sparse auto-encoders are biased toward reconstructing the most common n-grams.

## Loading the Dataset

We recommend you convert the dataset to a Pandas DataFrame for easy querying:

```python
from datasets import load_dataset

ngrams = load_dataset('danwil/owt-ngrams')['train'].to_pandas()
```

## Contents

Below, we list the number of n-grams and their count/frequency in the original ~9B-token OWT corpus. 
- We include all individual tokens (1-grams).
- Note that if an n-gram occurs >N times, then every contiguous subsequence must also occur >N times.

|                   | total  | n=1    | n=2      | n=3      | n=4    | n=5    | n=6    |
| ---               | -----  |------  | ------   | ------   | ------ | ------ | ------ |
| owt_1-6grams_246k | 245831 | 50257  | 58302    | 44560    | 32831  | 13566  | 12495  |
|      count in OWT |        | >= 0   | >= 10000 | >= 10000 | > 5000 | > 5000 | > 2000 |


**Point of Contact:** [Dan Wilhelm](mailto:dan@danwil.com)