cyrilzhang
commited on
Commit
•
91ef5c9
1
Parent(s):
8dfc16d
Update README.md
Browse files
README.md
CHANGED
@@ -32,3 +32,38 @@ dataset_info:
|
|
32 |
dataset_size: 918480000
|
33 |
---
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
dataset_size: 918480000
|
33 |
---
|
34 |
|
35 |
+
Data for [**Flip-Flop Language Modeling**](https://arxiv.org/abs/2306.00946). The task is to correctly execute the sequential operations of a 1-bit register. The Transformer architecture, despite being apparently built for this operation, makes sporadic extrapolation errors (*attention glitches*). An open challenge is to fix these without recourse to long-tailed data or a recurrent architecture. Splits reflect the FFLM setup from the paper:
|
36 |
+
- `train`: 1.6M sequences from FFL(0.8) *(256 instructions, 80% ignore, 10% read, 10% write)*.
|
37 |
+
- `val`: 16K sequences from FFL(0.8).
|
38 |
+
- `val_dense`: 4K sequences from FFL(0.1).
|
39 |
+
- `val_sparse`: 160K sequences from FFL(0.98).
|
40 |
+
|
41 |
+
Usage
|
42 |
+
---
|
43 |
+
```python
|
44 |
+
import torch
|
45 |
+
import datasets
|
46 |
+
|
47 |
+
dataset = datasets.load_dataset('synthseq/flipflop')
|
48 |
+
dataset['train'][0] # {'text': 'w1i1w0i0 ...
|
49 |
+
|
50 |
+
def tokenize_batch(batch):
|
51 |
+
mapping = {'w': 0, 'r': 1, 'i': 2, '0': 3, '1': 4}
|
52 |
+
tokenized_batch = [[mapping[char] for char in s] for s in batch['text']]
|
53 |
+
return {'tokens': torch.tensor(tokenized_batch, dtype=torch.int64)}
|
54 |
+
|
55 |
+
dataset.set_transform(tokenize_batch)
|
56 |
+
dataset['train'][0] # {'tokens': tensor([0, 4, 2, 4, 0, 3, 2, 3, 2 ...
|
57 |
+
```
|
58 |
+
|
59 |
+
Citation
|
60 |
+
---
|
61 |
+
|
62 |
+
```
|
63 |
+
@article{liu2023exposing,
|
64 |
+
title={Exposing Attention Glitches with Flip-Flop Language Modeling},
|
65 |
+
author={Liu, Bingbin and Ash, Jordan T and Goel, Surbhi and Krishnamurthy, Akshay and Zhang, Cyril},
|
66 |
+
journal={arXiv preprint arXiv:2306.00946},
|
67 |
+
year={2023}
|
68 |
+
}
|
69 |
+
```
|