When a negative adverb or expression is put at the beginning of a sentence, it is usually followed by auxiliary verb + subject. These structures are mostly formal.
- Under no circumstances can we appoint him as director. (NOT Under no circumstances we can appoint him as director.)
- Not until much later did she realize that she had made a huge mistake. (NOT Not until much later she realized that she had made a huge mistake.)
Inversion is also used after negative words like hardly, seldom, rarely, little, never and after expressions containing only.
- Hardly had I reached the station when the train arrived. (NOT Hardly I had reached the station …)
- Seldom have I seen such a mess. (NOT Seldom I have seen such a mess.)
- Little did he realize the danger he faced.
- Only then did I understand what was happening.
- No sooner had she read the letter than she started crying.
- Scarcely had I solved one problem when another cropped up.
Note that these structures are rather formal or literary. In a less formal style, we begin these sentences with their proper subjects.
- I had hardly reached the station when the train arrived.
- I have seldom seen such a mess.