{'fraction_non_alphanumeric': 0.03501747480574124, 'fraction_numerical': 0.011401038308845984, 'mean_word_length': 4.383013698630137, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Latent Tree Decomposition Parsers for AMR-to-Text Generation

Graph encoders in AMR-to-text generation models often rely on neighborhood convolutions or global vertex attention. While these approaches apply to general graphs, AMRs may be amenable to encoders that target their tree-like structure. By clustering edges into a hierarchy, a tree decomposition summarizes graph structure. Our model encodes a derivation forest of tree decompositions and extracts an expected tree. From tree node embeddings, it builds graph edge features used in vertex attention of the graph encoder. Encoding TD forests instead of shortest-pairwise paths in a self-attentive baseline raises BLEU by 0.7 and chrF++ by 0.3. The forest encoder also surpasses a convolutional baseline for molecular property prediction by 1.92% ROC-AUC.


Introduction
Due to the prevalence of structured data such as graphs or tables, models that generate text from these formats are highly practical. The models must produce fluent sequences without deviating from the input semantics. A major obstacle for this task is the disconnect between the structure and order of source and target elements.
Abstract Meaning Representation (Banarescu et al., 2013) is a semantic graph that captures sentence-level propositional meaning. It has labeled vertices and edges called concepts and relations, respectively. AMRs are typically tree-like and rooted at one concept from which relations point out. AMRs that are not strictly trees have reentrancies, or vertices with multiple parents. Besides AMR's denser structure, its underspecified semantic labels also challenge text generation.
Recent AMR-to-text models (Zhu et al., 2019;Cai and Lam, 2020) favor encoders that model global vertex dependencies. Such models often adopt self-attention from the sequence encoder of the Transformer (Vaswani et al., 2017). Unlike graph convolutional networks (GCNs), selfattention updates each vertex as a function of the entire graph. In place of the recurrent updates found in GCN models (Beck et al., 2018;Song et al., 2017), these graph encoders apply stacked layers of attention. Thus, vertices in self-attentive graph encoders enjoy constant-time communication, regardless of their distance. Despite their flexibility, self-attentive encoders ignore graph structure. One way to refine selfattention is to mimic GCNs by masking out nonadjacent vertices (Zhu et al., 2019;Wang et al., 2020). Cai and Lam (2020) instead bias embeddings of each pair of query-key vertices on the shortest path between them. The first approach faces the drawbacks of GCNs, while the second only partially captures per-vertex graph context.
Instead of encoding graph topology explicitly, we aim to close the structural gap between graph and string (Zhao et al., 2020). We train a latent parser that extracts tree decompositions, which cluster edges of the input graph into a hierarchy. Whereas these trees can be used to efficiently marginalize over variables of a graphical model, we use them to bridge graph and string. Specifi-cally, the trees simplify graph structure and ease alignment between predicted tokens and vertices.
To further motivate the use of tree decompositions for graph-to-string models, we note their parallels to context-free graph grammars. Bags of a tree decomposition map to states of a derivation tree in a hyperedge replacement grammar (Lautemann, 1988). In effect, the same algorithm that applies the graph grammar can be used to parse a forest of tree decompositions. Jones et al. (2013) present HRGs as analogous to context-free string and tree grammars; they further show how HRGs can be drawn from tree decompositions. They do not, however, apply the HRGs to concrete tasks.
Tree decompositions provide benefits as (i) a structural intermediate between graph and string and (ii) a model of AMR graph languages. This work integrates a tree decomposition parser into the graph encoder of an AMR-to-text model. Our encoder uses the node embeddings of an expected tree to bias self-attention following Cai and Lam (2020). While they use shortest paths to learn edge embeddings between all vertex pairs, we only update existing edges. By parsing tree decompositions, our model performs exact inference over the full graph instead of relying on local path features.
We further experiment on the molecular chemistry MolHIV dataset (Hu et al., 2020) to test the parser on graph classification. Previous work leveraged tree-structured scaffolds over molecular graphs to help constrain the chemical validity of a generative model (Jin et al., 2018). The bags of our tree decompositions are domain invariant and thus do not necessarily map to valid chemical substructures. The promising results of our tree decomposition parser in this new setting support its flexibility.

Tree Decomposition
We now introduce tree decomposition and how it applies to graphs of a certain treewidth. We then expose parallels between tree decomposition and hyperedge replacement grammars. Lastly, we review an O(n k+1 ) algorithm that parses k-width tree decompositions from a graph.

Definition
A tree decomposition reduces a graph to a hierarchy of subgraphs. Given graph G = (V, E) it is denoted by T = (I, F ), where {X i } i∈I contains vertex sets, or bags, that are linked by arcs in F .  Tree decompositions have the below properties.
1. Vertex cover: The bags of T cover all vertices in V , or i X i = V .
2. Edge cover: Each edge (u, v) ∈ E is covered by some bag of T , or ∃i : u, v ∈ X i .
3. Running intersection: All bags on the path from X i to X j in T cover vertices in X i ∩ X j .
An optimal tree decomposition (in short TD) of a graph has minimal width, which relates to the largest bag: max i |X i | − 1. A bag is capable of covering a clique among its vertices; graphs of greater complexity need larger bags to cover their edges. Thus, a graph's treewidth, or width of its optimal TD, helps characterize its complexity. For example, a tree lacks cliques of size greater than two and thus has treewidth 1. In contrast, an n × n grid graph has treewidth n; the optimal TD's bags chain together rows or columns of the grid. As previously noted, TDs enable linear time inference in graphical models. Limiting TD width bounds the complexity of message passing among adjacent nodes. This improved efficiency via constant treewidth holds for a variety of NP-complete graph problems (Arnborg et al., 1991).

Relation to HRGs
As HRG derivation trees and TDs have the same structure they can share a parser. We describe parsing TDs in terms of HRGs for clear intuition then define how the former maps onto the latter.
HRG is a context-free graph grammar that recursively replaces nonterminals called hyperedges with hypergraphs. An HRG is denoted by a tuple N, T, P, S of nonterminals N , terminals T , and start symbol S ∈ N . Productions P take form A → R with A ∈ N and R ∈ N ∪ T . Hypergraph fragment R includes a hypergraph V, E, and external node set X ∈ V + ; the latter is an interface between the hypergraph and hyperedge A.
A TD can be formed by mapping the external node sets of an HRG derivation tree to bags. The derivation tree's nodes are HRG rules, which are linked by chained hyperedge replacement. Each node covers a subgraph of the input graph. When a node has children, this subgraph is split into smaller edge-disjoint subgraphs. Each child subgraph shares external nodes X with its parent and exposes new edges that have not been seen in ancestor nodes. Thus, we can extract a TD by ignoring the nonterminals of each derivation tree node, keeping only the terminal vertices in X. Since a derivation tree rewrites all hyperedges by terminals, vertex and edge cover are satisfied. As external nodes X exist in the parent node's hyperedge, running intersection is enforced as well.

Parsing algorithm
In order to extract TDs of at most width k from an AMR, we employ an algorithm by Lautemann (1988). The method recursively checks whether a given vertex set S ⊆ V with |S| ≤ k + 1 can serve as the subtree root of a TD for graph G.
if |N S (C)∪C| ≤ k+1 then return true return root The algorithm depends on a dictionary D mapping a vertex set S i to connected components [C i1 . . . C ij ] that result from its removal from G. This dictionary is needed since, unlike substrings, subgraphs can be composed of each other in arbitrary ways. Given a candidate external node set, the connected components are the possible subgraphs that must be covered by child nodes in the equivalent HRG derivation tree.
Algorithm 1 recognizes k-width TDs of G. It equivalently applies an HRG whose rules have right-hand sides with no more than k + 1 external nodes. The term N S (C) ⊆ S refers to the vertices in S that subgraph C is incident to. The contextfree nature of hyperedge replacement is revealed by the fact that C connects to the rest of G only through vertices N S (C)-the external vertices that anchor a hypergraph to its host. This property enables a divide-and-conquer approach, where the node states can be reused by various TDs.
Algorithm 1 is initially called with S = ∅ and C = V . Line 2 is the base case where subgraph C merged with its neighbors in S is no larger than k + 1. In lines 4-10, the subgraph induced by N S (C) ∪ C is split to verify that all descendant nodes are valid roots of a k-width TD. Note that lines 4-5 iterate through all sets of children for the subgraph, yet only one true assignment to ch root is needed for recognition. Since we reuse this algorithm to produce a derivation forest of TDs by replacing the (∨, ∧) operators, we keep the exhaustive search.
Root-constrained search While Algorithm 1 considers all possible TDs for a given graph, we use the rooted structure of an AMR to narrow the search. We ensure that the root bags of the extracted forest cover (i) the root vertex of an AMR and (ii) at least one edge stemming from the root. Without this constraint, the algorithm can return trees that are structurally isomorphic yet rooted at different bags. Furthermore, we wish for the forest structure to resemble that of the input AMR.
Minimizing bag size As the molecular graphs are generally larger than AMRs we further prune their TD forests by keeping derivations of minimal bag size. For each (S, C) pair we store a (k + 1)-element bag size frequency vector, sorted in increasing order of bag size. Given multiple derivations for (S, C), each derivation is assigned the sum of its (S , C ) frequency vectors. We only retain the derivations whose frequency vectors have the lowest lexicographical order.
The baseline system (Cai and Lam, 2020) for AMRto-text generation adapts the Transformer to graph inputs. To do so it injects path embeddings between vertex pairs into encoder self-attention. For molecular property prediction we simply feed edge embeddings from the forest encoder to a baseline GCN model. We describe these changes while briefly covering the Transformer.

Encoder
The encoder computes embeddings of source tokens x = (x 1 , . . . , x n ) based on their initial embeddings. Given d-dimensional embeddings X ∈ R n×d , the encoder uses dot-product attention to apply function e : R n×d → R n×d . At each sub-layer, different attention heads indexed by h can update positions of x in parallel: where Q h , K h ∈ R d×m and V h ∈ R d×d are query, key, and value projections; represents matrix concatenation and σ refers to the softmax function. Besides the Attn function, a sub-layer includes two linear projections and layer normalization. Residual connections between sub-layers to allow the encoder more flexibility in combining them.
Relation encoder The original Transformer used positional encodings of string x as added inputs to the encoder. These positional encodings relay information about input structure to the self-attention mechanism. In contrast to string tokens, however, unordered graph vertices V = {v 1 . . . v n } cannot be assigned unique positions. To remedy this, Cai and Lam learn relation embeddings R ∈ R n×n×d for each directed edge between vertices. These R are summed with X in the dot-product attention between a query i and at j: Thus R ij has a direct influence on the attention between the two indices. To learn R ij , they apply bidirectional GRUs along relation labels of the shortest path between vertices v i and v j . To connect all vertex pairs, they add reverse edges and a global vertex v 0 that is adjacent to all vertices. Overall, leveraging graph paths in this way injects structure into the encoder.

Decoder
The decoder stack is analogous the encoder and applies function d : R n×d → R m×d , where m is the length of the target sequence y. In addition to self-attention on the current decoded embeddings Y ∈ R (t−1)×d , it also performs cross-attention on the encoder output X . In the latter case, Q applies to Y and K, V apply to X .
Following previous NLG models, Cai and Lam employ a copy mechanism (Gu et al., 2016) to handle sparsity in the output distribution. The decoder can mix between generating target tokens and copying concept labels from the input AMR. It learns a distribution p cp ∈ [0, 1] based on decoder hidden state Y t : wherep(y t |Y t ) is the initial decoder target distribution, C(y t ) is the set of concepts corresponding to y t , and A ∈ m × n is a cross-attention matrix between tokens and concepts.

Forest Encoder
We use the inside-outside algorithm to encode nodes of an AMR's TD derivation forest. Forest node embeddings are used to update relations covered by their associated bags.

Node initialization
The states of forest nodes are initialized based on the content and structure of their associated bags. Both inside and outside embeddings are initialized in this way. Edge labels in the bag's induced subgraph represent its content, while motif labels capture its structure. A motif refers to an unlabeled, canonical subgraph structure; isomorphic subgraphs map to the same motif.
Given matrix A s ∈ Z k×k of relation labels in subgraph s, we embed all non-diagonal entries R s ∈ R k(k−1)r . We denote the motif embedding for subgraph s by M s ∈ R m . The bag embedding is computed as where W 1 ∈ R (k(k−1)r+m)×h . Forest nodes mapping to the same bag share the same embedding, while those created to binarize the forest receive the zero vector. The forest root is encoded as a learned bias since it maps to an empty bag.

Inside pass
The inside algorithm iterates all ways to derive a nonterminal bottom-up. We apply this framework to compute forest node embeddings, training the model to learn derivation weights.
We first define a node's leaf-relative depth as where C(·) selects the children of a given node. These values are used to find relative depths of parent-child nodes and parallelize batched updates.
Since the forest is binarized, each node has at most 2y children for y derivations. A node embedding is a weighted sum of derivation states, which are each a function of two child node states. We denote the embedding of node a by e a ∈ R h .
Child combination Derivations are encoded based on the node embeddings and parent-relative depths of their children. The depth d a − d b of child node b relative to its parent a is represented by a learned embedding da−d b ∈ R d . Derivation states are found as where b 1 , b 2 are the children in derivation r and W 2 ∈ R 2(h+d)×h .
Derivation attention To sum over derivation states, we apply Transformer cross-attention queried by parent node state e a and keyed by all derivations v r for r ∈ [1, y].

Outside pass
Using results of the inside pass, we embed all outer contexts of a nonterminal. The outside value includes derivations of a forest node's ancestors rather than its descendents. An outside derivation consists of a parent's outside embedding and a sibling's inside one. Since both inside and outside passes compose a derivation from two predecessor embeddings, they can share model parameters.
As nodes are encoded top-down instead of bottom-up, we find the depth of each node relative to the forest root instead of the furthest leaf. As such, root-relative depthd a follows eq. 1 but replaces C(·) with the set of a node's parents P(·).
Parent-sibling combination Analogous to encoding an inside derivation, embeddings from a parent and sibling are combined to produce an outside derivation: where c 1 ∈ P(a) is the parent and c 2 ∈ C(c 1 ) the sibling in derivation r. If node a has z unique parents, then r ∈ [1, z]. The outside embedding of node c is written asē c . Derivation attention Neural parameters from the inside pass cross-attention module are reused to combine outside derivation states. The attention mechanism uses outside parent node stateē a as the query and derivations u r for r ∈ [1, z] as the keys.

Relation updates
In order to update AMR relations as a function of forest nodes, we rely on the edge cover property of a single TD. Since each edge exists in exactly one TD bag, we compute an expected tree from the forest such that this property is upheld.
Recall that the inside pass computes derivation attention weights for each node and all sets of its children. This means that each pairwise arc between nodes receives a weight normalized by the sum of all arc weights for the same source node. To find the probability of each node appearing in the final parsed tree, we apply sum-product over these arc weights top-down over the forest.
More concretely, let A be a node and B r , C r its children for derivation r ∈ [1, y]. The probability c(A) depends on all ways of reaching node A from the root. Thus, we first initialize c(ROOT) = 1 and must compute c(·) for all nodes between the root and A before computing c(A). If we process the rule A → B r C r , the following quantity is added to each of c(B r ) and c(C r ): This simply extends the path prefix ending in A by one rule application. The values w(·) are derivation attention weights from the inside pass, where r ∈[1,y] w(A → B r C r ) = 1. Processing rules in the forest top-down ensures that we compute all of a node's predecessor weights before its own.
Node aggregation While forming an expected tree from a weighted sum of forest nodes, we update AMR relation embeddings as a function of relevant node embeddings. At each parent-child arc we take the set of relations covered by the bag associated with the child node. For example, let X, X be the external vertex sets linked to nodes A, B r as described in §2.2. The set of updated relations is which ignores relations whose endpoints both fall in the intersection of parent and child bags. This filtering helps avoid relations previously covered by antecedent nodes. Furthermore, we ignore cases where relations that are self-loops (i.e., u = v) or do not exist the AMR. This restricts relations to those that affect vertex self-attention. The relations (u, v) ∈ R X,X are updated as The above update takes into account both inside and outside node embeddings of parent A, weighted by the probability of choosing derivation r. Updating relations in this way ensures that each relation receives a total weight of one across all derivations in the forest.

Experiments
For AMR-to-text generation the baseline system (Cai and Lam, 2020) computes pairwise shortest paths to encode relations for vertex self-attention. Our system replaces these paths with a forest encoder that embeds relations from forest node states, which are found via inside-outside. We use the LDC2017T10 sembank of 36,521 training, 1,368 development, and 1,371 test AMR-sentence pairs. Output sentences are evaluated via BLEU (Papineni et al., 2002) and CHRF++ (Popović, 2017).
For molecular property prediction we built atop a GCN-based model called a directional graph network (Beaini et al., 2021, DGN) that propagates information via directional derivatives. MolHIV contains 32,901 training, 4,113 validation, and 4,113 test molecule-label pairs. A model must predict whether a molecule inhibits HIV virus replication. The area under the receiver operating curve (ROC-AUC) is the evaluation metric.

Preprocessing
LDC2017T10 We adopt the same preprocessing pipeline as the baseline, which was first introduced by Konstas et al. (2017). The pipeline removes sense tags (e.g., 'go-01' → 'go') and variables (e.g., BLEU CHRF++ Cai and Lam (2020) 29 'b / boy' → 'boy') from concept labels. The AMRs are recategorized to simplify graph structure, which involves replacing named entity subgraphs with category concepts and standardizing dates.

Setup
LDC2017T10 As we use motif embeddings to initialize bag embeddings ( §4.1), we ablate them in TDP-M to test effectiveness. While embedding bag-level relation labels R s is enough to uniquely encode bags, we assert that motifs provide added graph structure to the edges covered per bag. We also ablate the use of TD forests as opposed to single trees in the TREE setting. The TDP model adopts baseline hyperparameters when possible. New hyperparameters are tuned manually based on validation BLEU and CHRF++. Vertex and token embeddings are of size 300 and randomly initialized. Their encoders include character-level CNNs with filter size 3 and projection size 256. Attention blocks have hidden states of size 512, feed-forward projections of size 1024, and 8 attention heads. Model parameters are optimized using Adam (Kingma and Ba, 2015) with default settings of α = 0.001, β 1 = 0.9, β 2 = .999, and η = 10 −8 . Training for both datasets is done on a 16GB Tesla V100 GPU.
In the ablated TDP-M, the size of embedding R s is kept the same as in TDP for consistency. The original [R s , M s ] sizes are [64k(k − 1), 32] with k = 4 as the maximum number of AMR concepts per bag. The AMRs are parsed into TDs of maximum width 3, while those with higher treewidth skip the forest encoder altogether.
MolHIV TDP adopts all hyperparameters from DGN. Vertex embeddings are size 70 and there are five convolution layers. In TDP parser parameters are jointly optimized with existing ones. Adam is used and learning rate is further halved after every twenty-epoch plateau in validation ROC-AUC. For TDP [R s , M s ] sizes are [32k(k − 1), 16] for k = 4 and edge embeddings are of size 8. We run the author-provided training script five times for each  of DGN and TDP in the experiments.

Results
LDC2017T10 As shown in Table 1 TDP gains a 0.7 BLEU and 0.3 CHRF++ margin over Cai and Lam (2020). TDP-M and TREE reveal the benefits of motif embeddings and parsing forests instead of trees. Both settings reduce BLEU by 0.5, while CHRF++ drops by 0.3 in TDP-M and 0.4 in TREE. These scores support the grounding effect of motif embeddings in the AMR topology. In addition, encoding forests rather than singular TDs appears to bolster the model's view of graph structure.
MolHIV Table 2 lists the mean ROC-AUC percentages over five trials for test and validation splits. TDP offers a clear advantage over DGN, with a 1.92% increase test ROC-AUC. During training it also reaches a higher validation ROC-AUC by 0.97%. We note that the evaluation splits of Mol-HIV are based on scaffold splitting, which tries to split the data into maximally diverse subsets according to molecular structure. Thus, these results provide more evidence that the forest encoder can generalize over global graph features.

Analysis
Focusing on AMR-to-text generation, we proposed that TDs can help close the structural gap between graphs and strings. Specifically, TDs summarize global graph structure while their acyclicity imposes an order on the vertices. If this is valid we would expect to see better results on structurally complex graphs in particular. In this section we inspect how sentence-level CHRF++ varies with AMR reentrancy count, diameter, and treewidth. We also compare several sentences generated by the baseline and TDP.
Reentrancy As reentrancies add cycles to an AMR, higher reentrancy counts should correlate with graph complexity. They are also of interest since TDs explicitly eliminate cycles from a graph and we hypothesize that this aligns them more closely with strings. The encoder by Cai and Lam (2020), however, relies only on shortest pairwise  paths between vertices and may be susceptible to cycles. Figure 4a shows that as reentrancy count increases TDP generally maintains a lead over the baseline. The only exception is the last bucket of AMRs that have at least seven reentrancies. Perhaps the baseline's RNN path encoder gives it an edge on highly reentrant cases. TDP-M suffers a performance hit relative to TDP on AMRs with over four reentrancies, which suggests that motif embeddings are especially helpful for such AMRs.
Diameter The maximum pairwise distance between AMR vertices is another salient metric. Among connected graphs of size n, a fully connected graph has diameter 1 while a linear graph has diameter n − 1. As such, graphs of greater connectivity generally have lower diameter. Figure 4b shows that TDP offers the greatest boost (1) Ref columbia is the only country that currently has a policy of targeting drug trafficking aircraft . CL20 columbia is the only country with the target of drug traffickers . TDP columbia is the only country that currently has the policy of targets for drug trafficking aircraft .
(2) Ref questions have emerged regarding the shipment of arms en route to kenya and of a possible clandestine arms deal between kenya and south sudan . CL20 the question with regard to kenya and south sudan a clandestine arms deal at its possible and a clandestine arms deal . TDP the question emerged in regards to the shipment of the route to kenya and possibly a clandestine arms deal with south sudan .
(3) Ref if you get out ahead of the need you are accused of causing sprawl . CL20 when you got ahead of need , you are accused of being of being the sprawl . TDP if you get ahead of the need , you are accused of causing a sprawl .
(4) Ref the preliminary competition for the women 's 10 -meter platform diving will be held this afternoon . CL20 this afternoon a preliminary compete between women and 10 -meter platform will be held ! TDP this afternoon, preliminary competition for the women 's 10 -meter platform dive is held . in CHRF++ for AMRs of diameter 1. It maintains a less dramatic advantage for diameters up to 6. Clearly the forest encoder can simplify global topology across a range of graph structures. Treewidth As defined in §2.1, treewidth correlates with the connectivity of a given graph. Intuitively, a graph with large, tight clusters needs larger bags to cover all its edges in a TD. As TDP directly captures higher-level AMR structure through TDs, it may be less affected by high treewidth AMRs. Figure 4c indicates that TDP outperforms the baseline on AMRs of treewidth up to 2. The performance dip on higher treewidths may be due to data sparsity, which hurts TDP's ability to learn motif embeddings of larger bags.
Manual inspection We next examine differences between the models' predicted sentences. Sentences in Table 3 highlight differences in how the models handle linguistic phenomena. The AMRs of (1) and (2) have reentrancy counts and diameters of 3-4, while those of (3) and (4) have 1-2 reentrancies and diameters of 3. All examples have treewidth 2 except for (4), which has treewidth 1.
In (1) the baseline drops the phrase currently has a policy and substitutes drug trafficking aircraft with drug traffickers. These omittances suggest that the baseline's encoder is not considering global structure, as TDP does not make the same errors. The reference sentence of (2) contains several clauses and long-range dependencies between the verb and noun phrases. The baseline omits the verb emerged and exhibits a lack of syntactic structure in the second half of the sentence. TDP maintains integrity of the two clauses referring to a shipment of arms and arms deal, though it drops the word arms in the former. Example (3) involves causality that the baseline fails to express; instead of if you get out ahead it chooses when you got ahead, which no longer describes a hypothetical scenario. It repeats itself at the sentence's end, replacing causing with being. Lastly, (4) reveals the importance of preserving relations between concepts. Whereas TDP correctly refers to a women 's diving competition, the baseline describes a compete between women and . . . platform. It unfortunately makes no mention of diving. This and previous examples illustrate how inaccuracies in the graph encoder may trickle down to sentence decoding.

Conclusion
We presented a way to parse TD forests within a graph encoder to bias it on global graph structure. With the structural mismatch between AMRs and their target sentences, TDs balance traits of both. Due to their equivalence to HRGs during parsing, TDs also serve as a language over source graphs. Our forest encoder efficiently forms TD node embeddings using the inside-outside algorithm. Experiments on AMR-to-text generation validate the use of motif embeddings and encoding TD forests rather than single trees. In addition to higher corpus-level BLEU and CHRF++ scores, our models succeed on structurally complex AMRs. We also reveal the impact of our forest encoder on coherence of decoded sentences. Finally, promising results on molecular property prediction support the generality of our parser to other model architectures and data domains. We leave further exploration in this direction for future work.