Uncertainty-modulated prediction errors in cortical microcircuits. To make contextually appropriate predictions in a stochastic environment, the brain needs to take uncertainty into account. Prediction error neurons have been identified in layer 2/3 of diverse brain areas. How uncertainty modulates prediction error activity and hence learning is, however, unclear. Here, we use a normative approach to derive how prediction errors should be modulated by uncertainty and postulate that such uncertainty-weighted prediction errors (UPE) are represented by layer 2/3 pyramidal neurons. We further hypothesise that the layer 2/3 circuit calculates the UPE through the subtractive and divisive inhibition by different inhibitory cell types. We ascribe different roles to somatostatin-positive (SST), and parvalbumin-positive (PV) interneurons. By implementing the calculation of UPEs in a microcircuit model, we show that different cell types in cortical circuits can compute means, variances and UPEs with local activity-dependent plasticity rules. Finally, we show that the resulting UPEs enable adaptive learning rates.