  Recent advances unveiled physical neural networks as promising machine
learning platforms, offering faster and more energy-efficient information
processing. Compared with extensively-studied optical neural networks, the
development of mechanical neural networks (MNNs) remains nascent and faces
significant challenges, including heavy computational demands and learning with
approximate gradients. Here, we introduce the mechanical analogue of in situ
backpropagation to enable highly efficient training of MNNs. We demonstrate
that the exact gradient can be obtained locally in MNNs, enabling learning
through their immediate vicinity. With the gradient information, we showcase
the successful training of MNNs for behavior learning and machine learning
tasks, achieving high accuracy in regression and classification. Furthermore,
we present the retrainability of MNNs involving task-switching and damage,
demonstrating the resilience. Our findings, which integrate the theory for
training MNNs and experimental and numerical validations, pave the way for
mechanical machine learning hardware and autonomous self-learning material
systems.
