Show the causal chain to LLM and it will learn the axioms.
AI is already helping mathematicians and scientists do research. For example, the famous mathematician Tao Zhexuan has repeatedly shared his research and exploration experience with the help of GPT and other AI tools. For AI to compete in these fields, strong and reliable causal reasoning capabilities are essential. The research to be introduced in this article found that Transformer models trained on demonstrations of the causal transitivity axiom for small graphs can generalize to the transitivity axiom for large graphs. In other words, if Transformer learns to perform simple causal reasoning, it may be used for more complex causal reasoning. The axiom training framework proposed by the team is a new paradigm for learning causal reasoning based on passive data, which can be used to learn arbitrary axioms as long as the demonstration is sufficient. Causal reasoning can be defined as a set of reasoning processes that conform to predefined axioms or rules specifically for causality. For example, the d-separation (directed separation) and do-calculus rules can be considered axioms, while the specifications of a collider set or a backdoor set can be considered rules derived from the axioms. Generally speaking, causal inference uses data that correspond to variables in a system. Axioms or rules can be integrated into machine learning models in the form of inductive biases through regularization, model architecture, or specific variable selection. Based on the differences in available data types (observation data, intervention data, counterfactual data), the "causal ladder" proposed by Judea Pearl defines possible types of causal inference. Since axioms are the cornerstone of causality, we can’t help but wonder if we can directly use machine learning models to learn axioms. That is, what if the way to learn axioms is not to learn data obtained through some data generation process, but directly to learn symbolic demonstrations of axioms (and thus to learn causal reasoning)? Compared with task-specific causal models built using specific data distributions, such a model has an advantage: it can achieve causal reasoning in a variety of different downstream scenarios. This issue becomes important as language models gain the ability to learn symbolic data expressed in natural language. In fact, some recent research has evaluated whether large language models (LLMs) are capable of performing causal inference by creating benchmarks that encode causal inference problems in natural language. Research teams from Microsoft, MIT, and the Indian Institute of Technology Hyderabad (IIT Hyderabad) have also taken an important step in this direction: proposing a method for learning causal inference through axiomatic training .
- Paper title: Teaching Transformers Causal Reasoning through Axiomatic Training
- Paper address: https://arxiv.org/pdf/2407.07612
They assume, The causal axiom can be expressed as the following symbolic tuple 〈premise, hypothesis, result〉. Among them, hypothesis refers to the hypothesis, that is, a causal statement; premise is the premise, which refers to any relevant information used to determine whether the statement is "true"; result is naturally the result. The result can be a simple "yes" or "no". For example, the collider axiom from the paper "Can large language models infer causation from correlation?" can be expressed as: , and the conclusion is "yes". Based on this template, a large number of synthetic tuples can be generated by modifying variable names, variable numbers, variable order, etc. In order to use Transformer to learn causal axioms and achieve axiom training, the team used the following methods to construct data sets, loss functions and position embeddings. Axiomatic training: Data set, loss function and position compilationBased on a specific axiom, "hypothesis" can be mapped to appropriate label based on "premise" ( Yes or No). To create the training data set, the team enumerates all possible tuples {(P, H, L)}_N under specific variable settings X, Y, Z, A, where P is the premise and H is the hypothesis , L is the label (Yes or No). Given a premise P based on some causal diagram, if the hypothesis P can be derived by using a specific axiom (one or more times), then the label L is Yes; otherwise it is No. For example, assume that the underlying real causal graph of a system has a chain topology: X_1 → X_2 → X_3 →・・・→ X_n. Then, a possible premise is X_1 → X_2 ∧ X_2 → X_3, then suppose X_1 → The above axioms can be used inductively many times to generate more complex training tuples. For the training setup, build a synthetic dataset D using N axiom instances generated by the transitivity axiom. Each instance in D is constructed of the form (P_i, H_ij, L_ij), , where n is the number of nodes in each i-th premise. P is the premise, that is, a natural language expression of a certain causal structure (such as X causes Y, Y causes Z); followed by the question H (such as does X cause Y?); L is the label (Yes or No). This form effectively covers all pairs of nodes for each unique chain in a given causal graph. Given a data set, the loss function is defined based on the ground truth label of each tuple, expressed as: The analysis shows that compared to the next token prediction, using this Losses can yield promising results. In addition to training and loss functions, the choice of positional encoding is also another important factor. Positional encoding can provide key information about the absolute and relative position of a token in a sequence. The famous paper "Attention is all you need" proposes an absolute position coding strategy that uses periodic functions (sine or cosine functions) to initialize these codes. Absolute position encoding can provide certain values for all positions of any sequence length. However, some research shows that absolute position encoding is difficult to cope with the length generalization task of Transformer. In the learnable APE variant, each position embedding is randomly initialized and trained using the model. This method struggles with sequences that are longer than those during training, because the new position embeddings are still untrained and uninitialized. Interestingly, recent findings have shown that removing position embeddings in autoregressive models can improve the length generalization ability of the model, and the attention mechanism during autoregressive decoding is sufficient to encode position information. The team used different position encodings to understand their impact on generalization in causal tasks, including learnable position encoding (LPE), sinusoidal position encoding (SPE), and no position encoding (NoPE).In order to improve the generalization ability of the model, the team also used data perturbations, including perturbations of length, node name, chain order and branch status. The following question arises: If a model is trained using this data, can the model learn to apply this axiom to new scenarios? To answer this question, the team trained a Transformer model from scratch using this symbolic demonstration of the causally independent axiom. To evaluate its generalization performance, they trained on simple causally independent axiom chains of size 3-6 nodes, and then tested several different aspects of generalization performance, including length generalization performance (chains of size 7-15), name generalization (longer variable names), sequential generalization (chains with reversed edges or shuffled nodes), structural generalization (graphs with branches) ). Figure 1 illustrates how to evaluate Transformer's structural generalization.
Specifically, they trained a decoder-based model with 67 million parameters based on the GPT-2 architecture. The model has 12 attention layers, 8 attention heads, and 512 embedding dimensions. They trained the model from scratch on each training dataset. To understand the impact of positional embedding, they also studied three positional embedding settings: sinusoidal positional encoding (SPE), learnable positional encoding (LPE), and no positional encoding (NoPE). The results are shown in Table 1, Figure 3 and Figure 4.
Table 1 gives the accuracy of different models when evaluated on larger causal chains not seen during training. It can be seen that the performance of the new model TS2 (NoPE) is comparable to the trillion-parameter scale GPT-4. Figure 3 is the results of the generalization ability evaluation on causal sequences with longer node names (longer than the training set) and the impact of different position embeddings.
Figure 4 evaluates the generalization ability on longer unseen causal sequences.
They found that models trained on simple chains can generalize to multiple applications of axioms on larger chains, but cannot generalize to more complex scenarios such as sequential or structural generalization. However, if the model is trained on a mixed dataset consisting of simple chains as well as chains with random reverse edges, the model generalizes well to various evaluation scenarios. Extending results on length generalization on NLP tasks, they discovered the importance of positional embeddings in ensuring causal generalization across length and other dimensions. Their best-performing model had no positional encoding, but they also found that sinusoidal encoding worked well in some cases. This axiom training method can also be generalized to a more difficult problem, as shown in Figure 5. That is, based on premises containing statements of statistical independence, the task goal is to discern correlation from causation. Solving this task requires knowledge of several axioms, including d-separation and Markov properties.
The team generated synthetic training data using the same method as above, and then trained a model. It was found that the Transformer trained on a task demonstration containing 3-4 variables could learn to solve problems containing 5 variables. Map tasks. And on this task, the model is more accurate than larger LLMs such as GPT-4 and Gemini Pro.
The team said: "Our research provides a new paradigm for teaching models to learn causal reasoning through symbolic demonstrations of axioms, which we call axiomatic training." Data generation and training of this method The procedure is general: as long as an axiom can be expressed in the format of symbolic tuples, it can be learned using this method. The above is the detailed content of Axiomatic training allows LLM to learn causal reasoning: the 67 million parameter model is comparable to the trillion parameter level GPT-4. For more information, please follow other related articles on the PHP Chinese website!