Preference pairs
On this page you add preference pairs to a text dataset, read how each pair checks out, find and count them, and remove their rejected replies in bulk.
What is available today. You can collect preference pairs and check them through the API, draft their rejected replies with a model, and train on them with a preference run (see Training on pairs). A supervised run trains on chats exactly as described in Training runs, and a chat's rejected reply does not change it. This page gives no quality figure for a preference run.
A preference pair is a chat with two replies to its last user message: the
chosen reply, which is the chat's last assistant message, and a rejected
reply, a reply you would rather the model did not give. Preference pairs
belong to text datasets. An embedding dataset has no rejected replies, and its
pair filters answer 400 unsupported_filter.
Add pairs
- One chat at a time. Send
rejected_reply, a string of at most 20,480 characters, with the chat inPOST .../datasets/{dataset_number}/itemsorPUT .../items/{item_number}. Each chat of a bulk create takes it too. - A CSV file. Map a column to
rejected_replyin an import. - A pairs file. A
.jsonlor.ndjsonfile in the layout of OpenAI, Together, Fireworks or Hugging Face TRL. The accepted layouts and what each refusal means are in Import preference pairs.
{
"messages": [
{"role": "user", "text": "Can I return this?"},
{"role": "assistant", "text": "Yes, within 30 days."}
],
"rejected_reply": "No."
}
An edit that sends rejected_reply sets it, null removes it, and leaving it
out keeps the stored one. Adding, changing or removing a reply is a new
revision of the chat, and its history says
that the reply was added, changed or removed, never what it said.
A single create or edit refuses a pair that could not train, before anything is
written, with 422 and param: "rejected_reply":
code | Meaning |
|---|---|
rejected_equals_chosen | The rejected reply is the chosen reply. A leading think block and surrounding spaces are ignored |
rejected_reply_empty | The reply is empty, blank or only a think block |
rejected_reply_without_assistant | The chat has no assistant turn for a reply to be compared with |
A bulk create and an import store a reply as written instead, and the
pair checks flag it. The bulk create's answer also lists such a
row at once: its entry in rows carries the code the single create would have
refused it with, the same fixed message, and param naming the row
(items.<index>.rejected_reply), never your text:
{"index": 1, "item_number": 8, "outcome": "created", "warnings": [
{"code": "rejected_equals_chosen",
"message": "The rejected reply is the chosen reply once the chat template is applied.",
"param": "items.1.rejected_reply"}
]}
flagged counts the rows with a warning. The row is stored all the same: in
this version of the API a bulk create never refuses a pair for these reasons.
Pair checks
Every pair gets a state, counted in the background after a write, so a new or just-edited pair has none for a short while. The counts use the base model's own tokenizer and a sequence length of 2,048 tokens.
state | Meaning | Left out of a preference run |
|---|---|---|
ok | The prompt and the longer reply fit | No |
shortened | They fit once the oldest whole turns are dropped. The system message and the last user message stay, and a reply is never cut | No |
same | The rejected reply is the chosen reply once the chat template is applied | Yes |
empty | The rejected reply is empty once the chat template is applied | Yes |
no_assistant | The chat has no assistant reply | Yes |
too_long | Even the last exchange with the longer reply does not fit | Yes |
context_only | The chosen reply does not train: it is set to Context only (weight: 0, see Message weight) | Yes |
not_counted | Preparation failed on ReOpenly's side after automatic retries; our team is alerted and it will be included once fixed | Yes (unless > 5%, which refuses the run) |
More states may be added. Read any state other than ok and shortened as non-training. A pair that
also fails a check (the same or an empty rejected reply, no assistant reply, or too long to fit)
says that state instead of context_only, so the counts of pairs the checks leave out still
include it. Switch the chosen reply back to Trains (weight: 1) and the pair is counted again.
not_counted is on ReOpenly's side, not a mistake in your pair: you do not need to edit the chat,
and not_counted pairs are kept apart from customer/check left-out counts. When at most 5% of a
selection is not_counted, the run trains without those chats and shows a neutral note; above 5%,
the estimate and start refuse with 503 pair_facts_unavailable and charge nothing.
The last column says what a preference run does with the pair; a supervised run does not read it.
GET .../datasets/{dataset_number}/items/{item_number} returns
rejected_reply and pair for a chat that has one:
{
"rejected_reply": "No.",
"pair": {
"state": "ok",
"near_identical": false,
"prompt_tokens": 31,
"chosen_tokens": 9,
"rejected_tokens": 2,
"differing_tokens": 8,
"facts_current": true
}
}
facts_current is false when the pair has not been counted yet, was edited
since, or was counted under an older counting rule. Then state and every
number are null, which means not computed yet, never zero: wait and read
again. A recorded 0 is a real 0. near_identical is true when the two replies differ
by a small edit, false when they differ more, and null (never false) for a
pair that a preference run leaves out; A small edit says what it
measures. A chat without a rejected reply has pair: null. A list row (items/search) carries neither
field, and an item read from a version carries
rejected_reply and no pair, because pair checks are kept for the live
revision only.
A small edit: what near measures
differing_tokens is the token-level edit distance between the two rendered
replies: the fewest tokens to insert, delete or replace to turn one into the
other. The check divides it by the token count of the longer reply and calls the
pair near when the result is 0.10 or less. That describes how little the two
replies differ and nothing more. The pair is not left out, nothing is removed,
and no run is blocked.
If you made the rejected reply by editing the chosen one, or the chosen reply by correcting a model's, the small difference is the point: that edit is the whole signal the pair carries.
What published tests say. In some published tests, training a model with a preference loss on pairs whose replies differ very little made the chosen reply less likely instead of more, even while the model got better at telling chosen from rejected. It did not happen on all data, and the same tests found that how many words two replies differ by did not tell which pairs cause it. We have measured no such effect on your runs (see Training on pairs).
Where the line comes from
The line is 10%, and it is a description, not a calibrated limit: no study gives a threshold. We chose it from two things. In the public MetaMath preference set, where the failure above was shown on pairs made by changing one spot of a correct answer, most pairs differ by 10% or less. In the public English preference sets we measured (HH-RLHF, UltraFeedback, Orca), at most 0.07% of the pairs do. It is a starting value, shown as a note and never a block.
Sources:
- Razin, Malladi, Bhaskar, Chen, Arora and Hanin, Unintentional Unalignment: Likelihood Displacement in Direct Preference Optimization, ICLR 2025: shows that the preferred reply's likelihood can fall while training, and that edit distance does not identify which pairs cause it in general settings.
- Pal, Karkhanis, Dooley, Roberts, Naidu and White, Smaug: Fixing Failure Modes of Preference Optimisation with DPO-Positive, 2024: shows the same reduction empirically, especially on datasets where the edit distance between the two completions is low.
Find and count pairs
The item search takes two pair filters, in the JSON body like every filter:
{"pair": "has_rejected", "pair_check": ["same", "empty"], "limit": 25}
pair: "has_rejected"keeps the chats that have a rejected reply, andpair: "no_rejected"the chats that have none (newest first: they have no pair problem to list first).pair_checkis a list ofsame,empty,too_long,shortened,near(a pair that trains and differs by only a small edit),context_onlyandnot_counted; a chat matches when its current check is any of them. A chat that has not been counted yet matches none.
With pair: "has_rejected" the list comes with the problems first (sort answers
pair_problems_first): same, empty, no_assistant, too_long,
context_only, not_counted, near, shortened, then every other pair. near is refused with 400 unsupported_filter only while the near line is not recorded, so that an empty
answer is never read as "none are near". The dataset health read's
pair_counts gives how many chats each of these filters matches, the same
totals the list answers, and the app's Health filter offers them under
Preference pairs. Pair filters work in a saved view and as a
bulk selection, and the pairs_import value of sources finds chats made by a
pairs file.
GET .../datasets/{dataset_number} carries a pairs block for a text dataset
(null for an embedding one), counted over the chats that have a rejected
reply and that train, so a chat in Trash or excluded from training is in no
count:
{
"with_rejected": 480,
"train": 441,
"left_out": {"same": 12, "empty": 3, "no_assistant": 0, "too_long": 9, "context_only": 0, "not_counted": 0},
"shortened": 35,
"near": 6,
"length_ratio": 1.4,
"facts_pending": 15
}
train is the pairs in ok or shortened, and shortened is the shortened
part of them. facts_pending is the pairs not counted yet: they are in
with_rejected and in nothing else, so train plus left_out plus
facts_pending is with_rejected. length_ratio is the median of chosen
tokens over rejected tokens among the pairs that train, and null while none
does. near is the number of pairs that train and differ by only a small edit
(see A small edit); it is null only while the line is not
recorded, never a 0 that was not counted. The numbers in the example are only
illustrative.