File size: 6,796 Bytes
5c6a0e3 2fa042d 5c6a0e3 2fa042d 5c6a0e3 2fa042d 5c6a0e3 dd3e42d 5c6a0e3 2fa042d 0ca04a3 2fa042d 5c6a0e3 2fa042d 5c6a0e3 2fa042d 5c6a0e3 2fa042d 5c6a0e3 2fa042d 5c6a0e3 2fa042d 5c6a0e3 87efaae 2fa042d 5c6a0e3 2fa042d 5c6a0e3 2fa042d 5c6a0e3 2fa042d 5c6a0e3 dd3e42d | 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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | ---
license: apache-2.0
language:
- en
tags:
- data-refinement
- function-calling
- programmatic-editing
- pretraining
pipeline_tag: text-generation
---
# UltraX: Refining Pre-Training Data at Scale with Adaptive Programmatic Editing
<p align="center">
<a href="https://huggingface.co/collections/openbmb/ultradata">
<img src="https://raw.githubusercontent.com/OpenBMB/UltraX/main/assets/ultradata-logo.png" alt="OpenBMB UltraData" width="350"/>
</a>
<br/>
<a href="https://huggingface.co/collections/openbmb/ultradata">
<img src="https://raw.githubusercontent.com/OpenBMB/UltraX/main/assets/ultrax-logo.png" alt="UltraX Logo" width="350"/>
</a>
</p>
<p align="center">
<a href="https://arxiv.org/abs/2607.08646">π Paper</a> |
<a href="https://github.com/openbmb/UltraX">π» Code</a> |
<a href="https://huggingface.co/datasets/openbmb/UltraX-Preview">π€ Datasets</a> |
<a href="https://huggingface.co/collections/openbmb/ultradata">π¦ UltraData Collection</a>
</p>
<p align="center">
English |
<a href="https://huggingface.co/openbmb/UltraX-0.6B-Preview/blob/main/README_ZH.md">δΈζ</a>
</p>
## π Introduction
**UltraX** is a function-calling refinement framework for large-scale pre-training data. Instead of end-to-end text rewriting, UltraX trains a lightweight refinement model to predict structured editing operations β including insertion, deletion, and modification β which are then deterministically executed on the original text.
This repository provides the **UltraX refinement models**, which are trained via full-parameter SFT to predict cleaning function calls for web-crawled text:
| Model | Description |
|-------|-------------|
| **UltraX** | Default model: instruction-guided with edit-weighted sampling (main experiment) |
| **UltraX-No-Instruction** | Ablation variant: trained without system instruction |
| **UltraX-Preservation-Weighted** | Ablation variant: trained with preservation-weighted sampling (60% keep_all) |
## π’ News
- **[2026.07.13]** UltraX codebase, refinement model, and refined datasets are now available on GitHub and Hugging Face. πππ
- **[2026.07.10]** UltraX technical report is available on [arXiv](https://arxiv.org/abs/2607.08646). π₯π₯π₯
## π‘ Highlights
- **Function-Calling Refinement:** Instead of end-to-end text rewriting, UltraX predicts structured editing operations (`keep_all`, `remove_all`, `remove_lines`, `replace_str`, `add_line`), enabling fine-grained instance-level editing with deterministic execution.
- **LAM + DCR Pipeline:** Line Alignment and Mapping (LAM) aligns original and refined text at line level, while Dynamic Context Replacement (DCR) converts character-level edits into reliable `replace_str` operations with unique context anchoring.
- **Lightweight & Efficient:** The refinement model is a standard SFT model that predicts structured function calls, significantly cheaper than end-to-end LLM rewriting while achieving superior performance.
## π¬ Pipeline Overview
<div align="center">
<img src="https://raw.githubusercontent.com/OpenBMB/UltraX/main/assets/ultrax_pipeline.png" width="800"/>
</div>
## π Model Details
All models are trained with the following configuration:
| Setting | Value |
|---------|-------|
| Training Framework | ms-swift with DeepSpeed ZeRO3 |
| Training Type | Full-parameter SFT |
| Max Sequence Length | 20,480 tokens |
| Learning Rate | 3e-5 (cosine decay, min lr 3e-6) |
| Warmup Ratio | 0.03 |
| Precision | bfloat16 |
| Hardware | 8x GPU |
### Model Variants
- **UltraX (Instruction-Guided, Edit-Weighted):** The default configuration. The model is trained with a system instruction that defines the editing operations and cleaning rules, using edit-weighted sampling.
- **UltraX-No-Instruction:** Trained without system instruction. Demonstrates that programmatic refinement brings clear gains even without explicit task protocol (Avg: 45.73 vs Raw 45.08), though instruction guidance further improves performance (Avg: 46.14).
- **UltraX-Preservation-Weighted:** Trained with preservation-weighted sampling where keep_all accounts for 60% of training data. Shows stronger performance on certain tasks (ARC-C, ARC-E, OBQA, SciQ), demonstrating the trade-off between editing aggressiveness and content preservation.
## π Evaluation Results
Performance comparison on FineWeb (20B tokens, 1B MiniCPM, 10 benchmarks, zero-shot):
<div align="center">
<img src="https://raw.githubusercontent.com/OpenBMB/UltraX/main/assets/results.png" width="900"/>
</div>
<div align="center">
<img src="https://raw.githubusercontent.com/OpenBMB/UltraX/main/assets/fineweb_token_curve.png" alt="FineWeb Token Curve" width="450"/>
<p><i>Average downstream performance on FineWeb under different training token budgets.</i></p>
</div>
## π§ Function Space
The model predicts operations from the following function space:
| Function | Description |
|----------|-------------|
| `keep_all()` | Document needs no modification |
| `remove_all()` | Entire document is valueless (e.g., error pages, login walls) |
| `remove_lines(start, end)` | Remove consecutive lines from start to end (inclusive) |
| `replace_str(line, old, new)` | Replace a substring within a specific line |
| `add_line(base, sub_idx, content)` | Insert a new line near the base position |
### Input/Output Format
**Input:** Text with line number markers (`<lid:N>` prefix per line), preceded by a system instruction.
**Output:** A sequence of function calls, one per line. Example:
```
remove_lines(1, 3)
replace_str(5, 'Click here to subscribe', '')
remove_lines(12, 15)
```
## π Quick Start
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("openbmb/UltraX-0.6B-Preview")
tokenizer = AutoTokenizer.from_pretrained("openbmb/UltraX-0.6B-Preview")
```
## β€οΈ Acknowledgements
- The refinement model is trained using [ms-swift](https://github.com/modelscope/ms-swift).
- UltraX builds upon insights from [ProX](https://github.com/GAIR-NLP/ProX) and RefineX.
Thanks for their awesome work! Open-source contributions make UltraX possible! π
## π Citation
If you find our work useful, please consider citing:
```bibtex
@misc{ultrax2026,
title={UltraX: Refining Pre-Training Data at Scale with Adaptive Programmatic Editing},
author={Xinlong Zhao and Dongsheng Liu and Hengyu Zhao and Zixuan Fu and Zheng Wang and Jie Cai and Jie Zhou and Qiang Ma and Xuanhe Zhou and Xu Han and Yudong Wang and Zhiyuan Liu},
year={2026},
eprint={2607.08646},
archivePrefix={arXiv},
primaryClass={cs.CL},
}
```
## π License
This project is licensed under the [Apache 2.0](https://huggingface.co/openbmb/UltraX-0.6B-Preview/blob/main/LICENSE) license.
|