Start Wars fans would find these caves familiar. In Star Wars Episode IV, a young Luke Skywalker lived in a cave house like this on the planet Tatooine.
I heard that the planet Tatooine itself was actually named after the real-life town Tataouine to the south east of Matmata.
Some of these are just caves dug into the sides of the mountain.
Some of these are more elaborate. A large pit was dug downwards into the ground at the edge of a cliff or escarpment to form a circular or rectangular courtyard. Caves were then dug sideways to form rooms. A tunnel was dug into the cliff/escarpment to make an entrance into the courtyard.
These caves are somewhat similar in concept to the caves in Shaansi in northwest China. In some ways they are more elaborate - in the sense there is a courtyard with caves branching off. In other ways the caves in China are more elaborate - some are much bigger.
I suspect these Berbet caves may be more comfortable. It is very hot and dry here, so close to the desert. Inside the caves it is relatively cool and dry.
In northwest China, the caves could be cold and damp.