An RNN is a recurrent neural network that processes a sequence using a state passed between steps. LSTM and GRU are recurrent-unit types with control mechanisms called gates. They serve tasks where observation order matters, including time-series analysis. Connect the model choice to available data and the required output rather than choosing an acronym first.

For a business, one possible application estimates enquiry volume for a future interval. An essential evaluation condition applies: use only information that would have been known at the forecast origin. A result calculated using future data answers a different question, even if it looks convincing when displayed in a chart.

The examples, intervals and numbers in this guide are invented for explanation. They are not statistics or WebHat outcomes. The photographs illustrate document analysis and computer work, not a model, dataset, dashboard or employees from a project we delivered.

Professional reviewing documents with a calculator at a desk
Mikhail Nilov

What are sequential data, and why does order matter?

A sequence is more than a table with an extra row

A sequence has an order relevant to the task. It can be text, a signal or a succession of commercial observations. A time series also relates observations to their times. Treat event intervals and regularity explicitly rather than assuming every event list automatically represents comparable daily observations suitable for the same modelling approach.

In our example, each observation describes enquiry volume within a defined interval. Separate event time from recording time. A late-imported enquiry can alter the history available in the system. Correct evaluation needs to establish which information was actually accessible when the model would have issued the forecast, not simply what is visible in today's corrected database.

Within the classification of types of artificial intelligence, RNN describes an architectural family. It does not name every forecast or every AI agent. A simple rule, statistical model or another network may better suit a particular task. Start the comparison from the same operational requirement rather than an architectural preference.

How do we prepare history for a forecasting application?

Define aggregation and missing information before the model

Establish the unit: enquiries per day, hour or another relevant period. Document the time zone and aggregation rules. An interval with no enquiries can legitimately be zero; an interval without collected data is different. Confusing them may teach the model that collection outages are genuine decreases in demand, compromising both training and later interpretation.

Select variables available at the forecast origin. A known calendar can be used differently from enquiry totals observed only after the day ends. Do not include later-calculated totals as inputs or retrospectively use a corrected history version without specifying the evaluation conditions. Availability, not merely a column's existence, determines whether it belongs in a forecast input.

Data-learned transformations, such as scaling parameters, are estimated during training and subsequently applied under version control. Do not use the test set to choose those parameters. Processing must remain consistent in evaluation and operation, including variable order and treatment of missing values, so that a deployment change does not silently redefine the model's inputs.

What is a recurrent network's state?

A numerical representation of processed history

At each step, the unit uses the current input and previous state to calculate a new state. The operation is reused along the sequence. TensorFlow's RNN guide describes this step-to-step relationship. The state is not an exact copy of all data and should not be confused with business records retained in a database.

The same operation, applied sequentially

  1. Observation 1

    The current input and initial state produce state 1.

  2. Observation 2

    The new input and state 1 produce state 2.

  3. Observation 3

    The new input and state 2 produce state 3.

  4. Task output

    Use the state or output sequence according to the model.

Original conceptual diagram. The state is a numerical representation, not an exact archive of every observation.

For an application handling multiple series, specify which series owns each state. One location's history must not accidentally continue with another location's observations merely because they enter the same processing job. Resetting, reusing and initialising state are technical workflow decisions. Preserve that separation when successive batches are processed rather than assuming a batch boundary establishes the correct business context.

The distinction from context and memory in an LLM application matters. A recurrent state is a computational model component. Authorised history, documents and persistent application memory have different roles. The name LSTM does not mean the system automatically remembers every piece of customer information or manages the associated access rights.

What does a simple RNN do, and where do difficulties arise?

A simple RNN transforms the input and previous state, then applies an activation function. During training, information needed for parameter adjustment propagates through sequence steps. Long dependencies can create optimisation difficulties, including vanishing or exploding gradients. Sequence length and configuration affect the particular case; the architecture name alone does not determine how it behaves.

Gated units were developed to provide more flexible control over information flow. They do not remove the need for data, evaluation and configuration. In a business deep-learning project, compare simple options before accepting the additional complexity of a more elaborate model, including what it will require to operate and maintain.

For enquiry volume, a baseline could use a comparable past period's value. Calculate it without future information. If a recurrent model does not provide a useful advantage in relevant tests, it need not remain in the solution merely because its architecture is more sophisticated or its demonstration appears more technically advanced.

How does an LSTM differ from a simple RNN?

Cell state and gates control updating

A common LSTM form has a cell state and a hidden state. Input, forget and output gates control contributions to updating and output. These are numerical operations with learned parameters, not conscious decisions to remember. Describe implementations and variants concretely when examining actual project code rather than treating every LSTM diagram as identical.

