Fig. 1: Concept and design of supervised learning in DNA neural networks.

a, Abstract training and testing process. b, Example of learning two 9-bit patterns ‘L’ and ‘T’ followed by classification of two corrupted tests. x1 to xn and y1 to y2 are binary inputs and outputs, respectively, represented by coloured and greyscale nodes. Black and white nodes represent outputs that are computed as ON and OFF, respectively. xv = {x1, x2, …, xn} can be either a training or test pattern, shown as a mixture of molecules in a droplet (actual form in an experiment) or arranged in a \(\sqrt{n}\)-by-\(\sqrt{n}\) array for visual clarity. A total of q and p patterns are used for training and testing, respectively. qj is the total number of training patterns in class j. l1 and l2 are binary class labels represented by polygon shapes. aj = {a1,j, a2,j, …, an,j} is a learned memory associated with output yj, which equals the average of all training patterns in class j. After training, the value of aj can then be transferred to wj for classification of test patterns. Light grey and black wires indicate inhibited and activated weights with zero and learned values, respectively. sj is the weighted sum of inputs for comparing a test pattern with memory j, represented by a polygon-shaped node matching the class label. c, Chemical reaction network implementation. d, Seesaw DNA circuit implementation. Black species indicate molecules whose concentrations correspond to variable values in the abstract mathematical function. Grey species indicate molecules designed to facilitate the desired reactions; their concentrations are typically in excess. Threshold thi is used to clean up noise in xi so that the input is only considered ON if xi > thi. For implementation reasons, the computation of weighted sum is split into weight multiplication pi,j = wi,jxi and summation \({s}_{j}={\sum }_{i=1}^{n}{p}_{i,j}\). The ON value of the output is set by the restoration gate concentration gj. kf and ks are reaction rate constants that must satisfy kf ≫ ks in a pair of reactions with shared reactants; separate reactions labelled with kf or ks do not need to have identical rates. Label inhibitor Inhj is not initially present during training but added after each training event to clean up leftover label. Notations for the seesaw circuit diagram are explained in Extended Data Fig. 2 caption.