<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Deep Molecular Programming. A Natural Implementation of Binary-Weight ReLU Neural Networks</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>2020</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10223402</idno>
					<idno type="doi"></idno>
					<title level='j'>Thirty-seventh International Conference on Machine Learning (ICML)</title>
<idno></idno>
<biblScope unit="volume"></biblScope>
<biblScope unit="issue"></biblScope>					

					<author>Marko Vasic</author><author>Cameron Chalk</author><author>Sarfraz Khurshid</author><author>David Soloveichik</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[Embedding computation in molecular contexts incompatible with traditional electronics is expected to have wide ranging impact in synthetic biology, medicine, nanofabrication and other fields. A key remaining challenge lies in developing programming paradigms for molecular computation that are well-aligned with the underlying chemical hardware and do not attempt to shoehorn ill-fitting electronics paradigms. We discover a surprisingly tight connection between a popular class of neural networks (binaryweight ReLU aka BinaryConnect) and a class of coupled chemical reactions that are absolutely robust to reaction rates. The robustness of rateindependent chemical computation makes it a promising target for bioengineering implementation. We show how a BinaryConnect neural network trained in silico using well-founded deep learning optimization techniques, can be compiled to an equivalent chemical reaction network, providing a novel molecular programming paradigm. We illustrate such translation on the paradigmatic IRIS and MNIST datasets. Toward intended applications of chemical computation, we further use our method to generate a chemical reaction network that can discriminate between different virus types based on gene expression levels. Our work sets the stage for rich knowledge transfer between neural network and molecular programming communities.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1.">Introduction</head><p>Although molecular computation cannot compete with electronics based on speed, the goal is to enable computation in contexts where traditional electronics cannot go.</p><p>Proceedings of the 37 th International Conference on Machine Learning, Online, PMLR 119, 2020. Copyright 2020 by the author(s).</p><p>Chemical control modules compatible with the chemical environments within natural or synthetic cells, bioreactors, and in-the-field diagnostics, are all envisioned applications for such technology. Such computation could, for example, recognize disease state based on chemical inputs and actuate drug delivery to the affected cell. The extensive information processing that occurs in natural cellular regulatory networks underlying all complex life, is a strong proof-ofprinciple that chemical computation is possible and useful.</p><p>Networks of coupled chemical reactions (chemical reaction networks, CRNs) are known to be Turing universal <ref type="bibr">(Fages et al., 2017;</ref><ref type="bibr">Soloveichik et al., 2008)</ref>, but the resulting systematic ways of programming their behavior can result in extremely large reaction networks and exceedingly inefficient computation. Reasoning in chemical reaction space is difficult: even a very small CRN can be hard to analyze. Thus, there were many previous attempts to build intuitive, yet more efficient programming approaches for CRNs. For example, <ref type="bibr">(Senum &amp; Riedel, 2011</ref>) describe a number of computational modules including arithmetic modules and control flow. Another example is CRN++ <ref type="bibr">(Vasic et al., 2018)</ref>, an imperative programming language that compiles to CRNs. Here, we present a different programming paradigm, one that allows translation of neural networks into chemical reactions. In a similar way that writing an image classifier in an imperative language is prohibitively complex, writing a classifier in a molecular programming language such as CRN++ is practically impossible. However, the technique of programming using neural networks opens doors for such applications in the molecular programming community.</p><p>We focus on a class of neural networks called binaryweight ReLU neural networks. These networks have binarized weights {+1, -1}, and were originally popularized due to their computational efficiency in electronics hardware <ref type="bibr">(Courbariaux et al., 2015)</ref>. We show that binaryweight ReLU networks have a tight correspondence to a class of rate-independent CRNs <ref type="bibr">(Chen et al., 2014a;</ref><ref type="bibr">b)</ref>. In rate-independent CRNs, computation arises solely from the stoichiometric exchange of reactants for products and the equilibrium is independent of reaction rates. The absolute robustness to reaction rates makes rate-independent CRNs a promising implementation target for bioengineering.</p><p>We first demonstrate our approach by training classifiers on the widely used machine learning datasets IRIS and MNIST. A promising envisioned application of molecular computation lies in medical diagnostics and so called "smart drugs" which activate in response to specific molecular cues. Thus, we next train a classifier to differentiate between four viral infections using chemical information as input (gene expression levels). In all cases, we translate neural networks into CRNs, and simulate CRN behavior in a chemical kinetics simulation framework. The chemical reaction networks exhibit the same output as their corresponding neural networks.</p><p>Section 2 first reviews CRNs, and how we can view their behavior as computation, then reviews binary-weight ReLU networks and the BinaryConnect <ref type="bibr">(Courbariaux et al., 2015)</ref> method for training them. In Section 3, we first introduce a simple set of chemical reactions which compute the ReLU function, then describe our general technique to compile binary-weight ReLU networks into CRNs which compute the same output. We also describe an optimization procedure which reduces the number of chemical reactions required to implement the neural network. In Section 4, we give simulation results on our chemical classifiers for IRIS, MNIST, and viral infection classification, and verify that their outputs match the neural networks they implement.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.">Background</head><p>In this section we provide a brief description of chemical reaction networks and BinaryConnect neural networks.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.1.">Chemical Reaction Networks</head><p>Chemical reaction networks (CRNs) formally model the time evolution of concentrations of chemical species in a solution undergoing chemical change. CRNs are typically used to understand naturally occurring chemistry and abstract the behavior of existing biological regulatory networks. The CRN formalism thus provides a standardized way to specify the interaction rules that we expect interacting chemicals to obey in order to perform computation. Closely related models from distributed computing include population protocols <ref type="bibr">(Angluin et al., 2006)</ref>, Petri nets <ref type="bibr">(Petri, 1966)</ref>, and vector addition systems <ref type="bibr">(Karp &amp; Miller, 1969)</ref>.</p><p>A CRN is formally a set of chemical species (typically written with capital letters) and a set of reactions between them. A state of the CRN is an assignment of a nonnegative real value to each species, representing the species' concentrations (quantity per unit volume). As the state varies over time, we denote by a(t) the concentration of species A at time t. Each reaction is composed of two multisets over the species, the reactants and products, which specify the stoichiometry (the relative quantities of the involved species). For example, species A and B might react to produce species C, which we write as the reaction</p><p>Each reaction has an associated rate constant which affects the dynamics of state change of the system. Under typical mass-action kinetics, the instantaneous rate of a reaction is the product of the rate constant and the concentrations of the reactants (i.e., k &#8226; a(t) &#8226; b(t) for the reaction above). <ref type="foot">1</ref>The behavior of the whole system is then described by a set of ordinary differential equations (ODEs) generated based on the reactions. For example, if the reaction above is the only one producing C, the kinetics of C is governed by</p><p>To define CRN computation, some chemical species are considered input species, and some others, disjoint from the first, are considered output species. The initial concentrations of the input species are the input to the computation. The system asymptotically converges to a state where the concentrations of the output species are equal to the desired output values.</p><p>Many CRN computations work under strong assumptions about the rates of the reactions, but engineering reactions with precise rates is difficult, and small changes in the environment can further disturb these rates. Instead, computation can be achieved by stoichiometry alone <ref type="bibr">(Chen et al., 2014a;</ref><ref type="bibr">b)</ref>, which forms the basis of the computation considered in this paper. The essential example is the reaction we have already seen: A + B -&#8594; C. The concentration of C as time approaches infinity is the min of the initial concentrations of A and B, since the reaction can occur only as long as both A and B are present. This fact holds for any (nonzero) reaction rate. Thus we say this CRN rate-independently computes the min function: c = min(a(0), b(0)).</p><p>A programmable chemical process called DNA strand displacement can in principle (and, to some extent, experimentally <ref type="bibr">(Chen et al., 2013;</ref><ref type="bibr">Srinivas et al., 2017)</ref>) implement arbitrary, rationally designed CRNs <ref type="bibr">(Soloveichik et al., 2010)</ref>. Watson-Crick base pairing enables programmability, since interactions are mediated by nucleotide sequence complementarity. In the basic DNA strand displacement reaction, an "output" strand is initially bound to a complementary strand. A single-stranded "in-put" binds to the double-stranded complex, displacing the "output" strand. Extended designs based on this elementary reaction allow enzyme-free synthetic DNA systems to behave as arbitrary CRNs.<ref type="foot">foot_2</ref> Rate-independent computation aligns well with the design of DNA strand displacement systems. The stoichiometry of a strand displacement reaction is engineered by setting regions on two or more strands to be complementary or orthogonal. In contrast, setting precise reaction rates requires designing specific sequences that achieve desired hybridization free energies. Hybridization rates are highly dependent on the temperature and on the chemical composition of the solution. Further, for a particular chemical implementation, there is some maximum rate possible, so requiring some reactions to be fast and others slow necessarily requires slowing the entire system down.</p><p>Although concentrations of species are nonnegative, to imitate the computation done by a neural network we need to store and process negative values. To do so, we represent negative values by the dual-rail convention: a value x is represented not by the concentration of one species X, but by the difference in concentration between two species X + and X - <ref type="bibr">(Chen et al., 2014b)</ref>. More precisely, at time t, x(t) = x + (t)x -(t). Note that values have multiple representations: x = 3 can be represented as either x + = 3 and x -= 0 or x + = 4 and x -= 1. Although the value is the same, the choice of representation affects convergence time. (Convergence time is an important question for future work as mentioned in Section 6.)</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.2.">Binary-Weight ReLU (BinaryConnect)</head><p>In recent years we have seen a growing interest in building specialized deep learning hardware to enable new and more complex deep learning applications as well as deploying deep learning systems on low-power devices <ref type="bibr">(Chen et al., 2014c;</ref><ref type="bibr">Dean et al., 2012;</ref><ref type="bibr">Kim et al., 2009)</ref>. One direction of work tries to tackle this problem by designing more computationally efficient neural networks <ref type="bibr">(Courbariaux et al., 2015;</ref><ref type="bibr">Hubara et al., 2016;</ref><ref type="bibr">Li et al., 2016;</ref><ref type="bibr">Simons &amp; Lee, 2019)</ref>. One of the initial works in this area introduces Bi-naryConnect networks <ref type="bibr">(Courbariaux et al., 2015)</ref> which restrict the weights of neural networks to values &#177;1. This restriction on the weight values enables replacement of most of the multiply units by simple accumulators which leads to a drastic reduction of computational expenses, considering that the multipliers are the most space and power hungry components of specialized deep learning hardware. Moreover, in spite of severe restriction on the weight values, Bi-naryConnect still achieves near state-of-the-art results on standard machine learning datasets.</p><p>BinaryConnect networks are trained similarly to traditional neural networks through a repeated sequence of: (a) forward-propagation pass computing the output of a network given an input; (b) backward-propagation pass computing error terms (derivatives of the cost function in respect to weights and bias terms); and (c) parameter updates (updating weight and bias terms based on the error terms). BinaryConnect maintains real-valued weights throughout training, but discretizes them to 1 or -1 (if positive or negative, respectively) during the forward and backwardpropagation passes. The parameter update is then performed on the real-valued weights. The final binary-weight neural network is generated by discretizing the resulting real-valued weights at the end of training. (Other variations of BinaryConnect training, such as stochastic discretization, are described in the original paper.)</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.">Technique</head><p>First we describe the technique for compiling binaryweight ReLU networks to CRNs. Then we show how to optimize the CRNs to reduce the total number of reactions. Ultimately, there will be one reaction per ReLU node.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.1.">ReLU Chemical Reaction Network</head><p>We propose the following CRN to compute the ReLU function:</p><p>In order to understand why the above reactions compute ReLU, suppose we start with x + (0) amount of X + and x -(0) amount of X -and no other species. These concentrations represent the input value x(0</p><p>in dual-rail form. Although the two reactions will be happening in parallel, the first reaction converges to producing x + (0) amount of M and Y + . Therefore, the second reaction converges to producing min(x + (0), x -(0)) of Y -. This implies that the system converges to the dualrail value of the output y = y</p><p>Note that this CRN is rate-independent because the computation will be correct no matter what the rates of the individual reactions are.</p><p>Since the output species Y + and Y -are not consumed in the above CRN, they can be used as input species for</p><p>any composed downstream computation without interfering with the computation of ReLU. Reactions 1-2 form the simplest CRN computing ReLU in the sense that there is no composable CRN with fewer than 2 reactions or fewer than 5 species computing this function <ref type="bibr">(Vasic et al., 2019</ref>). 3</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.2.">Compiling Binary-Weight ReLU Networks</head><p>Figure <ref type="figure">1</ref> shows an example binary-weight ReLU network. This network consists of an input layer, a single hidden layer with the ReLU activation function, and an output layer without an activation function. Let us initially ignore the bias terms. Then the output of the network is defined by y</p><p>2&#215;3 is a weight matrix into the hidden layer, w 2 &#8712; {-1, 1} 3 is a weight vector into the output layer, and y &#8712; R is the output. The Figure <ref type="figure">1</ref> neural network weight values are:</p><p>We now convert this binary-weight ReLU network into a CRN. Initially, for each input x i in the input vector, species X + i and X - i will be present such that x + i (0)-x - i (0) = x i . We multiply the input vector by the weights W 1 by the following reactions:</p><p>Species I l,i represents the ith intermediate (before applying nonlinearity) species of the layer l. For a weight with value 3 There is a simpler, non-composable ReLU computing CRN:</p><p>It cannot be combined with another CRN which uses species Y + as an input, as Y + may be consumed by the downstream CRN before it is annihilated by the second reaction. Composability is a well-understood feature in rate-independent CRNs <ref type="bibr">(Chalk et al., 2018;</ref><ref type="bibr">Severson et al., 2019)</ref>.</p><p>1 we include a reaction with a positive input species as a reactant and positive output species as a product, as that has the effect of addition to the product species' value. For a weight with value -1 we include a reaction with a positive input species as a reactant and negative output species as a product, as that has the effect of subtraction from the product species' value. To maintain the dual-rail convention we also include a reaction which contains all the same species with signs flipped. Next, to implement the ReLU activation function we use the module discussed above (reactions 1-2), with the appropriate renaming of species:</p><p>Each intermediate species I l,i of the hidden layer l is a part of a separate ReLU module producing output species H l,i . Finally, to multiply by the weight vector w 2 we use the following reactions (similar to the multiplication by W 1 ):</p><p>The Y species are the output species, and the value y = y + (t)y -(t) approaches ReLU (x &#8868; &#8226; W 1 ) &#8226; w 2 as t goes to infinity.</p><p>The complete equation of the neural network with bias terms is:</p><p>To encode bias terms b 1 , it is enough to set initial concentrations of the hidden layer I 1,i species accordingly (e.g., i + 11 (0)i - 11 (0) should be equal to the first component of vector b 1 ); similarly for b 2 and Y species.</p><p>We summarize the compilation procedure in Algorithm 1. The input of the algorithm is a binary-weight ReLU network (nn), and the output is its CRN equivalent. We iterate through all the layers of nn starting from the first hidden layer and including the output layer (layer number 1 is the input layer). If a layer does not contain the nonlinear activation (ReLU) we include reactions directly producing the layer output species (named H), otherwise intermediate Algorithm 1 NNCompile(&#177;1-weight neural network: nn) 1: crn = newCRN () 2: for l = 2 to nn.numLayers() do 3: layer = nn.getLayer(l) 4:</p><p>W, b, a = layer.params() 5:</p><p>pN ame = 'H' if a.linear() else 'I' 6:</p><p>for i = 1 to W.dimsX do 7: rxn = newReaction() 8:</p><p>rxn.reactants = {X + i if l == 1 else H + l-1,i } 9:</p><p>for j = 1 to W.dimsY do 10: crn.add(I + l,j -&#8594; M l,j + H + l,j ) 24:</p><p>crn.add(M l,j + I - l,j -&#8594; H - l,j ) 25:</p><p>end if 26:</p><p>end for 27: end for 28: return crn species are produced first (named I); the name of the appropriate product species is stored in pN ame (line 5). We iterate through the rows of the weight matrix (W ), creating one reaction per row, where the reactant is H + l-1,i (ith unit of the previous layer), or X + i in the case where the previous layer is the input layer (line 8). To construct the products of the reaction, we iterate through all of the columns of W , adding pN ame species with positive sign when the weight is +1 or negative sign when the weight is -1 (lines 10-11). For a valid dual-rail computation, we include such a constructed reaction to the CRN (line 13), as well as the same reaction with the signs of all the species flipped (line 14). Next, we set the initial concentrations of pN ame species to correspond to the bias terms. If a bias term is positive, we set the positive species to b[j], otherwise we set the negative species to -b[j] (lines 17-21). Finally, if the layer contains a ReLU activation, we include the ReLU CRN taking as inputs layer intermediate (I) species and producing layer output (H) species. Note that unlike in the previous example, the network output species will be denoted by H N,j (where N is the number of layers in the network).</p><p>To compute with the CRN, we provide input x by setting the initial concentrations of the input species X as follows. If a component x i of the input vector is non-negative, then the concentration of the positive input species X + i is set to x i ; otherwise the concentration of the negative input species X - i is set to -x i . Note that in chemistry, reactions occur in parallel, so layers begin their computation before the previous ones complete, unlike typical neural network architectures.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.3.">Optimization: Reducing the Compiled CRN</head><p>We find that unimolecular reactions, such as the first reactions of ReLU modules, can be eliminated from the CRN by altering the bimolecular reactions and the initial concentrations of the CRN species, a process which we describe next. Unimolecular reactions are those with exactly one reactant like A -&#8594; B + C. Whenever A is produced in another reaction, we can replace it with B + C. For example, if there is another reaction X -&#8594; A + B, we replace the reaction with X -&#8594; 2B + C. Further, we adjust the initial concentrations of the product species (B and C) by increasing them by the initial concentrations of the reactant (A). Importantly, this transformation works only if A is not a reactant in any other reaction; for example, if there were another reaction like X + A -&#8594; Y , it is not clear what to replace instances of A with, and indeed it is not possible to remove the unimolecular reaction in that case. Luckily, our construction has the property that any species occurs as a reactant in at most one reaction.</p><p>We will now illustrate the aforementioned elimination procedure on the neural network CRN presented in Section 3.2, characterized by reactions 3-18. We start by removing the downstream-most unimolecular reactions (reactions 13-18), although the order does not matter. Removing these reactions and adjusting the products accordingly results in the following CRN:</p><p>Note that the initial concentrations of Y species are unaffected as species H 1,i are initially set to 0. Next, we remove the now downstream-most unimolecular reactions (reactions 23,25,27) and obtain the following CRN:</p><p>The initial concentrations of M 1,1 , M 1,2 , M 1,3 , Y + and Y -are also affected:</p><p>The only remaining unimolecular reactions are those whose reactants are input species (X). We do not apply the above elimination procedure to these unimolecular reactions because doing so would remove the input species entirely. Then giving the input to the CRN would require setting the initial concentrations of a number of other species, complicating the input representation.</p><p>Note that the CRN can be further simplified while preserving dual-rail values. Reactions 29 and can be reduced to:</p><p>Further, the initial concentrations of Y + and Y -can be reduced by the same amount to make the smaller one zero.</p><p>In general, the CRN resulting from the optimization procedure has the following properties. There are no unimolecular reactions besides the input layer, for which there are two reactions per input. There is one bimolecular reaction per ReLU node of the original network. There are no other reactions. Optimization of some adversarial ReLU networks results in reactions with a number of products exponential in the depth of the network. Understanding the scaling of the number of products is an important avenue for future work to ensure feasible CRNs.</p><p>Algorithm 2 summarizes the reduction procedure. The algorithm first collects a list of all unimolecular reactions (line 1). Then, for each unimolecular reaction (R -&#8594; i P i ) the following steps are done: (a) if reactant R is an input species the following steps are skipped and the next reaction is processed (line 4); (b) for every reaction in the CRN producing R, the list of products is altered by removing the product R and adding products P i (lines 6-11); (c) the initial concentrations of species P i are increased by the amount of the initial concentration of R (line 13); and (d) the unimolecular reaction is removed from the CRN (line 15). After these steps we perform the following behavior-preserving transformations that further simplify the CRN. For each dual-rail value represented by S + Algorithm 2 reduce(CRN: crn) 1: uniRxns = crn.getU nimolecularReactions() 2: for all uniRxn &#8712; uniRxns do 3: R = uniRxn.getF irstReactant() 4:</p><p>if crn.inputSpecies(R) then continue 5: r(0) = crn.getConc(R) 6:</p><p>for all rxni &#8712; crn.reactions do 7:</p><p>if rxni.containsP roduct(R) then 8:</p><p>rxni.removeP roduct(R) 9:</p><p>rxni.addP roducts(uniRxn.products) 10:</p><p>end if 11:</p><p>end for 12:</p><p>for all Pi &#8712; uniRxn.products do 13:</p><p>crn.addConc(Pi, r(0)) 14:</p><p>end for 15:</p><p>crn.remove(uniRxn) 16: end for 17: for all S + , S -&#8712; crn.getDualRailP airs() do 18:</p><p>for all rxni &#8712; crn.reactions do 19:</p><p>while S + , S -&#8712; rxni.products do 20:</p><p>rxn.removeP roduct(S + ) 21:</p><p>rxn.removeP roduct(S -) 22:</p><p>end while 23:</p><p>end for 24: m = min(crn.getConc(S + ), crn.getConc(S -)) 25:</p><p>crn.addConc(S + , -m) 26:</p><p>crn.addConc(S -, -m) 27: end for and S -species we: (i) for every reaction whose products multiset contain both S + and S -, remove both species as long as both are present (lines 18-23); (ii) reduce the initial concentrations of S + and S -by the minimum of their values (lines 24-26).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.">Experiments</head><p>In this section we describe computational experiments showcasing compilation from neural networks to CRNs. We train BinaryConnect networks on IRIS <ref type="bibr">(Anderson, 1936;</ref><ref type="bibr">Fisher, 1936)</ref>, <ref type="bibr">MNIST (LeCun et al., 1998)</ref>, and virus infection datasets (GSE73072). We then translate trained neural networks to CRNs following our compilation technique (Section 3), and simulate the reactions' behavior using an ODE simulator (CRNSimulator). The simulator models CRNs with real-valued concentrations in the standard mass-action model of chemical kinetics, where the rate of a reaction is directly proportional to the concentrations of the reactants. Our main goal is to show the equivalence of the trained neural network and the compiled CRN, and not to improve accuracy of machine learning models, which is orthogonal to our work.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.1.">Datasets</head><p>IRIS. The IRIS dataset consists of 150 examples of 3 classes of flowers (Setosa, Versicolor or Virginica), and 4 features per example (sepal length and width, and petal length and width). Considering the small dataset size and that our goal is to show the equivalence of the neural network and the translated CRN, we use the whole dataset for both training and evaluation.</p><p>MNIST. The MNIST dataset consists of labeled handwritten digits, where features are image pixels, and labels are digits (0 to 9). We split the original MNIST training set consisting of 60, 000 images into 50, 000 for the training set, and 10, 000 for the validation set. We use the original test set consisting of 10, 000 images. In preprocessing, we center the images (as is done in the BinaryConnect work), and additionally we scale them from 28 &#215; 28 to 14 &#215; 14.</p><p>Virus Infection. For the virus infection classifier, we used data from NCBI GSE73072 (GSE73072). The dataset contains microarray data capturing gene expression profiles of humans, with the goal of studying four viral infections: H1N1, H3N2, RSV, and HRV (labels). There are 148 patients in the dataset, each with about 20 separate profiles taken at different times during their infection period, for a total of 2, 886 samples. The dataset contains information about which patient was infected and during which point of time. We filter the samples leaving only those that correspond to an active infection, and thus make the data suitable for classification of the four viruses. Finally, we have a total of 698 examples, split into 558 for training, 34 for validation, and 104 for testing. Each sample measures expression of 12, 023 different genes (features); we use the 10 most relevant genes as features which are selected using GEO2R tool (GEO2R) from the NCBI GEO.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.2.">Results</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>IRIS.</head><p>We train a neural network with a single hidden layer consisting of 8 units, 4 input units (capturing the features of IRIS flowers), and 3 output units where the unit with the highest value determines the output class. Given that our primary goal is to show the equivalence of a neural network and the compiled CRN, and since the dataset size is quite small (150 examples), we train and evaluate on the whole IRIS dataset. We achieve accuracy of 94% (141 out of 150 examples correctly classified) with a trained Bina-ryConnect neural network. The equivalent CRN consists of 40 chemical reactions (unoptimized compilation), and 16 chemical reactions (optimized compilation). We simulate both versions of the CRN and confirm that their outputs (labels) match the neural network in all 150 examples. Figure <ref type="figure">2</ref> shows the simulation results of the IRIS CRNs on an example input, which is classified with label 0 (since the y 0 output is largest). In both CRNs, the final simulation values of y 0 , y 1 and y 2 match the output units values of the neural network (approaching up to 4 decimal places in the time of simulation). Thus not only does the CRN have the same classification output, but also the numerical values of the individual dual-rail outputs match the output units of the neural network. In regard to the dynamics of CRN convergence, the reduced CRN converges significantly faster.</p><p>MNIST. We train a binary-weight neural network with 2 hidden layers and 512 units per each hidden layer, where hyperparameter values are obtained via a random search. We downscale MNIST images from original 28 &#215; 28 resolution to 14 &#215; 14; thus the neural network has 14 2 input units (one per pixel). We use 10 output units (for digits 0 to 9), and train the neural network to maximize the output unit corresponding to the correct digit. Our trained model achieves accuracy of 97.76% on the test set. Note that we did not focus on achieving high accuracy; BinaryConnect in the original paper achieves accuracy of over 98%, but uses larger networks (3 hidden layers with 1024 units each). We translate the network to an equivalent CRN consisting of 4488 chemical reactions (unoptimized compilation), and 1024 chemical reactions (optimized compilation). The CRN consists of 2 &#8226; 14 2 input species (two species per input unit encoding positive and negative parts), and similarly 2 &#8226; 10 output species. We simulate the CRN on 100 randomly chosen examples from the test set, and confirm that the output matches that of the neural network in all of the cases. Figure <ref type="figure">3</ref> shows simulation results on an example input image (unoptimized CRN). In regard to the dynamics of convergence, note the complex non-monotonic behavior resulting from the mass-action kinetics.</p><p>Virus Infection. We train a neural network with 1 hidden layer with 32 units, 10 input units capturing expression of different genes, and 4 output units classifying between virus infections. We achieve test set accuracy of 95.20%. The equivalent CRN consists of 148 chemical reactions (unoptimized compilation), and 32 chemical reactions (optimized compilation). We simulate the CRN on 100 randomly chosen examples from the test set and confirm that the output matches that of the neural network in all cases. Figure <ref type="figure">4</ref> shows simulation of the unoptimized CRN on an example that is misclassified.</p><p>The performed experiments empirically confirm the soundness of our compilation technique.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.3.">Training Specifics</head><p>We use the published implementation of BinaryConnect networks <ref type="bibr">(Courbariaux et al., 2015)</ref>, and follow the training procedure outlined in Section 2.2. We do not use Batch Normalization <ref type="bibr">(Ioffe &amp; Szegedy, 2015)</ref> because it would incur multiplication and division operations at the inference stage (training stage is not a problem) that would be hard to efficiently implement in CRNs. Instead, we rely on Dropout <ref type="bibr">(Srivastava et al., 2014)</ref> (stochastically dropping out units in a neural network during training) as a regular-Recently, Moorman et al <ref type="bibr">(Moorman et al., 2019)</ref> proposed an implementation of ReLU units based on a fast bimolecular sequestration reaction which competes with unimolecular production and degradation reactions. In contrast to the prior work, our implementation relies solely on the stoichiometric exchange of reactants for products, and is thus completely independent of the reaction rates. Our CRN is also more compact, using only a single bimolecular reaction per neuron, with two species per every connection (without any additional species for the neuron itself). Finally, in contrast to the prior schemes, our CRN converges to a static rather than a dynamic equilibrium, which means that all reactions cease firing. This implies that our implementation does not waste energy to maintain state.</p><p>We use neural networks as a way to program chemistry. The programming is done offline in the sense that neural networks are trained in silico. However, there is a body of work on creating chemical systems that are capable of learning in chemistry <ref type="bibr">(Blount et al., 2017;</ref><ref type="bibr">Chiang et al., 2015)</ref>. Although these constructions are much more complex than ours, and arguably difficult to realize, they demonstrate the proof-of-principle that chemical interactions such as those within a single cell are capable of brain-like behavior.</p><p>Besides the above-mentioned theoretical work on chemical neural networks, wet-lab demonstration of synthetic chemical neural computation argues that the theory is not vapid and that neural networks could be realized in chemistry. A chemical linear classifier reading gene expression levels could perform basic disease diagnostics <ref type="bibr">(Lopez et al., 2018)</ref>. Larger systems based on rate-dependent strand displacement cascades were used to implement Hopfield associative memory <ref type="bibr">(Qian et al., 2011)</ref>, and winner-take-all units to classify MNIST digits <ref type="bibr">(Cherry &amp; Qian, 2018)</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6.">Conclusion</head><p>We demonstrate how BinaryConnect (weight &#177;1) neural networks could be implemented in chemistry using rateindependent chemical reaction networks. As proof of principle, we demonstrate our scheme with numerical simulations of resulting CRNs classifying the MNIST and IRIS datasets. We further simulate a CRN constructed from a ReLU network trained to classify a virus gene expression dataset. Since this network relies on chemically available information for input, this example argues for the potential biological and medical utility of programming chemical computation via a translation from neural networks.</p><p>Performing the simulations with rate constants on the order of magnitude of those reported for DNA strand displacement (10 3 to 10 4 M/s) <ref type="bibr">(Srinivas et al., 2017)</ref> results in roughly the conversion factor of 1 time unit = 100 to 1000 seconds of real time (assuming 10 -6 M concentrations). Although molecular systems may be orders of magnitude slower than electronics, the time scales are compatible with the intended applications such as interfacing with biological regulatory networks or disease marker detection. As a point of comparison, other implementations of chemical neural networks also take hours to complete <ref type="bibr">(Cherry &amp; Qian, 2018)</ref>.</p><p>The convergence time of the CRNs described here scales in a complicated way with many variables, from the depth of the implemented neural network to the choice of representing input values in dual-rail representation (an input x = 3 can be represented for example as x + = 3 and x -= 0, or as x + = 4 and x -= 1). Thus an important area of future research is the formal proof of convergence properties of the system. Empirically, we observed that depending on the network architecture, the 90%-completion time may increase sublinearly, linearly, or superlinearly (in some contrived examples) with the number of layers.</p><p>Note that the concentrations of the positive (S + ) and negative (S -) dual-rail species can become very large, despite the value they represent remaining small. This can occur in special cases of the networks we construct. This is undesired generally; in synthetic implementations, reactions can use additional "fuel" species in addition to the species designed in the formal CRN, so higher concentrations require more of such species. However, there is an easy fix to this problem: inclusion of the reaction S + + S --&#8594; W , where W is some inert waste species. This cancellation reaction leaves the signal value unchanged and reduces the concentrations of the two species.</p><p>Although in principle arbitrary CRNs can be implemented using DNA strand displacement reactions, current laboratory demonstrations have been limited to small systems <ref type="bibr">(Srinivas et al., 2017)</ref>, and many challenges remain in constructing large CRNs in the laboratory. Rate independent CRNs offer an attractive implementation target due to their absolute robustness to reaction rates.</p><p>Our construction is surprisingly compact in the sense that we use exactly one reaction per ReLU node. This compactness argues that neural networks may be a fitting paradigm for programming chemical computation. This invites the exchange of knowledge between the molecular programming and deep learning communities.</p></div>			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="1" xml:id="foot_0"><p>The University of Texas at Austin, USA. Correspondence to: Marko Vasic &lt;vasic@utexas.edu&gt;.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="1" xml:id="foot_1"><p>Although the details of CRN kinetics is not essential for understanding the results in this paper, the numerical simulations are done using continuous mass-action kinetics. In other models of chemical kinetics the amounts of species are represented by nonnegative integer molecular counts and the system corresponds to a continuous time Markov chain. Our results apply to this setting as well, as long as real-valued signals are properly discretized.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="2" xml:id="foot_2"><p>No reaction is truly irreversible; that is to say, if A + B -&#8594; C, then C -&#8594; A + B with some non-zero rate. However, nature provides many examples of reactions which are effectively irreversible due to a large change in free energy between reactions and products. Reactions implemented by DNA strand displacement are thermodynamically driven by the formation of additional nucleotide base pairs, which provide enough free energy for the reaction to behave effectively irreversibly.</p></note>
		</body>
		</text>
</TEI>
