Group decisions typically outperform individual decisions. But how do groups combine their individual decisions to reach their collective decisions? Previous studies conceptualize collective decision making using static combination rules, be it a majority-voting rule or a weighted-averaging rule. Unknown is whether groups adapt their combination rules to changing information environments. We implemented a novel paradigm for which information obeyed a mixture of distributions, such that the optimal Bayesian rule is nonlinear and often follows minority opinions, while the majority rule leads to suboptimal but above chance performance. Using perceptual (Experiment 1) and cognitive (Experiment 2) signal-detection tasks, we switched the information environment halfway through the experiments to a mixture of distributions without informing participants. Groups gradually abandoned the majority rule to follow any minority opinion advocating signal presence with high confidence. Furthermore, groups with greater ability to abandon the majority rule achieved higher collective-decision accuracies. It is important to note that this abandonment was not triggered by performance loss for the majority rule relative to the first half of the experiment. Our results propose a new theory of human collective decision making: Humans make inferences about how information is distributed across individuals and time, and dynamically alter their joint decision algorithms to enhance the benefits of collective wisdom.