Grokked Transformers Are Implicit Reasoners
arxiv.org
arxiv.org
I thought this was the most interesting bit from the paper:
> Training data distribution, instead of training data size, qualitatively influences generalization behavior.
The better approach IMO would be finding architectures that heavily penalize the formation of memorizing and interpolating circuits. E.g much stronger weight decay than used today.
The search issue happened because Google had to use a really cheap model to power the search results, and a memorizing model that cheap is going to be highly constrained in capabilities (at least right now).
I wonder if this is why smaller LLMs seem to punch above their weight, are they further along in the process of distilling the data down into understanding?
> leave it training. I’ve often seen people tempted to stop the model training when the validation loss seems to be leveling off. In my experience networks keep training for unintuitively long time. One time I accidentally left a model training during the winter break and when I got back in January it was SOTA (“state of the art”).
(This is not the oldest version, and doesn't mention the NN in question, but I believe this was about Neuraltalk, his image captioner.)
Most people, for most tasks, will only learn/train/try to improve, up to where they get to a flat or negative return curve per unit of effort put in
But, the people that are the best at a certain task, usually implies they got through The Dip in the curve of return per effort
I'd put the lottery ticket hypothesis in the same bucket of "things that may happen that don't make sense at all for a simple optimization procedure."
For instance, the paper claims it beat GPT-4-Turbo and Gemini-Pro-1.5 on certain tasks... but it doesn't include any of the questions they asked GPT4 or Gemini, so it's hard to guess whether these results have any value at all.
It's also unclear what they even trained their custom transformer to do. It has a custom tokenizer, but they don't give a list of tokens (aside from a few examples in the diagrams like "Barrack", "Michelle", "Trump"). They talk about in-distribution and out-of-distribution tasks, but they don't give any examples of these tasks and what they look like.
This feels like accidental complexity. It wouldn't have been hard to add a few more appendices with eg a list of 20 or so in-distribution sentences they asked the model to complete and 10 out-of-distribution sentences. Instead all they include is diagrams comparing performance for different hyperparameters and stuff, but we don't even know what the models are being tested on.
They also say that they fit all (Gemini) or 1/3 (RAG for GPT-4 and Gemini) of all the knowledge graph in the prompt, so to be fair, I wouldn't say they're hiding the ball on the prompts here, but that the prompts are very long, even one would significantly multiply the length of the PDF.
Again, I wouldn't mind some excerpts, just like you.
That bit feels like you're playing devil's advocate. Including a prompt wouldn't significantly add to the length of the PDF unless you did it in the most obtuse, malicious-compliance-ish way possible.
And when the subject is "we got X performance on GPT-4", including (an abridged version of) the prompt isn't just a nice bonus, it's absolutely essential to judge the results. The perf data they give for GPT-4 is worthless without that information.
https://www.papertalk.xyz/ was on HN Frontpage but seems to not have gained any traction (yet).
Maybe arxiv should consider implementing it or integrating with some 3rd party?
Are there other communities that also post scientific papers and comment publicly? Even if the community isn’t exclusively about science?
alphaXiv (https://alphaxiv.org/) is a discussion layer on top of arXiv, and it's starting to gain a lot of traction.
You can replace the arXiv URL with "alphaXiv" to get to the discussion: https://arxiv.org/abs/2404.16710 → https://alphaxiv.org/abs/2404.16710
Disclaimer: I'm currently helping out with alphaXiv -- it's a fun project out of Stanford
Looking through the facts, we find the following:
* Mary is older than Kristin.
* Kristin is younger than Donya.
Since Mary is older than someone who is younger than Donya, we can conclude that
Mary is older than Donya.
Final Answer: older
Some sets of files contain just the answer "older" or "younger".Other sets of files are as above, a text output with reasoning leading to an older/younger/cannot decide result.
Overall it looks like the knowledge graph and reasoning was all using this pattern of age comparison problems.
Another result, from "gpt4turbo_retrieval_cot_88.txt":
To determine the relative ages of Rachel and Andres, we need to find a connection or a common
reference point between them through the relationships provided. Let's analyze the information:
1. Rachel is older than Maurice. (Rachel > Maurice)
2. Maurice is older than Josephine. (Maurice > Josephine)
3. Josephine is older than Doreen. (Josephine > Doreen)
4. Doreen is younger than Andres. (Andres > Doreen)
From these relationships, we can establish a chain:
- Rachel > Maurice > Josephine > Doreen
- Andres > Doreen
Since both Rachel and Andres are older than Doreen, and Rachel is higher up in the chain above Doreen compared to Andres, we can infer:
- Rachel > Andres
Final Answer: older
EDIT:Found the problem statements. They're too big to paste on in its entirety, but roughly, from "prompt_cot_3.txt" used for the first answer above, the first line is "Hi! I have some facts for you:", then after a blank there's a single line with thousands (not exaggerated) of age facts, either in the form "X is older than/younger than/the same age as Y." or "The age of X is N.", and finally after another blank line, "Based on these facts, is Mary younger, older or in the same age as Donya? You can think step by step through the problem. Begin your final answer by 'Final Answer: '. Your final answer should be one of ['younger', 'older', 'same age', 'cannot decide']."
Unfortunately, though, this reasoning is just wrong. If Mary is 30, Kristin is 20, and Donya is 40, then Mary is older than Kristin and Kristin is younger than Donya, but Mary is not older than Donya.
I generally regard grokking as a failure mode in a lot of cases -- it's oftentimes not really a good thing. It tends to indicate that the combination of your network, task, and data are poorly suited for learning {XYZ} thing. There are emergent traits which I think the network can learn in a healthy manner over training, and I think that tends to fall under the 'generalization' umbrella.
Though I'd strongly prefer to call it 'transitive' rather than 'compositional' in terms of generalization, as transitive is the formal term most disciplines use for such things, compositional is a different, more general meaning entirely. Similarly, I'd replace 'parametric' and 'non-parametric' with 'internal' and 'external', etc. Sloughing through the definition salad of words (this paper alone takes up roughly half of the top Kagi hits for 'parametric memory') makes actually interpreting an argument more difficult.
One reinterpretation of the problem is -- of course external memory models will have trouble generalizing to certain things like models relying on internal memory do! This is because, in part, models with internal memory will have much more 'experience' integrating the examples that they've seen, whereas, for an external-memory model like a typical RAG setup, anything is possible.
But, that being said, I don't think you can necessarily isolate that to the type of memory that the model has alone, i.e., I don't think you can clearly say even in a direct comparison between the two motifs that it's the kind of memory itself (internal vs. external) that is to blame for this. I think that might end up leading down some unfruitful research paths if so.
That said, one positive about this paper is the fact that they seem to have found a general circuit that forms for their task, and analyze that, I believe that has value, but (and I know I tend to be harsh on papers generally) the rest of the paper seems to be more of a distraction.
Definitional salad buffets and speculation about the 'in' topics are going to be the things that make the headlines, but in order to make real progress, focusing on the fundamentals is really what's necessary here, I think. They may seem 'boring' a lot of the times, but they've certainly helped me quite a bit in my research. <3 :'))))
The difficulty of such a task is two-fold. First, the search space is large. For example, on average, each query entity connects with more than 50 facts, and each bridge entity in the ground truth proof connects with more than 900 facts. Second, there are no surface form clues to exploit and bias the search towards the ground truth proof, unlike most conventional QA benchmarks where the proof steps are transparent from the query.
To test LLMs based on non-parametric memory, we translate the facts into natural language by simple templates (Appendix F). Facts/queries for each attribute are grouped/tested separately. We test both the vanilla setup where all facts (28.2K on average) are loaded into the LLM context, and the retrieval-augmented setup (5.4K facts retrieved on average) where the two-hop neighborhoods of the two query entities are retrieved, which includes enough facts to deduce the answer. We also try both standard prompting where the model answers directly, and chain-of-thought (CoT) prompting where the model is prompted to verbalize the reasoning. We test GPT-4-Turbo and Gemini-Pro-1.5, where for GPT-4-Turbo we only test the retrieval-augmented setup due to context length limit.
Table 1:Results on the complex reasoning task. Direct/CoT: predict the answer directly/verbalize the reasoning steps. “+R”: retrieval augmentation.
GPT-4-Turbo Gemini-Pro-1.5 Grokked Transformer
Direct+R CoT+R Direct CoT Direct+R. CoT+R
Accuracy (%) 33.3 31.3 28.7 11.3 37.3 12.0 99.3Foundational models are usually trained with a lot of stuff before doing these kinds of tests. Can we know the above statement is true? That something (a) wasn’t in the training data and (b) didn’t have surface-level clues a ML algorithm could spot which the authors didn’t?
I felt like asking the latter because both GA’s and NN’s have found simple patterns in problems that humans missed for a long time. They used those patterns to heuristically solve those problems. It might be hard to design tests that eliminate a factor humans can’t see.
One possibility, for example, could be journals allow AI written submissions but also require and distribute the prompts. Then we could just read the prompts and be spared stuff like the passive voice dance.
They probably abused a compiler to generate their program instead of writing it in assembly.
We put to much emphasis on the look rather than the substance. People are afraid to send out an email with 2 words: Meeting Friday and instead pad it out with pleasantry and detail, context and importance, but none of that really matters.
‘Meeting Friday’ was the message. You completely ignored the rest. It was just extra padding (intentionally so). Maybe 2 words is too short. But can you honestly tell me that the majority of emails you receive is suscinct and to the point? Or do you simply skim them for highlights and extract what is relevant to you?
That’s really the take away I was trying to get at. People equate quantity to quality far too often. We send way more content than we need to out of fear that someone will equate less with bad.
Can you believe the nerve of some people? Using tools to help write better?
> Causal tracing. The transformer could be viewed as a causal graph that propagates information from the input to the output through a grid of intermediate states, which allows for a variety of causal analyses on its internal computation
> [...] There are in total three steps:
> 1. The normal run records the model’s hidden state activations on a regular input [...]
> 2. In the perturbed run, a slightly perturbed input is fed to the model which changes the prediction, where again the hidden state activations are recorded. [...] Specifically, for the hidden state of interest, we replace the input token at the same position as the state to be a random alternative of the same type (e.g., r1 → r′1) that leads to a different target prediction (e.g., t → t′).
> 3. Intervention. During the normal run, we intervene the state of interest by replacing its activation with its activation in the perturbed run. We then run the remaining computations and measure if the target state (top-1 token through logit lens) is altered. The ratio of such alterations (between 0 and 1) quantitatively characterizes the causal strength between the state of interest and the target.
> The generalizing circuit. [...] The discovered generalizing circuit (i.e., the causal computational pathways after grokking) is illustrated in Figure 4(a). Specifically, we locate a highly interpretable causal graph consisting of states in layer 0, 5, and 8, [...]. Layer 5 splits the circuit into lower and upper layers, where 1) the lower layers retrieve the first-hop fact (h, r1, b) from the input h, r1, store the bridge entity b in S[5, r1], and “delay” the processing of r2 to S[5, r2]; 2) the upper layers retrieve the second-hop fact (b, r2, t) from S[5, r1] and S[5, r2], and store the tail t to the output state S[8, r2].
> What happens during grokking? To understand the underlying mechanism behind grokking, we track the strengths of causal connections and results from logit lens across different model checkpoints during grokking (the “start” of grokking is the point when training performance saturates). We observe two notable amplifications (within the identified graph) that happen during grokking. The first is the causal connection between S[5, r1] and the final prediction t, which is very weak before grokking and grows significantly during grokking. The second is the r2 component of S[5, r2] via logit lens, for which we plot its mean reciprocal rank (MRR). Additionally, we find that the state S[5, r1] has a large component of the bridge entity b throughout grokking. These observations strongly suggest that the model is gradually forming the second hop in the upper layers (5-8) during grokking. This also indicates that, before grokking, the model is very likely mostly memorizing the examples in train_inferred by directly associating (h, r1, r2) with t, without going through the first hop
> Why does grokking happen? These observations suggest a natural explanation of why grokking happens through the lens of circuit efficiency. Specifically, as illustrated above, there exist both a memorizing circuit Cmem and a generalizing circuit Cgen that can fit the training data [...]