Formal Grammars in Neural-Symbolic Approaches to Facade Generation

This blog post is based heavilty on the develpoment process of the paper FacAid, which you can check out here. In this research, we utilized generated facade grammars to create an artificial dataset for training a custom transformer model. These grammars formed the foundation of our neuro-symbolic approach, which I have elaborated on in another post—check it out here.

Now, let me try to introduce you to this fascinating topic of formal grammars and it’s peculiar implementaion in geomatrical context of facade generation


What Are Formal Grammars?

Formal grammars are mathematical models that describe the structure of languages. They are part of the Chomsky hierarchy, which categorizes grammars into four types based on their generative power:

  1. Type 0: Unrestricted grammars.
  2. Type 1: Context-sensitive grammars.
  3. Type 2: Context-free grammars.
  4. Type 3: Regular grammars.

A Venn diagram of these standard four types of grammars categories

I highly recommend this blog post which intouces in a bit more theoretical level with nice diagrams and additiobal information: here.

These classifications help in defining and analyzing syntactic structures in languages, which can range from natural (human) languages to programming languages, and even whole datasets with billions of entries.


In the discusison of grammars in the context of facades, I will strictly focus on the Context-free grammars, as this is this is the type of gramamrs i have been imlplementing and is a standard practice in the field. I will expalin te why is that, in the next chapters.

How Do We Define Formal Grammars?

Genereally, any formal grammar $G$ can be defined as a 4-tuple:

$$ G = (N, \Sigma, P, S) $$

  • $N$ A finite set of non-terminal symbols.
  • $\Sigma$: A finite set of terminal symbols.
  • $P$: A finite set of production rules, each defining how non-terminal symbols can be replaced.
  • $S$: The start symbol, a special non-terminal that initiates the generation process.

For example, a simple grammar can define the structure of sentences in a language, where each production rule specifies valid substitutions.

What Are Split Grammars?


Split grammars are a specific type of formal grammar, commonly used in geometry and architectural modeling. They operate by dividing a structure into smaller parts (splits) iteratively, enabling complex designs to emerge from simple initial shapes.

In our case these grammars are a part of context-free grammars, which have important effects. namely:

In facade modeling, split grammars are particularly powerful, as they can encapsulate hierarchical and repetitive patterns, making them ideal for generating structured datasets.

Examples of Split Grammars in Action

A prominent example of split grammars is their implementation in Blender Geometry Nodes, where they are used to generate complex 3D models. By applying recursive production rules, designers can create intricate models ad structures, including realistic facades.

Why Use Formal Grammars for Facade Generation?

One might wonder why we chose formal grammars instead of conventional methods, such as random noise-based image generation or dataset extraction using image processing tools. The answer lies in the structural clarity and control offered by formal grammars.

Using grammars directly enables us to:

  1. Generate facades with well-defined patterns and structural integrity.
  2. Encode architectural semantics and hierarchical relationships.
  3. Avoid the noise and inconsistency inherent in random methods.

Why context free grammars?

Now having a bit of context, I hope, we can assume that it is indeed important that the grammars we build have some limitations and are restricted to some degree. But why and how?

Challenges: The Major Blockade

While formal grammars are powerful, their implementation poses significant challenges. The main difficulty lies not in coding the productions or syntax but in designing realistic and efficient heuristics. These heuristics define:

  • How productions are chosen during generation.
  • What patterns and proportions are used.
  • How different facade styles are represented.

Creating heuristics that balance realism and generalizability is a challenging task, requiring both domain expertise and coding experience.

Bias in Grammar Design

One critical issue with heuristic-based grammars is bias. The addition of heuristics often influences:

  • The size and proportions of generated facades.
  • The patterns and stylistic elements included.
  • The variability across samples.

Ideally, a split grammar should have minimal bias, focusing on two fundamental actions: cut and extend. This simplicity allows for a wide range of buildings to be modeled. However, ensuring the generated samples are both realistic and diverse remains an unsolved challenge.

Find words

As we could observe, formal grammars in th econtext of facade generation and redonstruction offer a structured, symbolic and full of possibilities approach, enabling precise control over architectural designs and patterns, However, the success of this method hinges on developing heuristics that are robust yet flexible enough to produce diverse, realistic outputs. Looking for ways sped up and most importatly try to omit it continues to be a major area of research in neuro-symbolic modeling.