Decentralized networks offer enormous potential for crowd-sourced information aggregation, whether it takes the form of emergent market forces or a deliberative organizational process. In 1907, Sir Francis Galton observed that a large number of individual beliefs can produce highly accurate opinions when averaged. Even when no one person knows the right solution, independent errors cancel each other out, and groups as a whole can produce answers with pinpoint accuracy. The challenge with harnessing such statistical power is that when people communicate, they learn from each other, and in turn adjust their beliefs based on information circulating in the network. As a result, people can herd together, reducing the very diversity of information that makes the wisdom of crowds possible. When errors no longer cancel each other out, these herding dynamics lead to collective error in aggregated information. Our research shows, however, that such an unfortunate outcome is not inevitable. By studying social influence under a range of network conditions, we find that certain social structures may even work to improve collective intelligence.