Skip to main content

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 in POST .../datasets/{dataset_number}/items or PUT .../items/{item_number}. Each chat of a bulk create takes it too.
  • A CSV file. Map a column to rejected_reply in an import.
  • A pairs file. A .jsonl or .ndjson file 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":

codeMeaning
rejected_equals_chosenThe rejected reply is the chosen reply. A leading think block and surrounding spaces are ignored
rejected_reply_emptyThe reply is empty, blank or only a think block
rejected_reply_without_assistantThe 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.

stateMeaningLeft out of a preference run
okThe prompt and the longer reply fitNo
shortenedThey fit once the oldest whole turns are dropped. The system message and the last user message stay, and a reply is never cutNo
sameThe rejected reply is the chosen reply once the chat template is appliedYes
emptyThe rejected reply is empty once the chat template is appliedYes
no_assistantThe chat has no assistant replyYes
too_longEven the last exchange with the longer reply does not fitYes
context_onlyThe chosen reply does not train: it is set to Context only (weight: 0, see Message weight)Yes
not_countedPreparation failed on ReOpenly's side after automatic retries; our team is alerted and it will be included once fixedYes (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:

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, and pair: "no_rejected" the chats that have none (newest first: they have no pair problem to list first).
  • pair_check is a list of same, empty, too_long, shortened, near (a pair that trains and differs by only a small edit), context_only and not_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.

The length warning​

The estimate of a preference run lists its warnings, each a code plus numbers and never a sentence. One of them is length_skew:

{"code": "length_skew", "ratio": 2.3, "line": 2.0}

ratio is the median, over the pairs that train, of the chosen reply's tokens divided by the rejected reply's tokens (the length_ratio of the pairs block above). The warning appears when that median is at or past line (the chosen replies are about twice as long as the rejected ones, or more) or at or under 1 / line (the chosen replies are about half as long, or less). A set with no pair that trains has no ratio (length_ratio is null) and no length_skew; that means not measured, never "no skew".

It is a warning and never a block: the run still starts. It says what was measured, and nothing about what it does to a model, because no run has measured that.

The line is a starting line, not a rule. 2.0 was chosen from four public English preference sets and is not calibrated for pairs that you write yourself. A set of pairs that you wrote may differ in length for good reasons.

Data we chose the line from​

We counted the chosen and rejected replies of the training splits of these public preference datasets with the same tokenizer and counting rules as the pair checks above (up to 20,000 pairs of each, sampled at random from the larger ones):

We read the licences on each dataset's Hugging Face page on 2026-11-18. All four sets are English. Their median ratios run from 0.53 to 1.34, so a line of 2.0 lies outside all of them. Two things to know about it: in the Orca pairs the chosen reply is about half as long as the rejected one (median 0.53), and the line flagged about 3 in 10 random samples of 100 of its pairs; it flagged almost none from the other three sets. And no model was trained in this measurement, so it says where the line falls on this data and not whether a skewed set trains worse.

Remove rejected replies in bulk, with Undo​

POST .../datasets/{dataset_number}/items/bulk/rejected-reply/remove
POST .../datasets/{dataset_number}/items/bulk/rejected-reply/restore

Both need data:write and take the same selection as the other bulk actions: item numbers, or a filter with expected_count. Remove the replies of every pair a check flagged:

{
"selection": {"filter": {"pair": "has_rejected", "pair_check": ["same", "empty"]}, "expected_count": 15}
}

The answer is {"changed", "remaining", "batch_id"}. Each call changes at most 1,000 chats in one transaction; send the same body again with the returned batch_id while remaining is above 0. A chat loses only its rejected reply: its messages, tags and counts stay, and it becomes a new revision with a history entry that carries no text.

Undo is the second route, with the batch_id of the remove:

{"selection": {"batch_id": "<the batch_id of the remove>"}}

It answers {"changed", "remaining", "batch_id", "skipped"}. It puts back the replies of the chats that are still live, still without a reply and still at the revision the removal made. A chat edited, renamed, trashed or given a new reply since is left alone and counted in skipped. Only the person or key that made the removal can undo it, and a batch_id that matches nothing changes nothing.

Draft rejected replies with a model​

POST .../datasets/{dataset_number}/items/{item_number}/rejected-reply/draft
POST .../datasets/{dataset_number}/items/bulk/rejected-reply/draft/estimate
POST .../datasets/{dataset_number}/items/bulk/rejected-reply/draft
GET .../datasets/{dataset_number}/drafts/{batch_id}
POST .../datasets/{dataset_number}/drafts/{batch_id}/stop

A model can write the rejected reply for you. It answers every turn before the chat's last assistant turn (the chosen reply is never sent), and its answer is saved as the rejected reply. The key needs the inference scope as well as data:write (data:read for the estimate and the read). Name the model in model: a hosted model's slug in this project, a public base id such as ReOpenly/Qwen3.5-9B, or a public or shared model of another project by its address, {owner_slug}/{project_number}/{slug} (the three fields of its row in GET /api/v1/models). You pay for it like any call to that model, owner's surcharge included, and a model you cannot call answers 404 model_not_found.

