Different exemptions apply depending on the type of retaining wall you are building.
Retaining wall above ground level
This is a "fill" retaining wall where the purpose is to retain top soil placed upon the ground above natural ground level.
Retaining wall below ground level
This is a "cut-in" retaining wall where the purpose is to retain an embankment cut below natural ground level.
Your wall is considered to be below natural ground level if it is a combination of partly above and partly below ground level.