A multi-gradient cavity acoustic metamaterial (MCAM) structure and a modular reverse design method (MRDM) that can realize high ventilation and broadband acoustic isolation are proposed. The method controls the deep neural network model of acoustic metamaterials through a particle swarm algorithm, and the optimized multi-gradient cavity acoustic metamaterial structure (OMCAM) can be reverse-designed by inputting only the constraints and the objective function such as the amount of noise reduction. Compared with the finite element method, the computational efficiency can be improved by about 500 times to achieve an optimized design. The acoustic simulation results show that the average noise reduction of the structure is 23.5 dB in the range of 0∼4000 Hz, and a broadband sound attenuation with 38 dB noise reduction is formed in the target frequency band of 500Hz∼2000 Hz. The acoustic experimental results of the 3D-printed structure are in agreement with the simulation results. Compared with the two existing ventilated acoustic metamaterials, the average noise reduction of OMCAM under equal ventilation capacity is improved by 10.6 dB and 17.4 dB, respectively. The sound barrier based on the proposed OMCAM design is implemented on an elevated rail transit line, showing an improvement of 9.4 dB of average noise reduction compared with existing upright railroad sound barriers. The noise reduction mechanism of the OMCAM structure was finally revealed by the sound field distribution in different modes.