Hierarchical model

Just wondering if I there is a way to introduce a hierarchy to observations. Specifically, think of one category that splits the sample into two groups. Group 1 and Group 2. I want to train a model that uses the category as a predictive variable in a hierarchical way. That is, taking into account that some observations belong to group 1 and some to group 2.
Any thoughts of how to implement this with XGBoost?

Can you fit two XGBoost models, one for Group 1 and one for Group 2?

Thank you! Yes, but with hierarchical models there maybe better performance with one single model that allows for 1) a common effect of the features on both groups, and 2) group specific effects of every feature.
Splitting the sample and training two models assumes there is nothing common across the two groups.
I was wondering if there is any option to add a hierarchical structure with Xgboost, or if one would need to look for different methods, like gpboost.

No, XGBoost currently doesn’t offer a hierarchical structure.