AI Dictionary › Fondamenti AI

Memoization

Memoization is an optimization in which a function remembers the results of calls it has already performed: when invoked again with the same inputs, it returns the stored result instead of recomputing it. It is caching applied to functions, and it shines when computation is expensive and inputs repeat frequently.

Definition

What it is

Memoization is an optimization in which a function remembers the results of calls it has already performed: when invoked again with the same inputs, it returns the stored result instead of recomputing it. It is caching applied to functions, and it shines when computation is expensive and inputs repeat frequently.

How it works

The mechanism relies on a lookup table (typically a hash map) that maps a function's arguments to its output. On every call the function checks the table: if the input-result pair exists, it reuses it; otherwise it computes, stores and returns. It only works reliably with pure functions, meaning functions that always produce the same output for the same input and have no side effects.

Applications

In AI, memoization appears in agent frameworks that avoid re-running tool calls already executed with identical parameters, in evaluation systems that reuse previously computed scores, and in feature engineering pipelines. In classic programming it is the technique that makes dynamic programming tractable, from computing Fibonacci numbers to aligning DNA sequences in bioinformatics.

History & etymology

The term was coined by Donald Michie, the British AI pioneer, in his 1968 Nature paper Memo Functions and Machine Learning. It derives from the Latin memorandum, a thing to be remembered: Michie deliberately chose memoization rather than memorization to describe turning a function into a memo function that remembers its own results.

Definizione (italiano)

La memoization è un'ottimizzazione in cui una funzione ricorda i risultati delle chiamate già eseguite: se viene invocata di nuovo con gli stessi input, restituisce il risultato salvato invece di ricalcolarlo. È una forma di caching applicata alle funzioni, particolarmente efficace quando il calcolo è costoso e gli input si ripetono spesso.

Il meccanismo si basa su una tabella (di solito una hash map) che associa gli argomenti della funzione al risultato prodotto. A ogni chiamata la funzione controlla la tabella: se la coppia input-risultato esiste, la riusa; altrimenti calcola, salva e restituisce. Funziona in modo affidabile solo con funzioni pure, cioè funzioni che con gli stessi input producono sempre lo stesso output e sono prive di effetti collaterali.

Nell'AI la memoization compare nei framework per agenti che evitano di rieseguire chiamate a strumenti già effettuate con gli stessi parametri, nei sistemi di valutazione che riusano punteggi già calcolati e nelle pipeline di feature engineering. In programmazione classica è la tecnica che rende trattabili gli algoritmi di programmazione dinamica, come il calcolo dei numeri di Fibonacci o l'allineamento di sequenze in bioinformatica.

Il termine fu coniato da Donald Michie, pioniere britannico dell'intelligenza artificiale, nell'articolo Memo Functions and Machine Learning pubblicato su Nature nel 1968. Deriva dal latino memorandum, cosa da ricordare: Michie scelse deliberatamente memoization e non memorization per indicare la trasformazione di una funzione in una memo function, capace di ricordare i propri risultati.

Related terms

More in Fondamenti AI

Put it into practice

From our network

Kaimaki Web — Websites That Win Customers

Custom websites, web apps and digital marketing for growing businesses.

Visit kaimakiweb.com →

From the Agora Intelligence blog

More on agora-intelligence.com →

📱 Download the Android app (beta) iOS coming soon

Say what you mean. Get what you need.

Grace Certified — the AI coach that trains and certifies your prompt engineering — by Agora Intelligence.