DataOrchestra: Learning to Orchestrate Per-Example Curation of Pretraining Data
Paper • 2607.24717 • Published
How to use DataOrchestra/Orchestrator with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="DataOrchestra/Orchestrator")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("DataOrchestra/Orchestrator")
model = AutoModelForCausalLM.from_pretrained("DataOrchestra/Orchestrator", device_map="auto")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use DataOrchestra/Orchestrator with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "DataOrchestra/Orchestrator"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "DataOrchestra/Orchestrator",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/DataOrchestra/Orchestrator
How to use DataOrchestra/Orchestrator with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "DataOrchestra/Orchestrator" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "DataOrchestra/Orchestrator",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "DataOrchestra/Orchestrator" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "DataOrchestra/Orchestrator",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use DataOrchestra/Orchestrator with Docker Model Runner:
docker model run hf.co/DataOrchestra/Orchestrator
| Base model | Qwen/Qwen3-1.7B-Base |
| Role | Orchestrator (plan generator) |
| Input | one pretraining-data chunk (≤ 1024 Qwen3 tokens) |
| Output | a flat JSON plan (decision + NP / SR / PA) |
| Inference mode | non-thinking, greedy decoding |
The wire format is a one-line system prompt plus the raw chunk wrapped in [DOC] / [/DOC]. The model responds with a single JSON plan.
import json
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL = "DataOrchestra/Orchestrator"
tokenizer = AutoTokenizer.from_pretrained(MODEL)
model = AutoModelForCausalLM.from_pretrained(MODEL, torch_dtype="auto", device_map="auto")
SYSTEM_PROMPT = "You are an excellent orchestrator for pretraining data cleaning."
def plan_for_chunk(chunk: str) -> dict:
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": f"[DOC]\n{chunk}\n[/DOC]"},
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False, # orchestrator runs non-thinking
)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
generated = model.generate(
**inputs,
max_new_tokens=1024,
do_sample=False, # greedy: temperature 0.0 / top_p 1.0
)
response = tokenizer.decode(
generated[0][inputs.input_ids.shape[1]:], skip_special_tokens=True
)
return json.loads(response)
chunk = (
"Home | About | Contact\n\n"
"The Pythagorean theorem states that a^2 + b^2 = c^2 for a right triangle. "
"It is one of the most fundamental results in geometry.\n\n"
"Click here to subscribe to our newsletter!"
)
print(json.dumps(plan_for_chunk(chunk), indent=2, ensure_ascii=False))
For high-throughput curation, serve the model with an OpenAI-compatible endpoint:
vllm serve DataOrchestra/Orchestrator --served-model-name DataOrchestra-Orchestrator --trust-remote-code
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:8000/v1", api_key="EMPTY")
resp = client.chat.completions.create(
model="DataOrchestra-Orchestrator",
messages=[
{"role": "system", "content": "You are an excellent orchestrator for pretraining data cleaning."},
{"role": "user", "content": "[DOC]\n<your chunk here>\n[/DOC]"},
],
temperature=0.0,
max_tokens=1024,
extra_body={"chat_template_kwargs": {"enable_thinking": False}},
)
print(resp.choices[0].message.content)
The orchestrator returns a flat plan JSON:
{
"decision": "clean",
"noise_pruning": true,
"surface_rectification": "Remove the navigation header and the newsletter call-to-action; keep the statement of the theorem.",
"pedagogical_augmentation": "Add an intuitive explanation of why a^2 + b^2 = c^2 holds, with a worked example."
}
| Field | Type | Meaning |
|---|---|---|
decision |
"drop" | "untouch" | "clean" |
top-level gate; only clean triggers the stages below |
noise_pruning |
bool |
run the NP tool model (whole-line remove_lines edits) |
surface_rectification |
str | null |
if a string, run SR with this chunk-specific instruction; null skips |
pedagogical_augmentation |
str | null |
if a string, run PA with this chunk-specific instruction; null skips |
For drop / untouch decisions, all three stage fields are inert.
If you find this work useful, please cite:
@article{dataorchestra2026,
title = {DataOrchestra: Learning to Orchestrate Per-Example Curation of Pretraining Data},
author = {Huang, Zhen and Wang, Yikun and Xia, Shijie and Liu, Pengfei},
year = {2026},
journal = {arXiv preprint arXiv:2607.24717}
}
Base model
Qwen/Qwen3-1.7B-Base