Abstract: Techniques disclosed herein relate to querying a hierarchical classification model that includes a plurality of classification models. The hierarchical classification model is configured to classify an input into a class in a plurality of classes and includes a tree structure. The tree structure includes leaf nodes and non-leaf nodes. Each non-leaf node has two child nodes associated with two respective sets of classes in the plurality of classes, where a difference between numbers of classes in the two sets of classes is zero or one. Each leaf node is associated with at least two but fewer than a first threshold number of classes. Each of the leaf nodes and non-leaf nodes is associated with a classification model in the plurality of classification models of the hierarchical classification model. The classification model associated with each respective node in the tree structure can be trained independently.