INNER CODE UNIT · Python

ctop

FareedKhan-dev/kimi-k3-in-c · tools/cmp_logits.py:93

    ctop = set(np.argsort(-c)[:10].tolist())
    rtop = set(np.argsort(-r)[:10].tolist())

    print("vocab                 : %d" % c.size)
    print("C argmax              : %d  (logit %.6f)" % (ca, c[ca]))
    print("reference argmax      : %d  (logit %.6f)" % (ra, r[ra]))
    print("top-10 overlap        : %d/10" % len(ctop & rtop))
    print("max |diff|            : %.6e" % float(d.max()))
    print("relative to max|ref|  : %.6e   (budget %.1e)" % (rel, budget))
    print("mean |diff|           : %.6e" % float(d.mean()))
    print("correlation           : %.9f"
          % float(np.corrcoef(c.astype(np.float64), r.astype(np.float64))[0, 1]))

    ok_tok = ca == ra
    ok_num = rel <= budget
    # A genuine near-tie can flip argmax between two numerically-agreeing engines, so an
    # argmax difference is only damning when the logits themselves also disagree. Report
    # the gap so a tie is distinguishable from a real divergence rather than silently

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…