The mechanism AI would use to solve the problem is to give everyone individualized education, which would effectively be maximal segregation.
For socialization, another commenter here wrote a few months back about their experience at a school where they had more academic classes segregated by ability and more social classes segregated by age[0], which sounds to me like an excellent solution.
Your outcomes as child are also likely to plummet if you ever get sorted into the wrong bucket, which I feel is super unethical.
Personally I also really question the whole concept of pushing a grade schoolers "performance": What do you hope to gain from it? Looking e.g. at asian english tests I can see a likely worst-case outcome: Genuinely difficult and stressful tests (that even native speakers would struggle with) that just test some meaningless grammatical minutiae.
I fully agree that having optional programs and learning opportunities for talented/interested children is a very good thing, but I don't think dismantling the current system would really help at providing those (and they are always gonna be an additional cost, just like more segregation would be in practice). I also think that attempting to railroad children into (or out of!) those options is not desirable at all.
If you get sorted into the wrong bucket, it shouldn't be a huge deal. e.g. my elementary school had I think ~5 classes per grade level, so you have bands for 20%iles. Teachers can target the center of their %ile band for pacing. With a desegregated model, teachers end up targeting somewhere below the median student for everyone, so people in the top 50%ile and bottom 20%ile are all poorly served. You don't have to necessarily stay in your band either; if you do well, move up. If you do poorly, move down. If you're primarily segregating by ability, not age, then you might need to e.g. move into a younger cohort's top performing band to get onto the right pacing, but you don't need to lose much time. This is in contrast to today's system where if you're not close to the median, probably half your time in school is wasted.
In larger schools, you could potentially group kids into 15-10%ile bands. The tighter the bands, the less of an issue if they end up in the wrong band (assuming they're not completely misjudged). Personalized education is again the limit of this approach. The closer you get to that, the better kids will do.
As far as curriculum goes, I don't see why you couldn't have a baseline. The faster kids would just get through it faster, and maybe move onto more optional topics. The slower kids would progress more slowly, hopefully with a slightly higher end target than we set for them today.
Hopefully the thing high performing kids gain is to maintain their interest in academics instead of having it beaten out of them by moving at what is for them a snails pace. Testing them on larger volumes of meaningless minutiae is exactly the opposite of the goal. e.g. don't give them extremely tricky arithmetic/algebra problems; teach them calculus, linear algebra, mechanics, chemistry, etc. Teach the grown-up topics, but let them learn it when they're ready instead of holding them back several years.
By doing "early segregation" you make this more difficult because that "common baseline" no longer exists; you'd expect to get significantly more people that struggle with language and basic math as a result (in exchange for better outcomes in your "gifted" track).
Furthermore, you are sorting people into social buckets in a way that is really bad for social cohesion (inevitable, all the white kids with rich parents are gonna end up in the "gifted" schools). Everyone is gonna grow up in a echochamber, basically.
Finally, this is going to lead to restrictions on a young adults options, that I find really unpalatable to blame on the affected children: Can you honestly argue that people don't deserve the chance to study medicine at university just because their parents did not tutor, push and mentor them sufficiently? Equality of opportunity as a principle is gonna be nigh impossible to preserve in such a system.
I do not dispute that you could teach children faster and better with individual tutoring and customized programs, but that would be cost-prohibitive, and I see currently no realistic way to get there without above consequences.
Maybe AI will solve it :P