It's uncommon for rats in an unstressful situation to consume their young. It's very important during the last few days of pregnancy to make sure that each mom has her own cage/bedding/water bottle and, ultimately, privacy.
A mother rat should be allowed time to raise and wean her young before they are introduced to other rats. Once baby rats are eating and drinking on their own they can (and should) be separated by gender and placed into their own cages until they are a little bigger and able to mingle with other rats safely.
It's likely that having more than one mother together or having a stressful situation (such as a lingering cat or dog) may have provoked the mom into feeling the world was unsafe for her young and she may have consumed them for this reason. Cutting out any stressful measures should improve your chances of having a happy mom and healthy babies.
If my answer has helped you, please click accept. If not, reply. I personally don't get paid for my work unless you click the accept button. Good luck
Try leaving her alone for 6 hours at a time in a place that no one can disturb her such as a closet or a bathroom (in her own cage, of course) when delivery is expected. If she is new to your home or a highly stressed pet naturally, this may explain why she's eating her young. There are some animals that are simply not suited to be mothers and regardless of what we do will continue to eat their young. It's not known exactly why this happens but it is expected to do with stress, regardless of whether or not we have removed stressors from her environment. If this has happened more than once, purchase another female for breeding as this female may never produce young for you for one reason for another.
Thank you for the accept. If I can help you further, please let me know.