Cognitive flexibility is the ability of the brain to switch between different rules or actions depending on the situation. To improve the circuit and cellular level understanding of this process, our study focused on a specific pathway involving serotonin. We found that serotonin released from the dorsal raphe nuclei (DRN) to the orbitofrontal cortex (OFC) promotes reversal learning. In our study, we used Inscopix nVoke technology to inhibit the activity of PV interneurons, which increased the excitability of pyramidal neurons in the OFC. This led to a significant improvement in Reversal learning (RL), demonstrating that enhancing excitability in the OFC can help disengage from previous learning and improve flexibility in learning new tasks. Similarly, spatiotemporally precise serotonergic action also enhances the excitability of OFC neurons, which helps the OFC network fire more robustly. Our research suggests that the formation of choice-specific ensembles through serotonin-dependent synaptic plasticity is a critical modulator of cognitive flexibility.