When you develop a document-level customization, the code will only be loaded and executed when a particular Office document is opened by the end user. Document-level customization will also be unloaded when the corresponding document is closed. In an application-level add-in, typically the add-in will be loaded whenever a new Office application instance is created, by either double clicking an Office file or the application executable file. The application level add-in is also unloaded when the application is being closed.
For more detailed information about the Architecture of the document-level solution and the application level solution, please read the following two articles,