A draft is a model's answer, not a judgement of quality: it can be as good as the chosen reply. Read the drafts before you use them.

What it costs. Each draft is one ordinary inference request, billed to you per token like any call to that model, checked against your balance and any spending cap, and never charged when the model is warming up or busy and refuses it. The request asks for at most 1,024 tokens.

One chat. Send {"model", "expected_revision"}. The answer is the item as a read returns it, plus model and charge_usd, the dollars charged as a decimal string. The chat gets a new revision and a history entry with action drafted, the model and the charge_usd, never the reply. A chat that already has a rejected reply is refused with 409 rejected_reply_exists, before anything is requested or charged: a draft never overwrites one, so remove the reply first (a reply that is the empty string counts as none). GET .../datasets/{dataset_number}/draft-model names the model a screen drafts one chat with: the project's most recent hosted text model (hosted true, model its slug), else the base (hosted false, model its public id); send that model. A draft that comes out the same as the chosen reply, or empty, is not saved (422 rejected_equals_chosen or 422 rejected_reply_empty), and charge_usd is in the error body, because the request ran. A chat with no assistant turn is 422 rejected_reply_without_assistant, and one whose assistant turn is its first has nothing to answer (422 draft_without_prompt). When too many single drafts are being written at once the call answers 429 draft_capacity_busy with retry_after in seconds, before anything is requested or charged. If the reply cannot be saved after the model answered, the answer is 500 internal_error with the charge_usd of the request that ran.

Many chats. First count, with the same selection as the other bulk actions:

{"selection": {"item_numbers": [5, 6, 7]}, "model": "support-bot-v1"}

The estimate answers selected, to_draft and what is skipped (skipped_not_live, skipped_has_rejected, skipped_no_assistant, skipped_no_prompt), each chat counted once, and max_usd: a bound, not an estimate. It is the most the drafts can cost, from each prompt's size plus the 1,024 tokens at the model's prices. The real charge is at most that; how far below it falls depends on how long the answers are. It is null when more than 1,000 chats would be drafted, which cannot start.

The Draft dialog shows that bound as "Up to $…" under "Cost", says it is as if every reply ran to the 1,024-token limit and that each draft is billed by its tokens as it finishes, and adds a rough time: "Takes about 15 to 30 minutes" for 100 chats, "under a minute" for a few. The time is an estimate of about 10 to 16 seconds a chat, rounded outward (the low end down, the high end up), from one set of English chats. Treat it as a guide, not a promise: a long reply takes longer, and so does a model that has to start first. Two drafts are written at a time. You can stop at any time; the drafts already written are kept and charged. With more than 1,000 chats selected the dialog shows no time and Draft stays off.

Start the batch with the same body (a filter needs expected_count): 202 {"batch_id", "total"}. A batch drafts at most 1,000 chats (422 draft_batch_too_large, never silently cut), and one with nothing to draft is 422 nothing_to_draft. The model drafting a batch is the one you name in model, not the screen's choice for a single chat. Two chats are drafted at a time, each billed as its request completes. A chat that already has a rejected reply is skipped and never overwritten, and so is one that changed while the model answered. One batch runs per dataset at a time (409 draft_batch_active). Read it while state is queued or running. To stop it, POST .../drafts/{batch_id}/stop: the request already with the model finishes and is charged, no other chat is asked about, and the batch ends with state stopped and stopped_reason stop_requested (drafted of total, and charged_usd). A batch still queued ends at once, with nothing asked of the model; a running one answers state running and cancel_requested true until its last request finishes. Asking twice changes nothing, and a batch that already ended is returned as it is. The app shows a stopped batch as "Stopped · N of M drafted · $… charged" and says that what was drafted is kept and charged:

{
"batch_id": "5b1f2e6c-8a47-4d03-b9e1-3c7a90d2f418",
"state": "done",
"model": "support-bot-v1",
"total": 3,
"done": 3,
"drafted": 2,
"charged_usd": "0.000108",
"skipped": {"has_rejected": 1},
"stopped_reason": null
}

The batch stops, and keeps what it did, when your balance runs out (stopped_balance), a spending cap is reached (stopped_ceiling) or the model is warming up or busy (stopped); stopped_reason is then the error code. A batch checks its key again before each chat and before each request: a key that was deleted, deactivated or has expired, lost the data:write or inference scope or the project, or a person who left the workspace, ends the batch as failed with stopped_reason actor_gone and no further request. A cause a later request would meet again (a model that is gone or not supported, a project that is archived) also ends it failed, with that code. What was charged before any stop stays counted in charged_usd, which matches your ledger even if the batch was interrupted and resumed. skipped counts by reason: not_live, changed, has_rejected, no_assistant, no_prompt, same and empty (the answer was the chosen reply or nothing: not saved, still charged), interrupted and failed (a chat whose reply could not be saved after the model answered is failed and its charge is still counted). The numbers in the examples are only illustrative.

