-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patharticle.html
More file actions
2612 lines (2107 loc) · 190 KB
/
Copy patharticle.html
File metadata and controls
2612 lines (2107 loc) · 190 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<dt-article>
<header class="site-header px2 px-responsive l-middle">
<div class="mt2 wrap">
<div class="measure">
<a href="https://developmentalsystems.org" class="site-title" style="border-bottom:none;">
<img src="https://developmentalsystems.org/flowers-logo.png">
</a>
<nav class="site-nav" style="line-height:2;">
<a class="nav-link" href="https://flowers.inria.fr/" target="_blank">Flowers Lab</a>
<a class="nav-link" href="https://developmentalsystems.org/publications/">Publications</a>
<a class="nav-link" href="https://developmentalsystems.org/about">About</a>
</nav>
<div class="clearfix"></div>
<div class="social-icons" style="line-height:2;float:right;border-bottom:none;">
<div class="social-icons-right">
<a class="fa fa-github" href="https://github.com/flowersteam"></a>
<a class="fa fa-rss" href="/feed.xml"></a>
<a class="fa fa-twitter" href="https://twitter.com/FlowersINRIA"></a>
<a class="fa fa-envelope" href="mailto:pierre-yves.oudeyer@inria.fr"></a>
</div>
<div class="right">
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
</header>
<h1>Learning Sensorimotor Agency <br> in Cellular Automata</h1>
<h2 id='finding-robust-selforganizing-agents-with-gradient-descent-and-curriculum-learning-individuality-selfmaintenance-and-sensorimotricity-within-a-cellular-automaton-environment'>Finding robust self-organizing "agents" with gradient descent and curriculum learning: individuality, self-maintenance and sensori-motricity within a cellular automaton environment</h2>
<iframe class="l-middle outset" width="560" height="460" src="https://www.youtube.com/embed/mSy4z8nDLno" title="YouTube video player"
frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<dt-byline></dt-byline>
<h2 id='a'>What you will find in this blog <span>📝</span></h2>
<nav id="contentBlog" class="l-body" >
<li style="margin-bottom:20px"> <b>Some background on how different research fields such as Artificial Intelligence and Artificial Life consider the emergence of cognition in artificial agents.</b> </li>
<li style="margin-bottom:20px"> <b>How to model the emergence of life and cognition? What is a Cellular Automata? What is Lenia? </b> </li>
<li style="margin-bottom:20px"> <b>How to use Machine Learning in order to discover interesting creatures in Lenia, as the ones in the
video above? How can they self-organize without a pre-existing notion of body/brain? How can they behave robustly in the environment?</b> </li>
<li style="margin-bottom:20px"> <b>We'll illustrate the generalization capabilities of self-organizing agents
with several fun examples ranging from perturbing the agent structure in various ways not seen during training (including by a collision
with another agent) to changing the scale/size of the agent </b> </li>
<li style="margin-bottom:20px"> <b>We discuss some new perspectives it provides for both AI and biology. </b> </li>
<li style="margin-bottom:20px"> <b> We provide the source code of this work:</b> <a href="https://colab.research.google.com/drive/11mYwphZ8I4aur8KuHRR1HEg6ST5TI0RW#scrollTo=l6D-g1Q38yyC" class="colab-root">Reproduce in a <span class="colab-span">Notebook</span></a> </li>
</nav>
<h2 id='abstract'>Abstract</h2>
<p>Novel classes of Cellular Automata (CA) have been recently introduced in the Artificial Life (ALife) community, able to generate a high diversity of complex self-organized patterns from local update rules. These patterns can display certain properties of biological systems such as a spatially localized organization, directional or rotational movements, etc. In fact, CA have a long relationship with biology and especially the origins of life/cognition as it is a self-organizing system that can serve as a computational testbed and toy model for such theories <dt-cite key="autopoiesisBeer1754"></dt-cite> but also as a source of inspiration on what are the basic building block of "life". However, while the notions of embodiment within an environment, individuality<dt-fn> <strong>individuality:</strong> ability of an informational/physical structure to preserve its coherence and integrity</dt-fn> and self-maintenance<dt-fn> <strong>self-maintenance:</strong> capacity of a structure to modify its interactions with the rest of the environment for maintaining its integrity</dt-fn> are central in theoretical biology and in particular in the definition of agency (e.g. Maturana & Varela <dt-cite key="maturana1980autopoiesis"></dt-cite> , Varela <dt-cite key="varela1997patterns"></dt-cite>), it remains unclear how such mechanisms and properties can emerge from a set of local update rules in a CA. In this blogpost, we propose an approach enabling to learn self-organizing agents capable of reacting to the perturbations induced by the environment, i.e. robust agents with sensorimotor capabilities. We provide a method based on curriculum learning, on diversity search and on gradient descent over a differentiable CA able to discover the rules leading to the emergence of such creatures. The creatures obtained, using only local update rules, are able to regenerate and preserve their integrity and structure while dealing with the obstacles or other creatures in their way. They also show great generalization, with robustness to changes of scale, random updates or perturbations from the environment not seen during training. We believe that the field of artificial intelligence could benefit from these capabilities of self-organizing systems to make robust intelligent systems that can quickly adapt to new environments and to perturbations.</p>
<h2 id='interactive-demo'>Interactive Demo</h2>
<d-content style="padding-top:0">
<nav style="margin-left:2em;">
<p><a href="https://colab.research.google.com/drive/11mYwphZ8I4aur8KuHRR1HEg6ST5TI0RW#scrollTo=l6D-g1Q38yyC" class="colab-root">Reproduce in a <span class="colab-span">Notebook</span></a></p>
</nav>
<nav id="infoDemoAdvanced" style="margin-left:2em;display:none">
<li> <b>Press play to begin</b> </li>
<li>Place creature by clicking on the dark screen with <b>Creature</b> mode selected)</li>
<li>(Note that the multi creature setting was not seen during training)</li>
<li>Now place obstacles by selecting <b>Wall dot</b> and then clicking or dragging on the screen </li>
<li>You can erase by selecting the <b>Eraser</b> mode and then clicking or dragging on the screen </li>
<li> You can choose the brush size to draw bigger obstacles/ clear bigger areas etc</li>
<li> To zoom, select zoom mode, select zoom magnitude with the slider and then click where you want to zoom<br>Keep dragging to follow the creature </li>
<li> For the attractor, click and drag for a short distance attractor (Still experimental, works best with creature 2) </li>
</nav>
<nav id="infoDemo" style="margin-left:2em;display:block">
<li> The demo displays a differentiable continuous cellular automaton (CA) system where an emerging "creature" (yellow) is the result of local rules applied on the whole grid. The blue elements are obstacles (and are also part of the CA system).The rules leading to these very robust creatures were obtained using gradient descent,diversity search and curriculum learning. </li>
<li> <b>Press play to begin</b> (The demo won't work on phone) </li>
<li>Choose the type of creature on the left (each creature morphology is the result of different rules in the CA)</li>
<li>Choose pre defined environments at the bottom </li>
<li>Draw obstacles by clicking on the canvas </li>
<li>More options available at Advanced Options </li>
</nav>
</d-content>
<div class="radio-toolbar" id="radioCrea" style="float:left;margin-left:calc(50% - 1284px/2);width:50px">
<input type="radio" id="demoButton1" name="optionCrea" value="1" checked>
<label for="demoButton1" id="labelDemoButton1" onclick="setSpecies(0);document.getElementById('getStarted1').style.display='block';document.getElementById('getStarted2').style.display='none';document.getElementById('getStarted3').style.display='none'"><img style="width:80px;height:56px" src="public/crea1.png"></label><br>
<input type="radio" id="demoButton2" name="optionCrea" value="2" >
<label for="demoButton2" id="labelDemoButton2" onclick="setSpecies(1);document.getElementById('getStarted1').style.display='none';document.getElementById('getStarted2').style.display='block';document.getElementById('getStarted3').style.display='none'"><img style="width:80px;height:56px" src="public/crea2.png"></label><br>
<input type="radio" id="demoButton4" name="optionCrea" value="4">
<label for="demoButton4" id="labelDemoButton4" onclick="setSpecies(3);document.getElementById('getStarted1').style.display='none';document.getElementById('getStarted2').style.display='none';document.getElementById('getStarted3').style.display='block'"><img style="width:80px;height:56px" src="public/crea4.png"></label>
</div>
<div class='l-body'>
<canvas id="glCanvas" width="640" height="360" style="background-color:#000000;"></canvas>
<!--shadertoy at mac 840x472, at win 640x360-->
<div id="showText" onclick="this.style.display='none';">initializing...</div>
</div>
<div>
<span id="play-pause">
<svg class="icon" id="play" style="display: inline;"><svg id="playIcon" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg></svg>
<svg class="icon" id="pause" style="display: none;"> <svg id="pauseIcon" viewBox="0 0 24 24"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg> </svg>
</span>
<svg class="icon" id="reset" style="display:none"><svg id="resetIcon" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"></path><path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"></path></svg></svg>
<input type="file" id="imageLoader" style="display:none" name="imageLoader"/>
<div class="radio-toolbar" id="radioStart" >
<input type="radio" id="startButton1" name="optionStart" value="1" checked>
<label for="startButton1" id="labelStartButton1" onclick="document.getElementById('infoDemo').style.display='block';document.getElementById('infoDemoAdvanced').style.display='none';document.getElementById('getStarted').style.display='block';document.getElementById('controls').style.display='none'">Getting started</label>
<input type="radio" id="startButton2" name="optionStart" value="2" >
<label for="startButton2" id="labelStartButton2" onclick="document.getElementById('infoDemo').style.display='none';document.getElementById('infoDemoAdvanced').style.display='block';document.getElementById('getStarted').style.display='none';document.getElementById('controls').style.display='block'">Advanced options</label>
</div>
</div>
<div id="getStarted" class="l-body" style="display:block">
<div id="getStarted1" style="display:block">
<div class="row" >
<div id="zoomCrea1" class="column" style="background-color: rgba(0,0,0,0.1);border: solid rgba(0, 0, 0, .2);flex:1; " onclick="img.src='public/zoomCrea1.png'">
<img style="width:100%" src="public/zoomCrea1.png">
<p class="titleGetStarted"> Zoomed in </p>
</div>
<div id="multi1"class="column" style="background-color: rgba(0,0,0,0.1);border: solid rgba(0, 0, 0, .2);flex:1;" onclick="img.src='public/init1.png'">
<img style="width:100%" src="public/init1.png">
<p class="titleGetStarted"> Multi creature</p>
</div>
<div id="mazeCrea1" class="column" style="background-color: rgba(0,0,0,0.1);border: solid rgba(0, 0, 0, .2);flex:1;" onclick="img.src='public/mazeCrea1.png'">
<img style="width:100%" src="public/mazeCrea1.png">
<p style="margin-top:0px;margin-bottom:0px;text-align:center"> Maze </p>
</div>
</div>
</div>
<div id="getStarted2" style="display:none">
<div class="row" >
<div id="zoomCrea2" class="column" style="background-color: rgba(0,0,0,0.1);border: solid rgba(0, 0, 0, .2);flex:1;" onclick="img.src='public/zoomCrea2.png'">
<img style="width:100%" src="public/zoomCrea2.png">
<p class="titleGetStarted"> Zoomed in</p>
</div>
<div id="multi2"class="column" style="background-color: rgba(0,0,0,0.1);border: solid rgba(0, 0, 0, .2);flex:1;" onclick="img.src='public/init2.png'">
<img style="width:100%" src="public/init2.png">
<p class="titleGetStarted"> Multi creature</p>
</div>
<div id="mazeCrea2" class="column" style="background-color: rgba(0,0,0,0.1);border: solid rgba(0, 0, 0, .2);flex:1;" onclick="img.src='public/mazeCrea2.png'">
<img style="width:100%" src="public/mazeCrea2.png">
<p class="titleGetStarted"> Maze </p>
</div>
</div>
</div>
<div id="getStarted3" style="display:none">
<div class="row" >
<div id="zoomCrea3" class="column" style="background-color: rgba(0,0,0,0.1);border: solid rgba(0, 0, 0, .2);flex:1; " onclick="img.src='public/zoomCrea3.png'">
<img style="width:100%" src="public/zoomCrea3.png">
<p class="titleGetStarted"> Zoomed in</p>
</div>
<div id="multi3"class="column" style="background-color: rgba(0,0,0,0.1);border: solid rgba(0, 0, 0, .2);flex:1;" onclick="img.src='public/init3.png'">
<img style="width:100%" src="public/init3.png">
<p class="titleGetStarted"> Multi creature</p>
</div>
<div id="mazeCrea3"class="column" style="background-color: rgba(0,0,0,0.1);border: solid rgba(0, 0, 0, .2);flex:1;" onclick="img.src='public/mazeCrea3.png'">
<img style="width:100%" src="public/mazeCrea3.png">
<p style="margin-top:0px;margin-bottom:0px;text-align:center"> Maze </p>
</div>
</div>
</div>
</div>
<div id="controls" class="l-body" style="display:none">
<div class='row'>
<div class="column">
<input type="range" min="0.1" max="1" step="0.1" value="0.5" class="slider" id="rangeRadiusWall" >
<p> Brush size: <span id="valueRadiusWall"></span></p>
<input type="range" min="6" max="20" step="0.1" value="8.5" class="slider" id="rangeRadius" style="display:none">
<p style="display:none"> Radius of kernels (size of creature): <span id="valueRadius"></span></p>
</div>
<div class="column">
<input type="range" min="2" max="8" step="1" value="2" class="slider" id="rangeZoom" >
<p> Zoom : <span id="valueZoom"></span></p>
</div>
</div>
<div class="radio-toolbar" id="optionDiv">
<input type="radio" id="radioErase" name='option' value="erase">
<label for="radioErase">Eraser</label>
<input type="radio" id="radioCircle" name='option' value="circle" checked>
<label for="radioCircle">Wall Dot</label>
<input type="radio" id="radioCreature" name='option' value="creature" >
<label for="radioCreature">Creature</label>
<input type="radio" id="radioZoom" name='option' value="zoom" >
<label for="radioZoom">Zoom</label>
<input type="radio" id="radioAttract" name='option' value="attract" >
<label for="radioAttract">Attractor</label>
</div>
</div>
<script type="text/javascript" src="public/utils.js"></script>
<script type="text/javascript" src="public/gl.js"></script>
<div style="position:fixed;bottom:0;left :-175px;width:160px">
<input type="range" min="0" max="3" step="0.1" value="1" class="slider" id="rangeSpeed" >
<p> Speed of videos: <span id="valueSpeed"></span></p>
</div>
<d-content class="figcaption" >
<nav style="margin-left:2em">
<h2>Contents</h2>
<h5><a href="#introduction">Introduction</a></h5>
<h5><a href="#the-system">The System</a></h5>
<ul>
<li><a href="#lenia">Lenia</a></li>
<li><a href="#differentiable-lenia">Differentiable Lenia</a></li>
</ul>
<h5><a href="#how-to-discover-spatially-localized--and-moving-agents-in-lenia-">How to discover spatially localized and moving creatures in Lenia ? </a></h5>
<ul>
<li><a href="#how-to-discover-spatially-localized--and-moving-agents-in-lenia-">Target shape</a></li>
<li><a href="#curriculumdriven-goal-exploration-process">Curriculum-driven goal exploration process</a></li>
<li><a href="#moving-creatures-obtained">Moving creatures obtained</a></li>
</ul>
<h5><a href="#can-we-learn-robust-creatures-with-sensorimotor-capabilities-">Can we learn robust creatures with sensorimotor capabilities ?</a></h5>
<ul>
<li><a href="#-modeling-agentenvironment-interactions-in-lenia-the-example-of-obstacles-">Modeling agent-environment interactions in Lenia,
the example of obstacles</a></li>
<li><a href="#training-method-with-stochastic-environmental-perturbations">Training method with stochastic environmental perturbations</a></li>
<li><a href="#robust-moving-creatures-obtained">Robust moving creatures obtained</a></li>
</ul>
<h5><a href="#how-well-do-the-creatures-obtained-generalize-">How well do the creatures obtained generalize ?</a></h5>
<ul>
<li><a href="#single-creature-setting"> Single creature setting</a></li>
<li><a href="#multi-creature-setting">Multi creature setting</a></li>
</ul>
<h5><a href="#related-work">Related works</a></h5>
<h5><a href="#discussion">Discussion</a></h5>
<h5><a href="#appendix">Appendix</a></h5>
</nav>
</d-content>
<h2 id='introduction-connecting-the-dots-between-the-mechanistic-and-enactivist-views-of-cognition'>Introduction: Connecting the dots between the Mechanistic and Enactivist views of Cognition.</h2>
<p>Understanding what has led to the emergence of life, cognition and natural agency as we observe in living organisms is one of the major scientific quests in a variety of disciplines ranging from biology and chemistry to evolutionary science. The pragmatic complementary question, central in disciplines such as artificial life (ALife) and artificial intelligence (AI), is: <i>can we engineer the necessary ingredients to discover forms of functional life and cognition as-it-could-be in an artificial substrata? </i> With respect to this practical goal of building agents-as-they-could-be, key challenges are the modeling of an artificial <i>environment</i><dt-fn> <strong>environment:</strong> system that defines a notion of space, time, physical states and laws</dt-fn>, the characterization of an agent <i>embodiment</i><dt-fn> <strong>embodiment:</strong> ensemble of norms and necessary conditions that define an agent as an autonomous unity we could separate from the rest <dt-cite key="di2019process"></dt-cite></dt-fn><i> </i>and <i>cognitive capacity/domain</i><dt-fn> <strong>cognitive capacity/domain:</strong> ensemble of performances that an agent is able to realize and regulate in its environment <dt-cite key="di2019process"></dt-cite>, defined as the "domain of interactions in which a unity can engage without disintegration" <dt-cite key="autopoiesisBeer1754"></dt-cite></dt-fn><i> </i>within such an environment; and the finding of agents that (robustly) comply with those criteria. Depending on their focus of research, approaches in the literature can be divided into the <i>mechanistic</i> and the <i>enactivist</i> views<i>. </i>The mechanistic view already presupposes an agent embodiment and rather focuses on understanding how higher-level cognitive interactions can arise, typically seeking for agents capable of <i>sensorimotor adaptivity</i><dt-fn> <strong>sensorimotor adaptivity:</strong> sensory-motor coordination enabling agents to react to environmental perturbations, achieve repertoire of behavioral skills and adapt to unseen conditions</dt-fn>. In the enactive view, "the question of the bodily constitution is conceptually prior to any particular functional account of a cognitive subsystem" <dt-cite key="di2019process"></dt-cite>. The prior conditions of <i>individuality</i> and <i>self-maintenance</i> are coined by enactivists as necessary for determining the agent's own existence and survival. <strong>Whereas the mechanistic considerations "jump over" the biological processes that enable organisms to survive (primitive forms of life/cognition), the enactivist considerations still "fall behind" on showcasing higher-level processes of sensorimotor adaptivity (advanced forms of life/cognition).</strong> Can future work in AI and ALife bridge the gap between those two frameworks?</p>
<div style="clear: both;float: right; margin-top: 10px; margin-left: 10px; margin-right: calc((100vw - 1500px) / 2 + 168px);
width: calc((1500px - 648px) / 2 - 24px);">
<img src="public/mechanistic.svg" alt="scheme" style="width:94%">
</div>
<p>In the mechanistic view, robots and other virtual agents are referred as "embodied" if they can ground their sensorimotor capabilities in the environment (the external world) via a physical interface (the body) allowing to experience the world directly (sensory inputs) and to act upon it (motor outputs) using internal input-output information processing (the brain). Embodiment here is opposed to the computational non-embodied perspective where internal representations, either symbolic-based in "good-old fashion AI" or neural-network-based in the "internet AI", are decoupled from the external world and lack situatedness <dt-cite key="brooks1991intelligence"></dt-cite>. Yet, within the mechanistic modeling framework, it is not questioned what makes an agent an agent or even what makes a body a body <dt-cite key="di2019process"></dt-cite>: one assumes there is already a body interacting with the environment through predefined sensors and actuators. The agent <i>individuality </i>is clear: it is a separate unity (yellow box on the right figure) whose states and dynamics can be clearly distinguished from the states and dynamics of the rest of the environment. The agent <i>self-maintenance </i>is often not a problem as the agent body does not change over time except for rare cases of real world or artificially-induced degradations (e.g. robot damages, battery/energy level), and only the brain (white box on the right figure) adjusts to the environment. A more central question within that framework is the agent <i>sensorimotor adaptivity</i>: how to find agents capable of a repertoire of sensorimotor behaviors/skills such as locomotion, object manipulation <dt-cite key="akkaya2019solving"></dt-cite> or tool use <dt-cite key="guerin2012survey"></dt-cite> and capable of adapting the learned behaviors to unseen environmental conditions <dt-cite key="team2021open"></dt-cite>? To address that question in practice, a common methodology is the generation of a distribution of environments (tasks and rewards) to train the agent's brain to master and generalize those tasks, typically with learning approaches such as deep reinforcement learning. Whereas the focus is at the agent behavioral level, <strong>it remains open to criticism why the agent behavior should be instantiated in the brain in the first place, and why not in the body or even in the external world</strong><strong>. </strong></p>
<p>The clear body/brain/environment distinction of the mechanistic framework bears little resemblances with biological examples of brainless organisms using their body both for sensing and computing the decision. Plants move to get more sun, slime molds use mechanical cues of their environment to choose in which direction to expand <dt-cite key="murugan2021mechano"></dt-cite>, and swarm of bacterias can make group decisions to avoid a wall of antibiotics <dt-cite key="PhysRevE.101.012407"></dt-cite>, while there is no clear notion of a "brain" in these living forms. Pfeifer and colleagues <dt-cite key="pfeifer2006body"></dt-cite> introduced the concept of m<i>orphological computation</i>, arguing that all physical processes of the body (not only electrical circuitry in the brain but also morphological growth and body reconfiguration) are integral parts of cognition, and can achieve advanced forms of computation without a "brain". A famous example of (artificial) morphological computation is the passive bipedal walker <dt-cite key="collins2001three"></dt-cite> <dt-cite key="muller2017morphological"></dt-cite> which manages sensorimotor coordination and life-like locomotion behavior by simply exploiting the natural dynamics of the robot mechanical system.</p>
<!---<def>
<p> <b>Agent </b> a macro unity we could separate from the rest which regulates/self-maintains </p>
</def><br>
<def>
<p> <b>Sensori-motor capabilities </b> being able to resist and react to perturbation from the environment </p>
</def>
<def style="position:relative;margin-top:40px">
<p> <b>precarious conditions </b> the idea that bodies are constantly subjected to disruptions and breakdowns <dt-cite key="di2019process"></dt-cite></p>
</def>-->
<div style="clear: both;float: right; margin-top: 10px; margin-left: 10px; margin-right: calc((100vw - 1500px) / 2 + 168px);
width: calc((1500px - 648px) / 2 - 24px);">
<img src="public/enactivist.svg" alt="scheme" style="width:100%">
</div>
<div class="side-highlight">
<div class="highlight-text">
<i>There is no predefined notion of agent embodiment, instead it is considered that the body of the agent must come to existence through the coordination of the low-level elements and must operate under <i>precarious</i> conditions</i>
</div>
</div>
<p>The enactive view on embodiment however is rooted in the bottom-up organizational principles of living organisms in the biological world. The modeling framework typically uses tools from dynamical and complex systems theory where an artificial system (the environment) is made of low-level elements of matter \(\{a_i\}\) (called atoms, molecules or cells) described by their inner states (e.g. energy level) and locally interacting via physics-like rules (flow of matter and energy within the elements). There is no predefined notion of agent embodiment, instead it is considered that the body of the agent must come to existence through the coordination of the low-level elements and must operate under <i>precarious</i> conditions<dt-fn> <strong>precarious conditions</strong> : the idea that bodies are constantly subjected to disruptions and breakdowns <dt-cite key="di2019process"></dt-cite></dt-fn>. Within that modeling framework, the condition of <i>individuality</i> is the ability of a self-organizing structure (subpart of the environment) to preserve and propagate some spatiotemporal unity <dt-cite key="krakauer2020information"></dt-cite>, making it a distinguishable coherent entity in the domain in which it exists (called an autopoietic system in <dt-cite key="maturana1980autopoiesis"></dt-cite> <dt-cite key="varela1997patterns"></dt-cite>). The condition of <i>self-maintenance</i> is the capacity of a self-organizing structure to modify its internal and interactive exchanges of matter and energy with the rest of the environment (action) when facing external changes in the states or rules of the dynamical system (perturbations) for maintaining its integrity (goal). Interestingly, this "autonomy of an autopoietic system constitutes its minimal cognition" <dt-cite key="de2009enaction"></dt-cite>. </p>
<p>Whereas both the mechanistic and the enactivist framework agree on agents as entities with some form of goal-directedness and action response to external perturbations, we can see how the characterization of agents in self-organizing systems is non-intuitive and very challenging in practice. Some recent works have proposed rigorous quantitative measures of <i>individuality</i> based on information theory tools <dt-cite key="krakauer2020information"></dt-cite> <dt-cite key="biehlInformationBasedSpatiotemporal2016"></dt-cite>. Other works from R.D. Beer attempted to formalize the characterization of the <i>self-maintenance/cognitive domain</i> of a spatio-temporal structure (such as a glider <dt-cite key="beer2020bittorio"></dt-cite> <dt-cite key="PMID:24494612"></dt-cite> and other patterns <dt-cite key="cika2020resilient"></dt-cite> in the game of life or a protocell model <dt-cite key="agmon2015ontogeny"></dt-cite>) by enumerating the reactions to all possible perturbations that such structure can receive from its immediate environment. However, the practical application of those tools to identify forms of agency has so far been limited to toy models with small state grids and simple dynamics, as their algorithmic implementation requires exhaustive search and difficulty scales to more complex dynamical systems. Certainly due to those practical challenges, the higher-level questions of what makes an agent <i>sensorimotor</i> and <i>adaptive</i> and how such entities emerge in the enactivist framework remains, to our knowledge, poorly addressed in the literature.</p>
<div class="side-highlight">
<div class="highlight-text">
<i>Is it possible to find environments in which a subpart could exist/emerge and be called a "sensorimotor agent"?</i>
</div>
</div>
<p>In the work presented here, following the enactivist modeling framework, we initially only assume environments made of atomic elements and physical laws and try to answer the following scientific question: is it possible to find environments in which a subpart could exist/emerge and be called a "sensorimotor agent"? To do so, we use a continuous cellular automaton, called Lenia <dt-cite key="chan2020lenia"></dt-cite><dt-cite key="chan2019lenia"></dt-cite>, as our artificial "world". At the difference of previous work in Lenia and CA in general, our methodological contributions to efficiently foster the emergence of robust sensorimotor agents within the search process integrate (i) a bi-level optimisation method based on gradient descent and curriculum-driven goal exploration and (ii) controllable functional constraints and opportunities in the environment by specifying (subparts of) the environmental dynamics. The blogpost is organized as follows.</p>
<p>In the <a href='#the-system'>first section</a>, we explain how we made the Lenia framework as differentiable-friendly as possible in order to efficiently search for CA rules. The transition toward differentiable dynamics was recently proposed in the context of cellular automata <dt-cite key="mordvintsev2020growing"></dt-cite> or so-called neural CA (NCA). By unrolling the dynamics of the NCA over time and backpropagating through it, the use of deep-learning and differentiable programming tools allowed to efficiently find CA rules leading to complex patterns. Different training losses such as image <dt-cite key="mordvintsev2020growing"></dt-cite>, style-content <dt-cite key="niklasson2021self-organising"></dt-cite> and classification <dt-cite key="randazzo2020self-classifying"></dt-cite> losses have been proposed. Inspired by a more traditional (non-embodied) deep learning framework, they have shown how complex pattern-generation (morphogenesis) and computation (self-classifying) processes could emerge in those systems. However, the use of such tools to efficiently search the parameterizations leading to the emergence of "sensorimotor agents" remains an unexplored research direction to date. </p>
<video id="robust" width="100%" autoplay loop muted="" class="videoShow l-body side">
<source src="public/pacman.mp4" type="video/mp4">
</video>
<p>In the <a href='#how-to-discover-spatially-localized--and-moving-agents-in-lenia-'>second section</a>, we propose a method based on gradient descent and curriculum learning combined within an intrinsically-motivated goal exploration process (IMGEP<dt-fn> <strong>IMGEP:</strong> algorithmic process that aims to discover a diversity of behaviours in a dynamical system. Itgenerates a sequence of experiments to explore the parameters of a dynamical system by targeting a diversity of self-generated goals <dt-cite key="baranes2013active"></dt-cite>. Here we use a population-based version <dt-cite key="Forestier2017IntrinsicallyMG"></dt-cite> <dt-cite key="reinke2020intrinsically"></dt-cite> and introduce two novel elements compared to previous papers: the use of gradient descent for local optimization and the ability to handle stochasticity in the dynamical system.</dt-fn>, an efficient form of diversity search algorithms that can be combined with gradient descent) to automatically search parameters of the CA rule that can self-organize spatially localized<dt-fn> <strong>spatially-localized pattern:</strong> a pattern existing within some (fuzzy) boundary i.e. with a limited range in space as opposed to patterns with unbounded growth</dt-fn> and moving patterns<dt-fn> <strong>moving pattern:</strong> a spatially-localized pattern that move and propagate information in space</dt-fn> within Lenia. While many complex behaviors have already been observed in Lenia, among which some could qualify as sensorimotor behaviors as illustrated in the side video, they have so far been discovered "by chance" as the result of time-consuming manual search or with simple evolutionary algorithms. In this work, we define an outer exploratory loop (generation of training goal/loss) and an inner optimization loop (goal-conditioned policy) that allow us to automatically learn the CA rules leading to the systematic emergence of basic sensorimotor structures. </p>
<p>In the <a href='#can-we-learn-robust-creatures-with-sensorimotor-capabilities-'>third section</a>, we explain how our environment's physical rules can integrate both predetermined specific properties and learnable properties. That "trick" to control subparts of the environmental physics allows us to build a curriculum of tasks for optimizing the learnable part of the environment, in which we are searching parameters that could self-organize sensorimotor agents robust to stochastic variations in the environmental constraints.Environment-design allows us, by shaping the search process, to discover more advanced forms of sensorimotor capabilities such as self-maintenance and adaptivity to the surroundings. </p>
<p>Finally in the <a href='#how-well-do-the-creatures-obtained-generalize-'>last section</a>, we investigate the (zero-shot) generalization of the discovered sensorimotor agents to several out-of-distribution perturbations that were not encountered during training. Impressively, even though the agents still fail to preserve their integrity in certain configurations, they show very strong robustness to most of the tested variations. The agents are able to navigate in unseen and harder environmental configurations while self-maintaining their individuality. Not only the agents are able to recover their individuality when subjected to external perturbations but also when subjected to internal perturbations: they resist variations of the morphogenetic processes such that less frequent cell updates, quite drastic changes of scales as well as changes of initializations. Furthermore, when tested in a multi-entity initialization and despite having been trained alone, not only the agents are able to preserve their individuality but they show forms of coordinated interactions (attractiveness and reproduction), interactions that have been coined as <i>communicative interactions</i><dt-fn> <strong>communicative interactions:</strong> "entity-entity perturbations that serve to orient entities within their respective cognitive domains to new possibilities for action" <dt-cite key="PMID:24494612"></dt-cite></dt-fn> . </p>
<div class="side-highlight">
<div class="highlight-text">
<i>Searching for rules at the cell-level in order to give rise to higher-level cognitive processes at the level of the organism and at the
level of the group of organisms opens many exciting opportunities to the development of embodied approaches in AI in general.</i>
</div>
</div>
<p>Our results suggest that, contrary to the (still predominant) mechanistic view on embodiment, biologically-inspired enactive embodiment could pave the way toward agents with strong coherence and generalization to out-of-distribution changes, mimicking the remarkable robustness of living systems to maintain specific functions despite environmental and body perturbations <dt-cite key="kitano2004biological"></dt-cite>. Searching for rules at the cell-level in order to give rise to higher-level cognitive processes at the level of the organism and at the level of the group of organisms opens many exciting opportunities to the development of embodied approaches in AI in general.</p>
<h2 id='the-system'>The system</h2>
<p>Cellular automata are, in their classic form, a grid of "cells" \( A = \{ a_x \} \) that evolve through time \( A^{t=1} \rightarrow \dots \rightarrow A^{t=T} \) via local "physics-like" laws. More precisely, the cells sequentially update their state based on the states of their neighbours: \( a_x^{t+1}= f(a_x^t,\mathcal{N}(a_x^t))\), where \( x \in \mathcal{X}\) is the position of the cell on the grid, \(a_x \) is the state of the cell, and \(\mathcal{N}(a_x^t)\) is the neighbourhood of the cell. The dynamic of the CA is thus entirely defined by the initialization \( A^{t=1} \) (initial state of the cells in the grid) and the update rule \( f \) (how a cell updates based on its neighbours). <strong>B</strong><strong>ut predicting their long term behavior is a difficult challenge even for simple ones due to their chaotic dynamics. </strong></p>
<div style="clear: both;float: right;margin-top: 0;margin-left: 24px;margin-right: calc((100vw - 984px) / 2 + 68px);width: calc((984px - 448px) / 2 - 24px);
">
<div class="row" >
<div class="column" style="width:100%">
<p style="font-size: 14px;color:#A0A0A0;"> SLP</p>
<img style="width:100%" src="public/Pinwheel.gif">
</div>
<div class="column" style="width:100%">
<p style="font-size: 14px;color:#A0A0A0;"> Moving pattern</p>
<img style="width:100%" src="public/glider.gif">
</div>
</div>
</div>
<p>The <a href='https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life'>Game of Life</a> is one example of cellular automaton with binary states where cells can either be dead (\(a_x=0\)) or alive (\(a_x=1\)). Despite its very simple rule \(f\), very complex structures can emerge in it. One main type of pattern studied in the game of life is stable spatially localized patterns (SLP) : patterns with a kind of spatial boundary that separates the unity from the rest. The subcategory of moving patterns, SLP that periodically get back to their state after some timesteps but shifted in space, is of particular interest. The well-known <i>glider</i>, as shown on the right, was even proposed as a computational model of an autopoietic system <dt-cite key="beer2020bittorio"></dt-cite><dt-cite key="PMID:24494612"></dt-cite>. </p>
<div style="clear: both;float: right;margin-top: 0;margin-left: 24px;margin-right: calc((100vw - 984px) / 2 + 68px);width: calc((984px - 448px) / 2 - 24px);
">
<div class="row" >
<div class="column" style="width:100%">
<p style="font-size: 14px;color:#A0A0A0;"> SLP</p>
<video style="width:100%" autoplay loop muted="" class="videoShow">
<source src="public/pattern4.mp4" type="video/mp4">
</video>
</div>
<div class="column" style="width:100%">
<p style="font-size: 14px;color:#A0A0A0;"> Moving pattern</p>
<video style="width:100%" autoplay loop muted="" class="videoShow">
<source src="public/orbiumSolo.mp4" type="video/mp4">
</video>
</div>
</div>
</div>
<p>The cellular automaton we study in this work is Lenia <dt-cite key="chan2020lenia"></dt-cite><dt-cite key="chan2019lenia"></dt-cite> which has the particularity of having continuous C-dimensional states (\(a_x \in [0,1]^C\)). To be more precise, Lenia is a class of cellular automata in which each instance is a Cellular Automaton (CA). A CA instance is defined by a set of parameters \( \theta \) that condition its "physics" such that the update rule \(f\) is parametrized: \( a_x^{t+1}= f_{\theta}(a_x^t,\mathcal{N}(a_x^t))\). For example, the Game of Life can be seen as a particular instance in Lenia. Having these update rules parametrized allows the search for CA environments with rules which can lead to the emergence of interesting patterns, including SLP and moving ones. Contrary to the perfectly stable or periodically oscillating patterns in the game of life, it is very hard to know if a SLP in Lenia will not explode or vanish after a long period of time on account of tiny drift changes in its continuous states. </p>
<p>A wide variety of complex patterns has been found in Lenia, using a combination of hand made exploration/mutation and evolutionary algorithm <dt-cite key="chan2020lenia"></dt-cite><dt-cite key="chan2019lenia"></dt-cite> or exploratory algorithm <dt-cite key="etcheverry2020hierarchically"></dt-cite> <dt-cite key="reinke2020intrinsically"></dt-cite>. The work from <dt-cite key="chan2020lenia"></dt-cite><dt-cite key="chan2019lenia"></dt-cite> focused a lot on spatially localized patterns and especially moving ones.</p>
<div class="row l-body">
<div class="column">
<video id="robust" width="80%" autoplay loop muted="" class="videoShow">
<source src="public/orbiumCollision.mp4" type="video/mp4">
</video>
</div>
<div class="column">
<video id="robust" width="80%" autoplay loop muted="" class="videoShow">
<source src="public/orbiumCollision2.mp4" type="video/mp4">
</video>
</div>
</div>
<div class="row l-body" >
<div class="column">
<video id="robust" width="80%" autoplay loop muted="" class="videoShow">
<source src="public/LeniaSpecie.mp4" type="video/mp4">
</video>
</div>
<div class="column">
<video id="robust" width="80%" autoplay loop muted="" class="videoShow">
<source src="public/courLenia.mp4" type="video/mp4">
</video>
</div>
</div>
<p style="font-size: 19px;color:#000000;text-align:center;" >
Creatures obtained by hand made random exploration<br>
<span style="font-size: 14px;color:#A0A0A0;">
Creatures at the top are <a href="https://chakazul.github.io/Lenia/JavaScript/Lenia.html">orbiums in Lenia </a> <dt-cite key="chan2019lenia"></dt-cite>.
Videos at the bottom are from Bert Chan's twitter, found by handmade random exploration :
<a href="https://twitter.com/BertChakovsky/status/1219332395456815104">left</a>, <a href="https://twitter.com/BertChakovsky/status/1265861527829004288">right</a><br>
Finding creatures like these can take time (and expert knowledge) especially for more complicated ones. <br>
You can find a library of creatures found in the first version of Lenia (<dt-cite key="chan2019lenia"></dt-cite><dt-cite key="chan2020lenia"></dt-cite>) at this <a href="https://chakazul.github.io/Lenia/JavaScript/Lenia.html">link</a>.
</span>
</p>
<p>The moving creatures found are long term stable and can have interesting interactions with each other but some as the orbium (which you can find on the 2 upper videos) are not very robust for example here with collision between each other. Other more complex creatures (as shown in the two bottom videos) seem to resist collision better and to be able to sense the other creatures. These creatures show sensorimotor capabilities as they change direction in response to interaction with other creatures. </p>
<p> However, all of the previous methods use only random mutations and manual tuning to find these patterns, which can be computationally heavy especially to find very specific functionalities or in high dimensional parameter space. This motivates our choice to make Lenia differentiable, which then allows us to take advantage of the differentiability to find, in a more efficient and systematic way, the parameters leading to the emergence of agents with similar types of behaviors .</p>
<p> </p>
<p>In this section, we first explain in more detail the model in Lenia and present how we made parts of the Lenia model differentiable. </p>
<h3 id='lenia'>Lenia</h3>
<div class="l-middle-outset" style="width:calc(816px + 96px + 200px);">
<video id="robust" width="95%" controls muted="" class="videoShow">
<source src="public/leniaVid.mp4" type="video/mp4">
</video>
<p style="font-size: 19px;color:#000000;text-align:center;" >
Animation of Lenia Step <br>
<span style="font-size: 14px;color:#A0A0A0;"> made with manim:<a href="https://github.com/3b1b/manim" > https://github.com/3b1b/manim</a> forked
from <a href="https://github.com/3b1b/videos/blob/master/_2020/18S191/convolutions.py">
https://github.com/3b1b/videos/blob/master/_2020/18S191/convolutions.py </a>
</span>
</p><br>
</div>
<!---
<div class="l-screen-inset" style="position:relative">
<img src="public/LeniaScheme.svg" alt="scheme">
</div>
<p style="font-size: 19px;color:#000000;text-align:center;" class="l-middle-outset">
Update step of channel 1 in the Lenia System <br>
<span style="font-size: 14px;color:#A0A0A0;"> Update of channel 2 is done similarly, in parallel of update of channel 1</span>
</p><br>
--->
<p>In Lenia , the system is composed of several communicating grids \( A=\{ A_c\}\) which we call <i>channels</i>. The above video illustrates Lenia "physics" in a 2-channel example ( \(A_1\) is colored in yellow and \( A_2 \) in blue). In each of these grids, every cell/pixel can take any value between 0 and 1. Cells at 0 are considered dead while others are alive. As shown in the video, the channels are updated in parallel according to their own physics rule. Intuitively,<strong> </strong><strong>we can see channels as the domain of existence of a certain type of cell. Each type of cell has its own physic</strong><strong>s</strong> : it has its own way to interact with other cells of its type (intra-channel influence) and also its own way to interact with cells of other types (cross-channel influence).</p>
<p>The update of a cell \( a_{x,c}\) at position \(x\) in channel \(c\) can be decomposed in three steps. First the cell senses its neighbourhood in some other channels (its neighbourhood in its channel, with cells of the same type but also in other channels with other types of cells) through convolution <i>kernels</i> which are filters \(K_k\) of different shapes and sizes. Second, the cell converts this sensing into an update (whether positive or negative growth or neutral) through <i>growth functions</i> \(G_k\) associated with the kernels. Finally, the cell modifies its state by summing the scalars obtained after the growth functions and adding it to its current state. After the update of every rule has been applied, the state is clipped between 0 and 1. Each (kernel,growth function) couple is associated to the source channel \(c_s\) it senses, and to the target channel \(c_t\) it updates. A couple (kernel,growth function) characterizes a rule on how a type of cell \(c_t\) reacts to its neighbourhood of cells of type \(c_s\). Note that \(c_s\) and \(c_t\) could be the same, which correspond to interaction of cells of the same type (intra-channel influence). Note also that we can have several rules characterizing the interaction between \(c_s\) and \(c_t\), i.e. \(n(c_s \rightarrow c_t)\) (kernel,growth function) couples. </p>
<p>A local update in the grid is summarized with the following formula: </p>
<p>$$a_x^{t+1}=f(a_x^t, \mathcal{N}(a_x^t)) = \begin{bmatrix} a^t_{x,c_0} + \sum_{c_s=0}^C \sum_{k=0}^{n(c_s \rightarrow c_0)-1} G^k_{c_s \rightarrow c_0} ( K^k_{c_s \rightarrow c_0} (a^t_{x,c_0}, \mathcal{N}_{c_0}(a^t_x))) \\.\\.\\.\\a^t_{x,c_C} + \sum_{c_s=0}^C \sum_{k=0}^{n(c_s \rightarrow c_C)-1} G^k_{c_s \rightarrow c_C} ( K^k_{c_s \rightarrow c_C} (a^t_{x,c_C}, \mathcal{N}_{c_C}(a^t_x)))\end{bmatrix} $$ </p>
<p>For each rule, the shape of the (kernel, growth function) is parametrized. We are thus able to "tune" the physics of the cells and of their interactions by changing the kernels shape (how the cells perceive their neighborhood) as well as the growth function shape (how the cells react to this perception). </p>
<p>However, finding interesting parameters leading to the emergence of localized patterns or even moving one is not easy. For example here is a random search of 100 trials (with 1 channel and 10 rules) gives only 3-5 SLP and no moving creature. Even with more advanced diversity-driven exploration searches, moving creatures are hard to find <dt-cite key="etcheverry2020hierarchically"></dt-cite> <dt-cite key="reinke2020intrinsically"></dt-cite>. This motivates our choice to use gradient descent in order to learn these parameters.</p>
<video id="robust" width="95%" autoplay controls muted="" class="l-body videoShow">
<source src="public/random.mp4" type="video/mp4">
</video>
<p style="font-size: 19px;color:#000000;text-align:center;" >
Random exploration of the parameter space rarely results in moving creature.<br>
<span style="font-size: 14px;color:#A0A0A0;">
Each 100 squares are random parameters trials (each 1 channel and 10 rules so \(\sim \) 130 parameters for all the rules of a square). The parameters
control the local rules of interaction between cells, by changing the kernel shape (how a cell senses) and the growth function (how this sensing
is converted into growth). </span>
</p>
<h3 id='differentiable-lenia'>Differentiable Lenia</h3>
<p>Due to the locality and recurrence of the update rule, there is a close relationship between cellular automata and recurrent convolutional networks <dt-cite key="gilpin2019cellular"></dt-cite>. In fact, we can see a rollout in Lenia as applying a recurrent neural network to an initial state. If (some of) the network parameters are differentiable, <strong>backpropagation can be done by "unfolding" the Lenia rollout and applying a loss at certain time step(s)</strong> like in <dt-cite key="mordvintsev2020growing"></dt-cite> .</p>
<p>However, in the classic version of Lenia <dt-cite key="chan2020lenia"></dt-cite> <dt-cite key="chan2019lenia"></dt-cite>, the shape of the kernels are not totally differentiable and not very flexible. To allow easier optimization of the Lenia system, we introduce some changes to the kernel parametrization. You can find these changes in the <a href='#differentiableLeniaShift'>Differentiable Lenia Shift</a> section of the appendix. However even doing so, differentiating through Lenia can be difficult because the gradient must backpropagate through several steps (which moreover have their result clipped between 0 and 1) without vanishing. We should thus limit ourselves to a few iterations when training: in our experiments the loss is applied after 50 steps in Lenia.</p>
<h2 id='how-to-discover-spatially-localized--and-moving-agents-in-lenia-'>How to discover spatially localized and moving agents in Lenia ?</h2>
<p>In this section, <strong>we propose tools based on gradient descent and curriculum learning to learn the CA parameters leading to the emergence of moving creatures</strong><strong>.</strong> Finding gliders-like creatures will be the basis on which we'll build the method leading to the emergence of sensorimotor capabilities within the Lenia dynamics in the next section. </p>
<div class="side-highlight">
<div class="highlight-text">
<i>In this study, we learn to develop morphology and motricity at the same time. The CA rule will both be applied to grow
the creature from an initial state and be the "physics" that makes it move.</i>
</div>
</div>
<p>Note that moving creatures in cellular automaton differ from other types of movement like motors, muscle contraction or soft robot <dt-cite key="Trivedi2008SoftRB"></dt-cite>. CAs operate on a fixed grid and therefore moving necessarily requires patterns growing at the front and dying at the back. This should imply that creatures that move are more fragile because they are in a fragile equilibrium between growth (to move forward) and dying (because otherwise we would have infinite growth). In this study, we learn to develop morphology and motricity at the same time. The CA rule will both be applied to grow the creature from an initial state and be the "physics" that makes it move.</p>
<p>In this section, we only work with 1 channel (only 1 type of cells interacting). In this channel we want to learn the several rules (parameters of the kernel+growth functions encoding the interactions of those cells within the channel) that will result in the emergence of moving creatures when given the proper initialization. At the same time we also aim to learn an initialization that will be adapted to these rules i.e. lead to the emergence of the creature.</p>
<p>We start by randomly initializing the parameters and initialization until we get a localized pattern, meaning it doesn't spread to the whole grid and doesn't die . This obtained pattern will most of the time stay at the same position. What we want is to change the parameters and initialization such that this pattern ends further in the grid, meaning that it survived and stayed localized but moved to a different location in a few timesteps. Because our system is differentiable, we're able to backpropagate through the timesteps by "unfolding" the roll-out. We therefore need a loss applied on the roll-out which will encourage movement to a new position z.</p>
<img src="public/OptimStep.svg" alt="optimScheme" class='l-middle-outset' >
<p style="font-size: 19px;color:#000000;text-align:center;" class="l-body">
Schematic view of optimization step<br>
<span style="font-size: 14px;color:#A0A0A0;">Differentiable Lenia allows to optimize the CA parameters such that its dynamics converges
towards a target pattern. Here the figure shows optimization of the system with MSE error between target image and system state at last timestep.
Different training losses could be envisaged and applied at intermediate time steps depending on the dynamical
properties one aim to emerge in the system
. </span>
</p>
<p>Target image with MSE error applied at the last timestep of a rollout seems effective to learn CA rule leading to a certain pattern <dt-cite key="mordvintsev2020growing"></dt-cite>. And the fact that it's a very informative loss, thus helping with vanishing gradient problem, made us choose this loss for our problem over other losses such as maximizing the coordinate of the center of mass. We apply the MSE loss between the pattern at the last timestep of the roll out and a target shape put at a target location further in the grid.</p>
<p> The first target shape we tried was a single disk with the idea of getting a spatially localized agent contained within the disk as the target shape is finite. However, after seeing that the robust creature obtained seemed to have a "core" and a shallow envelope, we informally chose to move to two superposed discs, a large shallow one with a thick smaller one on top. The resulting target shape has the formula \(0.1*(R<1)+0.8*(R<0.5)\). We chose on purpose to have the sum to be smaller than 1 to avoid killing the gradient due to the clip operation.</p>
<p>Despite the choice of the target shape, the choice of the target location is crucial for the success of the optimization. Simply putting a target shape far from initialization and optimizing towards it does not work most of the time. In fact, it works only when the target is not too far ( more precisely overlaps a little bit) from where the creature ended before optimization. This comes from the fact that cells at 0 do not give gradients as we clip between 0 and 1 and so, for example, if at last timestep the target shape is on an area where the cell states are clipped at 0 no gradient will be propagated. Moreover, <strong>as the system is complex/chaotic, the optimization landscape will be very hard and changing some parameters too much can easily break the dynamic leading to completely different outcomes</strong> (loosing all the progress and making further optimization very hard). And so putting the target at a close position should lead to easier optimization landscape as well as more gradient information (because more non clipped pixel will overlap the target), leading to better optimization steps with less chances to diverge. To use these small steps, we propose to use curriculum learning exploiting the fact that we can shape optimization to aim for near-enough (and increasingly further) target shapes.</p>
<div class="l-middle">
<img id="schemeCuri" src="public/curriculum.svg" alt="CurriculumScheme" width="100%" >
</div>
<p style="font-size: 19px;color:#000000;text-align:center;" class="l-middle">
Result of Optimization step<br>
<span style="font-size: 14px;color:#A0A0A0;"> Red : target, yellow : initialization and green : agent at last timestep.
Left to right is one optimization step. The agent learns to go a little bit further in the same amount of time.<br>
. </span>
</p>
<h3 id='curriculumdriven-goal-exploration-process'><i>Curriculum-driven goal exploration process</i></h3>
<p>The effectiveness of curriculum with complex tasks has already been shown in Wang et al. <dt-cite key="DBLP:journals/corr/abs-1901-01753"></dt-cite> where a teacher agent was created to design increasingly complex tasks for another learning agent, such that the learning tasks were neither too hard nor too easy. Recent work by Variengien et al. showed the need of curriculum to stabilize learning and avoid local minima in complex self organizing systems <dt-cite key="variengien2021selforganized"></dt-cite>.</p>
<p>However, defining a learning curriculum (in our case defining how far and in which direction the target should be pushed at each optimization phase) is not trivial. In fact, some locations can lead to a hard optimization landscape (e.g. with a danger to get trapped in local minima or to diverge) while some other locations by luck can make the optimization easy. And these "easy" targets would change for every random initialization. </p>
<p>To tackle these challenges, we propose to rely on intrinsically-motivated goal exploration processes (IMGEPs), an algorithmic process which was shown successful at generating a learning curriculum for complex exploration spaces in robotics <dt-cite key="Forestier2017IntrinsicallyMG"></dt-cite> and which has already been used in Lenia as a diversity search tool <dt-cite key="etcheverry2020hierarchically"></dt-cite> <dt-cite key="reinke2020intrinsically"></dt-cite>. The general idea of IMGEP is to iteratively set new goals to achieve and for each of these goals try to learn a policy (here a policy is simply an initial state and the CA rule) that would suit this goal. To do so, an IMGEP integrates several key mechanisms: a <i>goal-sampling policy</i> (that decides how to sample interesting new goals, for example based on intrinsic reward), a <i>goal-achievement criterion</i> (that tracks the progress on a goal), and a <i>goal-achievement policy</i> (that optimizes toward a target goal). Importantly, an IMGEP can reuse the knowledge acquired on other goals to learn new goals or attain them more quickly.</p>
<div class="l-middle-outset" style="position:relative">
<img id="schemeIMGEP" src="public/IMGEP.svg" alt="IMGEPscheme" width="100%" >
<div style="position:absolute; left:80%; top:79%; width:17%; height:9%; background-color: rgba(0, 0, 0, 0.1);z-index:5;border-radius:10px 10px 10px
10px"" onmouseover="changeImgIMGEP('public/IMGEP1.svg')" onmouseout="changeImgIMGEP('public/IMGEP.svg')"></div>
<div style="position:absolute; left:39%; top:85%; width:17%; height:11%;background-color: rgba(0, 0, 0, 0.1);z-index:5;border-radius:10px 10px 10px
10px"" onmouseover="changeImgIMGEP('public/IMGEP2.svg')" onmouseout="changeImgIMGEP('public/IMGEP.svg')"></div>
<div style="position:absolute; left:25%; top:11%; width:16%; height:13%; background-color: rgba(0, 0, 0, 0.1);z-index:5;border-radius:10px 10px 10px
10px"" onmouseover="changeImgIMGEP('public/IMGEP3.svg')" onmouseout="changeImgIMGEP('public/IMGEP.svg')"></div>
<div style="position:absolute; left:58%; top:36%; width:14%; height:13%;background-color: rgba(0, 0, 0, 0.1);z-index:5;border-radius:10px 10px 10px
10px"" onmouseover="changeImgIMGEP('public/IMGEP4.svg')" onmouseout="changeImgIMGEP('public/IMGEP.svg')"></div>
</div>
<p style="font-size: 19px;color:#000000;text-align:center;" class="l-middle-outset">
IMGEP Step <br>
<span style="font-size: 14px;color:#A0A0A0;">Hover over gray areas to show the details of the step. <br>
An IMGEP is an algorithmic process that allows to sample new goals and try to achieve them. The IMGEP process reuses knowledge from the previous
trials. In our case, we use IMGEP as it allows to automatically build a curriculum by randomly trying new goals.
</span>
</p><br>
<p>In our case, the goal space is simply a 2-dimensional vector space representing the position of the center of mass of the creature. Hence, a policy in Lenia (controlling the CA initialization and rules) achieves a target goal when it produces a creature whose position at the last timestep (here t=50) is within an accepted range from the target one. While there exist many goal-sampling strategies in the IMGEP literature, we use here a simple version that randomly samples positions in the grid but that biases the sampling both toward one edge of the grid in order to obtain moving creatures and taking care that the sampled goals are not too far from already-attained positions. To attain a new target position/goal, the goal-achievement policy relies on (i) the history of previously-tried policies to select the parameters that performed best (achieved the closest position); and (ii) an inner loop that uses gradient descent with MSE error between the selected policy's last state and the target shape centered at the target goal. Therefore, there are two loops, one outer setting the goals and one inner that applies several steps of gradient descent toward this goal. The overall method can be summarized as such:</p>
<div class=l-body>
<pre>
<code style="line-height:0.4">
<p> Perform random policies in Lenia saving the obtained (parameters,reached goal) tuples in history \(\mathcal{H} = (p_i,rg_i)_{i=1,..s}\)</p>
<p>Loop (number of IMGEP step) </p>
<div style="margin:25px">
<p > Sample target position/goal (not too far from reached positions in the history \(\mathcal{H} \) )</p>
<p > Select, from the history , the parameters that achieved the closest position/goal </p>
<p > Initialize the system with those parameters </p>
<p> Loop (number of optimisation steps)</p>
<div style="margin:25px">
<p> Run lenia </p>
<p> Gradient descent toward the target shape at target position to optimize the parameters</p>
<p> Initialize the system with those optimized parameters </p>
</div>
<br>
<br>
<p> Run lenia one more time to see what is the position (i.e. goal) achieved </p>
<p> If the creature died or exploded, don't save</p>
<p> Else, add to history the parameters resulting from optimization and the outcome/goal reached \(\mathcal{H} =\mathcal{H} \cup (p^\star,rg )\) </p>
</div>
</code>
</pre>
</div>
<p>An advantage of IMGEPs is that the information collected when a policy "fails", e.g. reaching a position far from the selected target, can be useful later on for reaching other positions: it might still make a small improvement or it might go in a completely different area which we might want to explore. The fact that we don't always select the last checkpoint as in classic curriculum learning also allows us to have different "lineages" which may help to avoid being stuck in local minima or in an optimization area where the optimization can easily diverge.</p>
<h3 id='moving-creatures-obtained'><i>Moving creatures obtained</i></h3>
<!---
<div class="row l-screen-inset">
<div class="column">
<video id="robust" width="95%" controls autoplay loop muted="" class="videoShow">
<source src="public/move6.mp4" type="video/mp4">
</video>
</div>
<div class="column">
<video id="robust" width="95%" controls autoplay loop muted="" class="videoShow">
<source src="public/move7.mp4" type="video/mp4">
</video>
</div>
<div class="column">
<video id="robust" width="95%" controls autoplay loop muted="" class="videoShow">
<source src="public/move1.mp4" type="video/mp4">
</video>
</div>
<div class="column">
<video id="robust" width="95%" controls autoplay loop muted="" class="videoShow">
<source src="public/move9.mp4" type="video/mp4">
</video>
</div>
<div class="column">
<video id="robust" width="95%" controls autoplay loop muted="" class="videoShow">
<source src="public/move8die.mp4" type="video/mp4">
</video>
</div>
<div class="column">
<video id="robust" width="95%" controls autoplay loop muted="" class="videoShow">
<source src="public/move3die.mp4" type="video/mp4">
</video>
</div>
</div>
-->
<div class="row l-screen-inset">
<div class="column" style="
/* width: auto; */
width: 70%;
">
<video id="robust" controls="" autoplay="" loop="" muted="" class="videoShow" style="
width: 95%;
">
<source src="public/moveBar.mp4" type="video/mp4">
</video>
</div>
<div class="column" style="
width: 35%;
">
<video id="robust" controls="" autoplay="" loop="" muted="" class="videoShow" style="
width: 95%;
">
<source src="public/moveBarDie.mp4" type="video/mp4">
</video>
</div>
</div>
<p style="font-size: 19px;color:#000000;text-align:center;" class="l-middle-outset">
Robustness of learned moving creatures over longer time spans than in the training process.<br>
<span style="font-size: 14px;color:#A0A0A0;"> Each square is the result of 1 trial of the method. The video on the left displays successes of the method
where the creatures obtained are long term stable. The video on the right displays trials where the creatures obtained die few steps after the
number of timesteps it has been trained on. The last creature on the right
tries as much as possible to fit the target at last seen timestep resulting in a death right after. </span>
</p><br>
<p>The method proposed above gives us a set of rules and an initialization in Lenia that lead to the emergence of a moving creature. The obtained rules and initialization are different every time we run the search as the method's initialization (first line in the pseudocode) is random. This results in different creatures emerging with every set of obtained rules (different seeds of the method). Interestingly, some of the emerged creatures are long term stable (their shape is kept stable) while others may become unstable after a few timesteps. In fact as the creature is only trained for 50 timesteps, when running for longer, the creature can have unpredictable behaviors. Seeing that <strong>the majority of creatures that emerge from training are long term stable</strong> (8 over 10 trials with initialization selection, see <a href='#badInit'>appendix</a> for more info on initialization selection), <strong>whereas it is not specified/penalized in the training loss, is a first hint of the generalization capabilities of self-organizing agents.</strong></p>
<!---
<div class=' l-screen-inset l-screen-inset-bigger '>
<div class='row'>
<div class="column">
<video id="robust" width="95%" autoplay loop controls muted="" class="videoShow">
<source src="public/moveTraining.mp4" type="video/mp4">
</video>
</div>
<div class="column">
<video id="robust" width="95%" controls autoplay loop muted="" class="videoShow">
<source src="public/move7training.mp4" type="video/mp4">
</video>
</div>
</div>
<p style="font-size: 19px;color:#000000;text-align:center;" class="l-middle-outset">
IMGEP Steps <br>
<span style="font-size: 14px;color:#A0A0A0;">Left is the random Initialization, and then each video from left to right are successive IMGEP step and
Final video is best across all IMGEP </span>
</p><br>
</div>
<div class='l-screen-inset'>
<div class='row'>
<div class="column">
<video id="robust" width="95%" autoplay controls muted="" class="videoShow">
<source src="public/moveTrainingInner.mp4" type="video/mp4">
</video>
</div>
<div class="column">
<video id="robust" width="95%" controls autoplay muted="" class="videoShow">
<source src="public/move7trainingInner.mp4" type="video/mp4">
</video>
</div>
</div>
<p style="font-size: 19px;color:#000000;text-align:center;" class="l-middle-outset">
InnerOptimization <br>
<span style="font-size: 14px;color:#A0A0A0;"> First IMGEP step with training corresponding to the transition between the two first case of above videos, gradient descent step (1,20,60,70,80,90,100,110,120) </span>
</p><br>
</div> --->
<div class="l-screen-inset l-screen-inset-bigger">
<div class='row'>
<div class="column">
<video id="robust" width="95%" autoplay loop controls muted="" class="videoShow">
<source src="public/innerOuter.mp4" type="video/mp4">
</video>
<p style="font-size: 14px;color:#A0A0A0;text-align:center;" >
Run 1
</p>
</div>
<div class="column">
<video id="robust" width="95%" controls loop autoplay muted="" class="videoShow">
<source src="public/innerOuter7.mp4" type="video/mp4">
</video>
<p style="font-size: 14px;color:#A0A0A0;text-align:center;" >
Run 2
</p>
</div>
</div>
</div>
<p style="font-size: 19px;color:#000000;text-align:center;" class="l-screen-inset">
Results of successive outer (top) and inner (bottom) optimization steps in practice in 2 different runs <br>
<span style="font-size: 14px;color:#A0A0A0;">
This figure shows how the bi-level optimization (an inner loop inside of an outer loop) progressively evolves moving creatures. For each run, the upper-left video corresponds to the creature obtained after initialization of the parameters (before optimization), which is not able to move at all. After several outer steps (shown at the top and separated by blue lines), we can see how the evolved creatures improve their behavior, with the upper-right one (at the end of the bi-level optimization) reaching quickly the edge of the grid. At the bottom, a "zoom" (represented by the red lines)
on the first outer step (between first and second top videos)
shows in more details the successive small improvements made by the inner loop
(gradient steps) during first outer step. Each inner step slightly improves the creature by making it go a little further. At the end of
these inner steps, we get the result of the first outer step (second top video).
</span>
</p><br>
</div>
<h2 id='can-we-learn-robust-creatures-with-sensorimotor-capabilities-'>Can we learn robust creatures with sensorimotor capabilities ?</h2>
<div class="side-highlight">
<div class="highlight-text">
<i>When we talk about sensorimotor capability, we expect agents that are able to robustly perform goals
(such as moving toward the opposite edge of the CA grid) under a variety of environmental conditions, involving
the processes of sensing the environment and acting upon it.</i>
</div>
</div>
<p>In the previous section, we have shown how to learn rules in Lenia leading to the emergence of agents with <i>moving capacity.</i> However this was done in a neutral environment, where agents did not have to cope with any external perturbations. When we talk about <i>sensorimotor capability</i>, we expect agents that are able to robustly perform goals (such as moving toward the opposite edge of the CA grid) under a variety of environmental conditions, involving the processes of <i>sensing</i> the environment and <i>acting</i> upon it. To find sensorimotor capable agents, we want to train them on a variety of tasks that are not only specified by a goal (2D position on the CA grid) but also by an environmental configuration (everything that is "outside" of the agent and that challenges goal achievement). <strong>The effectiveness of training agents on a curriculum of tasks (curriculum of goals but also curriculum of environmental configurations per goal) has been shown to foster the emergence of generally capable agents</strong> <dt-cite key="team2021open"></dt-cite>. However, environment design and task generation is not trivial within the enactivist CA paradigm. Contrary to works where there are clear distinctions between agent/environment and sensors/actuators, in our framework there is only an environment made of low-level particles and a sensorimotor macro-behavior can only emerge from the application of local rules. Environmental perturbations must be specified as a controllable subpart of the particle rules/physics we want to impose in our system, while the remaining rules/physics are left free and learnable as the ones leading to interesting behaviors like emergence of sensorimotor agency.</p>
<p>In this work, we focus on modeling <i>obstacles</i> in the environment physics and propose to probe the agent sensorimotor capability as its performance to move forward under a variety of obstacle configurations. This section explains how we model the agent-obstacle interactions in Lenia and how our training method integrates the generation of a curriculum of stochastic goals and obstacle configurations, leading to the emergence of sensorimotor capable creatures.</p>
<h3 id='-modeling-agentenvironment-interactions-in-lenia-the-example-of-obstacles-'> Modeling agent-environment interactions in Lenia, the example of obstacles. </h3>
<div id="schemeLeniaWall" class="l-screen-inset" style="position:relative">
<img src="public/LeniaWall.svg" alt="scheme" style="width:95%">
<div id="formulasDisplay" style="position:absolute;display:none;left:0%; top:0%;width:100%;height:100%;background-color: rgba(255,255, 255, 0.9);z-index:4;">
<div style="position:absolute; left:5%; top:0%;border-radius:5px;background-color: rgba(255, 255, 255, 0.9)">
<p>
$$ A^{t+1}= \left[A^t +\frac{1}{\textcolor{#00c8c8}{T}} \left(G_{wall}(K_{wall}*A^t_1) +\sum_k \textcolor{#008000}{h^k} G_k(K_k * A^t_0) \right) \right]^1_0 $$
</p>
<div class="row">
<div class="column">
<!--
$$ K_k= x \rightarrow \left( \sum_i^{n} \textcolor{#0000c8}{b_i^k} exp(-\frac{(\frac{x}{\textcolor{#0000c8}{r^k} \textcolor{#baba40}{R}}-\textcolor{#0000c8}{rk^k_i})^2}{2(\textcolor{#0000c8}{w^k_{i}})^2})
\right) \mathbb{I}_{x\leq \textcolor{#0000c8}{r^k} \textcolor{#baba40}{R}} sigmoid(-10(\frac{x}{\textcolor{#0000c8}{r^k} \textcolor{#baba40}{R}}-1))$$
--->
$$ K_k= x \rightarrow \left( \sum_i^{n} \textcolor{#0000c8}{b_i^k} exp(-\frac{(\frac{x}{\textcolor{#0000c8}{r^k} \textcolor{#baba40}{R}}-\textcolor{#0000c8}{rk^k_i})^2}{2(\textcolor{#0000c8}{w^k_{i}})^2})
\right) sigmoid(-10(\frac{x}{\textcolor{#0000c8}{r^k} \textcolor{#baba40}{R}}-1)) $$
</div>
<div class="column">
$$ K_{wall}= x \rightarrow exp(-\frac{(\frac{x}{2})^2}{2}) sigmoid(-10(\frac{x}{2}-1)) $$
<!--$$ K_{wall}= x \rightarrow exp(-\frac{(x)^2}{2}) \mathbb{I}_{x \leq2} sigmoid(-10(\frac{x}{2}-1))$$-->
</div>
</div>
<div class="row">
<div class="column">
$$ G_k= x \rightarrow 2*exp(-\frac{(x-\textcolor{#c80000}{m^k})^2}{2(\textcolor{#c80000}{s^k} )^2})-1 $$
<!---exp(-\frac{(x-m^k)^2}{2(s^k)^2})\mathcal{N}(\frac{x}{r^kR},m^k,s^k)-->
</div>
<div class="column">
$$ G_{wall}= x \rightarrow -10 max(0,(x-0.001)) $$
</div>
</div>
<p style="text-align:center;"> The sigmoid term is only a smooth and differentiable version of \( \mathcal{1}_{x\leq r^k R } \)<p>
<p style="text-align: center">
<b>Parameters:</b><br>
<span style="color:rgba(186,186,40,0.8)">
R maximum radius of a kernel</span><br>
<span style="color:rgba(0,175,175,0.8)">
T time scale </span><br>
<span style="text-decoration:underline">For each kernel:<span>
<div class="row">
<div class="column">
<ul>
<li style="color:rgba(0,0,175,0.8)">w \( \in [0,1]^n \) width of the guassian bumps</li>
<li style="color:rgba(0,0,175,0.8)">b \( \in [0,1]^n \) height of the guassian bumps </li>
</ul>
</div>
<div class="column">
<ul>
<li style="color:rgba(0,0,175,0.8)">rk \( \in [0,1]^n \) shift of gaussian bumps from center of kernel </li>
<li style="color:rgba(0,0,175,0.8)"> r \( \in [0,1] \) relative radius </li>
</ul>
</div>
<div class="column">
<ul>
<li style="color:rgba(175,0,0,0.8)">m mean in growth function</li>
<li style="color:rgba(175,0,0,0.8)">s variance/size in growth function </li>
</ul>
</div>
<div class="column">
<ul>
<li style="color:rgba(0,128,0,0.8)"> h \( \in [0,1] \) weight of the kernel </li>
</ul>
</div>
</div>
</p>
</div>
</div>
<div style="position:absolute; left:65em; top:10%;border-radius:5px; background-color: rgba(0, 0, 0, .25);z-index:5;" onmouseover="document.getElementById('formulasDisplay').style.display='block';" onmouseout="document.getElementById('formulasDisplay').style.display='none';"> Formulas </div>
</div>
<p style="font-size: 19px;color:#000000;text-align:center;" class="l-middle-outset">
Update step in our Lenia System with obstacle channel<br>
<span style="font-size: 14px;color:#A0A0A0;">The obstacle channel is another parallel grid which allows to put obstacles in the environment by putting
some of the pixels of this grid to 1. These obstacles will have a direct impact (through a fixed local rule) on the learnable channel
as it will prevent any growth of the creature where obstacles are present.
You can hover on the Formulas button to see the corresponding Lenia's equations.</span>
</p><br>
<p>The multi-channel aspect of Lenia allows the implementation of different types of cells/particles. To implement obstacles in Lenia we added a separate "obstacle" channel with a kernel going from this channel to the learnable "creature" channel. This kernel triggers a severe negative growth in the pixels of the learnable channel where there are obstacles but has no impact on other pixels where there are no obstacles (very localized kernel). This way we prevent any growth in the pixels of the learnable channel where there are obstacles.</p>
<div class="l-page side">
<div id="orbicol">
<div class="row">
<div class="column">
<video id="robust" width="95%" autoplay loop muted="" class="videoShow">
<source src="public/orbium.mp4" type="video/mp4">
</video>
</div>
<div class="column">
<video id="robust" width="95%" autoplay loop muted="" class="videoShow">
<source src="public/orbiumWallb.mp4" type="video/mp4">
</video>
</div>
</div>
<p style="font-size: 14px;color:#A0A0A0;text-align:center;">
a ) Orbium (glider like in Lenia obtained by hand made mutation) dies from perturbation by obstacles
</p>
</div>
<div id ="complexCol">
<div class="row">
<div class="column">
<video id="robust" width="95%" autoplay loop muted="" class="videoShow">
<source src="public/aquariumWall2.mp4" type="video/mp4">
</video>
</div>
<div class="column">
<video id="robust" width="95%" autoplay loop muted="" class="videoShow">
<source src="public/multiK4.mp4" type="video/mp4">
</video>
</div>
</div>
<p style="font-size: 14px;color:#A0A0A0;text-align:center;">
b) In the creatures found by handmade random exploration, some die from perturbation by the obstacle while some
by luck are able to resist these perturbations.
</p>
</div>
<div id="gradientWall">
<div class="row">
<div class="column">
<video id="robust" width="95%" autoplay loop muted="" class="videoShow">
<source src="public/move7Wall.mp4" type="video/mp4">
</video>
</div>
<div class="column">
<video id="robust" width="95%" autoplay loop muted="" class="videoShow">
<source src="public/move6Wall.mp4" type="video/mp4">
</video>
</div>
</div>
<p style="font-size: 14px;color:#A0A0A0;text-align:center;">
c) Creatures obtained in the previous section
(which were trained to move forward without external perturbations) die from collision with obstacles.
</p>
<div class="row" id="resistColliDie">
<div class="column">
<video id="robust" width="95%" autoplay loop muted="" class="videoShow">
<source src="public/move9wall.mp4" type="video/mp4">
</video>
</div>
<div class="column">
<video id="robust" width="95%" autoplay loop muted="" class="videoShow">
<source src="public/move9dot.mp4" type="video/mp4">
</video>
</div>
</div>
<p style="font-size: 14px;color:#A0A0A0;text-align:center;">
d) Some creatures obtained in the previous section resist some collisions (left) but often die from other collisions (right). The
creature is the same in both videos.
</p>
</div>
</div>
<p>The learnable channel cells can only sense the obstacles through the changes/deformations it implies on it or its neighbours. In fact, as the only kernel that goes from the obstacle channel to the learnable channel is localized, if a macro agent emerges it has to "touch" the obstacle to sense it. To be precise the agent can only sense an obstacle because its interaction with the obstacle will perturb its own configuration and dynamics (i.e. its shape and the interaction between the cells constituting it). This is similar to experiments with swarming bacteria <dt-cite key="PhysRevE.101.012407"></dt-cite>, where the swarm agent must learn to collectively avoid antibiotic zones (externally-added obstacles) where the bacteria can't live.</p>
<p>
Additionally, we impose the obstacles to stay still, meaning that there is no rule that goes toward
(and hence no update of) the obstacle channel
. As such, an update step in the final system is summarized in the
<a href="#schemeLeniaWall">above figure</a>
with the channel 1 being the learnable channel while the channel 2 is the obstacle channel.</p>
<p>To grasp the impact of the new obstacle channel and physics, we then tested how the previously-found moving creatures react to this environment.</p>
<p>The creatures found by hand in Lenia are not very robust to this new environment physics. A glider type of creature that was found in 1-channel Lenia dies from most collisions with external obstacles (<a href='#orbicol'>figure a</a>). Another multi-channel creature (<a href='#complexCol'>figure b</a> left) dies from special collisions with the wall. Only one multi-kernel creature was able to sense the wall and resist perturbation, but even this required us to manually slow down Lenia's time (parameter T) so that the creature can make smaller updates. And even then, the creature movements are kind of erratic.</p>
<p>Similarly, the moving creatures obtained with gradient descent and curriculum in the previous section do not display much robustness to collision with obstacles (<a href='#gradientWall'>figure c</a>): only few by luck already have some level of robustness (<a href='#resistColliDie'>figure d</a>). This motivated the need for training methods which, given this environmental physics in the CA paradigm, are able to learn the parameters leading to the emergence of agency and sensorimotor capabilities with better resilience to perturbations. </p>
<h3 id='training-method-with-stochastic-environmental-perturbations'>Training method with stochastic environmental perturbations</h3>
<img id="figConfigOb" src="public/Merge.svg" alt="schemeLearn" width="100%" class="l-middle" >
<p style="font-size: 19px;color:#000000;text-align:center;" class="l-middle">
Two different configurations of obstacles during training<br>
<span style="font-size: 14px;color:#A0A0A0;">
The inner optimization samples diverse positions of obstacles allowing generalization as it induces, during training,
different perturbations on the agents.
For instance this figure displays 2 examples of sampled configurations (blue circles positions) and we can see that
the perturbations on the creature structure/morphology are totally different in left and right figure.
</span>
</p>
<p>To learn the rules leading to the emergence of a creature that would resist and avoid various obstacles in its environment, we simply introduce (randomly generated) obstacle configurations within the training process, as shown in red in the training pseudocode. This way, the inner loop (goal-directed gradient descent) becomes stochastic gradient descent with the stochasticity coming from the sampling of the obstacles. The learning process will thus encounter a lot of different obstacle configurations and may find a general behavior. In practice, we only put obstacles in half the lattice grid. This way, as shown in the <a href='#figConfigOb'>above figure</a>, the first half of the grid is free from obstacles which allows to first learn a creature that is able to move without any perturbation, as it was done in the previous section. Then, as we push the target further and further, the creature starts to encounter obstacles. And the deeper the target position is, the more it encounters obstacles and so the more robust it should be. The curriculum is made by going further and further because the further you go the more you will have to resist obstacles. In the IMGEP, at the end of each goal-directed inner optimization, the goal achievement is measured as the distance between the target position and the average position attained on different other random configurations of obstacles.</p>
<div clas=l-body>
<pre>
<code style="line-height:0.4">
<p>Perform random policies in Lenia saving the obtained (parameters, reached goal) tuples in history \(\mathcal{H} = (p_i,rg_i)_{i=1,..s}\)</p>
<p>Loop (number of IMGEP step) </p>
<div style="margin:25px">
<p > Sample target position/goal(not too far from reached positions in the history \(\mathcal{H} \) )</p>
<p > Select, from the history , the parameters that achieved the closest position/goal </p>
<p > Initialize the system with those parameters </p>
<p> Loop (number of optimisation steps)</p>
<div style="margin:25px">
<p style="color:rgba(255,0,0,0.5)"> Sample random obstacles </p>
<p> Run lenia </p>
<p> Gradient descent toward the target shape at target position to optimize the parameters</p>
<p> Initialize the system with those optimized parameters</p>
</div>
<br>
<p> See what is the <span style="color:rgba(255,0,0,0.5)"> mean <span> position(ie goal) achieved
<span style="color:rgba(255,0,0,0.5)"> over several random obstacles runs <span></p>
<p style="color:rgba(255,0,0,0.5)"> Loop (number of random run)</p>
<div style="margin:25px">
<p style="color:rgba(255,0,0,0.5)"> Sample random obstacles </p>
<p> Run lenia </p>
<p style="color:rgba(255,0,0,0.5)"> Add reached goal to the mean </p>
</div>
<p> If the creature died or exploded during one of the tests, don't save </p>
<p> Else, add to history the parameters resulting from optimization and the <span style="color:rgba(255,0,0,0.5)"> mean </span> outcome/goal
reached \(\mathcal{H} =\mathcal{H} \cup (p^\star,rg )\) </p>