Why Small Backward-Step Errors Matter
Backward Q-learning constructs a treatment rule one decision at a time. At the final stage, it estimates the expected outcome under each available treatment and selects the better option. At the earlier stage, it must use the value of following that optimized final-stage rule—not simply the outcome that happened under the final treatment a person happened to receive. Confusing these quantities can reverse an earlier treatment decision even when the final-stage model is correct.
Three errors are especially easy to make: using observed future outcomes instead of the optimized pseudo-outcome; reversing the sign of a treatment contrast; and maximizing a prediction that belongs to the wrong decision stage. The calculations below make each distinction explicit.
The Two-Stage Quantities to Keep Separate
Consider two treatment stages. Let \(H_1\) be the information available before the first treatment \(A_1\), and let \(H_2\) be the information available before the second treatment \(A_2\). The final outcome is \(Y\). For clarity, suppose each action set is finite. The stage-two Q-function and its optimized value are
The stage-one Q-function evaluates each possible first treatment while assuming that the best available second-stage treatment will be used afterward:
In practice, backward Q-learning estimates the stage-two Q-function, calculates a fitted maximum for each observed \(H_2\), and uses those fitted maxima as responses in the stage-one regression. Identification from observational data requires consistency, sequential exchangeability at each treatment stage, and positivity for the relevant histories and actions. The conditional-mean models must also represent the quantities being estimated if the fitted rules are to have the intended interpretation. These conditions do not excuse bookkeeping errors: even a correctly specified model can be used incorrectly.
To see why, fix a history \(h_2\). Among all second-stage actions, \(Q_2(h_2,a_2)\) is the conditional expected outcome under that action, so its largest value is \(V_2(h_2)\). Now fix \(h_1\) and a candidate \(a_1\). Averaging the best achievable continuation value over the resulting \(H_2\) distribution gives \(Q_1(h_1,a_1)\). Thus the best first-stage action maximizes the expected outcome achievable after that action. More formally, for any alternative two-stage rule \((g_1,g_2)\), conditional on \(H_2\),
Taking conditional expectations given \(H_1,A_1\) shows that the expected outcome under any continuation rule after \(A_1=a_1\) is no greater than \(Q_1(H_1,a_1)\). Maximizing over \(a_1\) therefore gives a value at least as large as that of any rule. For finite action sets, a maximizing action can be selected at each history; ties may be resolved by any fixed rule. \(\square\)
Error 1: Regressing on the Outcome That Happened
The observed outcome reflects the actual second-stage treatment, \(A_2\). The stage-one pseudo-outcome instead represents the best predicted continuation available at that person’s \(H_2\). These differ whenever the treatment actually received does not maximize the stage-two Q-function. Regressing \(Y\) directly on \(H_1,A_1\) can consequently compare first-stage treatments under the observed distribution of later treatments, rather than under optimized continuation.
Worked Example: An Observed Outcome Reverses the First Decision
Suppose the stage-two Q-values are known and \(H_2\) identifies which first-stage treatment was given. For \(A_1=0\), the stage-two outcomes predicted under \(A_2=0,1\) are \(6,0\). For \(A_1=1\), they are \(0,5\). In a small realized sample, suppose everyone happened to receive \(A_2=1\).
Using observed outcomes: The observed outcome is \(0\) for the \(A_1=0\) group and \(5\) for the \(A_1=1\) group. A direct comparison favors \(A_1=1\), since \(5>0\).
Using optimized pseudo-outcomes: For \(A_1=0\), \(V_2=\max(6,0)=6\). For \(A_1=1\), \(V_2=\max(0,5)=5\). The stage-one comparison is therefore \(6\) versus \(5\), and it favors \(A_1=0\).
The difference is not a contradiction: the first comparison reflects the second-stage treatment actually observed, while the second compares first-stage options assuming the best second-stage action follows each one. In observational data, the actual downstream treatment may also be associated with prognosis. Positivity means each relevant treatment has positive probability in the population; it does not require every action to appear in a small realized sample.
The algebra pinpoints what the direct-outcome substitution changes. Given \(H_2\), the observed outcome has conditional mean \(Q_2(H_2,A_2)\), whereas the optimized pseudo-outcome is \(V_2(H_2)\). Since \(V_2(H_2)\geq Q_2(H_2,A_2)\) pointwise, the values agree only when the received action is maximizing (or its Q-value ties for the maximum). Therefore, replacing \(V_2(H_2)\) with \(Y\) does not generally estimate \(Q_1\).
Error 2: Reversing the Treatment Contrast
For a binary treatment coded \(0\) and \(1\), define the treatment contrast at a fixed history as
If \(\Delta(h)>0\), action \(1\) has the larger predicted outcome; if \(\Delta(h)<0\), action \(0\) does. A coefficient is interpretable as this contrast only when the model’s coding and parameterization support that interpretation. In particular, changing the order of subtraction changes the sign, not the preferred action.
Worked Example: Checking the Sign Before Choosing
Suppose the fitted model at a given history predicts \(Q(h,0)=4\) and \(Q(h,1)=6\). Calculate both possible differences.
With the stated convention, \(\Delta(h)=Q(h,1)-Q(h,0)=6-4=2\). Since the contrast is positive, choose action \(1\). If instead someone calculates \(Q(h,0)-Q(h,1)=4-6=-2\), that negative number is the reverse contrast. It does not imply choosing action \(0\): the original predictions still give \(6>4\) for action \(1\).
A direct check is to substitute the action labels into the fitted predictions and compare the numbers. This check is particularly useful when treatment is reference-coded, when interactions make the contrast depend on history, or when software output uses a coefficient whose meaning is not the full treatment contrast.
The decision rule itself follows from a simple identity: for two actions, \(\max\{Q(h,0),Q(h,1)\}=Q(h,1)\) when and only when \(Q(h,1)-Q(h,0)\geq 0\). If the contrast is defined in the opposite order, the corresponding inequality must also reverse. Treating a negative reverse contrast as evidence for action \(0\) while retaining the original contrast convention mixes the two definitions.
Error 3: Maximizing a Prediction From the Wrong Stage
A prediction must be maximized over the action that is being chosen at that stage. At stage two, compare \(Q_2(H_2,a_2)\) over possible \(a_2\). At stage one, compare \(Q_1(H_1,a_1)\) over possible \(a_1\), after averaging the optimized stage-two value over the \(H_2\) distribution induced by each first-stage action. A large stage-two prediction at one possible future history is not itself the value of a first-stage choice.
Worked Example: A High Future Prediction Is Not a First-Stage Score
Suppose stage two has histories \(L\) and \(H\), with Q-values \(Q_2(L,0)=8\), \(Q_2(L,1)=4\), \(Q_2(H,0)=10\), and \(Q_2(H,1)=20\). Thus \(V_2(L)=8\) and \(V_2(H)=20\). The probability of history \(H\) is \(0.1\) after \(A_1=0\) and \(0.9\) after \(A_1=1\).
The correct stage-one scores are conditional averages of the optimized stage-two values:
The correct first-stage choice is \(A_1=1\), because \(18.8>9.2\). A mistaken procedure that uses only the largest stage-two prediction available after each action gives \(20\) for both actions and cannot distinguish them. That maximum ignores how likely each history is under the candidate first-stage treatment. The value \(20\) answers a different question: the best predicted outcome at history \(H\), not the expected optimized continuation after a first-stage action.
The general justification for the stage-one averaging step is the definition of conditional expectation: given \(H_1=h_1,A_1=a_1\), the continuation value \(V_2(H_2)\) varies with the future history. Its conditional mean, not its largest possible value, is the expected value associated with that first-stage choice. Maximizing a stage-two model over \(A_2\) is appropriate; maximizing over future histories or over an action that is not being chosen at the current stage is not.
Practical Checks, Alternatives, and Limits
A short audit of the computation can catch these errors before interpreting a rule:
Write which history is available and which action is being chosen. The stage-two optimization is over \(A_2\); the stage-one optimization is over \(A_1\).
Check that each response is the fitted maximum \(\max_{a_2}\hat Q_2(H_2,a_2)\), not \(Y\) or the fitted value at the received \(A_2\).
Calculate the predicted values under each action at the same history, then confirm that the chosen action has the larger value.
Confirm that it averages the optimized continuation value over the future-history distribution for each candidate \(A_1\), rather than selecting a favorable future history.
Backward Q-learning is a plug-in, regression-based approach. Other approaches, including g-computation and inverse-probability-weighted methods, organize estimation differently, but they target a specified treatment strategy or value; they do not make an incorrectly defined contrast or decision stage meaningful. Q-learning’s attraction is that it builds a rule directly from conditional outcome models. Its limitations include dependence on the conditional-mean models and the availability of treatment choices across relevant histories. The diagnostics above address implementation logic; they do not establish model adequacy, exchangeability, or positivity.
A common mistake is to say, “The observed outcome is the best available response, so it should be used at the earlier stage.” That reasoning confuses a realized outcome under the received treatment with the expected value under an optimized continuation. The correction is to construct the stage-two fitted maximum first, then use that quantity as the stage-one pseudo-outcome. Similarly, a positive or negative coefficient should not be translated into a rule until its contrast direction and action coding have been checked.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- At a history \(h_2\), suppose \(Q_2(h_2,0)=3\), \(Q_2(h_2,1)=7\), and the observed action is \(A_2=0\). What is the optimized pseudo-outcome, and what is the observed-action Q-value?
- A model gives \(Q(h,0)=9\) and \(Q(h,1)=5\). What is \(Q(h,1)-Q(h,0)\), and which action maximizes the prediction?
- After \(A_1=0\), \(H_2=L\) with probability \(0.75\) and \(H_2=H\) with probability \(0.25\). After \(A_1=1\), those probabilities are \(0.25\) and \(0.75\). If \(V_2(L)=4\) and \(V_2(H)=12\), calculate both stage-one scores and choose the better action.
- Why is the largest possible \(Q_2(H_2,a_2)\) across all future histories generally not the stage-one score for a candidate \(A_1\)?
Solutions. (1) The optimized pseudo-outcome is \(\max(3,7)=7\); the observed-action Q-value is \(Q_2(h_2,0)=3\). (2) The contrast is \(5-9=-4\), so action \(0\) maximizes the prediction because \(9>5\). (3) For \(A_1=0\), the score is \(0.75(4)+0.25(12)=3+3=6\). For \(A_1=1\), it is \(0.25(4)+0.75(12)=1+9=10\). Choose \(A_1=1\). (4) The stage-one score is the conditional expectation of the optimized continuation value over the future histories induced by that action. A largest possible value ignores the probabilities of those histories and therefore answers a different question.