Chung and colleagues' paper on gated recurrent units distinguishes these mechanisms and presents a particular LSTM variant. Do not turn historical research outcomes into a universal ranking for a company's time series. Data, history length and output computation can change the comparison between options, so the application still needs its own evaluation.

In our demonstrative pilot, the question is whether history improves the forecast at the chosen horizon. An active gate is not sufficient explanation for an estimate. Retain the estimate, conditions and later observation so error can be measured on data not used to adjust the model, with the same target definition throughout.

What does a GRU simplify, and how do we choose?

Reset and update gates without a separate cell

In a common GRU form, reset and update gates control how the state combines with a new candidate. There is no separate cell state as in the LSTM form described here. That is a structural distinction, not a sufficient basis for declaring either model more accurate or faster in the actual application.

Three recurrent units, different mechanisms

  1. Simple RNN

    Updates the state by transforming the input and previous state.

  2. Common LSTM

    Uses cell state, hidden state and input, forget and output gates.

  3. Common GRU

    Combines state and candidate through reset and update gates without a separate cell state.

Conceptual comparison of common forms, not a copied paper diagram or a performance verdict.

Compare models under documented conditions and an evaluation budget. Measure error, resource use, inference duration and stability across relevant periods. Unit count, window length and implementation matter. Do not generalise a speed claim about a particular engine to every device, configuration or workload simply because both implementations use the same recurrent-unit family.

Comparison with a Transformer and its attention mechanism must also follow the task. A newer architectural family is not automatically the best choice for limited history or a restricted integration. Use project results and operating requirements, not an imaginary ladder of architectures that every application must climb.

What are an input window and forecast horizon?

Observed history and future targets have different roles

The input window contains observations provided to the model. The horizon indicates how far ahead the estimate extends from its origin. TensorFlow's time-series tutorial separates input width, target position and selected variables. Evaluate the window for the task; there is no universal history length suitable for every business or every forecasting requirement.

An estimate for one interval differs from forecasting a sequence. Multiple outputs can be produced together, or a prediction can feed the next step, according to the model. Evaluate error at every relevant horizon. A good prediction immediately after the history does not establish quality across the whole future period the user requires.

A convolutional network can also be adapted to sequences rather than photographs alone. Compare architectures with baseline methods under the same conditions. First define available information and output, then test which option delivers a useful result within the application's accepted resource requirements instead of assuming recurrence is compulsory.

How do we evaluate chronologically without future information?

The forecast origin sets the information boundary

For future forecasting, training data precedes evaluated periods. Select configurations using development periods and retain a separate final test. Forecasting: Principles and Practice describes rolling-origin evaluation. At each origin, the model uses only information available up to that point, so the assessment corresponds to issuing a forecast rather than explaining an already known outcome.

Demonstrative chronological separation

  1. Intervals 1–40 · Training

    Estimate model parameters and data-learned transformations.

  2. Intervals 41–50 · Validation

    Compare suitable configurations without using the final test.

  3. Intervals 51–60 · Test

    Evaluate the fixed option under the defined protocol.

Original example with 60 fictional intervals, not a training-volume recommendation. Already available history can supply a test forecast; future targets are not used retrospectively for fitting.

Do not randomly split almost identical windows when the question concerns forecasting a future period. In successive forecasts, use new observations only after they become available. Retain each estimate's origin, horizon and version, so the evaluation does not compare retrospectively rebuilt predictions against an outcome already known when those predictions were recalculated.

A bidirectional network can process an already observed window in both directions. That does not grant legitimate access to observations after the forecast origin. Distinguish computation order within available history from access to future information. The protocol must specify which data actually enters each estimate rather than relying on a model label alone.

How do we measure error, and why retain a baseline?

Express the metric in units useful to the process

Mean absolute error, or MAE, aggregates absolute differences between predictions and observations. For enquiry counts, the result remains expressed in enquiries. Scikit-learn documents this evaluation function. Our calculation uses a hypothetical model and simple baseline without attributing the values to a particular architecture, implementation, dataset or operational deployment.

Demonstrative example: compare a simple alternative too

  1. Day A

    Observed 30; model 27; baseline 25. Absolute errors 3 and 5.

  2. Day B

    Observed 28; model 34; baseline 30. Absolute errors 6 and 2.

  3. Day C

    Observed 31; model 29; baseline 30. Absolute errors 2 and 1.

  4. MAE in enquiries

    Model: (3+6+2)/3 ≈ 3.67. Baseline: (5+2+1)/3 ≈ 2.67.

Invented numbers for 3 days, not a real experiment or universal comparison. The baseline has lower mean error here; these 3 days do not establish a production choice.