Training on pairs​

A text run takes training_method, sft by default. The preference method (dpo, which ReOpenly/Inkling-2-Mini does not take) is open to every account and every API key with the right scope, on a base that takes preference runs. On a base that does not, a start with training_method: "dpo" is refused with 409 training_method_not_available and the message "Preference runs are not available for this base model." The entries of profiles in GET /api/v1/base-models carry preference_available, true only when a start with the method would be accepted on that base: read it before offering the choice, and treat a profile that does not say as not open.

Also train on the chosen reply (dpo_chosen_sft, on by default): a small supervised term on the chosen reply. It can offset a drop in the chosen reply’s likelihood on pairs that differ by only a small edit, but it is not a guarantee.

A pair that is too long. A training step holds only so many tokens, and a pair counts its prompt twice (once for each reply) plus both replies. When the longest pair of the selection, read at the run's own maximum sequence length, is more than a step can hold, the start is refused with 400 preference_pairs_too_long, and the preference_pairs check of the estimate fails with the same code. The message names the longest pair and the limit in tokens; the check also carries them as longest and limit (decimal strings). The limit is per micro-batch, so a larger "Training batch size per device" lowers the longest pair a run can hold. Shorten or exclude the longest pairs, lower the maximum sequence length (a pair that no longer fits is then left out by the pair checks instead), or lower the batch size per device.

Pairs left out at the start. The estimate's preference block counts the pairs of the selection that do not train by choice or check in two parts: left_out_by_checks (every check state: same, empty, no_assistant, too_long) and set_not_to_train (context_only, the chosen reply set to Context only), with checks_left_out_share the first part's share of the pairs and left_out_share the share of both (not_counted is on ReOpenly's side and is never counted in either part; above 5% of the selection refuses with 503 pair_facts_unavailable). A start is refused with 400 preference_pairs_mostly_left_out when the checks leave out more than half of the pairs; pairs set not to train never count toward that, because you chose them. When both parts together are 20 percent of the pairs or more, the start asks first: it answers 409 confirmation_required until the body carries confirm_left_out: true. Both answers carry left_out_by_checks and set_not_to_train. A start is also refused, with 400 preference_pairs_insufficient, when too few pairs remain, whatever left them out. The New run screen names the two parts apart ("12 pairs set not to train · 3 left out by checks") only when some pairs are set not to train; otherwise it keeps one clause, "9 left out by the pair checks".

A preference run records, for every step, the loss, the share of pairs it ranks right and the gap between the two replies' rewards, and also the chosen reward (reward_chosen in the run's metrics, drawn on the run page as "Chosen reward"): how much more likely the model now finds the chosen replies than before training, scaled by beta. The gap can grow while that reward falls. A chosen reward that falls, or sits below zero, means the chosen replies are becoming less likely.

The run page reads those series under the names commonly used for preference training. Preference loss (preference_loss) is the chart and the first figure. It is the preference term alone: it starts at about 0.69 (ln 2), where the model prefers neither reply yet, and falls as the model learns to give the chosen replies a higher reward than the rejected ones. With Also train on the chosen reply (on by default) the run also trains on a second term; that term is recorded apart as chosen_reply_loss, and loss stays the total the run trains on (the two terms added, the chosen-reply one weighted by 1). The page names the 0.69 starting point only for a run recorded as the preference term alone. A run from before the two terms were recorded apart, and trained with the chosen-reply term, has its total under preference_loss; the page names no starting point for it. The preference loss is measured on the pairs the run trained on, so it shows that learning, not how good the answers are. Reward accuracy (reward_accuracy) is the share of the last step's pairs whose chosen reply got the higher reward; where the run also recorded how many pairs that step trained on (preference_pairs, one number per step), the page reads it as a count, such as "2 of 3". Reward margin (reward_margin) is the average gap between the chosen and the rejected rewards. A series the run did not record is absent from metrics, never zero.

Where it runs, a preference run's estimate shows a time and a price computed from measured step times (estimate_state: "measured", with duration_components.confidence "low"). Like every run, it is charged per minute of measured training time, not at the estimate. A pair's state is a fact about the text, not a score of how well a model trained on it will answer: a trained model is judged on the model as it is served, with your own test set.

Reference​

POST /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/items
PUT /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/items/{item_number}
GET /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/items/{item_number}
POST /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/items/search
GET /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}
POST /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/items/bulk/rejected-reply/remove
POST /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/items/bulk/rejected-reply/restore
POST /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/items/{item_number}/rejected-reply/draft
POST /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/items/bulk/rejected-reply/draft/estimate
POST /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/items/bulk/rejected-reply/draft
GET /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/draft-model
GET /api/v1/projects/{owner_slug}/{project_number}/datasets/{dataset_number}/drafts/{batch_id}