File size: 1,930 Bytes
de5f988
 
 
 
 
 
 
 
 
74c147e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
53
54
55
56
57
58
59
60
61
62
63
64
---
license: mit
language:
- en
metrics:
- bertscore
- rouge
base_model:
- allenai/led-base-16384
---

# ToS Simplifier

`sa-ma/tos-simplifier` is a fine-tuned **Longformer Encoder–Decoder (LED)** model that turns dense, jargon-filled Terms of Service (ToS) documents into clear, plain-English summaries. The underlying LED architecture processes sequences up to 16 384 tokens in one pass, making it ideal for very long contracts.:contentReference[oaicite:0]{index=0}

## Model details

| | |
| --- | --- |
| **Base model** | `allenai/led-base-16384` |
| **Parameters** | ~162 M |
| **Context window** | 16 384 tokens (encoder) / 1 024 (decoder) |
| **Language** | English |
| **License** | MIT |

## Training

The model was fine-tuned on an internal corpus of publicly available ToS and their human-written “plain language” summaries (≈ 1.2 k document–summary pairs).  
Key hyper-parameters:

* Optimiser — Adam W (β₁ = 0.9, β₂ = 0.98)  
* Learning-rate — 3 × 10⁻⁵ with linear warm-up  
* Batch — 16 effective (8 × 2 GPUs, gradient-accumulation = 2)  
* Early-stop on validation ROUGE-L

Full settings are stored in `training_args.bin`.

## Intended use

| ✔ What it’s for | ✖ What it’s **not** for |
| --- | --- |
| Summarising ToS, privacy policies, EULAs | Non-English input |
| General long-form abstractive summarisation | Producing legally binding advice |
| Making legal texts more accessible | Summarising sensitive or proprietary data without review |

## Quick start

```python
from transformers import LEDTokenizer, LEDForConditionalGeneration, pipeline

model_id = "sa-ma/tos-simplifier"
summariser = pipeline(
    "summarization",
    model=model_id,
    tokenizer=model_id,
    device_map="auto",       # drop or change if running on CPU
    max_length=256,
    min_length=30,
)

long_doc = open("tos.txt").read()
summary = summariser(long_doc)[0]["summary_text"]
print(summary)