Simplified version of Dually Ground BackTranslation for AutoFormalization:
def train_to_af_for_maf(mdl : causal_lm,
formal_data_set, # e.g., ITP lib like mathlib
informal_data_set, # e.g., time-tested maths textbook e.g., Rudin, CLRS.
):
for (nl, fl*) in formal_data_set; for (nl*, fl) in informal_data_set;
# -- Learn to Formalize: nl_i->fl* from fl* -> [nl_i]_i -> fl*
[nl_i]_i := mdl("informalize " + fl*, sampling=top_p, num_out=k) # noise is good for robustness!