SlowGuess/ACL_2020_OCR huggingface dataset:
As stated in Section 3.1, for a given module type and a given example, precision is defined as the number of matched proposed bounding boxes divided by the number of proposed bounding boxes to which the module assigns a probability more than 0.5. Recall is defined as the number of matched annotated bounding boxes divided by the number of annotated bounding boxes. Therefore, the numerators of the precision and the recall need not be equal. In short, the reason for the discrepancy is that there is no one-to-one alignment between annotated and proposed bounding boxes. To further illustrate why we chose not to have a common numerator, we will consider two sensible choices for this shared numerator and explain the issues with them.
One choice for the common numerator is the number of matched proposed bounding boxes. If we were to keep the denominator of the recall the same, then the recall would be defined as the number of matched proposed bounding boxes divided by the number of annotated bounding boxes. Consider an example in which there is a single annotated bounding box that is aligned with five proposed bounding boxes. When this definition of recall is applied to this example, the numerator would exceed the denominator. Another choice would be to set the denominator to be the number of proposed bounding boxes that are aligned with
some annotated bounding box. In the example, this approach would penalize a module that gives high probability to only one of the five aligned proposed bounding boxes. However, it is not clear that a module giving high probability to all five proposed boxes is more faithful than a module giving high probability to only one bounding box (e.g. perhaps one proposed box has a much higher IOU with the annotated box than the other proposed boxes). Hence, this choice for the numerator does not make sense.
Another choice for the common numerator is the number of matched annotated bounding boxes. If we were to keep the denominator of the precision the same, then the precision would be defined as the number of matched annotated bounding boxes divided by the number of proposed bounding boxes to which the module assigns probability more than 0.5. Note that since a single proposed bounding box can align with multiple annotated bounding boxes, it is possible for the numerator to exceed the denominator.
Thus, these two choices for a common numerator have issues, and we avoid these issues by defining the numerators of precision and recall separately.
B.2 Averaging Faithfulness Scores
The method described in Section 3.1 computes a precision, recall, and  $\mathrm{F_1}$  score for each example for every module type occurring in that example. The faithfulness scores reported in Table 1 are averages across examples. We also considered two other ways of aggregating scores across examples:
1. Cumulative P/R/F1: For each module type, we compute a single cumulative precision and recall across all examples. We then compute the dataset-wide  $\mathrm{F_1}$  score as the harmonic mean of the precision and the recall. The results using this method are in Table 4. There are some differences between these results and those in Table 1, e.g. in these results,  $NMNw/$  Graph-count + decont. + pretraining has the highest faithfulness score for every module type, including relocate.
2. Average over module occurrences: For each module type, for each occurrence of the module we compute a precision and recall and compute  $\mathrm{F}_1$  as the harmonic mean of precision and recall. Then for each module type, we compute the overall precision as the average precision across module occurrences and
5605
similarly compute the overall recall and  $\mathbf{F}_1$ . Note that a module can occur multiple times in a single program and that each image is considered a separate occurrence. The results using this method are in Table 5. Again, there are some differences between these results and those in Table 1, e.g. NMN w/ Sum-count has a slightly higher score for with-relation than NMN w/ Graph-count + decont. + pre-training.
With both of these alternative score aggregation methods, we still obtained  $p < 0.001$  in our significance tests.
We also noticed qualitatively that the metric can penalize modules that assign high probability to proposed bounding boxes that have a relatively high IOU that does not quite pass the IOU threshold of 0.5. In such cases, while it may not make sense to give the model credit in its recall score, it also may not make sense to penalize the model in its precision score. Consequently, we also performed an evaluation in which for the precision calculation we set a separate "negative" IOU threshold of  $10^{-8}$  (effectively 0) and only penalized modules for high probabilities assigned to proposed boxes whose IOU is below this threshold. The results computed with example-wise averaging are provided in Table 6.
C Details about Experiments
Visual Reasoning We use the published pretrained weights and the same training configuration of LXMERT (Tan and Bansal, 2019), with 36 bounding boxes proposed per image. Due to memory constraints, we restrict training data to examples having a gold program with at most 13 modules.
C.1 Program Annotations
We generated program annotations for NLVR2 by automatically canonicalizing its question decompositions in the BREAK dataset (Wolfson et al., 2020). Decompositions were originally annotated by Amazon Mechanical Turk workers. For each utterance, the workers were asked to produce the correct decomposition and an utterance attention for each operator (module), whenever relevant.
Limitations of Program Annotations Though our annotations for gold programs in NLVR2 are largely correct, we find that there are some examples for which the programs are unnecessarily
Figure 4: An example of a gold program for NLVR2 that is unnecessarily complicated.
complicated. For instance, for the sentence "the right image contains a brown dog with its tongue extended." the gold program is shown in Figure 4. This program could be simplified by replacing the with-relation with the second argument of with-relation. Programs like this make learning more difficult for the NMNs since they use modules (in this case, with-relation) in degenerate ways. There are also several sentences that are beyond the scope of our language, e.g. comparisons such as "the right image shows exactly two virtually identical trifle desserts."
D Significance tests
D.1 Visual Reasoning
We perform a paired permutation test to test the hypothesis  $H_0$ : NMN w/ Graph-count + decont. + pretraining has the same inherent faithfulness as NMN w/ Layer-count. We follow the procedure described by Ventura (2007), which is similar to tests described by Yeh (2000) and Noreen (1989). Specifically, we perform  $N_{total} = 100,000$  trials in which we do the following. For every example, with probability  $1 / 2$  we swap the  $F_1$  scores obtained by the two models for that example. Then we check whether the difference in the aggregated  $F_1$  scores for the two models is at least as extreme as the original difference in the aggregated  $F_1$  scores of the two models. The p-value is given by  $N_{exceed} / N_{total}$ , where  $N_{exceed}$  is the number of trials in which the new difference is at least as extreme as the original difference.
5606
5607
Model	Performance (Accuracy)	Overall Faithful.(↑)	Module-wise Faithfulness(↑)
Prec.	Rec.	F1	find	filter	with-relation	relocate
LXMERT	71.7
Upper Bound	1	0.63	0.77	0.78	0.79	0.73	0.71
NMN w/ Layer-count	71.2	0.069	0.29	0.11	0.13	0.09	0.07	0.05
NMN w/ Sum-count	68.4	0.25	0.18	0.21	0.23	0.20	0.16	0.05
NMN w/ Graph-count	69.6	0.20	0.22	0.21	0.24	0.19	0.17	0.04
NMN w/ Graph-count + decont.	67.3	0.21	0.29	0.24	0.28	0.22	0.19	0.04
NMN w/ Graph-count + pretraining	69.6	0.28	0.31	0.30	0.34	0.27	0.25	0.09
NMN w/ Graph-count + decont. + pretraining	68.7	0.34	0.43	0.38	0.43	0.34	0.29	0.11
Table 4: Faithfulness scores on NLVR2 using the cumulative precision/recall/ $F_1$  evaluation.
Model	Performance (Accuracy)	Overall Faithful.(↑)	Module-wise Faithfulness(↑)
Prec.	Rec.	F1	find	filter	with-relation	relocate
LXMERT	71.7
Upper Bound	1	0.91	0.92	0.90	0.95	0.96	0.82
NMN w/ Layer-count	71.2	0.67	0.64	0.39	0.21	0.50	0.61	0.50
NMN w/ Sum-count	68.4	0.70	0.59	0.48	0.38	0.53	0.63	0.49
NMN w/ Graph-count	69.6	0.55	0.64	0.43	0.36	0.47	0.54	0.41
NMN w/ Graph-count + decont.	67.3	0.47	0.70	0.45	0.42	0.47	0.55	0.33
NMN w/ Graph-count + pretraining	69.6	0.58	0.70	0.47	0.42	0.49	0.58	0.41
NMN w/ Graph-count + decont. + pretraining	68.7	0.58	0.79	0.55	0.54	0.55	0.62	0.43
Table 5: Faithfulness scores on NLVR2 using the average over module occurrences evaluation.
Model	Performance (Accuracy)	Overall Faithful.(↑)	Module-wise Faithfulness(↑)
Prec.	Rec.	F1	find	filter	with-relation	relocate
LXMERT	71.7
Upper Bound	1	0.8377	0.89	0.89	0.92	0.95	0.75
NMN w/ Layer-count	71.2	0.59	0.39	0.25	0.31	0.28	0.45	0.30
NMN w/ Sum-count	68.4	0.79	0.31	0.34	0.38	0.36	0.48	0.28
NMN w/ Graph-count	69.6	0.68	0.39	0.38	0.43	0.36	0.44	0.22
NMN w/ Graph-count + decont.	67.3	0.62	0.51	0.47	0.53	0.39	0.43	0.16
NMN w/ Graph-count + pretraining	69.6	0.70	0.49	0.47	0.52	0.41	0.51	0.27
NMN w/ Graph-count + decont. + pretraining	68.7	0.71	0.66	0.62	0.68	0.50	0.55	0.31
Table 6: Faithfulness scores on NLVR2 using a negative IOU threshold of  ${10}^{-8}$  and example-wise averaging.
5608