I am a CS undergraduate (but I don't know much about AI though, did not take any courses on it, and definitely nothing about NN until recently) who is about to do a school project in AI, so I pick a topics regarding grammar induction (of context-free language and perhaps some subset of context-sensitive language) using reinforcement learning on a neural network. I started to study previous successful approach first to see if they can be tweaked, and now I am trying to understand the approach using supervised learning with Long Short Term Memory. I am reading "Learning to Forget: Continual Prediction with LSTM". I am also reading the paper on peephole too, but it seems even more complicated and I'm just trying something simpler first. I think I get correctly how the memory cell and the network topology work. What I do not get right now is the training algorithm. So I have some questions to ask:

  • How exactly does different input get distinguished? Apparently the network is not reset after each input, and there is no special symbol to delimit different input. Does the network just receive a continuous stream of strings without any clues on where the input end and the next one begin?

  • What is the time lag between the input and the corresponding target output? Certainly some amount of time lag are required, and thus the network can never be trained to get a target output from an input that it have not have enough time to process. If it was not Reber grammar that was used, but something more complicated that could potentially required a lot more information to be stored and retrieved, the amount of time need to access the information might varied depending on the input, something that probably cannot be predicted while we decide on the time lag to do training.

  • Is there a more intuitive explanation of the training algorithm? I find it difficult to figure out what is going on behind all the complicated formulas, and I would need to understand it because I need to tweak it into a reinforced learning algorithm later.

  • Also, the paper did not mention anything regarding noisy training data. I have read somewhere else that the network can handle very well noisy testing data. Do you know if LSTM can handle situation where the training data have some chances of being corrupted/ridden with superfluous information?

  • 3
    $\begingroup$ This is a very large question which might be intimidating some readers. I suggest splitting it into several pieces (each of your bullet points, perhaps). Also, this topic bridges Computer Science and Cross Validated; you might consider asking about the more CS-related aspects here on Computer Science and the more statistics-related apsects on Cross Validated (but please do not post the same question on both sites). $\endgroup$ Jun 26, 2013 at 10:55
  • $\begingroup$ some references that might assist you: lstm.iupr.com/files nntutorial-lstm.pdf on that page may be of particular help here $\endgroup$
    – Brian Jack
    Sep 22, 2015 at 8:54
  • $\begingroup$ PS: could someone decode those epsilons and deltas in the appendix maybe down to something I might understand with only first year calculus? $\endgroup$
    – Brian Jack
    Sep 22, 2015 at 9:05
  • $\begingroup$ at this point I'm avoiding backprop for an evolutionary/mutagen training algorithm just because the calculus for the backprop looks a bit scary. I tried a small test text prediction problem with a backpropMinus lstm in PyBrain but it was having trouble on convergence even with only a mere 3-character input sequence - mutational training and fitness culling (on MSE of output error over training population) might allow more creative search area analysis $\endgroup$
    – Brian Jack
    Sep 22, 2015 at 9:11

1 Answer 1


LSTM is designed to process a stream of data chunks (each chunk being the set of inputs for the network at this point in time) that arrive over time and observe features occurring in the data and yield output accordingly. The time lag (delay) between the occurrence of features to recognize may vary and may be prolonged.

One would then train the network by streaming training examples in randomized ordering which should also have some timeshift noise added in the form of idle passes (have the network activate when inputs are at default idle values eg: when no audio in the case of a speech processor) [exception: if any training data should obey periodic timeshift patterns such as music then the timeshift noise should keep the timeshifting synchronized eg: in music making sure a start-of-measure training example isn't shifted to mid-measure and so forth]

It is possible also to have a semi supervised setup where the network is always in a training configuration and it's trained with examples that expect output of an idle value when no feauture is present or the appropriate expected value when a feature is presented to train).

If feedback format training is desired it can be emulated by:

  1. saving the internal state (time t)
  2. activating the network on current inputs (now at t+1)
  3. supervisory process evaluates the output obtained at t
    • 3a if correction is needed first rewind to the saved state (rewinds network back to t)
    • 3b generate a training example with the correction
    • 3c run a train (backprop) pass for this slice rather than an activation

thus one implements a feedback style system since training examples are basically only created while the network is "getting it wrong." The feedback format is useful if one wants the network to attempt improvisation (like Schmidhuber's music example).

  • it should be pointed out that part of the correction feedback (and thus training examples) necessarily includes those that enforce idle valued output when features are not present at the current time

It was mentioned by the OP that [there is no separation of inputs] except that actually there is. If one thinks of a voice recognition scenario one has periods of utterances (features the LSTM should detect) interspersed with long periods of silence. So to address the concern it would be fair to say those periods of silence are in fact separating the sequenced groups of inputs (those silences too are actually a feature the network needs to detect and learn to respond with idle valued outputs ie: learn to do nothing when silence).

A note about resetting of the network

Any reset or recalling of a saved network state in the LSTM sense has a meaning of "go back in time" thus undoing any learning the LSTM performed prior to the reset.

Thus you were correct in stating LSTMs are not reset prior to each training sample nor tranining epoch. LSTMs want their data streamed, or provided in an 'online' manner, so-to-speak.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.