Memory Usage Comparison: Recursive vs. Naive Cumulative Average
Consider two methods for calculating the cumulative average of key-value pairs for a memory component in a sequence of length 'N'.
- Method A: Uses a recursive formula, updating the average at each step based only on the previous step's average and the current key-value pair.
- Method B: Re-calculates the average at each step by summing all key-value pairs from the beginning of the sequence up to the current step.
Analyze and compare the memory storage requirements for both methods as 'N' becomes very large. Which method is more memory-efficient and why?
0
1
Tags
Ch.2 Generative Models - Foundations of Large Language Models
Foundations of Large Language Models
Foundations of Large Language Models Course
Computing Sciences
Analysis in Bloom's Taxonomy
Cognitive Psychology
Psychology
Social Science
Empirical Science
Science
Related
Analysis of Memory Efficiency in Running Average Algorithms
A language model processes a very long document (10,000 tokens) and maintains a memory state by computing the cumulative average of all key-value pairs from the beginning of the sequence. If this average is updated at each step using a recursive formula, what information from the past must be stored in memory to compute the state for the 10,000th token?
Memory Usage Comparison: Recursive vs. Naive Cumulative Average