0Pricing
NLP Academy · Lezione

Gate che controllano la memoria

Come le LSTM decidono cosa conservare

Gate che controllano la memoria è una lezione NLP Academy gratuita su CoddyKit. Questa è la lezione 1 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento NLP Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso NLP Academy include 4 lezioni in totale.

Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.

Plain RNNs Forget

A simple RNN struggles to remember things from far back. The LSTM was built to fix that by carefully managing what it keeps and forgets. 🧠

The Cell State

An LSTM carries a special cell state, a memory line that runs straight through every step so important signals survive long sequences.

Gates Are the Trick

The magic is in the gates: tiny learned switches that decide what to add, keep, or drop from memory at each time step.

How a Gate Works

Each gate uses a sigmoid to output values from 0 to 1, acting like a dimmer that lets some information through and blocks the rest.

gate = sigmoid(W @ x + U @ h + b)  # values in [0, 1]

The Forget Gate

The forget gate looks at the new input and decides how much of the old memory to erase. A 0 wipes it; a 1 keeps it fully.

The Input Gate

The input gate controls how much fresh information gets written into the cell state, so only useful new signals are stored.

The Candidate Values

A candidate vector proposes what new content could enter memory. The input gate then scales how much of it actually gets added.

candidate = tanh(W @ x + U @ h + b)

Updating Memory

The new cell state blends old memory kept by the forget gate with fresh candidate values let in by the input gate.

c = forget * c_prev + input * candidate

The Output Gate

The output gate decides what part of the cell state becomes the visible hidden state passed to the next step and the layer above.

Why Gates Beat Forgetting

Because gates keep the cell state mostly additive, gradients flow back many steps without vanishing. That is how an LSTM remembers long context.

Three Gates, One Cell

So an LSTM has three gates guarding one memory line: forget, input, and output, each learned from data during training.

Quick Check

Test your grip on LSTM gates.

Recap

An LSTM protects a cell state with forget, input, and output gates. Those switches keep long-range memory alive where plain RNNs fail. ✅

Domande Frequenti

La lezione «Gate che controllano la memoria» è gratuita?

Sì — il testo completo di «Gate che controllano la memoria» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso NLP Academy, passa a CoddyKit PRO. Il corso NLP Academy include 4 lezioni in totale.

Cosa imparerò in «Gate che controllano la memoria»?

Come le LSTM decidono cosa conservare Eserciti NLP Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.

Ho bisogno di esperienza per iniziare NLP Academy?

Non è richiesta alcuna esperienza precedente. NLP Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 1 di 4.

Quanto tempo richiede la lezione «Gate che controllano la memoria»?

La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.

Posso scrivere ed eseguire codice in questa lezione NLP Academy?

Sì. Ogni lezione NLP Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.

Tutte le lezioni di questo corso

  1. Gate che controllano la memoria
  2. GRU: un'alternativa più leggera
  3. Addestrare un classificatore LSTM
  4. Layer bidirezionali e impilati
← Torna a NLP Academy