The example shows why complexity does not replace comparison. In an actual project, use enough relevant periods, including activity changes, and inspect errors by horizon. An average hides distribution: also examine large deviations, error direction and the effort required by their operational consequence. A few demonstrative values do not establish the final model choice.

A forecasting metric differs from a commercial outcome. Lower error does not itself describe how many enquiries will be resolved or how the team will work. Define separately how the process owner uses the estimate and what is measured afterwards. This maintains the connection between model and application usefulness without inventing a business result.

A volume estimate can contain decimals even when observations are whole numbers. Define display and rounding separately from error calculation. A value impossible within the domain calls for checking the model, transformation or output rule; it must not be saved as a confirmed observation merely because it was returned as a number.

Person working at a laptop in an office
Mikhail Nilov

How do we operate without mixing series and versions?

States, data and forecasts must remain traceable

The application selects the correct series, applies compatible transformations and controls initial state. Stateful operation must preserve batch order and continuity according to the implementation. Do not accidentally continue a sequence with another entity's data. Store the forecast with its issue time and version, separately from the observation that becomes available later.

Proposed enquiry-volume forecasting workflow

  1. Available history

    Collect authorised events and check aggregation.

  2. Forecast origin

    Fix which information was known at that point.

  3. Estimate and checks

    The selected model runs with the correct preprocessing and state.

  4. Assisted decision

    The owner uses the estimate for planning with explicit exceptions.

  5. Later evaluation

    Compare the saved estimate with the subsequently available observation.

Original design workflow, not a client outcome. Forecast, observation and decision remain separate fields.

A collection-channel change can alter recorded enquiry counts. Check whether the difference reflects activity, a definition change or collection itself. Do not retrain automatically after every deviation. Establish the cause first, correct the appropriate data or configuration, then reevaluate the option before activation rather than asking a new model to absorb an unexplained data problem.

If processing cannot issue a valid forecast, the interface shows that state and the time of the latest available estimate. Do not silently present an old value as though it had been calculated from current data. That distinction can matter as much as the difference between two architectures when users rely on the displayed result.

Data protection in AI integration also concerns operational history. Use controlled access and defined retention without sending more content than forecasting needs. If the purpose is aggregate volume, the full text of every enquiry does not implicitly become a necessary input to the estimation model or its evaluation pipeline.

How do we prepare a business application with RNN, LSTM or GRU?

Start with the assisted decision, estimation frequency and authorised history. In a business dashboard with automated reports, distinguish forecasts from observed values and display the period, unit and calculation time. The process owner can then interpret information without confusing an estimate with a confirmed record.

For business automation with AI integration, define which operations may follow and which need review. A forecast does not itself grant modification rights. The pilot includes the baseline comparison, errors, interface and operating rules rather than merely saving a file of model parameters and treating that as a complete application.

A meaningful project estimate benefits from the enquiry definition, frequency, history, collection changes and how the team will use the result. These support a representative test and clear integration. Choose the architecture after evaluation and extend functions that meet process criteria, with an operating plan appropriate to the information users will actually receive.

Frequently asked questions about RNN, LSTM, GRU and forecasting

Is LSTM separate from recurrent networks?

LSTM is a recurrent-unit type. RNN names the broader family, including simple and gated units. A fair comparison specifies architecture, configuration, task and evaluation protocol rather than only an acronym, because a family name does not determine how an application has been trained or tested.

Is GRU always faster and LSTM more accurate?

The structures differ, but measure outcomes for the actual model and infrastructure. Data, configuration and task can alter the comparison. Test error and resource needs under the same conditions rather than using a historical result as a rule for every application, device or operating environment.

Can we randomly split history to forecast the future?

For this question, evaluation must respect time and information availability. Future data does not enter construction of an earlier prediction. The protocol can use multiple chronological origins, with windows and horizons defined for intended use, so the assessment represents forecasting rather than retrospective fitting.

What should we do when some intervals have missing data?

Separate no activity from no collection and choose treatment appropriate to the cause. Do not automatically fill with zero or values calculated using the future. Document the same processing rule for evaluation and operation, including when the system should withhold an estimate and request clarification.

How many observations are needed?

The amount depends on frequency, variation, task and model. Our fictional-interval example explains chronological separation only. Inventory history and relevant periods, then compare suitable options, including simple methods, before deciding which additional data is needed and whether the available material supports the intended evaluation.

Does LSTM state permanently retain every company record?

No. State is a numerical computational representation managed explicitly by the application. Business records, persistent memory and document history are separate components. Access rights and retention rules do not follow automatically from choosing a recurrent unit; they must be defined for the actual data and workflow.