OPD icon indicating copy to clipboard operation
OPD copied to clipboard

Possible inconsistency in Top-k OPD: Eq. (5) gives zero loss for k=1, but k=1 is reported

Open Jia-hn opened this issue 5 months ago • 1 comments

Hi authors,

Thanks for the interesting paper and code release. I noticed a possible inconsistency in the Top-k OPD formulation.

Eq. (5) defines Top-k OPD by selecting

S_t = TopK(p_t, k)

then renormalizing both student and teacher distributions on S_t, and minimizing

D_KL( p_bar_t^(S_t) || q_bar_t^(S_t) )

However, when k=1, this objective seems to degenerate. If S_t = {v*}, then both restricted distributions become point masses after renormalization:

p_bar_t(v*) = 1, q_bar_t(v*) = 1

so the KL is identically zero:

D_KL([1] || [1]) = 0

This would provide no distillation signal.

However, the paper reports results for k=1 in the Top-k OPD experiments. Could you clarify how the k=1 result was obtained?

Is Eq. (5) exactly the implemented objective, or does the implementation use a non-renormalized masked/truncated KL-like objective, such as

sum_{v in S_t} p_t(v) [log p_t(v) - log q_t(v)]

or another token-level reward formulation?

If the implementation differs from Eq. (5), it may be helpful to revise the equation or add a clarification, since the current subset-renormalized KL formulation makes the reported k=1 case mathematically zero.

Thanks!

Jia-hn avatar Jun 08 '26 14:06 Jia-hn

Thanks for pointing this out. Your derivation is correct: if Eq. (5) is interpreted as a KL between two distributions that are independently renormalized on S_t, then for k=1 both distributions become [1], and the KL is indeed zero.

The reported k=1 result, however, was obtained from the implementation rather than this singleton-renormalized KL interpretation. Concretely, in the released code:

For the default only_stu strategy, the relevant code is:

kl_val = S_logp - T_on_S
valid_mask = torch.ones_like(S_logp, dtype=torch.bool)
norm_weights = compute_reward_weights(S_logp, T_on_S, valid_mask, reward_weight_mode)
rm_scores = -kl_val * norm_weights

where S_logp is student_top_k_log_probs and T_on_S is teacher_on_student_log_probs.

Therefore, when k=1, the normalized weight over the single selected token is 1, but the reward is still

rm_scores = T_on_S - S_logp

In other word, the reward is still $$ \log p_t(v^) - \log p_s(v^) $$ , which provides a non-zero distillation signal. Here, v∗ denotes the student top-1 token, i.e., the token with the highest probability under the student distribution, rather than the sampled token.

We will revise the paper to make this distinction explicit. Thanks again for catching this ambiguity.

Turingzero0 avatar Jun 08 '26 21:06 Turingzero0