I want to compare the space complexity/memory requirement of tabular Q-learning v.s. deep neural Q-network (DQN). I think DQN would be faster and Q-table has a disadvantage at large table sizes but consider the following case.

A Q-table has the size 14 states *169 actions= 2366 entries and (say) a fully connected DNN whose number of parameters comes out to be like >8000. Space complexity/memory-wise, isn't storing a look-up q-table of 2366 size better than storing 8000 parameters of neural net? I never implemented a DNN before so no idea how much space neural net parameters take.

  • $\begingroup$ Please, do not ask for opinions. Ask for evidence and facts. We have a specific close reason that can be used to close posts that ask for opinions. Moreover, please, reformulate your title in the form of a question. I see only one question in the body of your post and it's slightly different than what you have in the title, which is more general. $\endgroup$
    – nbro
    Jun 20 at 9:17
  • $\begingroup$ Ok thanks. I will be careful in future questions. I have edited the title now. I thought I can ask this question since it is based on some actual numbers that I am dealing with. And not any general theory question. I asked for the opinion of people who have experienced such scenario so that I get clear as I don't have experience with dnn but only with q table..thanks for keeping the question though.. Do you know of any other site where you think this is more appropriate to post (for future reference I mean)? $\endgroup$ Jun 20 at 13:10
  • 1
    $\begingroup$ I think your problem is fine for our site, but the way you had formulated the question wasn't ideal (you can ask people to share with you their experience and empirical findings - that would not really be an opinion). So, every question on theoretical/conceptual/mathematical aspects of AI (including RL) can and probably should be asked here. I think your question can actually be asked here (because you're asking about the theoretical computational requirements - you're not asking e.g. which GPU you need to buy, which would be more a hardware question, and so off-topic), so don't worry! $\endgroup$
    – nbro
    Jun 20 at 14:22

1 Answer 1


You don't say, but I suspect from your description, that you have designed the neural network to operate over one-hot-encoding representations of states and actions. Using such a representation offers no benefit whatsoever compared to a simple table. That is because the intended benefit of using neural networks, or any kind of approximation, is generalisation.

It is not possible to generalise results between states and actions, if those states and actions are simply enumerated. If you represent $\mathcal{S}$ as $\{s_0, s_1, s_2 ... s_{13}\}$ and $\mathcal{A}$ as $\{a_0, a_1, a_2 ... a_{168}\}$ to any function, then the best generalisation that can be made are only based on the mean of $Q(s, a)$ for all states or all actions. You cannot use experience gained for $Q(s_0, a_0)$ to say anything about expected return for $Q(s_1, a_1)$. That is true even if $s_0$ and $s_1$ are similar in some way - the representation does not capture that similarity, so the approximator cannot use it.

State and action representation are very important details when adding approximation to reinforcement learning.

To gain generalisation, an approximation scheme needs to have feature data that encapsulates how elements in the space are similar or different to each other. For example, if the 169 actions are arranged on a 13x13 grid, then each action can be represented as a 2-element vector. This will work for approximation if actions that are close to each other in this 13x13 space usually have similar expected returns.

Space complexity/memory-wise, isn't storing a look-up q-table of 2366 size better than storing 8000 parameters of neural net?

Yes, typically neural network parameters are 32-bit floats, which would also a suitable storage type for the q table values.

It is not common to have a neural network use more space to store its parameters than would be required to fully describe the entire function domain that it is approximating. So you are right to find it unwanted/unexpected. The answer to this puzzle is likely to be in your choices for state and action representation.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .