Towards a DSL to Formalize Multimodal Requirements

Marcos Gomez-Vazquez, Jordi CabotarXiv 2025

Abstract

As AI systems increasingly rely on Multimodal User Interfaces (MUIs) that process text, audio, and images, the challenge of precisely defining system requirements grows. This paper introduces MERLAN (Multimodal Environment Requirements Language), a Domain-Specific Language (DSL) designed to formalize multimodal requirements. MERLAN decouples requirements from specific technical implementations, treats AI confidence levels as first-class citizens, and enables automated code generation for agentic frameworks.

Introduction

The rapid advancement of AI has led to a surge in Multimodal User Interfaces (MUIs)—systems capable of processing combinations of text, audio, and images simultaneously. For instance, a smart home assistant might need to react to a voice command while simultaneously interpreting a visual gesture. However, specifying the exact behavior of these systems remains a significant hurdle. Traditional requirements engineering often relies on ambiguous natural language or tools restricted to text-based "intents." There is a critical lack of formal languages to describe complex trigger conditions involving multiple sensors. Without precise definitions, developers risk building systems that fail to meet user needs or exhibit unpredictable behavior in edge cases.

Methodology

The authors propose MERLAN (Multimodal Environment Requirements Language) to bridge the gap between user needs and AI implementation. The language is built upon three core components:

1. The Metamodel

The structural foundation of MERLAN is its metamodel, which defines the fundamental building blocks of a requirement.

The MERLAN Metamodel defining the structure of multimodal requirements.

As shown in the metamodel, MERLAN distinguishes between Simple Requirements (e.g., "detect a car in an image with 80% confidence") and Complex Requirements, which use Boolean logic (AND, OR, NOT) to combine multiple inputs. This structure allows for the recursive nesting of requirements to form sophisticated logic.

2. Entities and Attributes

MERLAN allows for the definition of Concrete Entities (physical objects like "person" or "car") and Abstract Entities (concepts inferred from context, such as "night"). These entities can be further specified with attributes, such as a "car" entity having a "color" or "model" attribute, providing a rich vocabulary for environmental description.

3. Textual Syntax and Tooling

The language was implemented using ANTLR, a parser generator. To facilitate development, a "tree-visitor" tool was created to transform MERLAN scripts directly into Python code compatible with the BESSER Agentic Framework, effectively turning formal specifications into functional software agents.

Key Features and Insights

MERLAN introduces several novel concepts to requirements engineering for AI:

  • Technology Agnosticism: It defines what the system should detect without being tied to specific underlying models (e.g., YOLO vs. Transformers).
  • Probabilistic Requirements: Recognizing that AI is inherently probabilistic, MERLAN treats "confidence levels" as first-class citizens, allowing engineers to specify minimum certainty thresholds for system triggers.
  • Environmental Context: The distinction between concrete objects and abstract states allows for sophisticated modeling of environmental context that isn't tied to a single sensor frame.
  • Requirements-Driven Development: By automating the path from DSL to code, MERLAN moves toward a model where the specification itself drives the implementation.

Results and Discussion

The expressiveness of MERLAN was demonstrated through a "Home Automation and Security" case study. The DSL successfully formalized complex logic such as: "If fire is detected OR (the house is empty AND a car is detected), then trigger the alarm." Furthermore, the proof-of-concept tooling confirmed that these formal scripts could be automatically translated into executable Python code, significantly reducing manual prototyping effort.

While MERLAN provides a robust foundation, future work will address current limitations, including the integration of temporal constraints (e.g., "if a person remains for >30 seconds"), support for hierarchical modalities (e.g., gestures as sequences of images), and the development of graphical notations to improve accessibility for non-technical stakeholders. Additionally, the authors plan to implement conflict detection tools to identify logical deadlocks in complex requirement sets.

Conclusion

MERLAN represents a significant step toward formalizing the requirements of multimodal AI systems. By providing a structured, technology-agnostic language that supports automated code generation, it empowers engineers to build more reliable and predictable AI-enhanced environments.

Summary updated

Abstract

Multimodal systems, which process multiple input types such as text, audio, and images, are becoming increasingly prevalent in software systems, enabled by the huge advancements in Machine Learning. This triggers the need to easily define the requirements linked to these new types of user interactions, potentially involving more than one modality at the same time. This remains an open challenge due to the lack of languages and methods adapted to the diverse nature of multimodal interactions, with the risk of implementing AI-enhanced systems that do not properly satisfy the user needs. In this sense, this paper presents MERLAN, a Domain-Specific Language (DSL) to specify the requirements for these new types of multimodal interfaces. We present the metamodel for such language together with a textual syntax implemented as an ANTLR grammar. A prototype tool enabling requirements engineers to write such requirements and automatically generate a possible implementation of a system compliant with them on top of an agentic framework is also provided.
BibTeX
@misc{gomezvazquez2025towards,
  author = {Marcos Gomez-Vazquez and Jordi Cabot},
  title = {{Towards a DSL to Formalize Multimodal Requirements}},
  year = {2025},
  eprint = {2508.14631},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.14631},
}
Figure