I struggled with a same problem recently. I decided to create initial groups at spawn since that was when NPCs are guaranteed to be clustered. Specifically I make a group controller who then spawns the NPCs. If these controllers periodically update their location to the center of mass of their respective NPCs. If these controllers get too close, they merge. If after some merging, the group is too large for calculations (I set an arbitrary limit of 10 simply because of how I'm handling the more complex AI), it gets split evenly and the groups try to split apart physically.
It keeps my calculations low, but as I said, the primary driver was so I could better coordinate small group tactics.