Note that, unlike during parsing, there is no uncertainty over the actual rules used, so the E-step does not require summing over possible trees.
for the variable G we have For the hierarchy level L we can write , where we slightly abuse notation since the rule X → α can occur multiple times in a tree T. In the M-step, we find the maximum-likelihood model parameters given these posterior assignments; i.e., we find the best grammars given the way the training data's rules are distributed between individual and shared grammars.