Hierarchy Builder (HB) Framework
- Hierarchy Builder (HB) is a multi-domain design motif that organizes objects into layered and partially ordered structures, enabling flexible data representation.
- In medical information extraction, HB transforms flat textual spans into compact, navigable DAGs using lexical and semantic merging strategies to reduce user effort.
- HB also underpins adaptive model hierarchies for efficient multi-query computation and formalizes inheritance in categorical graph rewriting using Coq.
Hierarchy Builder (HB) is a name used for several technically distinct hierarchy-construction frameworks in recent research. In one usage, HB converts a flat list of extracted textual spans into a compact, navigable directed acyclic graph (DAG) for exploratory browsing in medical information extraction (Yair et al., 2023). In another, HB denotes an abstract framework of adaptive model hierarchies in which models of increasing cost and decreasing error are queried until an a posteriori error criterion is met (Kleikamp et al., 2024). In a third, HB is a packed-class framework on top of Coq’s canonical structures for describing directed acyclic graphs of mathematical structures and inheritance relations, used to formalize adhesive category theory and categorical graph rewriting in Rocq (Arsac et al., 22 Sep 2025). The shared name therefore identifies a recurring design motif—the explicit organization of objects into layered or partially ordered form—rather than a single unified formalism.
1. Terminological scope
The expression “Hierarchy Builder” does not designate a unique standard architecture across the literature. The three uses summarized here differ in domain, object of organization, and correctness criterion. In the information-extraction setting, the organized objects are textual spans, and the target artifact is a navigable DAG whose structure is driven by lexical containment, semantic similarity, and taxonomic abstraction. In the adaptive-model setting, the organized objects are surrogate or reduced models ordered by fidelity, cost, and certifiable error. In the Rocq setting, the organized objects are mathematical structures and morphism classes arranged by forgetful inheritance inside a packed-class hierarchy.
A common misconception is to equate HB with tree construction. That characterization is inaccurate for two of the three usages. The information-extraction HB explicitly produces a DAG and preserves multiple inheritance; the Rocq HB likewise represents a directed acyclic graph of structures rather than a simple chain. Even in the adaptive-model framework, the operative object is not a tree but an ordered sequence of models together with switching rules and adaptation procedures. This suggests that “hierarchy” is the stable abstraction, while the concrete semantics of nodes and edges are domain-specific.
2. HB as a textual-span organizer
In “Hierarchy Builder: Organizing Textual Spans into a Hierarchy to Facilitate Navigation,” HB is a multi-stage pipeline that turns a flat list of textual spans into a compact, navigable DAG (Yair et al., 2023). The workflow begins with hundreds–thousands of extracted noun-phrases. Each phrase is expanded by extracting all meaningful sub-spans, including head nouns and modifiers. Every span is then preprocessed to remove stop-words, modal words, and quantities, and is lemmatized to define its lemma-bag .
The first consolidation stage is lexical equivalence. Two spans belong to the same initial group if up to small edit-distance matches and known spelling variants in UMLS/WordNet. This produces equivalence sets . Every lexical equivalence set becomes a DAG node, and each span’s head noun or adjective is also introduced as an additional node to support co-mention grouping. A single artificial ROOT is added above all heads so that the graph is connected.
The initial edge relation is specificity by lemma-bag containment. Node is more specific than node when they are not equivalent and ’s lemma bag is strictly contained in ’s lemma bag. An edge 0 is drawn only when there is no intermediate node 1 with 2, yielding what the paper calls a clean “containment DAG.” This graph is subsequently refined by semantic merging. For each equivalence set 3, the average embedding is
4
The system traverses the DAG in depth-first order. Direct neighbors are merged when
5
and merging would not introduce a cycle. A second pass uses 6 for merging a node with its direct child. Any UMLS-synonym pairs are also merged.
A further enrichment stage injects taxonomy. Each node, via its canonical span, is mapped into UMLS, and UMLS concepts that subsume at least two nodes are collected. If such a concept already appears as a node, the system connects it to descendants where missing, while avoiding cycles. Otherwise, it creates a new node labeled by its most similar synonym and hooks it above its descendant nodes. The resulting DAG is intentionally rich, but it is then pruned to reduce visual and navigational burden while preserving reachability of all original spans.
Pruning is formulated as a set-cover problem. For each node 7, let 8 be the sets of original-span descendants covered by each child. HB chooses a minimal subcollection of children such that
9
Because minimum-cardinality set cover is NP-hard, the system uses the standard greedy set-cover approximation: at each step it picks the child covering the largest number of yet-uncovered spans. After pruning edges, any node with only one child is spliced out by connecting its parent directly to its grandchild.
Entry-point selection gives the hierarchy a browse-oriented top layer. Each candidate node 0 is scored by
1
where 2 are embeddings of original spans reachable from 3. HB picks the top-scoring node, subtracts its covered spans’ affinities from the scores of remaining candidates, and repeats until 4 entry nodes are chosen. In the front end, the user first sees the 5 entry nodes plus an “Other” bucket. Clicking an entry node expands its children, each node is labeled by its best representative span, and each node shows the number of original-span leaves reachable beneath it. The shallow average depth, approximately 6, and small average branching factor, approximately 7–8, are presented as the structural basis for bird’s-eye browsing with only a few clicks.
3. Medical information extraction deployment and evaluation
The textual-span HB was evaluated on a medical information-extraction task involving causes, or etiologies, of two common conditions: jaundice and chest pain, extracted from approximately 9M PubMed abstracts (Yair et al., 2023). Extraction used 0 syntactic patterns via SPIKE and yielded 1 raw strings for jaundice and 2 for chest pain, collapsing to 3 and 4 unique strings, respectively. After lexical grouping, these became 5 jaundice concepts and 6 chest-pain concepts. The known-etiology benchmarks contained 7 established causes for jaundice and 8 for chest pain.
Coverage was measured relative to both the flat extraction list and the hierarchy’s entry nodes. The flat list contained 9 jaundice causes and 0 chest-pain causes. With 1 entry nodes, the HB hierarchy made 2 reachable for jaundice and 3 for chest pain; with 4, it yielded full coverage for jaundice, 5, and 6 for chest pain. At 7, the jaundice DAG had 8 nodes, depth at most 9, average children approximately 0, and average entry-leaf distance approximately 1. The chest-pain DAG had 2 nodes, depth at most 3, average children approximately 4, and average entry-leaf distance approximately 5.
Human experts evaluated “effort” to locate known causes by comparing scanning a flat frequency-ranked list with navigating HB. The reported average outcome was that HB reduced effort drastically: most etiologies required far fewer clicks or scans in the DAG than positions in the flat list. Path quality was rated on a 6–7 scale. Among 8 jaundice paths, 9 were rated 0 (“excellent”), 1 was rated 2, and 3 was rated 4; for chest pain, 5 were rated 6, 7 was rated 8, and 9 was rated 0.
The deployment context was a demo in which biomedical researchers could pick a condition such as “chest pain” and browse hundreds of candidate causes in a compact DAG. Specialists reported that the hierarchy surfaces major categories of etiologies, hides near duplicates via merges, and preserves multiple inheritance when an item logically sits under two parents, as in “leg pain” under both Leg and Pain. The last point is important conceptually: the object produced by HB is not a taxonomic tree with unique parentage, but a DAG designed to retain semantically meaningful cross-classification.
4. HB as adaptive model hierarchies for multi-query computation
In “Adaptive Model Hierarchies for Multi-Query Scenarios,” HB is an abstract framework for choosing among cheaper and more expensive models on a per-query basis (Kleikamp et al., 2024). The starting point is an expensive “truth” solution operator 1, for example a PDE solve for parameter 2. One constructs 3 lower-fidelity models 4 with strictly increasing cost
5
and strictly decreasing error
6
For each query 7, HB tries models from lowest to highest fidelity and stops as soon as an a posteriori error criterion is met.
The mathematical formulation makes the switching rule explicit. For 8, define 9 or to some lower-dimensional 0, with evaluation cost 1 and error measure
2
Each level is equipped with an inexpensive error estimator 3 satisfying
4
with 5 a moderate constant. Given a global tolerance 6, HB stops at level 7 if
8
This makes the hierarchy adaptive per request rather than statically fixed at one fidelity level.
The same mechanism is integrated into larger computational loops. In optimization, many evaluations of an objective 9 are required; HB returns certified approximations 0 quickly, only calling the expensive model when needed. In Monte Carlo or uncertainty quantification, one draws 1 samples 2, and HB avoids calling 3 on every sample by replacing most calls with fast surrogates such as 4 or 5. The framework also defines an adaptation routine: when a higher level 6 with 7 is actually evaluated, the pair 8 is appended to a training set 9, and once 00, model 01 is retrained and the training set may be cleared or pruned.
The performance analysis is likewise hierarchical. If 02, then the average cost is approximately
03
Good hierarchies have 04, so 05 plus small overhead. With 06 and 07 for 08, the average cost per query is 09 with small 10. Reported empirical speed-ups include a 11–12 speed-up in total runtime for PDE-constrained optimization with two levels while meeting the same objective tolerance, up to 13 reduction in expensive solves for a parabolic PDE Monte Carlo example with three levels, and 14 fewer full-order solves for an optimal-control setting with three levels.
Implementation guidance in the same framework is concrete. Each 15 is stored as an object with methods eval(μ) and update(D_ℓ). Training sets 16 may be kept in a ring buffer or KD-tree for nearest-neighbor selection when pruning. Batch evaluation of many HB_Query calls can exploit GPUs or threads, and the error estimators 17 can be accumulated before falling back one model at a time. A concrete one-iteration example sets 18, 19, and 20, with 21 a linear regression surrogate of cost approximately 22 ms and 23 a full PDE solver of cost approximately 24 ms. For query 25, the surrogate gives 26 with 27, so the system falls back to 28 with true error approximately 29, appends 30 to 31, and retrains 32 by least squares when 33 reaches 34. In that illustrative scenario, after a few such iterations, 35 of future 36 values stop at level 37, yielding a 38 net speed-up compared to always using 39.
5. HB as a packed-class hierarchy builder in Rocq
In “Adhesive category theory for graph rewriting in Rocq,” HB is a “packed-class” framework on top of Coq’s canonical structures for defining a directed acyclic graph of structures by specifying, for each node, the extra data or “mixin” that it adds and the lower nodes from which it inherits (Arsac et al., 22 Sep 2025). From these specifications, HB automatically generates a record type for each structure, canonical-structure instances, and coercions. The intended effect is that an adhesive category is also recognized as a category with pullbacks, and similar inheritance relations are reconstructed automatically.
Three design principles are central. First, inheritance is forgetful only: every structure bundles its own mixin together with the mixins of its ancestors, with no implicit ad hoc augmentation of older nodes. Second, builders and factories mediate logical implication between mixins. When one mixin implies another, as with regular mono implying mono, the user supplies a builder lemma so that declaring a regular mono automatically fills the mono data. Factories are “virtual” mixins that do not appear in final structures but allow multiple alternative presentations of the same concept. Third, coercions are user-controlled: HB tracks a single “index” for each hierarchy, namely the object-type in the category hierarchy and the underlying arrow in the morphism hierarchy.
The resulting library contains two parallel hierarchies. In the category-theory hierarchy, the levels are Quiver, PreCategory, Category, CatPb, CatRmPo, RmQAdhesive, RmAdhesive, CatMPo, and Adhesive. In the morphism hierarchy, the levels are Morphism, Iso, SplitMono, SplitEpi, RegMono, RegEpi, Mono, Epi, PreAdh, and Adh. Because HB allows only forgetful inheritance, adhesive morphisms lie above RegMono but below Iso, and the development introduces a separate 40 that inherits from both Iso and Adh so that the primitive Iso mixin need not be rewritten.
The definitional backbone is categorical. For a precategory or category 41, objects 42, and morphisms 43, 44, a pullback square is defined by
45
For equalizers, with 46 and 47,
48
A regular mono is then
49
The higher levels specialize these notions. An rm-quasiadhesive category is one with all pullbacks and such that for every regular mono 50 and 51, the pushout of 52 and 53 exists, is stable, and is a pullback. An rm-adhesive category is an 54 category in which regular subobjects are closed under binary union. An adhesive category is an 55 category in which every mono is regular and all pushouts along monos exist, are stable, and are pullbacks. At the interface level, HB jargon treats every structure as a sequence of mixins; for example, regular monos are defined through a mixin record IsRegMono whose field is rm_prop : isRegMono m, and RegMono is declared as inheriting both Mono and IsRegMono, with a builder instance deriving IsMono from IsRegMono.
6. Instances, implementation trade-offs, and graph-rewriting formalization
The Rocq development uses HB to instantiate a range of concrete categorical settings (Arsac et al., 22 Sep 2025). The category of extensional Coq types, TypeCat, is given an AdhesiveCategory instance by supplying pullbacks and constructing pushouts via quotients by the smallest congruence; the proof uses two axioms, predicate_extensionality and constructive_definite_description. SetoidCat is also given an AdhesiveCategory instance. No axioms are needed to show it rm-quasiadhesive; to show it rm-adhesive one needs “56”; to show it fully adhesive one needs constructive indefinite description. The category of finite types, finType, is obtained by transport along the full-and-faithful forgetful functor finType → TypeCat, and because that functor preserves pullbacks, monos, and related structure, one obtains an axiom-free Adhesive instance on finType.
Other examples delimit the scope of adhesivity. A simple graph is represented as 57, and a homomorphism preserves edges. SimpleGraphCat is shown rm-quasiadhesive by reduction to TypeCat, but it is not rm-adhesive because of a counter-example pushout that fails to be a pullback. Slice and functor categories inherit structure pointwise: if 58 has pullbacks, or is adhesive, then 59 and 60 inherit the same structure. In particular, presheaf categories 61 are (rm-)adhesive.
The implementation choices are explicitly trade-off driven. The library adopts setoid-enrichment rather than strict categories with propositional equality: all hom-sets are setoids, and composition and identity respect the equivalence. This avoids the need for axioms for quotients and for suppressing computational content of “regular mono,” but it requires many Proper and CMorphisms.Proper instances so that rewriting works up to setoid equivalence in Type. The library also maintains both bundled and unbundled forms. Categories, monos, and pullbacks are bundled records, but proofs often need predicate forms such as isMono f : Prop or isPullback f g p q : Type; conversion lemmas support movement between the two. Duality is encoded by assigning each structure 62 a dual 63 obtained by swapping sources and targets and reversing composites. Since 64 and 65 are propositionally but not definitionally equal, occasional casts are necessary, and an alias catop : Type→Type with notation C^op is introduced to disambiguate canonical-structure inference.
The stated limitations of HB are equally important for understanding the framework. There is no universe polymorphism, so small and large setoids must be duplicated. HB does not allow adding new downward inheritance edges after the fact, which is why a separate 66 was created to sit above Adh. Dynamic collapse of classes, such as Mono ≡ AdhesiveMono in an adhesive category, is not automatic; promotions must be invoked explicitly via factories and builders. These are not incidental engineering details but structural constraints on the expressivity of the hierarchy description mechanism.
The principal application is the formalization of double-pushout graph rewriting. A linear production is a span of regular monos 76 and a derivation is represented by two pushout squares. Using the abstract library, the development formalizes the Local Church–Rosser theorem and the Concurrency Theorem from Lack and Sobociński. For Local Church–Rosser (Theorem 7.7), the equivalence “parallel independence ⇔ sequential independence” occupies 67 pages with 68 objects per diagram in the paper proof, and 69 lines of Coq statements plus 70 lines of proof in Rocq+HB. For the Concurrency Theorem (Theorem 7.10), the paper proof occupies 71 pages with 72 objects per diagram, and the Rocq+HB version uses 73 lines of statements plus 74 lines of proof. Because the abstract library itself is axiom-free, with axioms entering only when instantiating the Type category or lifting disjunctions in Setoids, these theorems hold in every rm-quasiadhesive instance without further assumption. The overall development, approximately 75 k LOC, presents HB as a modular mechanism for declaring large intertwined hierarchies of structures while supporting nontrivial reusable formalization in categorical graph rewriting.