  Artificial intelligence (AI) in its various forms finds more and more its way
into complex distributed systems. For instance, it is used locally, as part of
a sensor system, on the edge for low-latency high-performance inference, or in
the cloud, e.g. for data mining. Modern complex systems, such as connected
vehicles, are often part of an Internet of Things (IoT). To manage complexity,
architectures are described with architecture frameworks, which are composed of
a number of architectural views connected through correspondence rules. Despite
some attempts, the definition of a mathematical foundation for architecture
frameworks that are suitable for the development of distributed AI systems
still requires investigation and study. In this paper, we propose to extend the
state of the art on architecture framework by providing a mathematical model
for system architectures, which is scalable and supports co-evolution of
different aspects for example of an AI system. Based on Design Science
Research, this study starts by identifying the challenges with architectural
frameworks. Then, we derive from the identified challenges four rules and we
formulate them by exploiting concepts from category theory. We show how
compositional thinking can provide rules for the creation and management of
architectural frameworks for complex systems, for example distributed systems
with AI. The aim of the paper is not to provide viewpoints or architecture
models specific to AI systems, but instead to provide guidelines based on a
mathematical formulation on how a consistent framework can be built up with
existing, or newly created, viewpoints. To put in practice and test the
approach, the identified and formulated rules are applied to derive an
architectural framework for the EU Horizon 2020 project ``Very efficient deep
learning in the IoT" (VEDLIoT) in the form of a case study.
