Scientists Are Finally Getting Closer to Explaining Why We Dream
REM sleep as a simulation machine

Researchers Stefano Censi, Alberto Granzotto and Stefano Sensi have proposed that REM sleep functions as a kind of “dummy model” of the world. Their framework suggests that the brain first undergoes extensive reorganization during non-REM sleep and then uses REM sleep as an internal testing environment.
Inside this simulated world, the brain can generate situations and predictions without the consequences of actually performing them. Motor commands, expectations and sensory information can be internally tested while the body remains largely disconnected from the imagined environment.
The researchers compare this process to a form of biological regularization used in artificial neural networks. In machine learning, introducing controlled noise can prevent a model from becoming too rigidly fitted to its existing data. In REM sleep, internally generated variations could similarly help the brain update its model of reality.
Dreams, in this picture, are what it feels like when the brain runs the simulation.