How statement and proof provenance work
The first chip identifies the source of the statement or construction; the second identifies the source of its local proof or verification.
- Literature-sourced: the exact statement appears in a cited source; only wording and notation differ.
- AI-adapted: a semantically identical restatement of literature-sourced material, modulo indexing, notation, and boundary cases adopted by the library.
- AI-generated: a genuinely novel statement formulated by AI, with no source for the claim itself.
These labels describe origin, not correctness: citations and verification chips remain separate evidence.
Preference learning and direct preference optimization
1 · Prerequisites
- Absolute and Conditional Convergence; Rearrangement; Products
- Automatic differentiation and computational graphs
- Binary Operations, Monoids, Groups and Subgroups
- Calibration, proper losses, and surrogate classification
- Compactness in Metric Spaces
- Completeness, Completion, and Uniform Continuity
- Conditional Distributions and Regular Conditional Probability
- Construction of the Natural Numbers
- Construction of the Real Numbers via Cauchy Sequences
- Construction of the Real Numbers via Dedekind Cuts
- Continuity, IVT, EVT, and Uniform Continuity
- Convex and Semicontinuous Functions on Rⁿ
- Convexity
- Cosets, Index and Lagrange's Theorem
- Countability and Uncountability
- Darboux, L'Hôpital, and Taylor's Theorem
- Divisibility, Euclidean Domains, Principal Ideal Domains and Unique Factorisation
- Estimators and Randomized Procedures
- F-Divergences, Rényi Information, and Hypothesis Testing
- Filters and Ultrafilters
- Finite Counting, Factorials and Binomial Coefficients
- Foundations of the Real Numbers for Analysis
- Ideals, Quotient Rings and the Isomorphism Theorems for Rings
- Limits of Real Functions
- limsup, liminf, and Subsequential Limits
- Linear classifiers, discriminants, and logistic models
- Linear Independence, Bases and Dimension
- Linear Transformations, Rank-Nullity and Quotient Spaces
- Loss, Risk and Decision Theory
- Measurable Functions and Simple Approximation
- Measures and Their Basic Properties
- Metric Spaces
- Monotone Functions, Discontinuities, and Continuity Sets
- Monotone Sequences, Bolzano-Weierstrass, and Cauchy Completeness
- Normal Subgroups and Quotient Groups
- Order, Zorn's Lemma, and the Axiom of Choice
- Polynomial Rings, the Division Algorithm and Roots
- Power Series and Real-Analytic Functions
- Probability Spaces Random Variables and Expectation
- Properties of the Integral and the Working FTC
- Relations, Functions, and Quotients
- Rings, Subrings, Integral Domains and Fields
- Rⁿ as a Normed Space; Vector-Valued Functions
- Roots, Rational Powers, and Classical Inequalities
- Sequences and Limits
- Sequences and Series of Functions; Uniform Convergence
- Series: Convergence and the Nonnegative Tests
- Sigma Algebras and Borel Sets
- Simple Field Extensions and the Construction of the Complex Numbers
- Statistical Experiments, Models and Identifiability
- Suprema and Infima
- The Derivative and the Mean Value Theorems
- The Exponential Function
- The Inverse and Implicit Function Theorems
- The Lebesgue Integral and the Convergence Theorems
- The Logarithm and General Powers
- The Riemann Integral: Definition and Integrability
- The Total Derivative in ℝᵐ → ℝⁿ
- The ZFC Axioms and the Basic Set Constructions
- Topological Spaces and Continuity
- Topology of ℝ
- Vector Spaces, Linear Subspaces, Span and Direct Sums
2 · Logical flowchart
3 · Definitions, theorems and proofs
Finite KL-regularized policy improvement
Definition
Let be a finite nonempty set. A probability vector on is a family with and . For probability vectors , define the finite relative entropy when whenever , and define otherwise. Terms with are omitted. Given a real reward and a coefficient , define The finite KL-regularized policy-improvement problem is to maximize over all probability vectors on . The reference has full support when for every ; in that case is finite for every .
Definition references
Finite KL divergence: uses the same directed finite sum, omits zero first-coordinate terms, and assigns when has positive mass where is zero.
Natural logarithm: defines on as the inverse of the exponential function.
Finite Bradley–Terry preference model
Definition
Let be a finite nonempty prompt set. For each , let be a finite response set with at least two elements, and let be a real-valued reward. The Bradley–Terry model assigns to each ordered pair of distinct responses the two-outcome comparison or , with Here means that response is preferred to response at prompt ; the probability of the reverse outcome is . This is a statistical model for pairwise comparisons, not a universal law of human preference.
Definition references
Binary logistic and multiclass softmax models: defines the same sigmoid for finite real .
The finite-action Gibbs policy uniquely maximizes reward minus KL
Statement
Let be a finite nonempty set, let be a probability vector on with for every , let , and let . Define Then is finite and positive, is a full-support probability vector, the maximum objective value is , and for every probability vector on , Equality holds exactly when . Thus is the unique maximizer of the finite KL-regularized policy-improvement objective.
Statement references
Finite KL-regularized policy improvement: defines and the finite KL support convention.
Finite-label score loss: defines logarithmic loss as and its expected loss as the corresponding finite sum.
Strict propriety of finite logarithmic loss: the truthful forecast uniquely minimizes expected logarithmic loss on the finite simplex.
Facts & Assumptions
Given: The finite nonempty set , full-support probability vector , real reward , positive , and the vectors in the Statement.
Finite KL-regularized policy improvement: , and when the second vector is positive, with zero first-coordinate terms omitted.
Strictly proper scoring rules on a finite label set: the finite expected logarithmic loss at forecast under probability vector is .
Log and Brier losses are strictly proper: for finite probability vectors , the expected logarithmic loss is minimized at the truthful forecast , with equality only there.
Proof
Since is finite and each is a positive finite real, their sum is positive and finite. The coordinates of are positive and sum to , so is a full-support probability vector.
For each , the definition of gives . Substitution into the finite sum for , omitting zero coordinates of , yields . All sums are finite, and all logarithm arguments in the sums are positive.
Substituting in step 2.1 gives , because . Therefore for every , step 2.1 gives .
If , its simplex contains only , so the objective gap is zero and the maximizer is unique. Otherwise identify with a -label set, where . Since has full support, the difference is the finite sum by [F1] and [F2]. By [F3], this difference is nonnegative and is zero only when . As , step 3.1 proves the stated inequality and uniqueness.
Bradley–Terry reward-policy reparameterization and finite DPO gradient
Statement
For each prompt under consideration, let be a finite response set with at least two elements, let be a probability vector with for every , let , and let . Define and . For every distinct , so the Bradley–Terry probability is Conversely, every full-support probability vector on is the unique Gibbs policy for reward ; adding any prompt-only constant to this reward leaves both the Gibbs policy and the Bradley–Terry probabilities unchanged.
Let be a finite ordered dataset with , , and . Let be open and let each conditional policy be a probability vector with for every , whose coordinates are continuously differentiable in . Put Then is the finite direct preference optimization (DPO) loss: the average negative log likelihood for the Bradley–Terry model with implicit reward . Its Euclidean gradient is Here is the column vector of Euclidean partial derivatives on the open set .
Statement references
Finite Bradley–Terry preference model: defines and the sigmoid.
Finite KL-regularized policy improvement: defines the finite KL objective and its reward/reference conventions.
Finite-action Gibbs policy theorem: gives the unique optimizer and its normalization.
Chain rule for total derivatives: differentiates the finite composition of the loss and the conditional log-probability coordinates.
Natural logarithm derivative: supplies for .
Exponential derivative: supplies for real .
Facts & Assumptions
Given: The finite response sets, full-support reference vectors, rewards, positive , finite dataset, open parameter domain, and full-support policy family in the Statement.
Finite Bradley–Terry preference model: for distinct responses, , where .
Finite KL-regularized policy improvement: for finite probability vectors , ; with full-support , the finite KL sum has no zero denominator.
The finite-action Gibbs policy uniquely maximizes reward minus KL: the unique maximizer is , with .
The chain rule for total derivatives: : the derivative of a finite composition is the ordered composition of the derivatives of its constituent maps.
The natural logarithm has derivative 1/x and equals the integral from 1 to x of 1/t: is differentiable on with derivative .
The exponential function is smooth and : is differentiable on with derivative .
Proof
For each , the Gibbs formula and positivity of and give .
For any full-support probability vector , define . Its partition sum is . By the objective definition [F2], the policy is optimized over the finite simplex; the formula and uniqueness in [F3] then return as the unique Gibbs maximizer. Adding multiplies both the numerator and partition sum by , preserving that policy.
For real , [F5] and [F6] give . The logarithm arguments are positive for every finite .
Subtracting the identities in step 1.1 for and cancels the common term. Applying [F1] to the remaining reward difference gives the displayed Bradley–Terry probability formula. If is replaced by , the reward difference is unchanged, so the comparison probability is unchanged.
For each record , apply step 1.2 to . Its implicit reward is , and [F1] gives the preferred-outcome probability . Since , its negative logarithm is . Summing over the records proves the stated finite negative log likelihood.
Each and is positive and continuously differentiable on , so the logarithms are continuously differentiable. Applying [F4] to each gives , because is fixed. The finite-sum chain rule with step 1.3 gives the displayed gradient.
Preference coverage and Bradley–Terry model limits
Remarks
The Bradley–Terry equation is a modeling assumption for pairwise comparison noise, not a universal law of human preference. Here, model misspecification means that the actual pairwise conditional probabilities are not generated by any reward in this Bradley–Terry model. The Gibbs and direct preference optimization (DPO) formulas proved here use a finite response set, a full-support reference, and finite real rewards. For a countably infinite response space, the normalizing sum would have to be positive and finite, and the reward and KL sums would need convergence conditions that make them well-defined; no such extension is claimed.
For a fixed prompt, let be the graph whose vertices are the finite responses and whose edges are the observed comparisons, with each edge joining the two responses compared. A connected component is a maximal subset of vertices in which every two vertices can be joined by a path of edges in . If has connected components , adding a constant to every reward in leaves every observed edge difference unchanged because both endpoints of each edge lie in one component. Thus the Bradley–Terry probabilities on observed edges stay the same. But the Gibbs mass of component is so after the component shift its numerator and corresponding denominator contribution are multiplied by . With full-support , distinct component shifts can therefore change the policy's relative mass across components without changing any observed comparison probability. Pairwise data on a disconnected graph alone do not identify that policy mass.
Here, identifying a policy from comparisons means uniquely determining it from the exact probabilities on the observed edges. The finite DPO loss and finite update procedure do not by themselves show that minimizing empirical loss recovers the true policy, that the parameterized family can represent that policy, that the learned policy performs well on new prompts or comparisons, or that the updates converge to a minimizer. Such claims require additional assumptions on the comparison sampling process, model class, and optimization behavior; none is supplied here.
Finite-budget direct preference optimization by mini-batch gradient descent
Definition
Input a finite ordered preference dataset with , finite response sets of size at least two, distinct , reference probability vectors with all coordinates positive, a coefficient , a parameter domain that is open, and a conditional policy family that is a probability vector with all coordinates positive on each for every , with coordinates totally differentiable in and continuous derivative. Also input an initial value , a finite integer , a list of finite nonempty mini-batches with indices in for each , and finite step sizes . Duplicated indices in a mini-batch are allowed. Require each observed scalar log-probability and to be represented by a finite real-arithmetic graph whose primitive maps are totally differentiable with continuous derivative matrices on an open neighborhood of every evaluated parameter; a piecewise- primitive is allowed only on a unique strict branch.
Also supply an exact membership oracle that returns exactly on and terminates on every call, with finite declared per-call cost . Use this oracle for the candidate-parameter test below. Supply terminating exact evaluators for the policy-graph primitive values, derivative-transpose applications, and primitive-domain and strict-branch tests. In the work model, each such primitive call and each scalar arithmetic operation, comparison, exponential, logarithm, maximum, or absolute value costs one unit; vector operations count their scalar entries. Membership-oracle calls are counted separately and their costs added. These supplied oracle operations are part of the input model; openness of alone is not asserted to provide a computable membership test, nor is a bit-complexity or floating-point bound asserted.
For real , evaluate the per-record loss by the equivalent stable expression Set and initially compute . Store .
For , compute the mini-batch objective . For each index in the batch, use reverse-mode AD on the finite policy-log-probability graphs to compute the Euclidean gradients of the two log probabilities, and form the exact loss gradient from the finite DPO gradient formula proved on the A page:
Do not differentiate through the max/absolute-value expression used only to evaluate ; use this explicit derivative formula. If reverse mode returns DOMAIN_ERROR or NONDIFFERENTIABLE, stop and return with that status. Otherwise set . Evaluate . If its value is , so , stop and return the last valid pair with status DOMAIN_ERROR. If its value is , so , set , evaluate , and update .
After all updates, return with status COMPLETED. Thus returns the initial parameters and initial full-data loss. The procedure uses the fixed mini-batch indices and step-size schedule as supplied; it makes no convergence or statistical-optimality assertion.
Definition references
Finite-budget DPO preserves its valid pair and terminates with finite oracle work ↗: proves well-definedness, the stored valid-pair invariant, the exact mini-batch gradient, finite termination, and the work and membership-oracle bounds under the declared input model.
Finite Bradley–Terry preference model: defines the pairwise comparison probability and sigmoid.
DPO reward-policy reparameterization and gradient: supplies the exact finite DPO loss gradient.
Finite real-arithmetic program: fixes the finite topological graph and real-arithmetic conventions, and allows a primitive to be piecewise C1 only on a unique strict branch.
Continuously differentiable Euclidean maps: C1 means total differentiability with continuous derivative matrix.
Reverse-mode automatic differentiation: specifies the reverse sweep for a finite scalar-output C1 graph.
Reverse mode computes the graph gradient: confirms the returned cotangents are the exact derivative on each fixed strict branch.
Remarks
This is a finite real-arithmetic update procedure. The equivalent loss-value expression and procedure properties are justified by the separate result listed above. The gradient is computed from the explicit smooth formula, so the max/absolute-value implementation branch at is not differentiated. No floating-point error bound, minimizer attainment, convergence rate, or generalization guarantee is asserted.
Finite-budget DPO preserves its valid pair and terminates with finite oracle work
Statement
For every input of the finite-budget DPO procedure, under its supplied exact evaluator and membership-oracle model, all prescribed loss evaluations are finite and every successful reverse sweep gives the exact stated mini-batch gradient. Throughout the run, the stored pair is for the most recently accepted parameter ; initially this is . In particular, rejected candidates are not used for policy evaluation. The procedure terminates after at most attempted updates and returns this valid pair with the prescribed diagnostic status on early exit, or with status COMPLETED when all updates are accepted. When , it returns the initial pair with status COMPLETED.
Put , with for . There is a finite constant , determined by the finitely many supplied log-probability graphs, their fixed node dimensions and the unit-cost primitive model, such that the work excluding parameter-domain membership is
The implicit constant is independent of the numerical parameters and step sizes. There are at most calls to . For the actual queried candidates , the membership cost is , with , and is added to the displayed work. If a uniform finite membership bound is supplied, this contribution is at most . These are bounds in the declared exact primitive/oracle model, not a universal algorithm for membership in arbitrary open sets. No convergence, descent, or statistical-optimality conclusion is asserted.
Statement references
Finite-budget direct preference optimization by mini-batch gradient descent: gives the full input scope, exact oracle model, accept/reject rule and returned pair.
Facts & Assumptions
Given: The full inputs of the finite-budget DPO procedure, including arbitrary open , , positive reference and policy coordinates, , all supplied finite graphs and exact evaluators, finite schedules with , nonempty mini-batches and , and the exact terminating parameter-domain oracle with finite per-call costs.
Finite-budget direct preference optimization by mini-batch gradient descent: initializes the stored pair by the full-data loss; computes each trial parameter from the stated mini-batch gradient; accepts only when returns ; otherwise returns the previous pair, and uses at most the listed updates.
Bradley–Terry reward-policy reparameterization and finite DPO gradient: the loss per record is and its derivative is times the difference of the two policy-log-probability gradients. The same finite formula applies to a nonempty ordered dataset with repeated records.
Finite straight-line computational programs and real-arithmetic tapes Reverse-mode automatic differentiation for a scalar graph output: finite graphs and reverse sweeps have finite node and parent-slot lists; domain or branch failure returns the corresponding diagnostic, and cotangents are initialized and accumulated in finite-dimensional coordinates.
Reverse mode computes the exact gradient of the real-arithmetic graph: on an admissible fixed strict branch, the returned input cotangents are the exact Euclidean gradient of the represented scalar output.
The natural logarithm as the inverse of the exponential function The exponential is positive and satisfies The exponential addition formula : the exponential is finite and positive on real inputs, its reciprocal is , and the logarithm is a finite real on positive inputs and is inverse to the exponential; for real .
Proof
Fix an accepted parameter in . The reference and policy coordinates are positive, so every log ratio is a finite real and each is finite. By [F5], and its logarithm is finite. For , the stable evaluation expression is exactly . For , put and . The exponential addition and reciprocal identities give , so [F5] gives . Thus the stable expression equals the same finite loss on both branches, including , and finite dataset and batch averages are finite.
Each supplied graph is finite and its specified exact primitive value, pullback and domain/branch tests terminate. Therefore its forward and reverse traversals terminate. At every successful strict-branch evaluation, [F4] gives both exact policy-log-probability gradients. Apply [F2] to the ordered batch of size , counting duplicated indices with their multiplicity; its gradient is exactly . The algorithm does not differentiate the nonsmooth max/absolute-value implementation of the loss value.
There are finitely many record graphs with fixed finite node, slot and value-space dimensions. Forward evaluation, cotangent initialization and reverse accumulation consequently have a finite uniform upper bound in the declared unit-cost primitive model; finite branch tables are covered by their supplied terminating tests. Choose large enough to bound either one record's loss evaluation or its value-and-gradient computation, including the scalar sigmoid and loss operations. This bound depends on graph sizes and dimensions, not on parameter values, since primitive calls have unit cost in this model.
The initial parameter lies in , and step 1.1 makes its full-data loss finite, proving the stored-pair invariant at initialization. Suppose it holds before an attempted update. A reverse-mode diagnostic returns that unchanged pair. Otherwise step 1.2 gives a finite vector , and the finite step size gives a finite trial . The supplied exact oracle terminates and decides its membership. On rejection the unchanged valid pair is returned, without a policy evaluation at . On acceptance , so step 1.1 gives its finite full-data loss; replacing the stored pair preserves the invariant. Finite induction therefore proves the invariant at every attempted update and every return.
Every attempted update traverses only finite graph and coordinate lists, finitely many records, and at most one terminating membership call. Hence it finishes or exits with the specified diagnostic. The outer loop has only entries, so there are at most attempts and no infinite search or convergence test. If none exits early, [F1] returns the pair after update with COMPLETED; for it performs no updates and returns the initialized pair.
The procedure evaluates the full-data loss initially and after at most accepted updates, using at most record loss computations. Computing all attempted mini-batch objectives and gradients uses at most a constant times record computations, even if their forward values are recomputed. The remaining vector updates, loop and status bookkeeping cost , bounded by . Step 1.3 gives the stated total work excluding membership. Each attempt makes at most one membership call, so ; the actual costs sum to a finite number and, when bounded uniformly, to at most . This proves the work bound without assigning any general computability property to arbitrary open .
4 · Examples, counterexamples and false statements
None yet.
Sources
- Rafael Rafailov et al., Direct Preference Optimization: Your Language Model is Secretly a Reward Model, arXiv:2305.18290v3 (2024)
- Purdue course lecture notes, Preference Optimization (PrefOpt)
- Rafailov et al., Direct Preference Optimization, §4 and Appendix B (procedure background; the finite-budget and oracle-work properties are proved locally here)