Why does it take 18 months for invention patents to be published?

what you are talking about is an invention patent. Utility models and designs are published at the time of authorization, which generally does not take so long.

18 months is an international practice, not only in China, but also for a few reasons.

inventions may also be required to be made public in advance, which can be made public six to eight months after the date of application, and they can enjoy temporary protection after being made public.