Skip to main content

Module answer

Module answer 

Source
Expand description

Answers, built from a question’s option logits and act logits the way Laya builds them.

This is Laya’s Agent._decode_answers (unchanged from 0.3.7 to 0.3.11), done in the same float types numpy uses so the rounded numbers match: the calibrated softmax and the entropy in f32, the expected score in f64, and sums in numpy’s pairwise order. exp and log are numpy’s own AVX2 routines rather than libm’s, since they differ in the last bit often enough to move a rounded probability: 2 of the 400 parity responses changed in the fourth decimal with libm.

Structs§

Response
The answers to one request.
Temperatures
The calibration of a compat checkpoint, from its rl_agent_config.json, already clamped.

Enums§

Answer
One question’s answer.

Constants§

LAYA_MODEL
The model field of a compat response.
TEMPERATURE_RANGE
The range Laya 0.3.9 and later confine a checkpoint’s temperatures to. The English checkpoint ships 0.1006 for choice:11+, which would sharpen the logits tenfold.

Functions§

act_probability
The act head’s first probability, as torch.softmax gives it.
clamp_temperature
A temperature Laya would use: t confined to TEMPERATURE_RANGE, or 1 when it is not a finite number.
laya_answer
The answer to q from its option logits, in option order, and its two act logits.
py_round
Rounds to digits places the way Python’s round does: correctly, ties to even.
temperature_bucket
Laya’s temp_bucket: the key of temperature_by_options for a type and an option count.