City Research Online

Formal and Empirical Studies of Counting Behaviour in ReLU RNNs

El-Naggar, N., Ryzhikov, A., Daviaud, L. , Madhyastha, P. ORCID: 0000-0002-4438-8161 & Weyde, T. ORCID: 0000-0001-8028-9905 (2023). Formal and Empirical Studies of Counting Behaviour in ReLU RNNs. In: Proceedings of Machine Learning Research. The 16th International Conference on Grammatical Inference, 10-13 Jul 2023


In recent years, the discussion about systematicity of neural network learning has gained renewed interest, in particular the formal analysis of neural network behaviour. In this paper, we investigate the capability of single-cell ReLU RNN models to demonstrate precise counting behaviour. Formally, we start by characterising the semi-Dyck-1 language and semi-Dyck-1 counter machine that can be implemented by a single Rectified Linear Unit (ReLU) cell. We define three Counter Indicator Conditions (CICs) on the weights of a ReLU cell and show that fulfilling these conditions is equivalent to accepting the semi-Dyck-1 language, i.e. to perform exact counting. Empirically, we study the ability of single-cell ReLU RNNs to learn to count by training and testing them on different datasets of Dyck-1 and semi-Dyck-1 strings. While networks that satisfy the CICs count exactly and thus correctly even on very long strings, the trained networks exhibit a wide range of results and never satisfy the CICs exactly. We investigate the effect of deviating from the CICs and find that configurations that fulfil the CICs are not at a minimum of the loss function in the most common setups. This is consistent with observations in previous research indicating that training ReLU networks for counting tasks often leads to poor results. We finally discuss implications of these results and possible avenues for improving network behaviour.

Publication Type: Conference or Workshop Item (Paper)
Additional Information: Copyright 2023 N. El-Naggar, A. Ryzhikov, L. Daviaud, P. Madhyastha & T. Weyde.
Publisher Keywords: RNN, ReLU, Counting, Dyck-1, Automata Theory
Subjects: Q Science > QA Mathematics > QA75 Electronic computers. Computer science
Departments: School of Science & Technology > Computer Science
[thumbnail of el-naggar23a.pdf]
Text - Published Version
Available under License Creative Commons Attribution.

Download (955kB) | Preview


Add to AnyAdd to TwitterAdd to FacebookAdd to LinkedinAdd to PinterestAdd to Email


Downloads per month over past year

View more statistics

Actions (login required)

Admin Login Admin Login