Neural diversity is key to collective artificial learning