The beauty of emergence

Combining emergent architecture with conversational interfaces has lead to the creation of Oratio, a conversational interface framework for the web, running in the browser.

Who feeds Paris?

Figure 1 2.244 million people can have almost any food, drink and cuisine throughout the day, throughout the city. How?

A question as simple as ‘ Who feeds Paris?’ has no simple answer, nor has anyone ever been able to fully answer it in detail. The premises of the question is accurately described by Charles Wheelan in ‘Naked Economics’:

“A rhetorical way of drawing attention to the mind-numbing array of things happening every moment of every day to make a modern economy work.” [1]

People in Paris can get any food or drink, almost any cuisine, at any hour of the day, conveniently available throughout the city, for an incredibly large population and the system seemingly adjusts to (seasonal) changes. The system that handles all that is nearly impossible to describe in detail. But it’s definitely there and it definitely works, as it has worked for centuries. The system we’re talking about here is emergent: the parts in themselves might not be that intelligent, nor does every part know about every other part, but the system as a whole works beautifully well.

Characterizing emergence

Figure 2 Ants are another great example. They can survive across the globe, existed when dinosaurs roamed the earth and have survived mass extinction events. Ants are arguably one of the most successful species even though a single ant can hardly achieve anything. The emergent system can be described by characterizing the parts that make up the system:

  • The individual parts of the system do not know anything about the system.
  • The individual parts usually don’t know that much about other parts either, they usually only know about certain neighboring parts and nothing beyond that.
  • The system on its own does not exist, nor is there any centralized intelligence that handles everything. With ants, even the ‘queen’ ant has no authority, nor does she have the power to make decisions for the colony. [2]
  • The individual parts are usually unintelligent in the grand scheme of things, but the combined system can achieve incredible challenges.

To apply those characteristics to the ‘Who feeds Paris?’-question:

  • The restaurants, stores, distributors, farms, markets etc. that make up the system, are not knowingly working on a system that feeds the entire city. They are each concerned with their own part and leave everything else to others. No single part is entirely responsible for feeding Paris, nor would any individual entity be able to do that.
  • Take any restaurant and they will probably know something about surrounding restaurants, the distributors it works with and perhaps certain other venues, but they will not know everything about every restaurant and every distributor, nor do they need to.
  • There is no ministry or company single-handedly responsible for, or capable of, feeding the entire city of Paris, while taking into account the food-preferences of all citizens and tourists in the city at any point in time.
  • Every individual part seemingly adjusts based on input it takes from its local environment. Every restaurant will probably adjust to the food and time-preferences of its customers without centralized interference.

The beauty is of course that nobody is solely responsible for feeding Paris, nor is anyone able to, but the system as a whole somehow magically manages to achieve that very goal. This beauty comes at a price though: there are some severe downsides to an emergent architecture that have no clear solution.

A Leap of Faith

Figure 3 As we will see in this paragraph, choosing a highly emergent architecture was very much a leap of faith, without any guarantees of success. There are still severe downsides to the emergent architecture to this day that could still crash and end Oratio. Creating an emergent system poses the following problems:

  • There is no centralized decision making, no overruling, no centralized control.
  • The system is only as useful as its parts. The system adds no value on its own, all its value is derived from the individual parts. Without the parts, or the proper functioning of the parts, the system is useless.
  • If certain parts misbehave, the system has no centralized way to correct for it.

Yet with all its problems it also provides many benefits:

  • Because the centralized system does nothing of value, it is incredibly simple. It simply arises from its parts.
  • The individual parts can work entirely independent of each other, which provides the ultimate scaling and parallelization solution.
  • Highly extensible and modular, every individual part can be added in an easy and simple way, without effecting the other parts.

Most software systems do not use a fully emergent architecture, because the problems described above are unsolvable in an emergent system. They are simply part of what defines it. If Amazon would choose to make Alexa entirely emergent, they would be unable to override anyone who creates and adds a malicious or problematic skill to Alexa. They would also be unable to decide which skill gets called, or prevent any single skill from taking over Alexa entirely and even then those are just some of the issues they would suddenly face. If some of these issues seem scary and dangerous, that’s because they are scary and dangerous. Yet the benefits cannot be ignored: testing whether it was worth it has lead to the development of what we eventually called Oratio.

