This answer might not apply to some fields, but it does in something like CS where group work is valued and needed in both academia and the workplace. Your field seems to be physics, with which I have no experience, though I think that lab work is often (typically?) done in groups, not by individuals. I'm not so convinced it would apply in math, however. I think it would in true math research, though, and mathematicians are collaborating more widely in recent years than in the long-ago past.
I would, when still teaching, make group work a fundamental part of the course and of the grading. Projects were typically about 70% of the grade with most of that group projects. The courses were pretty technical, say database theory or compiler construction.
I used two strategies for forming groups; self selected and random. But, I also learned that I had to teach students proper behavior in group work. It wasn't appropriate for the "top" student to just do all the work and carry the others. It wasn't appropriate for anyone to slack. But this doesn't come naturally to them. They need instruction about group meetings, consensus, working together rather than just trying to divide the work and then, in an extra, difficult, task, integrate the parts into a whole. Pairing on all tasks was encouraged and even demonstrated in classroom situations. I'd even do this with some grad students. I also used peer evaluation (not peer grading) so that students could give me information about who participated and contributed and what those contributions were.
The effect of self selected groups was, I think, less beneficial to them. The "hot shots" could get together and mostly coast to a decent grade, learning less than they might have done. The "weak kittens" might be lost without external direction, though I had one massively successful experience with two "weak" students working together and outperforming the hot-shots, though they basically lived in my office for the semester asking and reasking the same questions. Finally, they got it and did well, explaining complex things to me by the end of the term. Not a common experience, but it can happen.
My experience with random selection was generally better, though instruction in group behavior was needed. It isn't part of the gene pool. A random group has, usually, some stronger and some weaker students, but if they work together all can benefit. One key, however, is that not everyone has the same skills and not everyone needs to contribute to the group in the same way. Suppose a ten person group has to write a ten page report. Lets divide the work so that everyone writes one page? How about everyone write every tenth line? Ain't gonna work so gud.
But some students can focus on the library searching, some on the coding, some on the writeup, one or two on the actual management of the group and making sure that the parts will fit together. Everyone contributes something valuable; equal if not the same.
I had another success in such a random group. There was one student who seemed to be a bit dull in class and I worried about him. He was put into a group of mostly "stronger" (my guess) students. When I asked them for for peer evaluations at the end of the course, this "dull" student was the one they all described as the main contributor to the project since he was able to keep everyone else "doing the right thing". Everyone in that group was happy with the result as was I.
I've also had the situation where students who were in a long lasting program and knew they were going to be part of several projects with the same team, would use a "pay it forward" technique in which some of the students would do the bulk of the work (together) on the current project and let one of their peer "off the hook" to deal with other things, even family emergencies. That student would then have extra responsibility to contribute to the next round or project. In effect, they built a collaborative community in which they helped other in the group learn the important lessons. They were mutually supportive but it wasn't that the hot-shots took over and left others out.
Detail on "peer evaluation". In a group of five ask two questions of each student, answers submitted privately but not anonymously.
Who were the three top contributors to the group and describe why you have listed them?
What was your own main contribution to the group?
These were seldom used to affect the grades, though they might. In the case above, the student mentioned got a boost. But a person not mentioned at all by anyone as a "main contributor" won't share in any bonuses and might be singled out for some intervention. But students didn't actually "grade" one another, just give positive comments when needed. A person refusing to answer the first question is just as much a problem as a student never mentioned as a contributor.
In a group of two, the first question would need to be something like "What was your partner's main contribution?"