Currently transformer-based networks have a very severe limitation: context window size. When it is exceeded, they forget information. It poses a big challenge.
Currently those AGI networks keep the general knowledge about the world in their weights. It is bad. To update the knowledge the nets have to be retrained on new data.
It is very tempting to discourage networks from learning and memoizing various sorts of knowledge except the language, logic and ather very elementary skills, and instead utilize the weights budget to learn generic cognitive abilities, while providing all the knowledge about the world as a prefix. Such prefix can be updated in realtime without retraining of the network and can contain all the corpus of scientific knowledge, math theorems, entry-level books on various topics giving the AGI capabilities to understand more advanced books, advanced books, and advanced SOTA articles. This way the network becomes kinda a problem-solver based on search, where the explicit knowledge is implicitly organized into a spanning tree, though not minimal, but redundant, and output is used to store search algorithm state. While weights are just params of the heuristics of guided search algorithm. Doing so requires extremily large context window.
The problem with context window is that it is O(N^2) complexity. Clearly inefficient.
The mechanism of multi-head attention first computes multiple learnable projections of token embeddings, three for each token (each token is projected into a query, a key and a value), then compares each projection to each other using dot product, which is used as a coefficient to determine a share of a certain value having a certain key. Projections of keys and values are like separate vector databases, each maps certain aspect of each token to another aspect of it. A certain aspect of a token (query projection) is extracted and looked up in the database, which contains all other tokens. For each token query aspect cosine similarity to key aspect of each another token is computed. These similarities are normalized to 1 to represent probabilities, and value aspects of the tokens are multiplied by those probabilities and are combined into expectation value of the vector. Then this vector is projected using a trainable projection.
What is trained:
* initial projections selecting needed aspects of each token
* the transform of each expectation.
The problem with long contexts when using such an approach is quadratic complexity of comparing each pf N tokens to each of N tokens. For each of N tokens we have to sweep all the rest of N tokens. In fact we don't :) There exist vector databases, that organize points into graphs so to find nodes similar to a certain vector one doesn't have to compare it to all the nodes. If we used only 1 vector, the complexity would have been N*log N. The problem is, we cannot train a network this way.
What the problem with the following way to extend length of context of transformer-based LLM?
1. we select a small dense context window length M, of which linear combination of the most suitable values we consider important enough, and the rest of are just discarded
1. we select a feasible N>>M with which we can train a network using dense O(N^2) attention, this way training attention heads to select right aspects of tokens and project the results correctly to the point of achieving desired AGI capabilities on N context window.
2. once AGI capabilities are achieved, we consider the projections be correct enough to work even on longer contexts. We change the attention mechanism to zero the shares of (N-M) least-suitable vectors and fine-tune the network to make it accustomed to each output being result of sum of M the most suitable entries.
3. we fill the prefix with common knowledge texts in random order
4. we change the attention mechanism. Now instead of dense attention we use 2 stages. For each token
a) we do KNN lookup of M the most similar keys in a vector index
b) we compute dense attention to M found tokens.
5. to discourage network from learning common knowledge we add examples of asking about common knowledge and when learning them, the common knowledge corpus is zeroed, and if a network answers correctly (the semantic embedding of the result is similar to semantic embedding of the correct answer), it is penalized.