(Yes, this means that all problems described above are rooted and cemented into Oratio and do not have a clear solution. We can still think of many potentially catastrophic scenarios for any application using Oratio. If all individual parts behave however, we gain a highly scalable, extendable, easy to develop and highly intelligent conversational interface, emphasis on the ‘if’. In short: Oratio entirely relies on trust instead of control.)

Charting the unknown

A conversational interface poses a set of challenges of its own. Conversations are incredibly complex; the possible words, sentences, intents, etc. used during a conversation are countless. To make matters worse, much of the meaning is also derived from the context. Is it even an option to have 1 single entity feed a city like Paris? When starting a conversational interface, the answer deemed simple to me: an emergent system seems much better suited to simplify the functional complexity. The individual part in the emergent system of Oratio is called a neuron. Every neuron receives every sentence throughout the conversation and decides on its own whether to do anything with it. This is very different from the architecture of for instance Amazon’s Alexa, where a centralized system decides whether a skill will be given any input at all. This seemingly small difference has an incredible effect: now all responsibilities are being directed to the individual parts, to the neurons. That does mean: accepting that you can create a fully functioning working framework with lots of neurons that work well and having it all fall to pieces if a single misbehaving neuron is added.

The die is cast

Figure 4 When Julius Caesar crossed the river Rubicon, there was no going back, as there is no going back to a non-emergent architecture for Oratio. The emergent architecture is a crucial part of Oratio’s identity.

With the context in place and the framework implemented as it is, Oratio has an emergent architecture. The emergent properties arise in the following way:

1.Every neuron knows nothing of the system as a whole, usually nothing of other neurons and simply implements the following interface: public process(input: UserInput, context: RequestContext): Promise

2. All neurons are combined together by a system which has no control and which makes no decisions about how to handle the input: const mind = HiveMindBuilder.createEmpty() .registerModule(CoreHiveMindModule.CORE_HIVE_MIND_MODULE) .registerModule(MathHiveMindModule.MATH_HIVE_MIND_MODULE) .build();

3. Then all the neurons are individually asked to handle any (and every) given input: const response = mind.process(input, locale, model)

The process really only calls every neuron with the input, locale and model of the application it runs in. It then simply returns the response of the neuron with the highest certainty. That’s it. If an even more emergent system is desired, Oratio can also return all neurons that had a response, regardless of certainty. For any given input 99% of neurons will not have a response, because neurons on their own have but a single purpose and only handle specific input.

The beauty is the fact that the system itself, the HiveMind, is incredibly simple, has no value or knowledge on its own and delegates everything to the neurons. This means extending it is as simple as implementing the interface and adding the neuron:

const mind = HiveMindBuilder.createEmpty() .registerModule(CoreHiveMindModule.CORE_HIVE_MIND_MODULE) .registerModule(MathHiveMindModule.MATH_HIVE_MIND_MODULE) .registerNeurons([new YourNeuronHere()]) .build();

Figure 5 Emergent vs. non-emergent. The emergent system gives all input to all neurons and the neurons decide to give output or stay silent. The non-emergent system uses a centralized decision-maker to give input to only a single neuron.

This explains basically how Oratio works with a few pieces of code. Of course the code behind it is a little more complex, but the architecture is as simple as described above.

(Reading about emergence opened my eyes to a new way of designing complex systems, in elegantly simple ways. It is hardly a viable architecture for every use-case, as a pure emergent system poses many problems. But for a conversational interface, it felt like the only viable option. In the end Oratio follows an emergent architecture, though not in its purest form. Hopefully the beauty of emergence is visible in the way Oratio is setup. If not the beauty, at least the simplicity is striking: implement a single interface, add it to the mind and that’s it: done.)

References

[1] Wheelan, C. J., & Malkiel, B. G. (2010). Naked economics: Undressing the dismal science. New York: W.W. Norton.

[2] https://en.wikipedia.org/wiki/Queen_ant

Jelle
Like what you read? Give Tech Labs a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.