ZHANGYUXUAN-zR commited on
Commit
6a2449f
·
verified ·
1 Parent(s): 6459277

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. parse/test/9JQtrumvg8/9JQtrumvg8.md +0 -0
  2. parse/test/9JQtrumvg8/9JQtrumvg8_content_list.json +0 -0
  3. parse/test/9JQtrumvg8/9JQtrumvg8_middle.json +0 -0
  4. parse/test/9JQtrumvg8/9JQtrumvg8_model.json +0 -0
  5. parse/test/BfMQIJ0nLc/BfMQIJ0nLc.md +0 -0
  6. parse/test/BfMQIJ0nLc/BfMQIJ0nLc_content_list.json +0 -0
  7. parse/test/BfMQIJ0nLc/BfMQIJ0nLc_middle.json +0 -0
  8. parse/test/BfMQIJ0nLc/BfMQIJ0nLc_model.json +0 -0
  9. parse/test/DY6uhcv4Xm/DY6uhcv4Xm.md +424 -0
  10. parse/test/DY6uhcv4Xm/DY6uhcv4Xm_content_list.json +912 -0
  11. parse/test/DY6uhcv4Xm/DY6uhcv4Xm_middle.json +0 -0
  12. parse/test/DY6uhcv4Xm/DY6uhcv4Xm_model.json +0 -0
  13. parse/test/ETH1GDbSPw/ETH1GDbSPw.md +350 -0
  14. parse/test/ETH1GDbSPw/ETH1GDbSPw_content_list.json +847 -0
  15. parse/test/ETH1GDbSPw/ETH1GDbSPw_middle.json +0 -0
  16. parse/test/ETH1GDbSPw/ETH1GDbSPw_model.json +0 -0
  17. parse/test/KOZu91CzbK/KOZu91CzbK_model.json +0 -0
  18. parse/test/dtvJF1Vy2i/dtvJF1Vy2i.md +0 -0
  19. parse/test/dtvJF1Vy2i/dtvJF1Vy2i_content_list.json +0 -0
  20. parse/test/dtvJF1Vy2i/dtvJF1Vy2i_middle.json +0 -0
  21. parse/test/dtvJF1Vy2i/dtvJF1Vy2i_model.json +0 -0
  22. parse/test/gDlsMWost9/gDlsMWost9.md +633 -0
  23. parse/test/gDlsMWost9/gDlsMWost9_content_list.json +0 -0
  24. parse/test/gDlsMWost9/gDlsMWost9_middle.json +0 -0
  25. parse/test/gDlsMWost9/gDlsMWost9_model.json +0 -0
  26. parse/test/jolYuxpVn1/jolYuxpVn1.md +634 -0
  27. parse/test/jolYuxpVn1/jolYuxpVn1_content_list.json +0 -0
  28. parse/test/jolYuxpVn1/jolYuxpVn1_middle.json +0 -0
  29. parse/test/jolYuxpVn1/jolYuxpVn1_model.json +0 -0
  30. parse/test/p6xslUyvka/p6xslUyvka.md +336 -0
  31. parse/test/p6xslUyvka/p6xslUyvka_content_list.json +747 -0
  32. parse/test/p6xslUyvka/p6xslUyvka_middle.json +0 -0
  33. parse/test/p6xslUyvka/p6xslUyvka_model.json +0 -0
  34. parse/test/qV83K9d5WB/qV83K9d5WB.md +504 -0
  35. parse/test/qV83K9d5WB/qV83K9d5WB_content_list.json +1167 -0
  36. parse/test/qV83K9d5WB/qV83K9d5WB_middle.json +0 -0
  37. parse/test/qV83K9d5WB/qV83K9d5WB_model.json +0 -0
  38. parse/test/rAnB7JSMXL/rAnB7JSMXL.md +275 -0
  39. parse/test/rAnB7JSMXL/rAnB7JSMXL_content_list.json +632 -0
  40. parse/test/rAnB7JSMXL/rAnB7JSMXL_middle.json +0 -0
  41. parse/test/rAnB7JSMXL/rAnB7JSMXL_model.json +0 -0
  42. parse/test/u6jbcaCHqO/u6jbcaCHqO.md +507 -0
  43. parse/test/u6jbcaCHqO/u6jbcaCHqO_content_list.json +0 -0
  44. parse/test/u6jbcaCHqO/u6jbcaCHqO_middle.json +0 -0
  45. parse/test/u6jbcaCHqO/u6jbcaCHqO_model.json +0 -0
  46. parse/test/umFYHBDCcW/umFYHBDCcW.md +348 -0
  47. parse/test/vqIH0ObdqL/vqIH0ObdqL.md +334 -0
  48. parse/test/vqIH0ObdqL/vqIH0ObdqL_content_list.json +803 -0
  49. parse/test/vqIH0ObdqL/vqIH0ObdqL_middle.json +0 -0
  50. parse/test/vqIH0ObdqL/vqIH0ObdqL_model.json +0 -0
parse/test/9JQtrumvg8/9JQtrumvg8.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/9JQtrumvg8/9JQtrumvg8_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/9JQtrumvg8/9JQtrumvg8_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/9JQtrumvg8/9JQtrumvg8_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/BfMQIJ0nLc/BfMQIJ0nLc.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/BfMQIJ0nLc/BfMQIJ0nLc_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/BfMQIJ0nLc/BfMQIJ0nLc_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/BfMQIJ0nLc/BfMQIJ0nLc_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/DY6uhcv4Xm/DY6uhcv4Xm.md ADDED
@@ -0,0 +1,424 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FEDSECURITY: A BENCHMARK FOR ATTACKS AND DEFENSES IN FEDERATED LEARNING AND FEDERATED LLMS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ This paper introduces FedSecurity, an end-to-end benchmark designed to simulate adversarial attacks and corresponding defense mechanisms in Federated Learning (FL). FedSecurity comprises two major components: FedAttacker, which simulates attacks injected during FL training, and FedDefender, which simulates defensive mechanisms to mitigate the impacts of the attacks. FedSecurity is opensource and can be customized to cover a wide range of machine learning models (e.g., Logistic Regression, ResNet, and GAN) and federated optimizers (e.g., FedAVG, FedOPT, and FedNOVA). We also demonstrate the use of FedSecurity during federated training of Large Language Models (LLMs), showcasing its adaptability and applicability in more complex scenarios.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Federated Learning (FL) (McMahan et al., 2017a) facilitates training across distributed data and empowers individual clients to utilize their local data to collaboratively train machine learning models. Instead of sending their local data to a centralized server, FL clients train models on their local data and share the local models with the FL server, which aggregates the local models into a global model. This global model is redistributed to the clients, enabling the clients to further fine-tune the model using their local data.
12
+
13
+ FL maintains the privacy and security of client data by allowing clients to train locally without spreading their data to other parties. As a result of its privacy-preserving nature, FL has attracted considerable attention across various domains and has been utilized in numerous areas such as nextword prediction (Hard et al., 2018; Chen et al., 2019; Ramaswamy et al., 2019), hot-word detection (Leroy et al., 2019), financial risk assessment (Byrd & Polychroniadou, 2020), and cancer risk prediction (Chowdhury et al., 2022), demonstrating its wide-ranging versatility.
14
+
15
+ Recently, FL has found applications in large language models (LLMs) which expands its use cases. Referred to as federated LLMs, these models utilize FL during pre-training and finetuning as well as for prompt engineering (Chen et al., 2023). Currently, there are industry products that utilize FL (or distributed training) to train LLMs, including Deepspeed ZeRO (Rajbhandari et al., 2020; Wang et al., 2023), HuggingFace Accelerate (Gugger, 2021), Pytorch Lightning Fabric (Antiga, 2023). FL can facilitate LLM training due to the following reasons: i) Distributed nature of LLM training data: LLMs are pre-trained using large amounts of data, which often reside in different locations. Collecting such data to a central server is expensive and may also leak sensitive user information, while a viable way is to train LLMs in a federated manner. ii) Scalability and efficiency: LLMs, such as GPT-3 (Brown et al., 2020), have an extremely large number of parameters. Training LLMs on a single machine is infeasible and inflexible, while FL can be a good choice. iii) Continuous improvement with user data: LLMs can be deployed in a federated manner and local instances of the models can be further finetuned based on the local data, enabling the global model to improve over time based on users’ data without ever having direct access to that data. This is particularly relevant for privacy-sensitive fields such as healthcare or personal communications.
16
+
17
+ Even though FL does not require sharing raw data with others, its decentralized and collaborative nature might inadvertently introduce privacy and security vulnerabilities. In recent years, a burgeoning body of research has spotlighted various attack mechanisms in FL (Bhagoji et al., 2019;
18
+
19
+ Xie et al., 2019; Lam et al., 2021; Jin et al., 2021; Tomsett et al., 2019; Chen et al., 2017; Fang et al., 2020; Tolpegin et al., 2020; Zhu et al., 2019; Bagdasaryan et al., 2020; Zhang et al., 2022a; Kariyappa et al., 2022; Zhang et al., 2022b), where adversarial clients might submit spurious models to disrupt the global model from converging, or sabotage the global model to misidentify particular data samples by planting backdoors. Meanwhile, a wide range of defense mechanisms has emerged to mitigate the impact of these attacks (Li et al., 2022; Kumari et al., 2023; Sun et al., 2019; Ozdayi et al., 2021; Blanchard et al., 2017; Xie et al., 2020; Chen et al., 2017; Sun et al., 2019; Karimireddy et al., 2020; Yin et al., 2018; Pillutla et al., 2022; Fung et al., 2020; Xie et al., 2021; Yin et al., 2018; Ma et al., 2022; Kumar et al., 2022; Chen et al., 2022). Despite the efforts for addressing the vulnerability of FL systems, there still lacks a comprehensive benchmark for comparing approaches under unified sittings. Moreover, existing research has not yet investigated applying the attack and defense mechanisms to federated LLMs. In contrast to traditional small models, LLMs are distinguished by the large number of parameters and complex training datasets obtained from unregulated sources, which could introduce challenges when applying attacks and defenses on top of them. These motivate a need for a standardized and comprehensive benchmark to assess baseline attack and defense mechanisms in the context of FL and federated LLMs.
20
+
21
+ To this end, this paper introduces FedSecurity, a benchmark that simulates attacks and defenses in FL.1 FedSecurity comprises two primary components: FedAttacker and FedDefender. FedAttacker simulates attacks in FL to help understand and prepare for potential security risks, while FedDefender is equipped with various defense mechanisms to counteract the threats injected by FedAttacker.Besides small model tasks, we also apply FedSecurity to federated LLMs. Our contributions are summarized as follows:
22
+
23
+ i) Enabling benchmarking of various attacks and defenses in FL. FedSecurity implements attacks that are widely considered in the literature, including Byzantine attacks of random/zero/flipping modes (Chen et al., 2017; Fang et al., 2020), label flipping backdoor attack (Tolpegin et al., 2020), deep leakage gradient (Zhu et al., 2019), and model replacement backdoor attack (Bagdasaryan et al., 2020). Some of the well-known defense mechanisms supported include Norm Clipping (Sun et al., 2019), Robust Learning Rate (Ozdayi et al., 2021), Krum (and $m$ - Krum) (Blanchard et al., 2017), SLSGD (Xie et al., 2020), geometric median (Chen et al., 2017), weak DP (Sun et al., 2019), CClip (Karimireddy et al., 2020), coordinate-wise median (Yin et al., 2018), RFA (Pillutla et al., 2022), Foolsgold (Fung et al., 2020), CRFL (Xie et al., 2021), and coordinate-wise trimmed mean (Yin et al., 2018).
24
+
25
+ ii) Flexible configuration. FedSecurity supports configurations using a .yaml file. Users can utilize two parameters, “enable attack” and “enable defense”, to activate FedAttacker and FedDefender. Sample configurations are respectively shown in Figures 14 and Figures 15of Appendix A.
26
+
27
+ iii) Supporting customization of attack and defense mechanisms. We provide APIs in FedSecurity to enable users to integrate user-defined attacks and defenses in addition to the default baseline attack and defense mechanisms included in FedSecurity.
28
+
29
+ iv) Supporting various models and FL optimizers. FedSecurity can be utilized with a wide range of models, including Logistic Regression, LeNet (LeCun et al., 1998), ResNet (He et al., 2015), CNN (LeCun et al., 1989), RNN (Rumelhart et al., 1986), GAN (Goodfellow et al., 2014), and so on. FedSecurity is compatible with various FL optimizers, such as FedAVG (McMahan et al., 2016), FedSGD (Shokri & Shmatikov, 2015), FedOPT (Reddi et al., 2021), FedPROX (Li et al., 2020), FedGKT (He et al., 2020), FedGAN (Rasouli et al., 2020), FedNAS (He et al., 2021), FedNOVA (Wang et al., 2020b), and so on.
30
+
31
+ v) Extensions to federated LLMs and real-world applications. FedSecurity is suitable for demonstrating attacks and defenses during training of federated LLMs (Section 5.2). We also include a real-world experiment, where we use edge devices for FL with FedSecurity instead of simulations (Appendix E). These show the adaptability of the proposed FedSecurity benchmark.
32
+
33
+ Key takeaways: i) Byzantine attack of random mode (Chen et al., 2017; Fang et al., 2020) is effective in decreasing the test accuracy of the global model, and $m$ -Krum (Blanchard et al., 2017) can produce robust results against various attacks; $i i )$ ) while introducing a defense mechanism can help mitigate attacks, it might also affect the aggregation results, potentially compromising the model’s performance. However, in actual FL systems, attacks are infrequent. Therefore, it’s crucial to weigh the benefits against potential drawbacks before integrating a defense mechanism into real systems.
34
+
35
+ # 2 PRELIMINARIES AND OVERVIEW
36
+
37
+ In this section, we first discuss the related literature and introduce adversarial models considered in FedSecurity. Then we present an overview of FedSecurity.
38
+
39
+ # 2.1 RELATED WORKS
40
+
41
+ Recent years, various benchmarks have been introduced for FL, such as TensorFlow Federated (Abadi et al., 2015), PySyft (Ziller et al., 2021), FATE (Liu et al., 2021), Flower (Beutel et al., 2020), FedScale (Lai et al., 2022), NVIDIA FLARE (Roth et al., 2022), OpenFL (Reina et al., 2021), Fed-BioMed (Silva et al., 2020), IBM Federated Learning (Ludwig et al., 2020), FederatedScope (Xie et al., 2022), and FLUTE (Dimitriadis et al., 2022). Among these, only FederatedScope delves into the implications of adversarial attacks in FL, with a focus on data reconstruction attacks that utilize models or gradients to revert sensitive information, including GAN-based leakage attack (Hitaj et al., 2017), Passive Property Inference (Melis et al., 2019), and DLG attack (Zhu et al., 2019). However, FederatedScope neglects to address attacks prevalent in the research literature, e.g., Byzantine attacks (Yin et al., 2018; Yang et al., Dec 2019). It also does not include any defense mechanisms for FL. It is worth noting that, while FederatedScope integrates secret-sharing (Beimel, 2011), it is in the scope of federated analytics (Elkordy et al., 2023; Ramage, 2020; Wang et al., 2022a; Jung et al., 2012), instead of FL.
42
+
43
+ FedSecurity implements attacks that are widely considered in the literature (Yin et al., 2018; Tolpegin et al., 2020; Zhu et al., 2019); it also integrates a wide range of defense mechanisms (Sun et al., 2019; Ozdayi et al., 2021; Blanchard et al., 2017; Xie et al., 2020; Chen et al., 2017; Sun et al., 2019; Karimireddy et al., 2020; Yin et al., 2018; Pillutla et al., 2022; Fung et al., 2020; Xie et al., 2021; Yin et al., 2018). Designed with flexibility in mind, FedSecurity offers configurable settings and APIs, enabling users to customize their attack and defense mechanisms.
44
+
45
+ # 2.2 ADVERSARIAL MODEL
46
+
47
+ Real-world adversaries in FL systems fall into two categories: active and passive adversaries.
48
+
49
+ Active Adversaries. Active adversaries intentionally manipulate training data or trained models to achieve malicious goals. This might involve altering models to prevent global model convergence (e.g., Byzantine attacks (Chen et al., 2017; Fang et al., 2020)), or subtly misclassifying a specific set of samples to minimally impact the overall performance of the global model (e.g., backdoor attacks (Bagdasaryan et al., 2020; Wang et al., 2020a; Zhang et al., 2022a)). Active adversaries can take various forms, including: 1) malicious clients who manipulate their local models (Bagdasaryan et al., 2020; Chen et al., 2017; Fang et al., 2020; Zhang et al., 2022a) or submit contrived models without actual training (Wang, 2022); 2) a global “sybil” (Tolpegin et al., 2020; Fung et al., 2020) that has full access to the FL system and possesses complete knowledge of the entire system, including local and global models for each training round and clients’ local datasets. This “sybil” may also modify data within the FL system, such as clients’ local datasets and their submitted local models; and 3) external adversaries capable of monitoring the communication channel between clients and the server, thereby intercepting and altering local models during the transfer process.
50
+
51
+ Passive Adversaries. Passive adversaries do not modify data or models, but may still pose a threat to data privacy by potentially deducing sensitive information (such as local training data) from revealed models (gradients, or model updates) (Zhu et al., 2019). Examples of passive adversaries include: 1) an adversarial FL server attempting to infer local training data using submitted local models; 2) adversarial FL clients trying to deduce other clients’ training data using the global model provided by the server; and 3) external adversaries, e.g., hackers, that access communication channels to acquire local and global models transferred between clients and the FL server.
52
+
53
+ The adversaries can inject attacks at different stages of FL training. In summary, active adversaries can conduct attacks that modify local models (model poisoning attacks) or poison local datasets (data poisoning attack), while passive adversaries can infer sensitive information, such as user data, based on the models or gradients they observe (data reconstruction attacks). In the next subsection, we illustrate how to inject those attacks at different stages of FL frameworks.
54
+
55
+ ![](images/bb67fb35fb53787a89c07fa7e6657358335b88adff6e7da32c87857a8d68319b.jpg)
56
+ Figure 1: FedSecurity overview. FedSecurity enables injecting attacks (shown in red) and defenses (shown in green) at various stages of FL training at the clients and at the server.
57
+
58
+ # 2.3 OVERVIEW OF FEDSECURITY
59
+
60
+ FedSecurity serves as an external component that injects attacks and defense mechanisms at different stages of training without altering the existing processes in FL. FedSecurity utilizes FedAttacker and FedDefender to initiate two instances and simulate attacks and defenses, respectively. The two instances are initialized once and are accessible by other objects in the FL system2.
61
+
62
+ Injection of attacks. Without loss of generality, we classify the attacks in FL into the following three categories based on the targets of the attacks:
63
+
64
+ i) Data poisoning attacks that are conducted by active adversaries to modify clients’ local datasets and are injected at clients (Tolpegin et al., 2020; Dang et al., 2021).
65
+
66
+ ii) Model poisoning attacks that are also conducted by active adversaries to temper with local models submitted by clients (Fang et al., 2020; Shejwalkar & Houmansadr, 2021; Bhagoji et al., 2019). FedAttacker injects these attacks before the aggregation of local models in each FL training round at the server, so that it can get access to all client models submitted in that training round.
67
+
68
+ iii) Data reconstruction attacks that are conducted by passive adversaries by exploring local models or updates to infer information about the training data (Melis et al., 2018; Zhang et al., 2020; Luo et al., 2021; Wang et al., 2022b; Fowl et al., 2021). FedAttacker injects such attacks at the FL server, as the FL server has access to all local models and the global model of each iteration, and can perform the attacks with flexibility.
69
+
70
+ Injection of defenses. FedDefender integrates defenses to mitigate, if not completely nullify, the impacts of the injected attacks. Since the defenses either address issues related to tampered local models by active adversaries3 or prevent adversaries from deducing information from the local/global models shared between clients and the FL server, FedDefender deploys defenses at the FL server to get access to all local models and global models in each FL training round. For this, FedDefender can inject three functions at different stages of FL aggregation:
71
+
72
+ i) Before-aggregation functions that modify local models submitted by clients.
73
+
74
+ ii) On-aggregation functions that modify the FL aggregation function to mitigate the impacts of local models submitted by adversarial clients.
75
+
76
+ iii) After-aggregation functions that modify the aggregated global model (e.g., by adding noise or clipping) to protect the real global model or improve its quality.
77
+
78
+ Figure 1 summarizes the injections of attacks and defenses to the FL framework in FedSecurity. We also provide detailed algorithms for injecting attacks and defenses to different stages of FL training, as shown in Algorithm 1 (for server aggregation) and Algorithm 2 (for client training) in Appendix B. Below, we explain the implementations of attacks and defenses in detail.
79
+
80
+ # 3 IMPLEMENTATION OF ATTACKS IN FEDATTACKER
81
+
82
+ FedAttacker injects model poisoning, data poisoning, and data reconstruction attacks at different stages of FL training and provides APIs for these attacks. We present each class of attacks and defer the user integration of a new attack to FedSecurity to Appendix C.1 due to space limitations.
83
+
84
+ # 3.1 MODEL POISONING ATTACKS
85
+
86
+ Model poisoning attacks are designed to modify the local models submitted by clients. FedAttacker injects such attacks before FL aggregation in each iteration, modifying each local model directly. Model poisoning attacks implemented in FedAttacker include Byzantine attacks (Chen et al., 2017; Fang et al., 2020) of three different modes and the model replacement backdoor attack (Bagdasaryan et al., 2020). For example, FedAttacker implements three modes of Byzantine attacks, as follows:
87
+
88
+ • Zero mode that poisons the client models by setting their weights to zero. • Random mode that manipulates client models by attributing random values to model weights. • Flipping mode that updates the global model in the opposite direction by formulating a poisoned local model based on the global model ${ \bf w } _ { g }$ and the real local model $\mathbf { W } _ { \ell }$ as $\mathbf { w } _ { g } + ( \mathbf { w } _ { g } - \mathbf { w } _ { \ell } )$ .
89
+
90
+ APIs for Model Poisoning Attacks. FedAttacker has two APIs for model poisoning attacks.
91
+
92
+ • poison model(local models, auxiliary info), which takes the local models submitted by clients in the current FL iteration and modifies the local models. The input local models is a list of tuples containing the number of data samples and the submitted client models. The input auxiliary info is any information used in the defense, e.g., the global model in the last FL iteration. • is model poisoning attack(), which checks whether the attack component is activated and whether the attack modifies local models.
93
+
94
+ # 3.2 DATA POISONING ATTACKS
95
+
96
+ Data poisoning attacks modify (or poison) local datasets of some clients to achieve some malicious goals, e.g., degrading the performance of the global model or inducing the global model to misclassify some samples. As an example, in label flipping attack (Tolpegin et al., 2020), a global “sybil” controls some clients and modifies their local data by mislabeling samples of some classes to wrong classes. Given a source class (or label) $c _ { s }$ and a target class $c _ { t }$ , the local dataset of each poisoned client is modified such that all samples with class $c _ { s }$ are now associated with an incorrect label $c _ { t }$ .
97
+
98
+ APIs for Data Poisoning Attacks. FedAttacker has two APIs for data poisoning attacks.
99
+
100
+ • poison data(dataset), which takes a local dataset and mislabels a set of chosen samples based on the clients’ (or attackers’) requirements, which are included in the configuration. Normally, clients would change labels of a specific subset of samples to some other labels in the same dataset, or label a set of samples to new classes that do not exist in the dataset.
101
+ • is data poisoning attack(), which examines whether FedAttacker is enabled and whether the attack requires poisoning the datasets.
102
+
103
+ # 3.3 DATA RECONSTRUCTION ATTACKS
104
+
105
+ Data reconstruction attacks are performed by passive adversaries that attempts to infer sensitive information without actively interfering with the FL training or the local data. We assume that there is no leakage during the local training process in FL, as clients are on their fully trusted local machines. Thus, data reconstruction attacks take the trained models (either the global model or the local models) to revert training data. For example, Deep Leakage from Gradients (DLG) attack (Zhu et al., 2019) infers local training data from the publicly shared gradients. A passive adversary can use the global model from the previous FL training round and the newly obtained model to compute a “model update” between models in different FL training rounds to deduce the training data.
106
+
107
+ APIs for Data Reconstruction Attacks. We have two APIs for data reconstruction attacks.
108
+
109
+ • reconstruct data(model, auxiliary info), which takes a client model or a global model to reconstruct the training data. It also takes some extra information (auxiliary info) to help infer.
110
+
111
+ • is data reconstruction attack(), which examines whether the attack component is enabled and whether the attack requires reconstructing training data using the trained models.
112
+
113
+ # 4 IMPLEMENTATION OF DEFENSES IN FEDDEFENDER
114
+
115
+ FedDefender injects defense functions at different stages of FL aggregation at the server. Based on the point of injection, FedDefender provides three types of functions to support defense mechanisms, including 1) before-aggregation, 2) on-aggregation, and 3) after-aggregation. Note that a defense may inject functions at one or multiple stages of FL aggregation.
116
+
117
+ # 4.1 BEFORE-AGGREGATION DEFENSES
118
+
119
+ Before-aggregation functions operate on local models of each FL training iteration to mitigate (or eliminate) the impacts of potential attacks. We use Krum (Blanchard et al., 2017) as an example.
120
+
121
+ Krum. Krum (Blanchard et al., 2017) tolerates $f$ Byzantine clients among $n$ clients by retaining only one local model that is the most likely to be benign as the global model. That is, Krum selects a single model as the global model in aggregation. A generalization of Krum is $m$ -Krum (Blanchard et al., 2017) that selects $m$ client models with the $m$ lowest scores for aggregation, instead of choosing only one local model. This approach requires less than $\textstyle { \frac { n - m } { 2 } } - 1$ clients to be malicious.
122
+
123
+ APIs for before-aggregation functions. We provide two APIs for before-aggregation functions:
124
+
125
+ • defend before aggregation(local models, auxiliary info), which modifies the client models of the current FL iteration. The input local models is a list of tuples that contain the number of samples and the local model submitted by each client in the current FL iteration. The input auxiliary info can be any information that is utilized in the defense functions. • is defense before aggregation(), which checks whether the FedDefender is activated and whether the defense requires injecting functions before aggregating local models at the server.
126
+
127
+ # 4.2 ON-AGGREGATION DEFENSES
128
+
129
+ On-aggregation defense functions modify the aggregation function to a robust version that tolerates or mitigates impacts of the potential adversarial client models. As an example, RFA (Robust Federated Aggregation) (Pillutla et al., 2022) computes a geometric median of the client models in each iteration as the aggregated model, instead of simply averaging the client models. RFA defense effectively mitigates the impact of poisoned client models, as the geometric median can represent the central tendency of the client models, and the median point is chosen in a way to minimize the sum of distances between that point and the other client models of the current FL iteration. In practice, the geometric median is calculated using the Smoothed Weiszfeld Algorithm (Pillutla et al., 2022).
130
+
131
+ APIs for on-aggregation defenses. We provide two APIs for on-aggregation defense functions:
132
+
133
+ • defend on aggregation(local models, auxiliary info), which takes the local models of the current training round for aggregation. The input local models is a list of tuples that contain the number of samples and the local model submitted by each client in the current FL iteration. The input auxiliary info can include any information required by the defense functions. • is defense on aggregation(), which checks if the defense component is enabled and whether the current defense requires the injection of functions during aggregation.
134
+
135
+ # 4.3 AFTER-AGGREGATION DEFENSE
136
+
137
+ After-aggregation defense functions modify the aggregation result, i.e., the global model, of each FL iteration to mitigate the effects of poisoned local models or protect the global model from potential adversaries. As an example, CRFL (Xie et al., 2021) clips the global model to bound the norm of the model each time after aggregation at the FL server. The FL server then adds Gaussian noise to the clipped global model before distributing the global model to the clients for the next FL iteration.
138
+
139
+ APIs for After-Aggregation Defenses. We provide two APIs to support after-aggregation defenses:
140
+
141
+ ![](images/15f297abedef89493dc0e7ac1efbba6bd0a947269ea315da6233e5fe98dbf3ab.jpg)
142
+ Figure 2: Attack comparison.
143
+
144
+ ![](images/4fbaee8bcca5e27bee31ce1500de685440dd710e6f50bb857cf404c715adc484.jpg)
145
+ Figure 3: Defense comparison.
146
+
147
+ ![](images/04b67fd6e3609497a5cf010b549dcd31fe489ea6f6d0e9826dbd5c6b89436f18.jpg)
148
+ Figure 4: Label flipping exps.
149
+
150
+ ![](images/7730f303b59dcaf3d688af12d6a95cb41d5ab186d9a138bbe7fbd2e80b55dbb5.jpg)
151
+
152
+ ![](images/905a07cd1af9f124500c6760faf9c098d81e0193750ac7c98b22fb85b0826f3c.jpg)
153
+ Figure 5: Random-Byzantine exps. Figure 6: I.I.D. data evaluations.
154
+
155
+ ![](images/dc0fc5b58db645e0bb3a0d1a0e2a031a4463962cb68d38f12a989ad1f7a5155d.jpg)
156
+ Figure 7: Scale # clients to 100.
157
+
158
+ • defend after aggregation(global model), which directly modifies the global model after aggre
159
+ gation using methods such as clipping or adding noise.
160
+ • is defense after aggregation(), which checks if the defense component is activated and whether the current defense requires injecting functions after aggregation.
161
+
162
+ # 5 EXPERIMENTAL EVALUATIONS
163
+
164
+ This section presents a comprehensive evaluation of FedSecurity to benchmark some of the wellknown attack and defense mechanisms in FL.
165
+
166
+ Experimental setting. A summary of datasets and models for evaluations can be found in Table 1 in Appendix D. By default, we employ ResNet20 and the non-i.i.d. CIFAR10 dataset (partition parameter $\alpha = 0 . 5$ ), as the non-i.i.d. setting closely captures real-world scenarios. We further extend our evaluations to i.i.d. cases and various other models and datasets. For evaluations on LLMs, we utilize FedLLM (FedML Inc., 2023) that trains LLMs in a federated manner. We employ the Pythia1B model (Biderman et al., 2023) and PubMedQA (Jin et al., 2019), a non-i.i.d. biomedical research dataset that contains 212,269 questions for question answering. We utilize the “artificial” subset for training and the “labelled” subset for testing. We utilize FedAVG in our experiments. Evaluations are conducted on a server with 8 NVIDIA A100-SXM4-80GB GPUs.
167
+
168
+ # 5.1 EVALUATIONS ON FL
169
+
170
+ Unless otherwise noted, we use 10 clients, set the percentage of malicious clients to $10 \%$ , and evaluate results with the accuracy of the global model. We employ three attack mechanisms, including label flipping attacks and Byzantine attacks of random mode and flipping mode. For the label flipping attack, we set the attack to modify the local and test data labels of malicious clients from label 3 to label 9 and label 2 to label 1. We utilize three defense mechanisms: $m$ -Krum (Blanchard et al., 2017), Foolsgold (Fung et al., 2020), and RFA (Pillutla et al., 2022). For $m$ -Krum, we set $m$ to 5, which means 5 out of 10 submitted local models participate in aggregation in each training round.
171
+
172
+ Exp 1: Attack Comparisons. This experiment evaluates the impact of various attacks on test accuracy, using a no-attack scenario as a baseline. As illustrated in Figure 2, Byzantine attacks, specifically in the random and zero modes, substantially degrade accuracy. In contrast, the label flipping attack and the flipping mode of the Byzantine attack show a milder impact on accuracy. This can be attributed to the nature of Byzantine attacks, where Byzantine attackers would prevent the global model from converging, especially for the random mode that generates weights for models arbitrarily, causing the most significant deviation from the benign local model. In subsequent experiments, unless specified otherwise, we employ the Byzantine attack in the random mode as the default attack, as it provides the strongest impact compared with the other three attacks.
173
+
174
+ Exp 2: Defense Comparisons. This experiment investigates the potential impact of defense mechanisms on accuracy in the absence of attacks, i.e., whether defense mechanisms inadvertently degrade accuracy when all clients are benign. We incorporate a scenario without any defense or attack as our baseline. As illustrated in Figure 3, it becomes evident that when all clients are benign, involving defense strategies to FL training might lead to a reduction in accuracy. This decrease might arise from several factors: the exclusion of some benign local models from aggregation, e.g., as in $m$ -Krum, adjustments to the aggregation function, e.g., as in RFA, or re-weighting local models, e.g., as in Foolsgold. Specifically, the RFA defense mechanism significantly impacts accuracy as it computes a geometric median of the local models instead of leveraging the original FedAVG optimizer, which introduces a degradation in accuracy.
175
+
176
+ ![](images/2bbc4e4050a59de96408ec645c568926629ed9b4739655198eb8e1c03c116cf2.jpg)
177
+ Figure 8: ResNet56 (CV).
178
+
179
+ ![](images/1aa4894376006eed419999ad44f228fcdfa685d93411d0a8fc51ec6bb75b0568.jpg)
180
+ Figure 9: RNN (NLP).
181
+
182
+ ![](images/f3cb16940a8833c7ef42a11aff23c1f433582f06beb346d84504aba5eec8c919.jpg)
183
+ Figure 10: CNN (CV).
184
+
185
+ ![](images/23428eb5eaf13a1e2045a77a3d27b7a1c940145d4682aa6046a838d20a830c3d.jpg)
186
+ Figure 11: Varying # adversaries.
187
+
188
+ ![](images/0facfc5591d5cc9bb7212fca445d120834a6339ad16a187f6b01e060137deab1.jpg)
189
+ Figure 12: BERT evaluations.
190
+
191
+ ![](images/3ae2090bac0875c99d5eb9a39fc65e4753bb0ab2376b32f99d71c69d50ec6975.jpg)
192
+ Figure 13: Pythia-1B evaluations.
193
+
194
+ Exp 3: Evaluations of defense mechanisms against activated attacks. This experiment evaluates the effect of defense mechanisms in the context of ongoing attacks. We include two baseline scenarios: 1) an “original attack” scenario with an activated attack without any defense in place, and 2) a “benign” scenario with no activated attack or defense. We select label flipping attack and the random mode of Byzantine attack based on their impacts in Exp1, where label flipping has the least impact and the random mode of Byzantine attack exhibits the largest impact, as shown in Figure 2. Results for the label flipping and the random mode of Byzantine attacks are in Figure 4 and Figure 5, respectively. These results indicate that the defenses may contribute to minor improvements in accuracy for low-impact attacks, e.g., Foolsgold in Figure 4. In certain cases, it is noteworthy that the defensive mechanisms may inadvertently compromise accuracy, such as the case with RFA in Figure 4. For high-impact attacks, such as the Byzantine attack of the random mode, Krum exhibits resilience, effectively neutralizing the negative impact of the attacks, as shown in Figure 5.
195
+
196
+ Exp 4: Evaluations on i.i.d. data. This experiment evaluates various defense mechanisms against an attack on i.i.d. data. We select the random mode of the Byzantine attack, and employ Foolsgold, $m$ -Krum $m = 5$ ), and RFA to counteract the adverse effects of this attack. As shown in Figure 6, $m$ -Krum is the most effective one among all the defense mechanisms, where the test accuracy is close to the case where all the FL clients are honest, i.e., no attack scenario.
197
+
198
+ Exp 5: Scaling the number of clients to 100. This experiment scales the number of clients to 100 and evaluates the defense mechanisms against the random mode of the Byzantine attack. We employ Foolsgold, $m$ -Krum (with $m = 5$ ), and RFA to counteract the adverse effects of this attack. As shown in Figure 7, $m$ -Krum is the most effective one among all the defense mechanisms, and the test accuracy is very close to the case where no attack happens.
199
+
200
+ Exp 6: Evaluations on different models. We evaluate defense mechanisms against the random mode of the Byzantine attack with different models and datasets, including: i) $\mathrm { R e s N e t } 5 6 + \mathrm { C I } -$ FAR100, ii) $\mathrm { R N N } + \mathfrak { s }$ Shakespeare, and $i i i$ ) CNN $^ +$ FEMNIST. The results are shown in Figures 8, 9, and 10, respectively. The results show that while the defense mechanisms can mitigate the impact of attacks in most cases, some attacks may fail some tasks, e.g., $m$ -Krum fails RNN in Figure 9, and Foolsgold fails CNN in Figure 10. This is because the two defense mechanisms either select several local models for aggregation in each FL training round, or significantly re-weight the local models, which may eliminate some local models that are important to the aggregation in the first several FL training iterations, leading to unchanged test accuracy in later FL iterations.
201
+
202
+ Exp 7: Varying the number of malicious clients. This experiment evaluates the impact of varying numbers of malicious clients on test accuracy. We utilize $m$ -Krum to protect against 1, 2, and 3 malicious clients out of 10 clients in each FL training round. As shown in Figure 11, the test accuracy remains relatively consistent across different numbers of malicious clients, as in each FL training round, $m$ -Krum selects a local model that is the most likely to be benign to represent the other models, effectively minimizing the impact of malicious client models on the aggregation.
203
+
204
+ We present an experiment that utilizes real-world edge devices in Theta network (Theta Network., 2023) to showcase the scalability of FedSecurity to real-world applications in Appendix E.
205
+
206
+ # 5.2 EVALUATIONS ON FEDERATED LLMS
207
+
208
+ We employ two LLMs, BERT (Devlin et al., 2018) and Pythia (Biderman et al., 2023), to showcase the scalability of FedSecurity and its applicability to federated LLM scenarios. We notice that some defenses (e.g., Foolsgold (Fung et al., 2020)) that require memorizing intermediate results, such as models of previous FL training rounds, might encounter limitations when integrated with LLMs due to the significant cache introduced. Considering this, we utilize $m$ -Krum for our experiments, as it does not require storing intermediate results and demonstrates consistent performance in most of our previous experiments.
209
+
210
+ Exp 8: Evaluations of Krum against model replacement backdoor attack on BERT. This experiment utilizes BERT (Devlin et al., 2018) and the 20 news dataset (Lang, 1995) for a classification task. We employ 10 clients and set 1 client to be malicious in each FL training round. We set $m$ to 5 in $m$ -Krum, i.e., 5 out of 10 local models participate in aggregation in each FL training round. Results in Figure 12 show that $m$ -Krum effectively mitigates the adversarial effect, bringing the accuracy closer to the level of the attack-free case.
211
+
212
+ Exp 9: Evaluations of Krum against the Byzantine attack on Pythia-1B. We employ 7 clients for FL training, and 1 out of 7 clients is malicious in each round of FL training. We set the $m$ parameter in $m$ -Krum to 2, signifying that 2 out of 7 submitted local models participate in the aggregation in each FL training round. The performance is evaluated based on the test loss. Results in Figure 13 show that Byzantine attack significantly increases the test loss during training. Nevertheless, $m$ - Krum effectively mitigates the adversarial effect.
213
+
214
+ # 6 CONCLUSION
215
+
216
+ This paper presents FedSecurity, a library designed to demonstrate potential adversarial attacks and corresponding defense strategies in FL to bolster innovation in the secure FL domain. FedSecurity contains two components: FedAttacker that simulates various attacks that can be injected during FL training, and FedDefender, which facilitates defense strategies to mitigate the impacts of these attacks. FedSecurity is open-sourced, and we welcome contributions from the research community to enrich the benchmark repository with novel attack and defense strategies to foster a diverse, comprehensive, and robust foundation for ongoing research in FL security.
217
+
218
+ # 7 ETHICS STATEMENT
219
+
220
+ FedSecurity is under the Apache 2.0 license, ensuring open access and customization. All datasets used for evaluations are publicly available, such as CIFAR10 (Krizhevsky et al., 2009), FEMNIST (Caldas et al., 2018), Shakespeare (McMahan et al., 2017b), and so on. All models for evaluations are publicly available as well.
221
+
222
+ # 7.1 CODE OF ETHICS
223
+
224
+ Data Handling and Protection. We are aware of the risks associated with data processing in FL settings. Users can use the open-sourced FedSecurity library to simulate attacks and defenses on any machine without uploading their raw data and model. If users use our MLOps platform for simulation, only the model weights are uploaded. The uploaded model weights are encrypted (i.e., only users with proper ownership can decrypt them) and can be deleted upon request. That is, we have no access to raw user data and we do not claim any data and model ownership.
225
+
226
+ Benchmark Model Documentation and Transparency. We are committed to: $i ,$ ) providing comprehensive documentation on the functionalities of the benchmark; $i i )$ ) making a detailed datasheet available for the benchmark model, outlining its specifications, capabilities, and intended use cases; and iii) offering transparent and well-documented APIs for users.
227
+
228
+ # 7.2 LIMITATIONS AND FURTHER IMPROVEMENT
229
+
230
+ While FedSecurity offers a foundation for ML security research, we recognize its limitations and potential for further enhancement. Our plans for improvement are as follows: $i$ ) conducting more experiments on federated LLMs to provide a comprehensive understanding of vulnerabilities of LLMs within the FL context; and $i i ^ { \cdot }$ ) designing and implementing advanced defense mechanisms against potential adversaries in asynchronous FL scenarios.
231
+
232
+ # 7.3 POTENTIAL NEGATIVE SOCIAL IMPACTS
233
+
234
+ Even though we put our best efforts in mitigating negative social impacts, the proposed FedSecurity benchmark might still be subject to some indistinct negative social impact, including:
235
+
236
+ • Potential misuse: While our module simulates attacks and defenses in FL to help the communities to better understand and compare the attacks in FL, it is not immune to malicious use. The platform could potentially be used to exploit vulnerabilities or develop advanced attack techniques in FL systems.
237
+ • Data security: FL is susceptible to various threats such as data poisoning. We acknowledge these inherent risks and are actively working on introducing defenses mechanisms to mitigate such attacks.
238
+ • Privacy Concerns: Although FL aims to train models without sharing raw data, there remains a risk of indirect data leakage, for example, attackers might utilize the models to infer whether specific data points are in the training datasets, where users should be cautious and informed.
239
+
240
+ # REFERENCES
241
+
242
+ Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dandelion Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris ´ Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Wat- ´ tenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL https://www.tensorflow.org/. Software available from tensorflow.org.
243
+
244
+ Luca Antiga. Introducing pytorch lightning 2.0 and fabric. https://lightning.ai/blog/introducinglightning-2-0/, 2023.
245
+
246
+ Eugene Bagdasaryan, Andreas Veit, Yiqing Hua, Deborah Estrin, and Vitaly Shmatikov. How to backdoor federated learning. In International Conference on Artificial Intelligence and Statistics, pp. 2938–2948. PMLR, 2020.
247
+ Amos Beimel. Secret-sharing schemes: A survey. In International conference on coding and cryptology, pp. 11–46. Springer, 2011.
248
+ Daniel J Beutel, Taner Topal, Akhil Mathur, Xinchi Qiu, Titouan Parcollet, Pedro PB de Gusmao, ˜ and Nicholas D Lane. Flower: A friendly federated learning research framework. arXiv preprint arXiv:2007.14390, 2020.
249
+ Arjun Nitin Bhagoji, Supriyo Chakraborty, Prateek Mittal, and Seraphin Calo. Analyzing federated learning through an adversarial lens. In International Conference on Machine Learning, pp. 634– 643. PMLR, 2019.
250
+ Stella Biderman, Hailey Schoelkopf, Quentin Anthony, Herbie Bradley, Kyle O’Brien, Eric Hallahan, Mohammad Aflah Khan, Shivanshu Purohit, USVSN Sai Prashanth, Edward Raff, et al. Pythia: A suite for analyzing large language models across training and scaling. arXiv preprint arXiv:2304.01373, 2023.
251
+ Peva Blanchard, El Mahdi El Mhamdi, Rachid Guerraoui, and Julien Stainer. Machine learning with adversaries: Byzantine tolerant gradient descent. Advances in neural information processing systems, 30, 2017.
252
+ Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
253
+ David Byrd and Antigoni Polychroniadou. Differentially private secure multi-party computation for federated learning in financial applications. In Proceedings of the First ACM International Conference on AI in Finance, pp. 1–9, 2020.
254
+ Sebastian Caldas, Sai Meher Karthik Duddu, Peter Wu, Tian Li, Jakub Konecnˇ y, H Brendan McMa- \` han, Virginia Smith, and Ameet Talwalkar. Leaf: A benchmark for federated settings. arXiv preprint arXiv:1812.01097, 2018.
255
+ Chaochao Chen, Xiaohua Feng, Jun Zhou, Jianwei Yin, and Xiaolin Zheng. Federated Large Language Model : A Position Paper. arXiv preprint arXiv:2307.08925, 2023.
256
+ Jiahui Chen, Yi Zhao, Qi Li, Xuewei Feng, and Ke Xu. Feddef: Defense against gradient leakage in federated learning-based network intrusion detection systems. IEEE Transactions on Information Forensics and Security, 18:4561–4576, 2022. URL https://api.semanticscholar. org/CorpusID:253420565.
257
+ Mingqing Chen, Rajiv Mathews, Tom Ouyang, and Franc¸oise Beaufays. Federated learning of outof-vocabulary words. arXiv preprint arXiv:1903.10635, 2019.
258
+ Y. Chen, L. Su, and J. Xu. Distributed statistical machine learning in adversarial settings: Byzantine gradient descent. ACM on Measurement and Analysis of Computing Systems, 1(2):1–25, 2017.
259
+ Alexander Chowdhury, Hasan Kassem, Nicolas Padoy, Renato Umeton, and Alexandros Karargyris. A review of medical federated learning: Applications in oncology and cancer research. In Brainlesion: Glioma, Multiple Sclerosis, Stroke and Traumatic Brain Injuries: 7th International Workshop, BrainLes 2021, Held in Conjunction with MICCAI 2021, Virtual Event, September 27, 2021, Revised Selected Papers, Part I, pp. 3–24. Springer, 2022.
260
+ Trung Dang, Om Thakkar, Swaroop Ramaswamy, Rajiv Mathews, Peter Chin, and Franc¸oise Beaufays. Revealing and protecting labels in distributed training. Advances in Neural Information Processing Systems, 34:1727–1738, 2021.
261
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
262
+
263
+ Dimitrios Dimitriadis, Mirian Hipolito Garcia, Daniel Madrigal Diaz, Andre Manoel, and Robert Sim. Flute: A scalable, extensible framework for high-performance federated learning simulations. arXiv preprint arXiv:2203.13789, 2022.
264
+
265
+ Ahmed Roushdy Elkordy, Yahya H Ezzeldin, Shanshan Han, Shantanu Sharma, Chaoyang He, Sharad Mehrotra, Salman Avestimehr, et al. Federated analytics: A survey. APSIPA Transactions on Signal and Information Processing, 12(1), 2023.
266
+ Minghong Fang, Xiaoyu Cao, Jinyuan Jia, and Neil Gong. Local model poisoning attacks to {Byzantine-Robust} federated learning. In 29th USENIX security symposium (USENIX Security 20), pp. 1605–1622, 2020.
267
+ FedML Inc. Releasing FedLLM: Build your own large language models on proprietary data using the FedML platform. https://blog.fedml.ai/releasing-fedllm-build-your-own-large-languagemodels-on-proprietary-data-using-the-fedml-platform, 2023.
268
+ Liam Fowl, Jonas Geiping, Wojtek Czaja, Micah Goldblum, and Tom Goldstein. Robbing the fed: Directly obtaining private data in federated learning with modified models. arXiv preprint arXiv:2110.13057, 2021.
269
+ Clement Fung, Chris JM Yoon, and Ivan Beschastnikh. The limitations of federated learning in sybil settings. In RAID, pp. 301–316, 2020.
270
+ Erich Gamma, Richard Helm, Ralph Johnson, Ralph E Johnson, and John Vlissides. Design patterns: elements of reusable object-oriented software. Pearson Deutschland GmbH, 1995.
271
+ Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron C. Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, 2014.
272
+ Sylvain Gugger. Introducing hugging face accelerate. https://huggingface.co/blog/accelerate-library, 2021.
273
+ Andrew Hard, Kanishka Rao, Rajiv Mathews, Swaroop Ramaswamy, Franc¸oise Beaufays, Sean Augenstein, Hubert Eichner, Chloe Kiddon, and Daniel Ramage. Federated learning for mobile ´ keyboard prediction. arXiv preprint arXiv:1811.03604, 2018.
274
+ Chaoyang He, Murali Annavaram, and Salman Avestimehr. Group knowledge transfer: Federated learning of large cnns at the edge. Advances in Neural Information Processing Systems, 33: 14068–14080, 2020.
275
+ Chaoyang He, Erum Mushtaq, Jie Ding, and Salman Avestimehr. Fednas: Federated deep learning via neural architecture search. 2021.
276
+ Kaiming He, X. Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, 2015.
277
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
278
+ Briland Hitaj, Giuseppe Ateniese, and Fernando Perez-Cruz. Deep models under the gan: information leakage from collaborative deep learning. In Proceedings of the 2017 ACM SIGSAC conference on computer and communications security, pp. 603–618, 2017.
279
+ Qiao Jin, Bhuwan Dhingra, Zhengping Liu, William Cohen, and Xinghua Lu. Pubmedqa: A dataset for biomedical research question answering. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 2567–2577, 2019.
280
+ Xiao Jin, Pin-Yu Chen, Chia-Yi Hsu, Chia-Mu Yu, and Tianyi Chen. Cafe: Catastrophic data leakage in vertical federated learning. Advances in Neural Information Processing Systems, 34:994–1006, 2021.
281
+ Gueyoung Jung, Nathan Gnanasambandam, and Tridib Mukherjee. Synchronous parallel processing of big-data analytics services to optimize performance in federated clouds. 2012 IEEE Fifth International Conference on Cloud Computing, pp. 811–818, 2012.
282
+ Sai Praneeth Karimireddy, Lie He, and Martin Jaggi. Byzantine-robust learning on heterogeneous datasets via bucketing. arXiv preprint arXiv:2006.09365, 2020.
283
+ Sanjay Kariyappa, Chuan Guo, Kiwan Maeng, Wenjie Xiong, G. Edward Suh, Moinuddin K. Qureshi, and Hsien-Hsin S. Lee. Cocktail party attack: Breaking aggregation-based privacy in federated learning using independent component analysis. In International Conference on Machine Learning, 2022. URL https://api.semanticscholar.org/CorpusID: 252211968.
284
+ Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
285
+ Abhishek Kumar, Vivek Khimani, Dimitris Chatzopoulos, and Pan Hui. Fedclean: A defense mechanism against parameter poisoning attacks in federated learning. ICASSP 2022 - 2022 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4333–4337, 2022. URL https://api.semanticscholar.org/CorpusID:249437417.
286
+ Kavita Kumari, Phillip Rieger, Hossein Fereidooni, Murtuza Jadliwala, and Ahmad-Reza Sadeghi. Baybfed: Bayesian backdoor defense for federated learning. arXiv preprint arXiv:2301.09508, 2023.
287
+ Fan Lai, Yinwei Dai, Sanjay Singapuram, Jiachen Liu, Xiangfeng Zhu, Harsha Madhyastha, and Mosharaf Chowdhury. FedScale: Benchmarking model and system performance of federated learning at scale. In International Conference on Machine Learning, pp. 11814–11827. PMLR, 2022.
288
+ Maximilian Lam, Gu-Yeon Wei, David Brooks, Vijay Janapa Reddi, and Michael Mitzenmacher. Gradient disaggregation: Breaking privacy in federated learning by reconstructing the user participant matrix. In International Conference on Machine Learning, pp. 5959–5968. PMLR, 2021.
289
+ Ken Lang. Newsweeder: Learning to filter netnews. In Armand Prieditis and Stuart Russell (eds.), Machine Learning Proceedings 1995, pp. 331–339. Morgan Kaufmann, San Francisco (CA), 1995. ISBN 978-1-55860-377-6. doi: https://doi.org/10.1016/ B978-1-55860-377-6.50048-7. URL https://www.sciencedirect.com/science/ article/pii/B9781558603776500487.
290
+ Yann LeCun, Bernhard Boser, John S Denker, Donnie Henderson, Richard E Howard, Wayne Hubbard, and Lawrence D Jackel. Backpropagation applied to handwritten zip code recognition. Neural computation, 1(4):541–551, 1989.
291
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
292
+ David Leroy, Alice Coucke, Thibaut Lavril, Thibault Gisselbrecht, and Joseph Dureau. Federated learning for keyword spotting. In IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6341–6345, 2019.
293
+ Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. Federated optimization in heterogeneous networks. Proceedings of Machine learning and systems, 2:429–450, 2020.
294
+ Xingyu Li, Zhe Qu, Shangqing Zhao, Bo Tang, Zhuo Lu, and Yao-Hong Liu. Lomar: A local defense against poisoning attack on federated learning. IEEE Transactions on Dependable and Secure Computing, 20:437–450, 2022. URL https://api.semanticscholar.org/ CorpusID:245837821.
295
+ Yang Liu, Tao Fan, Tianjian Chen, Qian Xu, and Qiang Yang. Fate: An industrial grade platform for collaborative learning with data protection. The Journal of Machine Learning Research, 22 (1):10320–10325, 2021.
296
+
297
+ Heiko Ludwig, Nathalie Baracaldo, Gegi Thomas, Yi Zhou, Ali Anwar, Shashank Rajamoni, Yuya Ong, Jayaram Radhakrishnan, Ashish Verma, Mathieu Sinn, et al. IBM Federated Learning: An Enterprise Framework White Paper v0.1. arXiv preprint arXiv:2007.10987, 2020.
298
+
299
+ Renqian Luo, Liai Sun, Yingce Xia, Tao Qin, Sheng Zhang, Hoifung Poon, and Tie-Yan Liu. BioGPT: generative pre-trained transformer for biomedical text generation and mining. Briefings in Bioinformatics, 23(6), 09 2022. ISSN 1477-4054. doi: 10.1093/bib/bbac409. URL https://doi.org/10.1093/bib/bbac409. bbac409.
300
+ Xinjian Luo, Yuncheng Wu, Xiaokui Xiao, and Beng Chin Ooi. Feature inference attack on model predictions in vertical federated learning. In IEEE International Conference on Data Engineering (ICDE), pp. 181–192. IEEE, 2021.
301
+ Zhuo Ma, Jianfeng Ma, Yinbin Miao, Yingjiu Li, and Robert H. Deng. Shieldfl: Mitigating model poisoning attacks in privacy-preserving federated learning. IEEE Transactions on Information Forensics and Security, 17:1639–1654, 2022. URL https://api.semanticscholar. org/CorpusID:248358657.
302
+ Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Artificial intelligence and statistics, pp. 1273–1282. PMLR, 2017a.
303
+ Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Artificial intelligence and statistics, pp. 1273–1282. PMLR, 2017b.
304
+ H. B. McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. ¨ Communication-efficient learning of deep networks from decentralized data. In International Conference on Artificial Intelligence and Statistics, 2016.
305
+ Luca Melis, Congzheng Song, Emiliano De Cristofaro, and Vitaly Shmatikov. Exploiting unintended feature leakage in collaborative learning. 2019 IEEE Symposium on Security and Privacy $( S P )$ , pp. 691–706, 2018. URL https://api.semanticscholar.org/CorpusID:53099247.
306
+ Luca Melis, Congzheng Song, Emiliano De Cristofaro, and Vitaly Shmatikov. Exploiting unintended feature leakage in collaborative learning. In 2019 IEEE symposium on security and privacy (SP), pp. 691–706. IEEE, 2019.
307
+ Mustafa Safa Ozdayi, Murat Kantarcioglu, and Yulia R Gel. Defending against backdoors in federated learning with robust learning rate. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pp. 9268–9276, 2021.
308
+ Krishna Pillutla, Sham M Kakade, and Zaid Harchaoui. Robust aggregation for federated learning. IEEE Transactions on Signal Processing, 70:1142–1154, 2022.
309
+ Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. Zero: Memory optimizations toward training trillion parameter models. In SC20: International Conference for High Performance Computing, Networking, Storage and Analysis, pp. 1–16. IEEE, 2020.
310
+ Daniel Ramage. Federated analytics: Collaborative data science without data collection. Google AI Blog, May 2020. URL https://ai.googleblog.com/2020/05/ federated-analytics-collaborative-data.html.
311
+ Swaroop Ramaswamy, Rajiv Mathews, Kanishka Rao, and Franc¸oise Beaufays. Federated learning for emoji prediction in a mobile keyboard. arXiv preprint arXiv:1906.04329, 2019.
312
+ Mohammad Rasouli, Tao Sun, and Ram Rajagopal. Fedgan: Federated generative adversarial networks for distributed data. arXiv preprint arXiv:2006.07228, 2020.
313
+ Sashank J. Reddi, Zachary Charles, Manzil Zaheer, Zachary Garrett, Keith Rush, Jakub Konecnˇ y,´ Sanjiv Kumar, and Hugh Brendan McMahan. Adaptive federated optimization. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum? id $=$ LkFG3lB13U5.
314
+
315
+ G Anthony Reina, Alexey Gruzdev, Patrick Foley, Olga Perepelkina, Mansi Sharma, Igor Davidyuk, Ilya Trushkin, Maksim Radionov, Aleksandr Mokrov, Dmitry Agapov, et al. Openfl: An opensource framework for federated learning. arXiv preprint arXiv:2105.06413, 2021.
316
+
317
+ Holger R Roth, Yan Cheng, Yuhong Wen, Isaac Yang, Ziyue Xu, Yuan-Ting Hsieh, Kristopher Kersten, Ahmed Harouni, Can Zhao, Kevin Lu, et al. NVIDIA FLARE: Federated learning from simulation to real-world. arXiv preprint arXiv:2210.13291, 2022.
318
+ David E Rumelhart, Geoffrey E Hinton, and Ronald J Williams. Learning representations by backpropagating errors. nature, 323(6088):533–536, 1986.
319
+ Virat Shejwalkar and Amir Houmansadr. Manipulating the byzantine: Optimizing model poisoning attacks and defenses for federated learning. In NDSS, 2021.
320
+ Reza Shokri and Vitaly Shmatikov. Privacy-preserving deep learning. In Proceedings of the 22nd ACM SIGSAC conference on computer and communications security, pp. 1310–1321, 2015.
321
+ Santiago Silva, Andre Altmann, Boris Gutman, and Marco Lorenzi. Fed-BioMed: A General OpenSource Frontend Framework for Federated Learning in Healthcare. In Domain Adaptation and Representation Transfer, and Distributed and Collaborative Learning: Second MICCAI Workshop, pp. 201–210. Springer, 2020.
322
+ Ziteng Sun, Peter Kairouz, Ananda Theertha Suresh, and H Brendan McMahan. Can you really backdoor federated learning? arXiv preprint arXiv:1911.07963, 2019.
323
+ Theta Network. Theta network website. https://thetatoken.org/, 2023.
324
+ Vale Tolpegin, Stacey Truex, Mehmet Emre Gursoy, and Ling Liu. Data poisoning attacks against federated learning systems. In European Symposium on Research in Computer Security, pp. 480– 501. Springer, 2020.
325
+ Richard Tomsett, Kevin Chan, and Supriyo Chakraborty. Model poisoning attacks against distributed machine learning systems. In Artificial Intelligence and Machine Learning for Multi-Domain Operations Applications, volume 11006, pp. 481–489. SPIE, 2019.
326
+ Dan Wang, Siping Shi, Yifei Zhu, and Zhu Han. Federated analytics: Opportunities and challenges. IEEE Network, 36:151–158, 2022a.
327
+ Guanhua Wang, Heyang Qin, Sam Ade Jacobs, Connor Holmes, Samyam Rajbhandari, Olatunji Ruwase, Feng Yan, Lei Yang, and Yuxiong He. Zero $^ { + + }$ : Extremely efficient collective communication for giant model training. arXiv preprint arXiv:2306.10209, 2023.
328
+ H. Wang, K. Sreenivasan, S. Rajput, H. Vishwakarma, S. Agarwal, J. Sohn, K. Lee, and D. Papailiopoulos. Attack of the tails: Yes, you really can backdoor federated learning. In NeurIPS, 2020a.
329
+ Jianhua Wang. Pass: Parameters audit-based secure and fair federated learning scheme against free rider. arXiv preprint arXiv:2207.07292, 2022.
330
+ Jianyu Wang, Qinghua Liu, Hao Liang, Gauri Joshi, and H. Vincent Poor. Tackling the objective inconsistency problem in heterogeneous federated optimization. ArXiv, abs/2007.07481, 2020b.
331
+ Zhibo Wang, Yuting Huang, Mengkai Song, Libing Wu, Feng Xue, and Kui Ren. Poisoning-assisted property inference attack against federated learning. IEEE Transactions on Dependable and Secure Computing, 2022b.
332
+ Chulin Xie, Keli Huang, Pin-Yu Chen, and Bo Li. Dba: Distributed backdoor attacks against federated learning. In International conference on learning representations, 2019.
333
+ Chulin Xie, Minghao Chen, Pin-Yu Chen, and Bo Li. CRFL: Certifiably robust federated learning against backdoor attacks. In International Conference on Machine Learning, pp. 11372–11382. PMLR, 2021.
334
+ Cong Xie, Oluwasanmi Koyejo, and Indranil Gupta. SLSGD: Secure and Efficient Distributed Ondevice Machine Learning. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 213–228. Springer, 2020.
335
+ Yuexiang Xie, Zhen Wang, Daoyuan Chen, Dawei Gao, Liuyi Yao, Weirui Kuang, Yaliang Li, Bolin Ding, and Jingren Zhou. FederatedScope: A Flexible Federated Learning Platform for Heterogeneity. arXiv preprint arXiv:2204.05011, 2022.
336
+ H. Yang, X. Zhang, M. Fang, and J. Liu. Byzantine-resilient stochastic gradient descent for distributed learning: A Lipschitz-inspired coordinate-wise median approach. In IEEE CDC, Dec 2019.
337
+ Dong Yin, Yudong Chen, Kannan Ramchandran, and Peter Bartlett. Byzantine-robust distributed learning: Towards optimal statistical rates. In International Conference on Machine Learning, pp. 5650–5659. PMLR, 2018.
338
+ Jingwen Zhang, Jiale Zhang, Junjun Chen, and Shui Yu. Gan enhanced membership inference: A passive local attack in federated learning. In ICC 2020-2020 IEEE International Conference on Communications (ICC), pp. 1–6. IEEE, 2020.
339
+ Zhengming Zhang, Ashwinee Panda, Linyue Song, Yaoqing Yang, Michael Mahoney, Prateek Mittal, Ramchandran Kannan, and Joseph Gonzalez. Neurotoxin: Durable backdoors in federated learning. In International Conference on Machine Learning, pp. 26429–26446. PMLR, 2022a.
340
+ Zhengming Zhang, Ashwinee Panda, Linyue Song, Yaoqing Yang, Michael W. Mahoney, Joseph Gonzalez, Kannan Ramchandran, and Prateek Mittal. Neurotoxin: Durable backdoors in federated learning. In International Conference on Machine Learning, 2022b. URL https: //api.semanticscholar.org/CorpusID:249889464.
341
+ Ligeng Zhu, Zhijian Liu, and Song Han. Deep leakage from gradients. Advances in Neural Information Processing Systems, 32, 2019.
342
+ Alexander Ziller, Andrew Trask, Antonio Lopardo, Benjamin Szymkow, Bobby Wagner, Emma Bluemke, Jean-Mickael Nounahon, Jonathan Passerat-Palmbach, Kritika Prakash, Nick Rose, et al. PySyft: A library for easy federated learning. Federated Learning Systems: Towards NextGeneration AI, pp. 111–139, 2021.
343
+
344
+ # APPENDIX
345
+
346
+ # A EXAMPLE CONFIGURATION FILES FOR ATTACKS AND DEFENSES
347
+
348
+ We provide example configuration files for Byzantine attack (Chen et al., 2017; Fang et al., 2020) in Figure 14 and for $m$ -Krum defense (Blanchard et al., 2017) in Figure 15.
349
+
350
+ ![](images/c1e9192b09af5ecb88e7837a3e2ce84591215f08f3406e313a68af51309aca9c.jpg)
351
+ Figure 14: Configuration for Byzantine attack (Chen et al., 2017; Fang et al., 2020).
352
+
353
+ ![](images/a11eb9395b96c7c97e79ac98c68b0c8ba0901aa2fb27b38fcfd710fffb437786.jpg)
354
+ Figure 15: Configuration for $m$ -Krum (Blanchard et al., 2017) defense.
355
+
356
+ # B ALGORITHMS FOR FL SERVER AGGREGATION AND CLIENT TRAINING
357
+
358
+ The algorithms for injecting attacks and defenses in FL training are described in Algorithm 1 (for FL server aggregation) and Algorithm 2 (for client training).
359
+
360
+ # Algorithm 1: Server Aggregation
361
+
362
+ Inputs: $\mathbf { w } _ { g } ^ { \prime }$ : the global model of last FL training round; $\mathcal { W } _ { l }$ : the list of local models submitted by each client in the current FL training round.
363
+
364
+ Variables: $\mathcal { A }$ : A FedAttacker instance initialized based on the FL configuration file; $\mathcal { D }$ : A FedDefender instance that is initialized based on the FL configuration file.
365
+
366
+ 1 Function server aggregation $( \mathcal { W } _ { l } )$ begin
367
+ 2 $\mathcal { W } _ { l } \gets$ before aggregation process $( \mathcal { W } _ { l } , \mathbf { w } _ { g } ^ { \prime } )$
368
+ 3 $\mathbf { w } _ { g } \gets$ before aggregation process $( \mathcal { W } _ { l } , \mathbf { w } _ { g } ^ { \prime } )$
369
+ 4 return after aggregation process $( \mathcal { W } _ { l } , \mathbf { w } _ { g } )$
370
+
371
+ 5 Function before aggregation process $( \mathcal { W } _ { l } , \mathbf { w } _ { g } ^ { \prime } )$ begin
372
+
373
+ 6 if A.is attack enabled () then 7 if A.is data reconstruction attack () then A.reconstruct data $( \mathcal { W } _ { l } , \mathbf { w } _ { g } ^ { \prime } )$ ; if A.is model poisoning attack () then ${ \mathcal { W } } _ { l } \gets A$ .poison model $( \mathcal { W } _ { l } , \mathbf { w } _ { g } ^ { \prime } )$ ;
374
+
375
+ 8 if D.is defense enabled () & $\mathcal { D } .$ .is defense before aggregation() then L ${ \mathcal { W } } _ { l } \gets { \mathcal { D } } .$ defend before aggregation $( \mathcal { W } _ { l } , \mathbf { w } _ { g } ^ { \prime } )$
376
+ 9 return $\mathcal { W } _ { i }$
377
+
378
+ 10 Function on aggregation process $( \mathcal { W } _ { l } , \mathbf { w } _ { g } )$ begin 11 if $\mathcal { D }$ .is defense enabled() & $\mathcal { D }$ .is defense on aggregation() then return $\mathcal { D }$ .defend on aggregation $( \mathscr { W } _ { l } , { \mathbf { w } } _ { g } )$ 12 return aggregate $( \mathcal { W } _ { i } )$
379
+
380
+ 13 Function after aggregation process $\left( \mathbf { w } _ { g } \right)$ begin
381
+ 14 if $\mathcal { D } .$ .is defense enabled() & $\mathcal { D }$ .is defense after aggregation() then return D.defend after aggregation $\left( \mathbf { w } _ { g } \right)$
382
+ 15 return wg
383
+
384
+ # Algorithm 2: Client Training
385
+
386
+ Inputs: dataset: the local dataset of a client. Variables: $\mathcal { A }$ : A FedAttacker instance initialized based on the FL configuration file; 1 Function client training(dataset) begin 2 if $\mathcal { A }$ .is attack enabled () & A.is data poisoning attack () then dataset $ A$ .poison data(dataset) 3 wl ← train(dataset) 4 send to server (wl)
387
+
388
+ # C INTEGRATION OF NEW ATTACKS AND DEFENSES
389
+
390
+ # C.1 INTEGRATION OF A NEW ATTACK
391
+
392
+ To customize a new attack, users should follow these steps: i) determine the type of the attack, i.e., model poisoning, data poisoning, or data reconstruction; $i i )$ ) create a new class for the attack and implement functions using the APIs, e.g., attack model $( * )$ , poison data $( * )$ , and reconstruct data $( * )$ , to inject attacks at the appropriate stages of FL training; and $i i i$ ) add the attack name to the corresponding enabler functions, i.e., is model poisoning attack(), is data poisoning attack (), and is data reconstruction attack (), within the FedAttacker class to ensure that the injected attacks are activated at the proper stages of FL training.
393
+
394
+ # C.2 INTEGRATION OF A NEW DEFENSE
395
+
396
+ To implement a self-designed defense mechanism, users should first determine the stages to inject the defense functions (i.e., before/on/after-aggregation), add a class for the new defense and implement the corresponding defense functions using the aforementioned APIs, i.e., defend before aggregation $( * )$ , defend on aggregation $( * )$ , and defend after aggregation $( * )$ , to inject functions at appropriate stages of FL. Note that some defenses involve more than one stage; thus, users need to implement all relevant functions. Users should add the name of the defense to the enabler functions to activate the injected function at the different stages of FL. The approach computes some scores using local models submitted by clients, and uses the scores to identify outlier local models before aggregating the local models. As such process only happens before aggregation, we only need to implement defend before aggregation $( * )$ for the defense class, and include the name of the defense in is defense after aggregation().
397
+
398
+ # D MODELS AND DATASETS FOR EVALUATIONS
399
+
400
+ Models and datasets used in this work are given in Table 1.
401
+
402
+ Table 1: Models and datasets for evaluations.
403
+
404
+ <table><tr><td>Model</td><td>Dataset</td></tr><tr><td>ResNet20 (He et al., 2016)</td><td>CIFAR10 (Krizhevsky et al., 2009)</td></tr><tr><td>ResNet56 (He et al., 2016)</td><td>CIFAR100 (Krizhevsky et al., 2009)</td></tr><tr><td>CNN (McMahan et al., 2017a)</td><td>FEMNIST (Caldas et al., 2018)</td></tr><tr><td>RNN (bi-LSTM) (McMahan et al., 2017a)</td><td>Shakespeare (McMahan et al., 2017b)</td></tr><tr><td>BERT (Devlin et al., 2018)</td><td>20News (Lang, 1995)</td></tr><tr><td>Pythia-1B (Biderman et al., 2023)</td><td>PubMedQA (Luo et al., 2022)</td></tr></table>
405
+
406
+ # E SUPPLEMENTARY EXPERIMENT
407
+
408
+ In this section, to demonstrate the scalability of our benchmark, we include an experiment using real-world devices, instead of simulations.
409
+
410
+ Exp10: Evaluations in real-world applications. We utilize edge devices from the Theta network (Theta Network., 2023) to validate the scalability of FedSecurity to real-world applications. The FL client package is integrated into Theta’s edge nodes, which periodically fetches data from the Theta back-end. Subsequently, the FL training platform capitalizes on these Theta edge nodes and their associated data to train, fine-tune, and deploy machine learning models.
411
+
412
+ We select $m$ -Krum as the defense and the Byzantine attack of random mode as the attack. Considering the challenges posed by real-world environments, such as devices equipped solely with CPUs (lacking GPUs), potential device connectivity issues, network latency, and limited storage on edge devices (for instance, some mobile devices might have less than 500MB of available storage), we choose a simple task by employing the MNIST dataset for a logistic regression task.
413
+
414
+ In our experimental setup, we deploy 70 client edge devices, designating 7 of these as malicious for each FL training round. For $m$ -Krum, we set $m$ to 35, meaning that 35 out of the 70 local models are involved in aggregation during each FL training round. As illustrated in Figure 18, $m$ -Krum mitigates the adversarial effect of the random-mode Byzantine attack. We also include a screenshot of the platform, as shown in Figure 16 for the FL training process and Figure 17 for the training status of each device.
415
+
416
+ ![](images/7f6d350ff69f3b70e6de77593556957ac3b926fa80ebc03790240f1d8abfc05c.jpg)
417
+ Figure 16: Real-world application. Yellow: aggregation server waiting time; pink: aggregation time; green: client training time; blue: client communication.
418
+
419
+ ![](images/6014703f26aa4e23c11660e3d02805e95791a3a058e3175c01323d93792a8523.jpg)
420
+
421
+ Figure 17: Real-world application: training status of devices.
422
+
423
+ ![](images/3b5c8133d5c084d139926f3204f6e019f7df6596c6f717c601296314db4376ef.jpg)
424
+ Figure 18: $m$ -Krum against random-mode Byzantine attack in a real-world application.
parse/test/DY6uhcv4Xm/DY6uhcv4Xm_content_list.json ADDED
@@ -0,0 +1,912 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "FEDSECURITY: A BENCHMARK FOR ATTACKS AND DEFENSES IN FEDERATED LEARNING AND FEDERATED LLMS ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Anonymous authors Paper under double-blind review ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "ABSTRACT ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "This paper introduces FedSecurity, an end-to-end benchmark designed to simulate adversarial attacks and corresponding defense mechanisms in Federated Learning (FL). FedSecurity comprises two major components: FedAttacker, which simulates attacks injected during FL training, and FedDefender, which simulates defensive mechanisms to mitigate the impacts of the attacks. FedSecurity is opensource and can be customized to cover a wide range of machine learning models (e.g., Logistic Regression, ResNet, and GAN) and federated optimizers (e.g., FedAVG, FedOPT, and FedNOVA). We also demonstrate the use of FedSecurity during federated training of Large Language Models (LLMs), showcasing its adaptability and applicability in more complex scenarios. ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "1 INTRODUCTION ",
27
+ "text_level": 1,
28
+ "page_idx": 0
29
+ },
30
+ {
31
+ "type": "text",
32
+ "text": "Federated Learning (FL) (McMahan et al., 2017a) facilitates training across distributed data and empowers individual clients to utilize their local data to collaboratively train machine learning models. Instead of sending their local data to a centralized server, FL clients train models on their local data and share the local models with the FL server, which aggregates the local models into a global model. This global model is redistributed to the clients, enabling the clients to further fine-tune the model using their local data. ",
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "FL maintains the privacy and security of client data by allowing clients to train locally without spreading their data to other parties. As a result of its privacy-preserving nature, FL has attracted considerable attention across various domains and has been utilized in numerous areas such as nextword prediction (Hard et al., 2018; Chen et al., 2019; Ramaswamy et al., 2019), hot-word detection (Leroy et al., 2019), financial risk assessment (Byrd & Polychroniadou, 2020), and cancer risk prediction (Chowdhury et al., 2022), demonstrating its wide-ranging versatility. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "text",
42
+ "text": "Recently, FL has found applications in large language models (LLMs) which expands its use cases. Referred to as federated LLMs, these models utilize FL during pre-training and finetuning as well as for prompt engineering (Chen et al., 2023). Currently, there are industry products that utilize FL (or distributed training) to train LLMs, including Deepspeed ZeRO (Rajbhandari et al., 2020; Wang et al., 2023), HuggingFace Accelerate (Gugger, 2021), Pytorch Lightning Fabric (Antiga, 2023). FL can facilitate LLM training due to the following reasons: i) Distributed nature of LLM training data: LLMs are pre-trained using large amounts of data, which often reside in different locations. Collecting such data to a central server is expensive and may also leak sensitive user information, while a viable way is to train LLMs in a federated manner. ii) Scalability and efficiency: LLMs, such as GPT-3 (Brown et al., 2020), have an extremely large number of parameters. Training LLMs on a single machine is infeasible and inflexible, while FL can be a good choice. iii) Continuous improvement with user data: LLMs can be deployed in a federated manner and local instances of the models can be further finetuned based on the local data, enabling the global model to improve over time based on users’ data without ever having direct access to that data. This is particularly relevant for privacy-sensitive fields such as healthcare or personal communications. ",
43
+ "page_idx": 0
44
+ },
45
+ {
46
+ "type": "text",
47
+ "text": "Even though FL does not require sharing raw data with others, its decentralized and collaborative nature might inadvertently introduce privacy and security vulnerabilities. In recent years, a burgeoning body of research has spotlighted various attack mechanisms in FL (Bhagoji et al., 2019; ",
48
+ "page_idx": 0
49
+ },
50
+ {
51
+ "type": "text",
52
+ "text": "Xie et al., 2019; Lam et al., 2021; Jin et al., 2021; Tomsett et al., 2019; Chen et al., 2017; Fang et al., 2020; Tolpegin et al., 2020; Zhu et al., 2019; Bagdasaryan et al., 2020; Zhang et al., 2022a; Kariyappa et al., 2022; Zhang et al., 2022b), where adversarial clients might submit spurious models to disrupt the global model from converging, or sabotage the global model to misidentify particular data samples by planting backdoors. Meanwhile, a wide range of defense mechanisms has emerged to mitigate the impact of these attacks (Li et al., 2022; Kumari et al., 2023; Sun et al., 2019; Ozdayi et al., 2021; Blanchard et al., 2017; Xie et al., 2020; Chen et al., 2017; Sun et al., 2019; Karimireddy et al., 2020; Yin et al., 2018; Pillutla et al., 2022; Fung et al., 2020; Xie et al., 2021; Yin et al., 2018; Ma et al., 2022; Kumar et al., 2022; Chen et al., 2022). Despite the efforts for addressing the vulnerability of FL systems, there still lacks a comprehensive benchmark for comparing approaches under unified sittings. Moreover, existing research has not yet investigated applying the attack and defense mechanisms to federated LLMs. In contrast to traditional small models, LLMs are distinguished by the large number of parameters and complex training datasets obtained from unregulated sources, which could introduce challenges when applying attacks and defenses on top of them. These motivate a need for a standardized and comprehensive benchmark to assess baseline attack and defense mechanisms in the context of FL and federated LLMs. ",
53
+ "page_idx": 1
54
+ },
55
+ {
56
+ "type": "text",
57
+ "text": "To this end, this paper introduces FedSecurity, a benchmark that simulates attacks and defenses in FL.1 FedSecurity comprises two primary components: FedAttacker and FedDefender. FedAttacker simulates attacks in FL to help understand and prepare for potential security risks, while FedDefender is equipped with various defense mechanisms to counteract the threats injected by FedAttacker.Besides small model tasks, we also apply FedSecurity to federated LLMs. Our contributions are summarized as follows: ",
58
+ "page_idx": 1
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "i) Enabling benchmarking of various attacks and defenses in FL. FedSecurity implements attacks that are widely considered in the literature, including Byzantine attacks of random/zero/flipping modes (Chen et al., 2017; Fang et al., 2020), label flipping backdoor attack (Tolpegin et al., 2020), deep leakage gradient (Zhu et al., 2019), and model replacement backdoor attack (Bagdasaryan et al., 2020). Some of the well-known defense mechanisms supported include Norm Clipping (Sun et al., 2019), Robust Learning Rate (Ozdayi et al., 2021), Krum (and $m$ - Krum) (Blanchard et al., 2017), SLSGD (Xie et al., 2020), geometric median (Chen et al., 2017), weak DP (Sun et al., 2019), CClip (Karimireddy et al., 2020), coordinate-wise median (Yin et al., 2018), RFA (Pillutla et al., 2022), Foolsgold (Fung et al., 2020), CRFL (Xie et al., 2021), and coordinate-wise trimmed mean (Yin et al., 2018). ",
63
+ "page_idx": 1
64
+ },
65
+ {
66
+ "type": "text",
67
+ "text": "ii) Flexible configuration. FedSecurity supports configurations using a .yaml file. Users can utilize two parameters, “enable attack” and “enable defense”, to activate FedAttacker and FedDefender. Sample configurations are respectively shown in Figures 14 and Figures 15of Appendix A. ",
68
+ "page_idx": 1
69
+ },
70
+ {
71
+ "type": "text",
72
+ "text": "iii) Supporting customization of attack and defense mechanisms. We provide APIs in FedSecurity to enable users to integrate user-defined attacks and defenses in addition to the default baseline attack and defense mechanisms included in FedSecurity. ",
73
+ "page_idx": 1
74
+ },
75
+ {
76
+ "type": "text",
77
+ "text": "iv) Supporting various models and FL optimizers. FedSecurity can be utilized with a wide range of models, including Logistic Regression, LeNet (LeCun et al., 1998), ResNet (He et al., 2015), CNN (LeCun et al., 1989), RNN (Rumelhart et al., 1986), GAN (Goodfellow et al., 2014), and so on. FedSecurity is compatible with various FL optimizers, such as FedAVG (McMahan et al., 2016), FedSGD (Shokri & Shmatikov, 2015), FedOPT (Reddi et al., 2021), FedPROX (Li et al., 2020), FedGKT (He et al., 2020), FedGAN (Rasouli et al., 2020), FedNAS (He et al., 2021), FedNOVA (Wang et al., 2020b), and so on. ",
78
+ "page_idx": 1
79
+ },
80
+ {
81
+ "type": "text",
82
+ "text": "v) Extensions to federated LLMs and real-world applications. FedSecurity is suitable for demonstrating attacks and defenses during training of federated LLMs (Section 5.2). We also include a real-world experiment, where we use edge devices for FL with FedSecurity instead of simulations (Appendix E). These show the adaptability of the proposed FedSecurity benchmark. ",
83
+ "page_idx": 1
84
+ },
85
+ {
86
+ "type": "text",
87
+ "text": "Key takeaways: i) Byzantine attack of random mode (Chen et al., 2017; Fang et al., 2020) is effective in decreasing the test accuracy of the global model, and $m$ -Krum (Blanchard et al., 2017) can produce robust results against various attacks; $i i )$ ) while introducing a defense mechanism can help mitigate attacks, it might also affect the aggregation results, potentially compromising the model’s performance. However, in actual FL systems, attacks are infrequent. Therefore, it’s crucial to weigh the benefits against potential drawbacks before integrating a defense mechanism into real systems. ",
88
+ "page_idx": 1
89
+ },
90
+ {
91
+ "type": "text",
92
+ "text": "",
93
+ "page_idx": 2
94
+ },
95
+ {
96
+ "type": "text",
97
+ "text": "2 PRELIMINARIES AND OVERVIEW ",
98
+ "text_level": 1,
99
+ "page_idx": 2
100
+ },
101
+ {
102
+ "type": "text",
103
+ "text": "In this section, we first discuss the related literature and introduce adversarial models considered in FedSecurity. Then we present an overview of FedSecurity. ",
104
+ "page_idx": 2
105
+ },
106
+ {
107
+ "type": "text",
108
+ "text": "2.1 RELATED WORKS ",
109
+ "text_level": 1,
110
+ "page_idx": 2
111
+ },
112
+ {
113
+ "type": "text",
114
+ "text": "Recent years, various benchmarks have been introduced for FL, such as TensorFlow Federated (Abadi et al., 2015), PySyft (Ziller et al., 2021), FATE (Liu et al., 2021), Flower (Beutel et al., 2020), FedScale (Lai et al., 2022), NVIDIA FLARE (Roth et al., 2022), OpenFL (Reina et al., 2021), Fed-BioMed (Silva et al., 2020), IBM Federated Learning (Ludwig et al., 2020), FederatedScope (Xie et al., 2022), and FLUTE (Dimitriadis et al., 2022). Among these, only FederatedScope delves into the implications of adversarial attacks in FL, with a focus on data reconstruction attacks that utilize models or gradients to revert sensitive information, including GAN-based leakage attack (Hitaj et al., 2017), Passive Property Inference (Melis et al., 2019), and DLG attack (Zhu et al., 2019). However, FederatedScope neglects to address attacks prevalent in the research literature, e.g., Byzantine attacks (Yin et al., 2018; Yang et al., Dec 2019). It also does not include any defense mechanisms for FL. It is worth noting that, while FederatedScope integrates secret-sharing (Beimel, 2011), it is in the scope of federated analytics (Elkordy et al., 2023; Ramage, 2020; Wang et al., 2022a; Jung et al., 2012), instead of FL. ",
115
+ "page_idx": 2
116
+ },
117
+ {
118
+ "type": "text",
119
+ "text": "FedSecurity implements attacks that are widely considered in the literature (Yin et al., 2018; Tolpegin et al., 2020; Zhu et al., 2019); it also integrates a wide range of defense mechanisms (Sun et al., 2019; Ozdayi et al., 2021; Blanchard et al., 2017; Xie et al., 2020; Chen et al., 2017; Sun et al., 2019; Karimireddy et al., 2020; Yin et al., 2018; Pillutla et al., 2022; Fung et al., 2020; Xie et al., 2021; Yin et al., 2018). Designed with flexibility in mind, FedSecurity offers configurable settings and APIs, enabling users to customize their attack and defense mechanisms. ",
120
+ "page_idx": 2
121
+ },
122
+ {
123
+ "type": "text",
124
+ "text": "2.2 ADVERSARIAL MODEL ",
125
+ "text_level": 1,
126
+ "page_idx": 2
127
+ },
128
+ {
129
+ "type": "text",
130
+ "text": "Real-world adversaries in FL systems fall into two categories: active and passive adversaries. ",
131
+ "page_idx": 2
132
+ },
133
+ {
134
+ "type": "text",
135
+ "text": "Active Adversaries. Active adversaries intentionally manipulate training data or trained models to achieve malicious goals. This might involve altering models to prevent global model convergence (e.g., Byzantine attacks (Chen et al., 2017; Fang et al., 2020)), or subtly misclassifying a specific set of samples to minimally impact the overall performance of the global model (e.g., backdoor attacks (Bagdasaryan et al., 2020; Wang et al., 2020a; Zhang et al., 2022a)). Active adversaries can take various forms, including: 1) malicious clients who manipulate their local models (Bagdasaryan et al., 2020; Chen et al., 2017; Fang et al., 2020; Zhang et al., 2022a) or submit contrived models without actual training (Wang, 2022); 2) a global “sybil” (Tolpegin et al., 2020; Fung et al., 2020) that has full access to the FL system and possesses complete knowledge of the entire system, including local and global models for each training round and clients’ local datasets. This “sybil” may also modify data within the FL system, such as clients’ local datasets and their submitted local models; and 3) external adversaries capable of monitoring the communication channel between clients and the server, thereby intercepting and altering local models during the transfer process. ",
136
+ "page_idx": 2
137
+ },
138
+ {
139
+ "type": "text",
140
+ "text": "Passive Adversaries. Passive adversaries do not modify data or models, but may still pose a threat to data privacy by potentially deducing sensitive information (such as local training data) from revealed models (gradients, or model updates) (Zhu et al., 2019). Examples of passive adversaries include: 1) an adversarial FL server attempting to infer local training data using submitted local models; 2) adversarial FL clients trying to deduce other clients’ training data using the global model provided by the server; and 3) external adversaries, e.g., hackers, that access communication channels to acquire local and global models transferred between clients and the FL server. ",
141
+ "page_idx": 2
142
+ },
143
+ {
144
+ "type": "text",
145
+ "text": "The adversaries can inject attacks at different stages of FL training. In summary, active adversaries can conduct attacks that modify local models (model poisoning attacks) or poison local datasets (data poisoning attack), while passive adversaries can infer sensitive information, such as user data, based on the models or gradients they observe (data reconstruction attacks). In the next subsection, we illustrate how to inject those attacks at different stages of FL frameworks. ",
146
+ "page_idx": 2
147
+ },
148
+ {
149
+ "type": "image",
150
+ "img_path": "images/bb67fb35fb53787a89c07fa7e6657358335b88adff6e7da32c87857a8d68319b.jpg",
151
+ "image_caption": [
152
+ "Figure 1: FedSecurity overview. FedSecurity enables injecting attacks (shown in red) and defenses (shown in green) at various stages of FL training at the clients and at the server. "
153
+ ],
154
+ "image_footnote": [],
155
+ "page_idx": 3
156
+ },
157
+ {
158
+ "type": "text",
159
+ "text": "",
160
+ "page_idx": 3
161
+ },
162
+ {
163
+ "type": "text",
164
+ "text": "2.3 OVERVIEW OF FEDSECURITY ",
165
+ "text_level": 1,
166
+ "page_idx": 3
167
+ },
168
+ {
169
+ "type": "text",
170
+ "text": "FedSecurity serves as an external component that injects attacks and defense mechanisms at different stages of training without altering the existing processes in FL. FedSecurity utilizes FedAttacker and FedDefender to initiate two instances and simulate attacks and defenses, respectively. The two instances are initialized once and are accessible by other objects in the FL system2. ",
171
+ "page_idx": 3
172
+ },
173
+ {
174
+ "type": "text",
175
+ "text": "Injection of attacks. Without loss of generality, we classify the attacks in FL into the following three categories based on the targets of the attacks: ",
176
+ "page_idx": 3
177
+ },
178
+ {
179
+ "type": "text",
180
+ "text": "i) Data poisoning attacks that are conducted by active adversaries to modify clients’ local datasets and are injected at clients (Tolpegin et al., 2020; Dang et al., 2021). ",
181
+ "page_idx": 3
182
+ },
183
+ {
184
+ "type": "text",
185
+ "text": "ii) Model poisoning attacks that are also conducted by active adversaries to temper with local models submitted by clients (Fang et al., 2020; Shejwalkar & Houmansadr, 2021; Bhagoji et al., 2019). FedAttacker injects these attacks before the aggregation of local models in each FL training round at the server, so that it can get access to all client models submitted in that training round. ",
186
+ "page_idx": 3
187
+ },
188
+ {
189
+ "type": "text",
190
+ "text": "iii) Data reconstruction attacks that are conducted by passive adversaries by exploring local models or updates to infer information about the training data (Melis et al., 2018; Zhang et al., 2020; Luo et al., 2021; Wang et al., 2022b; Fowl et al., 2021). FedAttacker injects such attacks at the FL server, as the FL server has access to all local models and the global model of each iteration, and can perform the attacks with flexibility. ",
191
+ "page_idx": 3
192
+ },
193
+ {
194
+ "type": "text",
195
+ "text": "Injection of defenses. FedDefender integrates defenses to mitigate, if not completely nullify, the impacts of the injected attacks. Since the defenses either address issues related to tampered local models by active adversaries3 or prevent adversaries from deducing information from the local/global models shared between clients and the FL server, FedDefender deploys defenses at the FL server to get access to all local models and global models in each FL training round. For this, FedDefender can inject three functions at different stages of FL aggregation: ",
196
+ "page_idx": 3
197
+ },
198
+ {
199
+ "type": "text",
200
+ "text": "i) Before-aggregation functions that modify local models submitted by clients. ",
201
+ "page_idx": 3
202
+ },
203
+ {
204
+ "type": "text",
205
+ "text": "ii) On-aggregation functions that modify the FL aggregation function to mitigate the impacts of local models submitted by adversarial clients. ",
206
+ "page_idx": 3
207
+ },
208
+ {
209
+ "type": "text",
210
+ "text": "iii) After-aggregation functions that modify the aggregated global model (e.g., by adding noise or clipping) to protect the real global model or improve its quality. ",
211
+ "page_idx": 3
212
+ },
213
+ {
214
+ "type": "text",
215
+ "text": "Figure 1 summarizes the injections of attacks and defenses to the FL framework in FedSecurity. We also provide detailed algorithms for injecting attacks and defenses to different stages of FL training, as shown in Algorithm 1 (for server aggregation) and Algorithm 2 (for client training) in Appendix B. Below, we explain the implementations of attacks and defenses in detail. ",
216
+ "page_idx": 3
217
+ },
218
+ {
219
+ "type": "text",
220
+ "text": "3 IMPLEMENTATION OF ATTACKS IN FEDATTACKER ",
221
+ "text_level": 1,
222
+ "page_idx": 4
223
+ },
224
+ {
225
+ "type": "text",
226
+ "text": "FedAttacker injects model poisoning, data poisoning, and data reconstruction attacks at different stages of FL training and provides APIs for these attacks. We present each class of attacks and defer the user integration of a new attack to FedSecurity to Appendix C.1 due to space limitations. ",
227
+ "page_idx": 4
228
+ },
229
+ {
230
+ "type": "text",
231
+ "text": "3.1 MODEL POISONING ATTACKS ",
232
+ "text_level": 1,
233
+ "page_idx": 4
234
+ },
235
+ {
236
+ "type": "text",
237
+ "text": "Model poisoning attacks are designed to modify the local models submitted by clients. FedAttacker injects such attacks before FL aggregation in each iteration, modifying each local model directly. Model poisoning attacks implemented in FedAttacker include Byzantine attacks (Chen et al., 2017; Fang et al., 2020) of three different modes and the model replacement backdoor attack (Bagdasaryan et al., 2020). For example, FedAttacker implements three modes of Byzantine attacks, as follows: ",
238
+ "page_idx": 4
239
+ },
240
+ {
241
+ "type": "text",
242
+ "text": "• Zero mode that poisons the client models by setting their weights to zero. • Random mode that manipulates client models by attributing random values to model weights. • Flipping mode that updates the global model in the opposite direction by formulating a poisoned local model based on the global model ${ \\bf w } _ { g }$ and the real local model $\\mathbf { W } _ { \\ell }$ as $\\mathbf { w } _ { g } + ( \\mathbf { w } _ { g } - \\mathbf { w } _ { \\ell } )$ . ",
243
+ "page_idx": 4
244
+ },
245
+ {
246
+ "type": "text",
247
+ "text": "APIs for Model Poisoning Attacks. FedAttacker has two APIs for model poisoning attacks. ",
248
+ "page_idx": 4
249
+ },
250
+ {
251
+ "type": "text",
252
+ "text": "• poison model(local models, auxiliary info), which takes the local models submitted by clients in the current FL iteration and modifies the local models. The input local models is a list of tuples containing the number of data samples and the submitted client models. The input auxiliary info is any information used in the defense, e.g., the global model in the last FL iteration. • is model poisoning attack(), which checks whether the attack component is activated and whether the attack modifies local models. ",
253
+ "page_idx": 4
254
+ },
255
+ {
256
+ "type": "text",
257
+ "text": "3.2 DATA POISONING ATTACKS ",
258
+ "text_level": 1,
259
+ "page_idx": 4
260
+ },
261
+ {
262
+ "type": "text",
263
+ "text": "Data poisoning attacks modify (or poison) local datasets of some clients to achieve some malicious goals, e.g., degrading the performance of the global model or inducing the global model to misclassify some samples. As an example, in label flipping attack (Tolpegin et al., 2020), a global “sybil” controls some clients and modifies their local data by mislabeling samples of some classes to wrong classes. Given a source class (or label) $c _ { s }$ and a target class $c _ { t }$ , the local dataset of each poisoned client is modified such that all samples with class $c _ { s }$ are now associated with an incorrect label $c _ { t }$ . ",
264
+ "page_idx": 4
265
+ },
266
+ {
267
+ "type": "text",
268
+ "text": "APIs for Data Poisoning Attacks. FedAttacker has two APIs for data poisoning attacks. ",
269
+ "page_idx": 4
270
+ },
271
+ {
272
+ "type": "text",
273
+ "text": "• poison data(dataset), which takes a local dataset and mislabels a set of chosen samples based on the clients’ (or attackers’) requirements, which are included in the configuration. Normally, clients would change labels of a specific subset of samples to some other labels in the same dataset, or label a set of samples to new classes that do not exist in the dataset. \n• is data poisoning attack(), which examines whether FedAttacker is enabled and whether the attack requires poisoning the datasets. ",
274
+ "page_idx": 4
275
+ },
276
+ {
277
+ "type": "text",
278
+ "text": "3.3 DATA RECONSTRUCTION ATTACKS ",
279
+ "text_level": 1,
280
+ "page_idx": 4
281
+ },
282
+ {
283
+ "type": "text",
284
+ "text": "Data reconstruction attacks are performed by passive adversaries that attempts to infer sensitive information without actively interfering with the FL training or the local data. We assume that there is no leakage during the local training process in FL, as clients are on their fully trusted local machines. Thus, data reconstruction attacks take the trained models (either the global model or the local models) to revert training data. For example, Deep Leakage from Gradients (DLG) attack (Zhu et al., 2019) infers local training data from the publicly shared gradients. A passive adversary can use the global model from the previous FL training round and the newly obtained model to compute a “model update” between models in different FL training rounds to deduce the training data. ",
285
+ "page_idx": 4
286
+ },
287
+ {
288
+ "type": "text",
289
+ "text": "APIs for Data Reconstruction Attacks. We have two APIs for data reconstruction attacks. ",
290
+ "page_idx": 4
291
+ },
292
+ {
293
+ "type": "text",
294
+ "text": "• reconstruct data(model, auxiliary info), which takes a client model or a global model to reconstruct the training data. It also takes some extra information (auxiliary info) to help infer. ",
295
+ "page_idx": 4
296
+ },
297
+ {
298
+ "type": "text",
299
+ "text": "• is data reconstruction attack(), which examines whether the attack component is enabled and whether the attack requires reconstructing training data using the trained models. ",
300
+ "page_idx": 5
301
+ },
302
+ {
303
+ "type": "text",
304
+ "text": "4 IMPLEMENTATION OF DEFENSES IN FEDDEFENDER ",
305
+ "text_level": 1,
306
+ "page_idx": 5
307
+ },
308
+ {
309
+ "type": "text",
310
+ "text": "FedDefender injects defense functions at different stages of FL aggregation at the server. Based on the point of injection, FedDefender provides three types of functions to support defense mechanisms, including 1) before-aggregation, 2) on-aggregation, and 3) after-aggregation. Note that a defense may inject functions at one or multiple stages of FL aggregation. ",
311
+ "page_idx": 5
312
+ },
313
+ {
314
+ "type": "text",
315
+ "text": "4.1 BEFORE-AGGREGATION DEFENSES ",
316
+ "text_level": 1,
317
+ "page_idx": 5
318
+ },
319
+ {
320
+ "type": "text",
321
+ "text": "Before-aggregation functions operate on local models of each FL training iteration to mitigate (or eliminate) the impacts of potential attacks. We use Krum (Blanchard et al., 2017) as an example. ",
322
+ "page_idx": 5
323
+ },
324
+ {
325
+ "type": "text",
326
+ "text": "Krum. Krum (Blanchard et al., 2017) tolerates $f$ Byzantine clients among $n$ clients by retaining only one local model that is the most likely to be benign as the global model. That is, Krum selects a single model as the global model in aggregation. A generalization of Krum is $m$ -Krum (Blanchard et al., 2017) that selects $m$ client models with the $m$ lowest scores for aggregation, instead of choosing only one local model. This approach requires less than $\\textstyle { \\frac { n - m } { 2 } } - 1$ clients to be malicious. ",
327
+ "page_idx": 5
328
+ },
329
+ {
330
+ "type": "text",
331
+ "text": "APIs for before-aggregation functions. We provide two APIs for before-aggregation functions: ",
332
+ "page_idx": 5
333
+ },
334
+ {
335
+ "type": "text",
336
+ "text": "• defend before aggregation(local models, auxiliary info), which modifies the client models of the current FL iteration. The input local models is a list of tuples that contain the number of samples and the local model submitted by each client in the current FL iteration. The input auxiliary info can be any information that is utilized in the defense functions. • is defense before aggregation(), which checks whether the FedDefender is activated and whether the defense requires injecting functions before aggregating local models at the server. ",
337
+ "page_idx": 5
338
+ },
339
+ {
340
+ "type": "text",
341
+ "text": "4.2 ON-AGGREGATION DEFENSES ",
342
+ "text_level": 1,
343
+ "page_idx": 5
344
+ },
345
+ {
346
+ "type": "text",
347
+ "text": "On-aggregation defense functions modify the aggregation function to a robust version that tolerates or mitigates impacts of the potential adversarial client models. As an example, RFA (Robust Federated Aggregation) (Pillutla et al., 2022) computes a geometric median of the client models in each iteration as the aggregated model, instead of simply averaging the client models. RFA defense effectively mitigates the impact of poisoned client models, as the geometric median can represent the central tendency of the client models, and the median point is chosen in a way to minimize the sum of distances between that point and the other client models of the current FL iteration. In practice, the geometric median is calculated using the Smoothed Weiszfeld Algorithm (Pillutla et al., 2022). ",
348
+ "page_idx": 5
349
+ },
350
+ {
351
+ "type": "text",
352
+ "text": "APIs for on-aggregation defenses. We provide two APIs for on-aggregation defense functions: ",
353
+ "page_idx": 5
354
+ },
355
+ {
356
+ "type": "text",
357
+ "text": "• defend on aggregation(local models, auxiliary info), which takes the local models of the current training round for aggregation. The input local models is a list of tuples that contain the number of samples and the local model submitted by each client in the current FL iteration. The input auxiliary info can include any information required by the defense functions. • is defense on aggregation(), which checks if the defense component is enabled and whether the current defense requires the injection of functions during aggregation. ",
358
+ "page_idx": 5
359
+ },
360
+ {
361
+ "type": "text",
362
+ "text": "4.3 AFTER-AGGREGATION DEFENSE ",
363
+ "text_level": 1,
364
+ "page_idx": 5
365
+ },
366
+ {
367
+ "type": "text",
368
+ "text": "After-aggregation defense functions modify the aggregation result, i.e., the global model, of each FL iteration to mitigate the effects of poisoned local models or protect the global model from potential adversaries. As an example, CRFL (Xie et al., 2021) clips the global model to bound the norm of the model each time after aggregation at the FL server. The FL server then adds Gaussian noise to the clipped global model before distributing the global model to the clients for the next FL iteration. ",
369
+ "page_idx": 5
370
+ },
371
+ {
372
+ "type": "text",
373
+ "text": "APIs for After-Aggregation Defenses. We provide two APIs to support after-aggregation defenses: ",
374
+ "page_idx": 5
375
+ },
376
+ {
377
+ "type": "image",
378
+ "img_path": "images/15f297abedef89493dc0e7ac1efbba6bd0a947269ea315da6233e5fe98dbf3ab.jpg",
379
+ "image_caption": [
380
+ "Figure 2: Attack comparison. "
381
+ ],
382
+ "image_footnote": [],
383
+ "page_idx": 6
384
+ },
385
+ {
386
+ "type": "image",
387
+ "img_path": "images/4fbaee8bcca5e27bee31ce1500de685440dd710e6f50bb857cf404c715adc484.jpg",
388
+ "image_caption": [
389
+ "Figure 3: Defense comparison. "
390
+ ],
391
+ "image_footnote": [],
392
+ "page_idx": 6
393
+ },
394
+ {
395
+ "type": "image",
396
+ "img_path": "images/04b67fd6e3609497a5cf010b549dcd31fe489ea6f6d0e9826dbd5c6b89436f18.jpg",
397
+ "image_caption": [
398
+ "Figure 4: Label flipping exps. "
399
+ ],
400
+ "image_footnote": [],
401
+ "page_idx": 6
402
+ },
403
+ {
404
+ "type": "image",
405
+ "img_path": "images/7730f303b59dcaf3d688af12d6a95cb41d5ab186d9a138bbe7fbd2e80b55dbb5.jpg",
406
+ "image_caption": [],
407
+ "image_footnote": [],
408
+ "page_idx": 6
409
+ },
410
+ {
411
+ "type": "image",
412
+ "img_path": "images/905a07cd1af9f124500c6760faf9c098d81e0193750ac7c98b22fb85b0826f3c.jpg",
413
+ "image_caption": [
414
+ "Figure 5: Random-Byzantine exps. Figure 6: I.I.D. data evaluations. "
415
+ ],
416
+ "image_footnote": [],
417
+ "page_idx": 6
418
+ },
419
+ {
420
+ "type": "image",
421
+ "img_path": "images/dc0fc5b58db645e0bb3a0d1a0e2a031a4463962cb68d38f12a989ad1f7a5155d.jpg",
422
+ "image_caption": [
423
+ "Figure 7: Scale # clients to 100. "
424
+ ],
425
+ "image_footnote": [],
426
+ "page_idx": 6
427
+ },
428
+ {
429
+ "type": "text",
430
+ "text": "• defend after aggregation(global model), which directly modifies the global model after aggre \ngation using methods such as clipping or adding noise. \n• is defense after aggregation(), which checks if the defense component is activated and whether the current defense requires injecting functions after aggregation. ",
431
+ "page_idx": 6
432
+ },
433
+ {
434
+ "type": "text",
435
+ "text": "5 EXPERIMENTAL EVALUATIONS ",
436
+ "text_level": 1,
437
+ "page_idx": 6
438
+ },
439
+ {
440
+ "type": "text",
441
+ "text": "This section presents a comprehensive evaluation of FedSecurity to benchmark some of the wellknown attack and defense mechanisms in FL. ",
442
+ "page_idx": 6
443
+ },
444
+ {
445
+ "type": "text",
446
+ "text": "Experimental setting. A summary of datasets and models for evaluations can be found in Table 1 in Appendix D. By default, we employ ResNet20 and the non-i.i.d. CIFAR10 dataset (partition parameter $\\alpha = 0 . 5$ ), as the non-i.i.d. setting closely captures real-world scenarios. We further extend our evaluations to i.i.d. cases and various other models and datasets. For evaluations on LLMs, we utilize FedLLM (FedML Inc., 2023) that trains LLMs in a federated manner. We employ the Pythia1B model (Biderman et al., 2023) and PubMedQA (Jin et al., 2019), a non-i.i.d. biomedical research dataset that contains 212,269 questions for question answering. We utilize the “artificial” subset for training and the “labelled” subset for testing. We utilize FedAVG in our experiments. Evaluations are conducted on a server with 8 NVIDIA A100-SXM4-80GB GPUs. ",
447
+ "page_idx": 6
448
+ },
449
+ {
450
+ "type": "text",
451
+ "text": "5.1 EVALUATIONS ON FL ",
452
+ "text_level": 1,
453
+ "page_idx": 6
454
+ },
455
+ {
456
+ "type": "text",
457
+ "text": "Unless otherwise noted, we use 10 clients, set the percentage of malicious clients to $10 \\%$ , and evaluate results with the accuracy of the global model. We employ three attack mechanisms, including label flipping attacks and Byzantine attacks of random mode and flipping mode. For the label flipping attack, we set the attack to modify the local and test data labels of malicious clients from label 3 to label 9 and label 2 to label 1. We utilize three defense mechanisms: $m$ -Krum (Blanchard et al., 2017), Foolsgold (Fung et al., 2020), and RFA (Pillutla et al., 2022). For $m$ -Krum, we set $m$ to 5, which means 5 out of 10 submitted local models participate in aggregation in each training round. ",
458
+ "page_idx": 6
459
+ },
460
+ {
461
+ "type": "text",
462
+ "text": "Exp 1: Attack Comparisons. This experiment evaluates the impact of various attacks on test accuracy, using a no-attack scenario as a baseline. As illustrated in Figure 2, Byzantine attacks, specifically in the random and zero modes, substantially degrade accuracy. In contrast, the label flipping attack and the flipping mode of the Byzantine attack show a milder impact on accuracy. This can be attributed to the nature of Byzantine attacks, where Byzantine attackers would prevent the global model from converging, especially for the random mode that generates weights for models arbitrarily, causing the most significant deviation from the benign local model. In subsequent experiments, unless specified otherwise, we employ the Byzantine attack in the random mode as the default attack, as it provides the strongest impact compared with the other three attacks. ",
463
+ "page_idx": 6
464
+ },
465
+ {
466
+ "type": "text",
467
+ "text": "",
468
+ "page_idx": 7
469
+ },
470
+ {
471
+ "type": "text",
472
+ "text": "Exp 2: Defense Comparisons. This experiment investigates the potential impact of defense mechanisms on accuracy in the absence of attacks, i.e., whether defense mechanisms inadvertently degrade accuracy when all clients are benign. We incorporate a scenario without any defense or attack as our baseline. As illustrated in Figure 3, it becomes evident that when all clients are benign, involving defense strategies to FL training might lead to a reduction in accuracy. This decrease might arise from several factors: the exclusion of some benign local models from aggregation, e.g., as in $m$ -Krum, adjustments to the aggregation function, e.g., as in RFA, or re-weighting local models, e.g., as in Foolsgold. Specifically, the RFA defense mechanism significantly impacts accuracy as it computes a geometric median of the local models instead of leveraging the original FedAVG optimizer, which introduces a degradation in accuracy. ",
473
+ "page_idx": 7
474
+ },
475
+ {
476
+ "type": "image",
477
+ "img_path": "images/2bbc4e4050a59de96408ec645c568926629ed9b4739655198eb8e1c03c116cf2.jpg",
478
+ "image_caption": [
479
+ "Figure 8: ResNet56 (CV). "
480
+ ],
481
+ "image_footnote": [],
482
+ "page_idx": 7
483
+ },
484
+ {
485
+ "type": "image",
486
+ "img_path": "images/1aa4894376006eed419999ad44f228fcdfa685d93411d0a8fc51ec6bb75b0568.jpg",
487
+ "image_caption": [
488
+ "Figure 9: RNN (NLP). "
489
+ ],
490
+ "image_footnote": [],
491
+ "page_idx": 7
492
+ },
493
+ {
494
+ "type": "image",
495
+ "img_path": "images/f3cb16940a8833c7ef42a11aff23c1f433582f06beb346d84504aba5eec8c919.jpg",
496
+ "image_caption": [
497
+ "Figure 10: CNN (CV). "
498
+ ],
499
+ "image_footnote": [],
500
+ "page_idx": 7
501
+ },
502
+ {
503
+ "type": "image",
504
+ "img_path": "images/23428eb5eaf13a1e2045a77a3d27b7a1c940145d4682aa6046a838d20a830c3d.jpg",
505
+ "image_caption": [
506
+ "Figure 11: Varying # adversaries. "
507
+ ],
508
+ "image_footnote": [],
509
+ "page_idx": 7
510
+ },
511
+ {
512
+ "type": "image",
513
+ "img_path": "images/0facfc5591d5cc9bb7212fca445d120834a6339ad16a187f6b01e060137deab1.jpg",
514
+ "image_caption": [
515
+ "Figure 12: BERT evaluations. "
516
+ ],
517
+ "image_footnote": [],
518
+ "page_idx": 7
519
+ },
520
+ {
521
+ "type": "image",
522
+ "img_path": "images/3ae2090bac0875c99d5eb9a39fc65e4753bb0ab2376b32f99d71c69d50ec6975.jpg",
523
+ "image_caption": [
524
+ "Figure 13: Pythia-1B evaluations. "
525
+ ],
526
+ "image_footnote": [],
527
+ "page_idx": 7
528
+ },
529
+ {
530
+ "type": "text",
531
+ "text": "Exp 3: Evaluations of defense mechanisms against activated attacks. This experiment evaluates the effect of defense mechanisms in the context of ongoing attacks. We include two baseline scenarios: 1) an “original attack” scenario with an activated attack without any defense in place, and 2) a “benign” scenario with no activated attack or defense. We select label flipping attack and the random mode of Byzantine attack based on their impacts in Exp1, where label flipping has the least impact and the random mode of Byzantine attack exhibits the largest impact, as shown in Figure 2. Results for the label flipping and the random mode of Byzantine attacks are in Figure 4 and Figure 5, respectively. These results indicate that the defenses may contribute to minor improvements in accuracy for low-impact attacks, e.g., Foolsgold in Figure 4. In certain cases, it is noteworthy that the defensive mechanisms may inadvertently compromise accuracy, such as the case with RFA in Figure 4. For high-impact attacks, such as the Byzantine attack of the random mode, Krum exhibits resilience, effectively neutralizing the negative impact of the attacks, as shown in Figure 5. ",
532
+ "page_idx": 7
533
+ },
534
+ {
535
+ "type": "text",
536
+ "text": "Exp 4: Evaluations on i.i.d. data. This experiment evaluates various defense mechanisms against an attack on i.i.d. data. We select the random mode of the Byzantine attack, and employ Foolsgold, $m$ -Krum $m = 5$ ), and RFA to counteract the adverse effects of this attack. As shown in Figure 6, $m$ -Krum is the most effective one among all the defense mechanisms, where the test accuracy is close to the case where all the FL clients are honest, i.e., no attack scenario. ",
537
+ "page_idx": 7
538
+ },
539
+ {
540
+ "type": "text",
541
+ "text": "Exp 5: Scaling the number of clients to 100. This experiment scales the number of clients to 100 and evaluates the defense mechanisms against the random mode of the Byzantine attack. We employ Foolsgold, $m$ -Krum (with $m = 5$ ), and RFA to counteract the adverse effects of this attack. As shown in Figure 7, $m$ -Krum is the most effective one among all the defense mechanisms, and the test accuracy is very close to the case where no attack happens. ",
542
+ "page_idx": 8
543
+ },
544
+ {
545
+ "type": "text",
546
+ "text": "Exp 6: Evaluations on different models. We evaluate defense mechanisms against the random mode of the Byzantine attack with different models and datasets, including: i) $\\mathrm { R e s N e t } 5 6 + \\mathrm { C I } -$ FAR100, ii) $\\mathrm { R N N } + \\mathfrak { s }$ Shakespeare, and $i i i$ ) CNN $^ +$ FEMNIST. The results are shown in Figures 8, 9, and 10, respectively. The results show that while the defense mechanisms can mitigate the impact of attacks in most cases, some attacks may fail some tasks, e.g., $m$ -Krum fails RNN in Figure 9, and Foolsgold fails CNN in Figure 10. This is because the two defense mechanisms either select several local models for aggregation in each FL training round, or significantly re-weight the local models, which may eliminate some local models that are important to the aggregation in the first several FL training iterations, leading to unchanged test accuracy in later FL iterations. ",
547
+ "page_idx": 8
548
+ },
549
+ {
550
+ "type": "text",
551
+ "text": "Exp 7: Varying the number of malicious clients. This experiment evaluates the impact of varying numbers of malicious clients on test accuracy. We utilize $m$ -Krum to protect against 1, 2, and 3 malicious clients out of 10 clients in each FL training round. As shown in Figure 11, the test accuracy remains relatively consistent across different numbers of malicious clients, as in each FL training round, $m$ -Krum selects a local model that is the most likely to be benign to represent the other models, effectively minimizing the impact of malicious client models on the aggregation. ",
552
+ "page_idx": 8
553
+ },
554
+ {
555
+ "type": "text",
556
+ "text": "We present an experiment that utilizes real-world edge devices in Theta network (Theta Network., 2023) to showcase the scalability of FedSecurity to real-world applications in Appendix E. ",
557
+ "page_idx": 8
558
+ },
559
+ {
560
+ "type": "text",
561
+ "text": "5.2 EVALUATIONS ON FEDERATED LLMS ",
562
+ "text_level": 1,
563
+ "page_idx": 8
564
+ },
565
+ {
566
+ "type": "text",
567
+ "text": "We employ two LLMs, BERT (Devlin et al., 2018) and Pythia (Biderman et al., 2023), to showcase the scalability of FedSecurity and its applicability to federated LLM scenarios. We notice that some defenses (e.g., Foolsgold (Fung et al., 2020)) that require memorizing intermediate results, such as models of previous FL training rounds, might encounter limitations when integrated with LLMs due to the significant cache introduced. Considering this, we utilize $m$ -Krum for our experiments, as it does not require storing intermediate results and demonstrates consistent performance in most of our previous experiments. ",
568
+ "page_idx": 8
569
+ },
570
+ {
571
+ "type": "text",
572
+ "text": "Exp 8: Evaluations of Krum against model replacement backdoor attack on BERT. This experiment utilizes BERT (Devlin et al., 2018) and the 20 news dataset (Lang, 1995) for a classification task. We employ 10 clients and set 1 client to be malicious in each FL training round. We set $m$ to 5 in $m$ -Krum, i.e., 5 out of 10 local models participate in aggregation in each FL training round. Results in Figure 12 show that $m$ -Krum effectively mitigates the adversarial effect, bringing the accuracy closer to the level of the attack-free case. ",
573
+ "page_idx": 8
574
+ },
575
+ {
576
+ "type": "text",
577
+ "text": "Exp 9: Evaluations of Krum against the Byzantine attack on Pythia-1B. We employ 7 clients for FL training, and 1 out of 7 clients is malicious in each round of FL training. We set the $m$ parameter in $m$ -Krum to 2, signifying that 2 out of 7 submitted local models participate in the aggregation in each FL training round. The performance is evaluated based on the test loss. Results in Figure 13 show that Byzantine attack significantly increases the test loss during training. Nevertheless, $m$ - Krum effectively mitigates the adversarial effect. ",
578
+ "page_idx": 8
579
+ },
580
+ {
581
+ "type": "text",
582
+ "text": "6 CONCLUSION ",
583
+ "text_level": 1,
584
+ "page_idx": 8
585
+ },
586
+ {
587
+ "type": "text",
588
+ "text": "This paper presents FedSecurity, a library designed to demonstrate potential adversarial attacks and corresponding defense strategies in FL to bolster innovation in the secure FL domain. FedSecurity contains two components: FedAttacker that simulates various attacks that can be injected during FL training, and FedDefender, which facilitates defense strategies to mitigate the impacts of these attacks. FedSecurity is open-sourced, and we welcome contributions from the research community to enrich the benchmark repository with novel attack and defense strategies to foster a diverse, comprehensive, and robust foundation for ongoing research in FL security. ",
589
+ "page_idx": 8
590
+ },
591
+ {
592
+ "type": "text",
593
+ "text": "7 ETHICS STATEMENT ",
594
+ "text_level": 1,
595
+ "page_idx": 9
596
+ },
597
+ {
598
+ "type": "text",
599
+ "text": "FedSecurity is under the Apache 2.0 license, ensuring open access and customization. All datasets used for evaluations are publicly available, such as CIFAR10 (Krizhevsky et al., 2009), FEMNIST (Caldas et al., 2018), Shakespeare (McMahan et al., 2017b), and so on. All models for evaluations are publicly available as well. ",
600
+ "page_idx": 9
601
+ },
602
+ {
603
+ "type": "text",
604
+ "text": "7.1 CODE OF ETHICS ",
605
+ "text_level": 1,
606
+ "page_idx": 9
607
+ },
608
+ {
609
+ "type": "text",
610
+ "text": "Data Handling and Protection. We are aware of the risks associated with data processing in FL settings. Users can use the open-sourced FedSecurity library to simulate attacks and defenses on any machine without uploading their raw data and model. If users use our MLOps platform for simulation, only the model weights are uploaded. The uploaded model weights are encrypted (i.e., only users with proper ownership can decrypt them) and can be deleted upon request. That is, we have no access to raw user data and we do not claim any data and model ownership. ",
611
+ "page_idx": 9
612
+ },
613
+ {
614
+ "type": "text",
615
+ "text": "Benchmark Model Documentation and Transparency. We are committed to: $i ,$ ) providing comprehensive documentation on the functionalities of the benchmark; $i i )$ ) making a detailed datasheet available for the benchmark model, outlining its specifications, capabilities, and intended use cases; and iii) offering transparent and well-documented APIs for users. ",
616
+ "page_idx": 9
617
+ },
618
+ {
619
+ "type": "text",
620
+ "text": "7.2 LIMITATIONS AND FURTHER IMPROVEMENT ",
621
+ "text_level": 1,
622
+ "page_idx": 9
623
+ },
624
+ {
625
+ "type": "text",
626
+ "text": "While FedSecurity offers a foundation for ML security research, we recognize its limitations and potential for further enhancement. Our plans for improvement are as follows: $i$ ) conducting more experiments on federated LLMs to provide a comprehensive understanding of vulnerabilities of LLMs within the FL context; and $i i ^ { \\cdot }$ ) designing and implementing advanced defense mechanisms against potential adversaries in asynchronous FL scenarios. ",
627
+ "page_idx": 9
628
+ },
629
+ {
630
+ "type": "text",
631
+ "text": "7.3 POTENTIAL NEGATIVE SOCIAL IMPACTS ",
632
+ "text_level": 1,
633
+ "page_idx": 9
634
+ },
635
+ {
636
+ "type": "text",
637
+ "text": "Even though we put our best efforts in mitigating negative social impacts, the proposed FedSecurity benchmark might still be subject to some indistinct negative social impact, including: ",
638
+ "page_idx": 9
639
+ },
640
+ {
641
+ "type": "text",
642
+ "text": "• Potential misuse: While our module simulates attacks and defenses in FL to help the communities to better understand and compare the attacks in FL, it is not immune to malicious use. The platform could potentially be used to exploit vulnerabilities or develop advanced attack techniques in FL systems. \n• Data security: FL is susceptible to various threats such as data poisoning. We acknowledge these inherent risks and are actively working on introducing defenses mechanisms to mitigate such attacks. \n• Privacy Concerns: Although FL aims to train models without sharing raw data, there remains a risk of indirect data leakage, for example, attackers might utilize the models to infer whether specific data points are in the training datasets, where users should be cautious and informed. ",
643
+ "page_idx": 9
644
+ },
645
+ {
646
+ "type": "text",
647
+ "text": "REFERENCES ",
648
+ "text_level": 1,
649
+ "page_idx": 9
650
+ },
651
+ {
652
+ "type": "text",
653
+ "text": "Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dandelion Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris ´ Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Wat- ´ tenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL https://www.tensorflow.org/. Software available from tensorflow.org. ",
654
+ "page_idx": 9
655
+ },
656
+ {
657
+ "type": "text",
658
+ "text": "Luca Antiga. Introducing pytorch lightning 2.0 and fabric. https://lightning.ai/blog/introducinglightning-2-0/, 2023. ",
659
+ "page_idx": 9
660
+ },
661
+ {
662
+ "type": "text",
663
+ "text": "Eugene Bagdasaryan, Andreas Veit, Yiqing Hua, Deborah Estrin, and Vitaly Shmatikov. How to backdoor federated learning. In International Conference on Artificial Intelligence and Statistics, pp. 2938–2948. PMLR, 2020. \nAmos Beimel. Secret-sharing schemes: A survey. In International conference on coding and cryptology, pp. 11–46. Springer, 2011. \nDaniel J Beutel, Taner Topal, Akhil Mathur, Xinchi Qiu, Titouan Parcollet, Pedro PB de Gusmao, ˜ and Nicholas D Lane. Flower: A friendly federated learning research framework. arXiv preprint arXiv:2007.14390, 2020. \nArjun Nitin Bhagoji, Supriyo Chakraborty, Prateek Mittal, and Seraphin Calo. Analyzing federated learning through an adversarial lens. In International Conference on Machine Learning, pp. 634– 643. PMLR, 2019. \nStella Biderman, Hailey Schoelkopf, Quentin Anthony, Herbie Bradley, Kyle O’Brien, Eric Hallahan, Mohammad Aflah Khan, Shivanshu Purohit, USVSN Sai Prashanth, Edward Raff, et al. Pythia: A suite for analyzing large language models across training and scaling. arXiv preprint arXiv:2304.01373, 2023. \nPeva Blanchard, El Mahdi El Mhamdi, Rachid Guerraoui, and Julien Stainer. Machine learning with adversaries: Byzantine tolerant gradient descent. Advances in neural information processing systems, 30, 2017. \nTom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. \nDavid Byrd and Antigoni Polychroniadou. Differentially private secure multi-party computation for federated learning in financial applications. In Proceedings of the First ACM International Conference on AI in Finance, pp. 1–9, 2020. \nSebastian Caldas, Sai Meher Karthik Duddu, Peter Wu, Tian Li, Jakub Konecnˇ y, H Brendan McMa- \\` han, Virginia Smith, and Ameet Talwalkar. Leaf: A benchmark for federated settings. arXiv preprint arXiv:1812.01097, 2018. \nChaochao Chen, Xiaohua Feng, Jun Zhou, Jianwei Yin, and Xiaolin Zheng. Federated Large Language Model : A Position Paper. arXiv preprint arXiv:2307.08925, 2023. \nJiahui Chen, Yi Zhao, Qi Li, Xuewei Feng, and Ke Xu. Feddef: Defense against gradient leakage in federated learning-based network intrusion detection systems. IEEE Transactions on Information Forensics and Security, 18:4561–4576, 2022. URL https://api.semanticscholar. org/CorpusID:253420565. \nMingqing Chen, Rajiv Mathews, Tom Ouyang, and Franc¸oise Beaufays. Federated learning of outof-vocabulary words. arXiv preprint arXiv:1903.10635, 2019. \nY. Chen, L. Su, and J. Xu. Distributed statistical machine learning in adversarial settings: Byzantine gradient descent. ACM on Measurement and Analysis of Computing Systems, 1(2):1–25, 2017. \nAlexander Chowdhury, Hasan Kassem, Nicolas Padoy, Renato Umeton, and Alexandros Karargyris. A review of medical federated learning: Applications in oncology and cancer research. In Brainlesion: Glioma, Multiple Sclerosis, Stroke and Traumatic Brain Injuries: 7th International Workshop, BrainLes 2021, Held in Conjunction with MICCAI 2021, Virtual Event, September 27, 2021, Revised Selected Papers, Part I, pp. 3–24. Springer, 2022. \nTrung Dang, Om Thakkar, Swaroop Ramaswamy, Rajiv Mathews, Peter Chin, and Franc¸oise Beaufays. Revealing and protecting labels in distributed training. Advances in Neural Information Processing Systems, 34:1727–1738, 2021. \nJacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. ",
664
+ "page_idx": 10
665
+ },
666
+ {
667
+ "type": "text",
668
+ "text": "Dimitrios Dimitriadis, Mirian Hipolito Garcia, Daniel Madrigal Diaz, Andre Manoel, and Robert Sim. Flute: A scalable, extensible framework for high-performance federated learning simulations. arXiv preprint arXiv:2203.13789, 2022. ",
669
+ "page_idx": 11
670
+ },
671
+ {
672
+ "type": "text",
673
+ "text": "Ahmed Roushdy Elkordy, Yahya H Ezzeldin, Shanshan Han, Shantanu Sharma, Chaoyang He, Sharad Mehrotra, Salman Avestimehr, et al. Federated analytics: A survey. APSIPA Transactions on Signal and Information Processing, 12(1), 2023. \nMinghong Fang, Xiaoyu Cao, Jinyuan Jia, and Neil Gong. Local model poisoning attacks to {Byzantine-Robust} federated learning. In 29th USENIX security symposium (USENIX Security 20), pp. 1605–1622, 2020. \nFedML Inc. Releasing FedLLM: Build your own large language models on proprietary data using the FedML platform. https://blog.fedml.ai/releasing-fedllm-build-your-own-large-languagemodels-on-proprietary-data-using-the-fedml-platform, 2023. \nLiam Fowl, Jonas Geiping, Wojtek Czaja, Micah Goldblum, and Tom Goldstein. Robbing the fed: Directly obtaining private data in federated learning with modified models. arXiv preprint arXiv:2110.13057, 2021. \nClement Fung, Chris JM Yoon, and Ivan Beschastnikh. The limitations of federated learning in sybil settings. In RAID, pp. 301–316, 2020. \nErich Gamma, Richard Helm, Ralph Johnson, Ralph E Johnson, and John Vlissides. Design patterns: elements of reusable object-oriented software. Pearson Deutschland GmbH, 1995. \nIan J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron C. Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, 2014. \nSylvain Gugger. Introducing hugging face accelerate. https://huggingface.co/blog/accelerate-library, 2021. \nAndrew Hard, Kanishka Rao, Rajiv Mathews, Swaroop Ramaswamy, Franc¸oise Beaufays, Sean Augenstein, Hubert Eichner, Chloe Kiddon, and Daniel Ramage. Federated learning for mobile ´ keyboard prediction. arXiv preprint arXiv:1811.03604, 2018. \nChaoyang He, Murali Annavaram, and Salman Avestimehr. Group knowledge transfer: Federated learning of large cnns at the edge. Advances in Neural Information Processing Systems, 33: 14068–14080, 2020. \nChaoyang He, Erum Mushtaq, Jie Ding, and Salman Avestimehr. Fednas: Federated deep learning via neural architecture search. 2021. \nKaiming He, X. Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, 2015. \nKaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. \nBriland Hitaj, Giuseppe Ateniese, and Fernando Perez-Cruz. Deep models under the gan: information leakage from collaborative deep learning. In Proceedings of the 2017 ACM SIGSAC conference on computer and communications security, pp. 603–618, 2017. \nQiao Jin, Bhuwan Dhingra, Zhengping Liu, William Cohen, and Xinghua Lu. Pubmedqa: A dataset for biomedical research question answering. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 2567–2577, 2019. \nXiao Jin, Pin-Yu Chen, Chia-Yi Hsu, Chia-Mu Yu, and Tianyi Chen. Cafe: Catastrophic data leakage in vertical federated learning. Advances in Neural Information Processing Systems, 34:994–1006, 2021. \nGueyoung Jung, Nathan Gnanasambandam, and Tridib Mukherjee. Synchronous parallel processing of big-data analytics services to optimize performance in federated clouds. 2012 IEEE Fifth International Conference on Cloud Computing, pp. 811–818, 2012. \nSai Praneeth Karimireddy, Lie He, and Martin Jaggi. Byzantine-robust learning on heterogeneous datasets via bucketing. arXiv preprint arXiv:2006.09365, 2020. \nSanjay Kariyappa, Chuan Guo, Kiwan Maeng, Wenjie Xiong, G. Edward Suh, Moinuddin K. Qureshi, and Hsien-Hsin S. Lee. Cocktail party attack: Breaking aggregation-based privacy in federated learning using independent component analysis. In International Conference on Machine Learning, 2022. URL https://api.semanticscholar.org/CorpusID: 252211968. \nAlex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. \nAbhishek Kumar, Vivek Khimani, Dimitris Chatzopoulos, and Pan Hui. Fedclean: A defense mechanism against parameter poisoning attacks in federated learning. ICASSP 2022 - 2022 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4333–4337, 2022. URL https://api.semanticscholar.org/CorpusID:249437417. \nKavita Kumari, Phillip Rieger, Hossein Fereidooni, Murtuza Jadliwala, and Ahmad-Reza Sadeghi. Baybfed: Bayesian backdoor defense for federated learning. arXiv preprint arXiv:2301.09508, 2023. \nFan Lai, Yinwei Dai, Sanjay Singapuram, Jiachen Liu, Xiangfeng Zhu, Harsha Madhyastha, and Mosharaf Chowdhury. FedScale: Benchmarking model and system performance of federated learning at scale. In International Conference on Machine Learning, pp. 11814–11827. PMLR, 2022. \nMaximilian Lam, Gu-Yeon Wei, David Brooks, Vijay Janapa Reddi, and Michael Mitzenmacher. Gradient disaggregation: Breaking privacy in federated learning by reconstructing the user participant matrix. In International Conference on Machine Learning, pp. 5959–5968. PMLR, 2021. \nKen Lang. Newsweeder: Learning to filter netnews. In Armand Prieditis and Stuart Russell (eds.), Machine Learning Proceedings 1995, pp. 331–339. Morgan Kaufmann, San Francisco (CA), 1995. ISBN 978-1-55860-377-6. doi: https://doi.org/10.1016/ B978-1-55860-377-6.50048-7. URL https://www.sciencedirect.com/science/ article/pii/B9781558603776500487. \nYann LeCun, Bernhard Boser, John S Denker, Donnie Henderson, Richard E Howard, Wayne Hubbard, and Lawrence D Jackel. Backpropagation applied to handwritten zip code recognition. Neural computation, 1(4):541–551, 1989. \nYann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. \nDavid Leroy, Alice Coucke, Thibaut Lavril, Thibault Gisselbrecht, and Joseph Dureau. Federated learning for keyword spotting. In IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6341–6345, 2019. \nTian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. Federated optimization in heterogeneous networks. Proceedings of Machine learning and systems, 2:429–450, 2020. \nXingyu Li, Zhe Qu, Shangqing Zhao, Bo Tang, Zhuo Lu, and Yao-Hong Liu. Lomar: A local defense against poisoning attack on federated learning. IEEE Transactions on Dependable and Secure Computing, 20:437–450, 2022. URL https://api.semanticscholar.org/ CorpusID:245837821. \nYang Liu, Tao Fan, Tianjian Chen, Qian Xu, and Qiang Yang. Fate: An industrial grade platform for collaborative learning with data protection. The Journal of Machine Learning Research, 22 (1):10320–10325, 2021. ",
674
+ "page_idx": 11
675
+ },
676
+ {
677
+ "type": "text",
678
+ "text": "",
679
+ "page_idx": 12
680
+ },
681
+ {
682
+ "type": "text",
683
+ "text": "Heiko Ludwig, Nathalie Baracaldo, Gegi Thomas, Yi Zhou, Ali Anwar, Shashank Rajamoni, Yuya Ong, Jayaram Radhakrishnan, Ashish Verma, Mathieu Sinn, et al. IBM Federated Learning: An Enterprise Framework White Paper v0.1. arXiv preprint arXiv:2007.10987, 2020. ",
684
+ "page_idx": 13
685
+ },
686
+ {
687
+ "type": "text",
688
+ "text": "Renqian Luo, Liai Sun, Yingce Xia, Tao Qin, Sheng Zhang, Hoifung Poon, and Tie-Yan Liu. BioGPT: generative pre-trained transformer for biomedical text generation and mining. Briefings in Bioinformatics, 23(6), 09 2022. ISSN 1477-4054. doi: 10.1093/bib/bbac409. URL https://doi.org/10.1093/bib/bbac409. bbac409. \nXinjian Luo, Yuncheng Wu, Xiaokui Xiao, and Beng Chin Ooi. Feature inference attack on model predictions in vertical federated learning. In IEEE International Conference on Data Engineering (ICDE), pp. 181–192. IEEE, 2021. \nZhuo Ma, Jianfeng Ma, Yinbin Miao, Yingjiu Li, and Robert H. Deng. Shieldfl: Mitigating model poisoning attacks in privacy-preserving federated learning. IEEE Transactions on Information Forensics and Security, 17:1639–1654, 2022. URL https://api.semanticscholar. org/CorpusID:248358657. \nBrendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Artificial intelligence and statistics, pp. 1273–1282. PMLR, 2017a. \nBrendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Artificial intelligence and statistics, pp. 1273–1282. PMLR, 2017b. \nH. B. McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. ¨ Communication-efficient learning of deep networks from decentralized data. In International Conference on Artificial Intelligence and Statistics, 2016. \nLuca Melis, Congzheng Song, Emiliano De Cristofaro, and Vitaly Shmatikov. Exploiting unintended feature leakage in collaborative learning. 2019 IEEE Symposium on Security and Privacy $( S P )$ , pp. 691–706, 2018. URL https://api.semanticscholar.org/CorpusID:53099247. \nLuca Melis, Congzheng Song, Emiliano De Cristofaro, and Vitaly Shmatikov. Exploiting unintended feature leakage in collaborative learning. In 2019 IEEE symposium on security and privacy (SP), pp. 691–706. IEEE, 2019. \nMustafa Safa Ozdayi, Murat Kantarcioglu, and Yulia R Gel. Defending against backdoors in federated learning with robust learning rate. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pp. 9268–9276, 2021. \nKrishna Pillutla, Sham M Kakade, and Zaid Harchaoui. Robust aggregation for federated learning. IEEE Transactions on Signal Processing, 70:1142–1154, 2022. \nSamyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. Zero: Memory optimizations toward training trillion parameter models. In SC20: International Conference for High Performance Computing, Networking, Storage and Analysis, pp. 1–16. IEEE, 2020. \nDaniel Ramage. Federated analytics: Collaborative data science without data collection. Google AI Blog, May 2020. URL https://ai.googleblog.com/2020/05/ federated-analytics-collaborative-data.html. \nSwaroop Ramaswamy, Rajiv Mathews, Kanishka Rao, and Franc¸oise Beaufays. Federated learning for emoji prediction in a mobile keyboard. arXiv preprint arXiv:1906.04329, 2019. \nMohammad Rasouli, Tao Sun, and Ram Rajagopal. Fedgan: Federated generative adversarial networks for distributed data. arXiv preprint arXiv:2006.07228, 2020. \nSashank J. Reddi, Zachary Charles, Manzil Zaheer, Zachary Garrett, Keith Rush, Jakub Konecnˇ y,´ Sanjiv Kumar, and Hugh Brendan McMahan. Adaptive federated optimization. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum? id $=$ LkFG3lB13U5. ",
689
+ "page_idx": 13
690
+ },
691
+ {
692
+ "type": "text",
693
+ "text": "G Anthony Reina, Alexey Gruzdev, Patrick Foley, Olga Perepelkina, Mansi Sharma, Igor Davidyuk, Ilya Trushkin, Maksim Radionov, Aleksandr Mokrov, Dmitry Agapov, et al. Openfl: An opensource framework for federated learning. arXiv preprint arXiv:2105.06413, 2021. ",
694
+ "page_idx": 14
695
+ },
696
+ {
697
+ "type": "text",
698
+ "text": "Holger R Roth, Yan Cheng, Yuhong Wen, Isaac Yang, Ziyue Xu, Yuan-Ting Hsieh, Kristopher Kersten, Ahmed Harouni, Can Zhao, Kevin Lu, et al. NVIDIA FLARE: Federated learning from simulation to real-world. arXiv preprint arXiv:2210.13291, 2022. \nDavid E Rumelhart, Geoffrey E Hinton, and Ronald J Williams. Learning representations by backpropagating errors. nature, 323(6088):533–536, 1986. \nVirat Shejwalkar and Amir Houmansadr. Manipulating the byzantine: Optimizing model poisoning attacks and defenses for federated learning. In NDSS, 2021. \nReza Shokri and Vitaly Shmatikov. Privacy-preserving deep learning. In Proceedings of the 22nd ACM SIGSAC conference on computer and communications security, pp. 1310–1321, 2015. \nSantiago Silva, Andre Altmann, Boris Gutman, and Marco Lorenzi. Fed-BioMed: A General OpenSource Frontend Framework for Federated Learning in Healthcare. In Domain Adaptation and Representation Transfer, and Distributed and Collaborative Learning: Second MICCAI Workshop, pp. 201–210. Springer, 2020. \nZiteng Sun, Peter Kairouz, Ananda Theertha Suresh, and H Brendan McMahan. Can you really backdoor federated learning? arXiv preprint arXiv:1911.07963, 2019. \nTheta Network. Theta network website. https://thetatoken.org/, 2023. \nVale Tolpegin, Stacey Truex, Mehmet Emre Gursoy, and Ling Liu. Data poisoning attacks against federated learning systems. In European Symposium on Research in Computer Security, pp. 480– 501. Springer, 2020. \nRichard Tomsett, Kevin Chan, and Supriyo Chakraborty. Model poisoning attacks against distributed machine learning systems. In Artificial Intelligence and Machine Learning for Multi-Domain Operations Applications, volume 11006, pp. 481–489. SPIE, 2019. \nDan Wang, Siping Shi, Yifei Zhu, and Zhu Han. Federated analytics: Opportunities and challenges. IEEE Network, 36:151–158, 2022a. \nGuanhua Wang, Heyang Qin, Sam Ade Jacobs, Connor Holmes, Samyam Rajbhandari, Olatunji Ruwase, Feng Yan, Lei Yang, and Yuxiong He. Zero $^ { + + }$ : Extremely efficient collective communication for giant model training. arXiv preprint arXiv:2306.10209, 2023. \nH. Wang, K. Sreenivasan, S. Rajput, H. Vishwakarma, S. Agarwal, J. Sohn, K. Lee, and D. Papailiopoulos. Attack of the tails: Yes, you really can backdoor federated learning. In NeurIPS, 2020a. \nJianhua Wang. Pass: Parameters audit-based secure and fair federated learning scheme against free rider. arXiv preprint arXiv:2207.07292, 2022. \nJianyu Wang, Qinghua Liu, Hao Liang, Gauri Joshi, and H. Vincent Poor. Tackling the objective inconsistency problem in heterogeneous federated optimization. ArXiv, abs/2007.07481, 2020b. \nZhibo Wang, Yuting Huang, Mengkai Song, Libing Wu, Feng Xue, and Kui Ren. Poisoning-assisted property inference attack against federated learning. IEEE Transactions on Dependable and Secure Computing, 2022b. \nChulin Xie, Keli Huang, Pin-Yu Chen, and Bo Li. Dba: Distributed backdoor attacks against federated learning. In International conference on learning representations, 2019. \nChulin Xie, Minghao Chen, Pin-Yu Chen, and Bo Li. CRFL: Certifiably robust federated learning against backdoor attacks. In International Conference on Machine Learning, pp. 11372–11382. PMLR, 2021. \nCong Xie, Oluwasanmi Koyejo, and Indranil Gupta. SLSGD: Secure and Efficient Distributed Ondevice Machine Learning. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 213–228. Springer, 2020. \nYuexiang Xie, Zhen Wang, Daoyuan Chen, Dawei Gao, Liuyi Yao, Weirui Kuang, Yaliang Li, Bolin Ding, and Jingren Zhou. FederatedScope: A Flexible Federated Learning Platform for Heterogeneity. arXiv preprint arXiv:2204.05011, 2022. \nH. Yang, X. Zhang, M. Fang, and J. Liu. Byzantine-resilient stochastic gradient descent for distributed learning: A Lipschitz-inspired coordinate-wise median approach. In IEEE CDC, Dec 2019. \nDong Yin, Yudong Chen, Kannan Ramchandran, and Peter Bartlett. Byzantine-robust distributed learning: Towards optimal statistical rates. In International Conference on Machine Learning, pp. 5650–5659. PMLR, 2018. \nJingwen Zhang, Jiale Zhang, Junjun Chen, and Shui Yu. Gan enhanced membership inference: A passive local attack in federated learning. In ICC 2020-2020 IEEE International Conference on Communications (ICC), pp. 1–6. IEEE, 2020. \nZhengming Zhang, Ashwinee Panda, Linyue Song, Yaoqing Yang, Michael Mahoney, Prateek Mittal, Ramchandran Kannan, and Joseph Gonzalez. Neurotoxin: Durable backdoors in federated learning. In International Conference on Machine Learning, pp. 26429–26446. PMLR, 2022a. \nZhengming Zhang, Ashwinee Panda, Linyue Song, Yaoqing Yang, Michael W. Mahoney, Joseph Gonzalez, Kannan Ramchandran, and Prateek Mittal. Neurotoxin: Durable backdoors in federated learning. In International Conference on Machine Learning, 2022b. URL https: //api.semanticscholar.org/CorpusID:249889464. \nLigeng Zhu, Zhijian Liu, and Song Han. Deep leakage from gradients. Advances in Neural Information Processing Systems, 32, 2019. \nAlexander Ziller, Andrew Trask, Antonio Lopardo, Benjamin Szymkow, Bobby Wagner, Emma Bluemke, Jean-Mickael Nounahon, Jonathan Passerat-Palmbach, Kritika Prakash, Nick Rose, et al. PySyft: A library for easy federated learning. Federated Learning Systems: Towards NextGeneration AI, pp. 111–139, 2021. ",
699
+ "page_idx": 14
700
+ },
701
+ {
702
+ "type": "text",
703
+ "text": "",
704
+ "page_idx": 15
705
+ },
706
+ {
707
+ "type": "text",
708
+ "text": "APPENDIX ",
709
+ "text_level": 1,
710
+ "page_idx": 15
711
+ },
712
+ {
713
+ "type": "text",
714
+ "text": "A EXAMPLE CONFIGURATION FILES FOR ATTACKS AND DEFENSES ",
715
+ "text_level": 1,
716
+ "page_idx": 15
717
+ },
718
+ {
719
+ "type": "text",
720
+ "text": "We provide example configuration files for Byzantine attack (Chen et al., 2017; Fang et al., 2020) in Figure 14 and for $m$ -Krum defense (Blanchard et al., 2017) in Figure 15. ",
721
+ "page_idx": 15
722
+ },
723
+ {
724
+ "type": "image",
725
+ "img_path": "images/c1e9192b09af5ecb88e7837a3e2ce84591215f08f3406e313a68af51309aca9c.jpg",
726
+ "image_caption": [
727
+ "Figure 14: Configuration for Byzantine attack (Chen et al., 2017; Fang et al., 2020). "
728
+ ],
729
+ "image_footnote": [],
730
+ "page_idx": 15
731
+ },
732
+ {
733
+ "type": "image",
734
+ "img_path": "images/a11eb9395b96c7c97e79ac98c68b0c8ba0901aa2fb27b38fcfd710fffb437786.jpg",
735
+ "image_caption": [
736
+ "Figure 15: Configuration for $m$ -Krum (Blanchard et al., 2017) defense. "
737
+ ],
738
+ "image_footnote": [],
739
+ "page_idx": 15
740
+ },
741
+ {
742
+ "type": "text",
743
+ "text": "B ALGORITHMS FOR FL SERVER AGGREGATION AND CLIENT TRAINING ",
744
+ "text_level": 1,
745
+ "page_idx": 16
746
+ },
747
+ {
748
+ "type": "text",
749
+ "text": "The algorithms for injecting attacks and defenses in FL training are described in Algorithm 1 (for FL server aggregation) and Algorithm 2 (for client training). ",
750
+ "page_idx": 16
751
+ },
752
+ {
753
+ "type": "text",
754
+ "text": "Algorithm 1: Server Aggregation ",
755
+ "text_level": 1,
756
+ "page_idx": 16
757
+ },
758
+ {
759
+ "type": "text",
760
+ "text": "Inputs: $\\mathbf { w } _ { g } ^ { \\prime }$ : the global model of last FL training round; $\\mathcal { W } _ { l }$ : the list of local models submitted by each client in the current FL training round. ",
761
+ "page_idx": 16
762
+ },
763
+ {
764
+ "type": "text",
765
+ "text": "Variables: $\\mathcal { A }$ : A FedAttacker instance initialized based on the FL configuration file; $\\mathcal { D }$ : A FedDefender instance that is initialized based on the FL configuration file. ",
766
+ "page_idx": 16
767
+ },
768
+ {
769
+ "type": "text",
770
+ "text": "1 Function server aggregation $( \\mathcal { W } _ { l } )$ begin \n2 $\\mathcal { W } _ { l } \\gets$ before aggregation process $( \\mathcal { W } _ { l } , \\mathbf { w } _ { g } ^ { \\prime } )$ \n3 $\\mathbf { w } _ { g } \\gets$ before aggregation process $( \\mathcal { W } _ { l } , \\mathbf { w } _ { g } ^ { \\prime } )$ \n4 return after aggregation process $( \\mathcal { W } _ { l } , \\mathbf { w } _ { g } )$ ",
771
+ "page_idx": 16
772
+ },
773
+ {
774
+ "type": "text",
775
+ "text": "5 Function before aggregation process $( \\mathcal { W } _ { l } , \\mathbf { w } _ { g } ^ { \\prime } )$ begin ",
776
+ "page_idx": 16
777
+ },
778
+ {
779
+ "type": "text",
780
+ "text": "6 if A.is attack enabled () then 7 if A.is data reconstruction attack () then A.reconstruct data $( \\mathcal { W } _ { l } , \\mathbf { w } _ { g } ^ { \\prime } )$ ; if A.is model poisoning attack () then ${ \\mathcal { W } } _ { l } \\gets A$ .poison model $( \\mathcal { W } _ { l } , \\mathbf { w } _ { g } ^ { \\prime } )$ ; ",
781
+ "page_idx": 16
782
+ },
783
+ {
784
+ "type": "text",
785
+ "text": "8 if D.is defense enabled () & $\\mathcal { D } .$ .is defense before aggregation() then L ${ \\mathcal { W } } _ { l } \\gets { \\mathcal { D } } .$ defend before aggregation $( \\mathcal { W } _ { l } , \\mathbf { w } _ { g } ^ { \\prime } )$ \n9 return $\\mathcal { W } _ { i }$ ",
786
+ "page_idx": 16
787
+ },
788
+ {
789
+ "type": "text",
790
+ "text": "10 Function on aggregation process $( \\mathcal { W } _ { l } , \\mathbf { w } _ { g } )$ begin 11 if $\\mathcal { D }$ .is defense enabled() & $\\mathcal { D }$ .is defense on aggregation() then return $\\mathcal { D }$ .defend on aggregation $( \\mathscr { W } _ { l } , { \\mathbf { w } } _ { g } )$ 12 return aggregate $( \\mathcal { W } _ { i } )$ ",
791
+ "page_idx": 16
792
+ },
793
+ {
794
+ "type": "text",
795
+ "text": "13 Function after aggregation process $\\left( \\mathbf { w } _ { g } \\right)$ begin \n14 if $\\mathcal { D } .$ .is defense enabled() & $\\mathcal { D }$ .is defense after aggregation() then return D.defend after aggregation $\\left( \\mathbf { w } _ { g } \\right)$ \n15 return wg ",
796
+ "page_idx": 16
797
+ },
798
+ {
799
+ "type": "text",
800
+ "text": "Algorithm 2: Client Training ",
801
+ "text_level": 1,
802
+ "page_idx": 16
803
+ },
804
+ {
805
+ "type": "text",
806
+ "text": "Inputs: dataset: the local dataset of a client. Variables: $\\mathcal { A }$ : A FedAttacker instance initialized based on the FL configuration file; 1 Function client training(dataset) begin 2 if $\\mathcal { A }$ .is attack enabled () & A.is data poisoning attack () then dataset $ A$ .poison data(dataset) 3 wl ← train(dataset) 4 send to server (wl) ",
807
+ "page_idx": 16
808
+ },
809
+ {
810
+ "type": "text",
811
+ "text": "C INTEGRATION OF NEW ATTACKS AND DEFENSES ",
812
+ "text_level": 1,
813
+ "page_idx": 16
814
+ },
815
+ {
816
+ "type": "text",
817
+ "text": "C.1 INTEGRATION OF A NEW ATTACK ",
818
+ "text_level": 1,
819
+ "page_idx": 16
820
+ },
821
+ {
822
+ "type": "text",
823
+ "text": "To customize a new attack, users should follow these steps: i) determine the type of the attack, i.e., model poisoning, data poisoning, or data reconstruction; $i i )$ ) create a new class for the attack and implement functions using the APIs, e.g., attack model $( * )$ , poison data $( * )$ , and reconstruct data $( * )$ , to inject attacks at the appropriate stages of FL training; and $i i i$ ) add the attack name to the corresponding enabler functions, i.e., is model poisoning attack(), is data poisoning attack (), and is data reconstruction attack (), within the FedAttacker class to ensure that the injected attacks are activated at the proper stages of FL training. ",
824
+ "page_idx": 16
825
+ },
826
+ {
827
+ "type": "text",
828
+ "text": "C.2 INTEGRATION OF A NEW DEFENSE ",
829
+ "text_level": 1,
830
+ "page_idx": 17
831
+ },
832
+ {
833
+ "type": "text",
834
+ "text": "To implement a self-designed defense mechanism, users should first determine the stages to inject the defense functions (i.e., before/on/after-aggregation), add a class for the new defense and implement the corresponding defense functions using the aforementioned APIs, i.e., defend before aggregation $( * )$ , defend on aggregation $( * )$ , and defend after aggregation $( * )$ , to inject functions at appropriate stages of FL. Note that some defenses involve more than one stage; thus, users need to implement all relevant functions. Users should add the name of the defense to the enabler functions to activate the injected function at the different stages of FL. The approach computes some scores using local models submitted by clients, and uses the scores to identify outlier local models before aggregating the local models. As such process only happens before aggregation, we only need to implement defend before aggregation $( * )$ for the defense class, and include the name of the defense in is defense after aggregation(). ",
835
+ "page_idx": 17
836
+ },
837
+ {
838
+ "type": "text",
839
+ "text": "D MODELS AND DATASETS FOR EVALUATIONS ",
840
+ "text_level": 1,
841
+ "page_idx": 17
842
+ },
843
+ {
844
+ "type": "text",
845
+ "text": "Models and datasets used in this work are given in Table 1. ",
846
+ "page_idx": 17
847
+ },
848
+ {
849
+ "type": "table",
850
+ "img_path": "images/bb590a9631515b084f0e07dafd9897d44df7bc75519061699b3e69e5c696e0da.jpg",
851
+ "table_caption": [
852
+ "Table 1: Models and datasets for evaluations. "
853
+ ],
854
+ "table_footnote": [],
855
+ "table_body": "<table><tr><td>Model</td><td>Dataset</td></tr><tr><td>ResNet20 (He et al., 2016)</td><td>CIFAR10 (Krizhevsky et al., 2009)</td></tr><tr><td>ResNet56 (He et al., 2016)</td><td>CIFAR100 (Krizhevsky et al., 2009)</td></tr><tr><td>CNN (McMahan et al., 2017a)</td><td>FEMNIST (Caldas et al., 2018)</td></tr><tr><td>RNN (bi-LSTM) (McMahan et al., 2017a)</td><td>Shakespeare (McMahan et al., 2017b)</td></tr><tr><td>BERT (Devlin et al., 2018)</td><td>20News (Lang, 1995)</td></tr><tr><td>Pythia-1B (Biderman et al., 2023)</td><td>PubMedQA (Luo et al., 2022)</td></tr></table>",
856
+ "page_idx": 17
857
+ },
858
+ {
859
+ "type": "text",
860
+ "text": "E SUPPLEMENTARY EXPERIMENT ",
861
+ "text_level": 1,
862
+ "page_idx": 17
863
+ },
864
+ {
865
+ "type": "text",
866
+ "text": "In this section, to demonstrate the scalability of our benchmark, we include an experiment using real-world devices, instead of simulations. ",
867
+ "page_idx": 17
868
+ },
869
+ {
870
+ "type": "text",
871
+ "text": "Exp10: Evaluations in real-world applications. We utilize edge devices from the Theta network (Theta Network., 2023) to validate the scalability of FedSecurity to real-world applications. The FL client package is integrated into Theta’s edge nodes, which periodically fetches data from the Theta back-end. Subsequently, the FL training platform capitalizes on these Theta edge nodes and their associated data to train, fine-tune, and deploy machine learning models. ",
872
+ "page_idx": 17
873
+ },
874
+ {
875
+ "type": "text",
876
+ "text": "We select $m$ -Krum as the defense and the Byzantine attack of random mode as the attack. Considering the challenges posed by real-world environments, such as devices equipped solely with CPUs (lacking GPUs), potential device connectivity issues, network latency, and limited storage on edge devices (for instance, some mobile devices might have less than 500MB of available storage), we choose a simple task by employing the MNIST dataset for a logistic regression task. ",
877
+ "page_idx": 17
878
+ },
879
+ {
880
+ "type": "text",
881
+ "text": "In our experimental setup, we deploy 70 client edge devices, designating 7 of these as malicious for each FL training round. For $m$ -Krum, we set $m$ to 35, meaning that 35 out of the 70 local models are involved in aggregation during each FL training round. As illustrated in Figure 18, $m$ -Krum mitigates the adversarial effect of the random-mode Byzantine attack. We also include a screenshot of the platform, as shown in Figure 16 for the FL training process and Figure 17 for the training status of each device. ",
882
+ "page_idx": 17
883
+ },
884
+ {
885
+ "type": "image",
886
+ "img_path": "images/7f6d350ff69f3b70e6de77593556957ac3b926fa80ebc03790240f1d8abfc05c.jpg",
887
+ "image_caption": [
888
+ "Figure 16: Real-world application. Yellow: aggregation server waiting time; pink: aggregation time; green: client training time; blue: client communication. "
889
+ ],
890
+ "image_footnote": [],
891
+ "page_idx": 18
892
+ },
893
+ {
894
+ "type": "image",
895
+ "img_path": "images/6014703f26aa4e23c11660e3d02805e95791a3a058e3175c01323d93792a8523.jpg",
896
+ "image_caption": [
897
+ "",
898
+ "Figure 17: Real-world application: training status of devices. "
899
+ ],
900
+ "image_footnote": [],
901
+ "page_idx": 18
902
+ },
903
+ {
904
+ "type": "image",
905
+ "img_path": "images/3b5c8133d5c084d139926f3204f6e019f7df6596c6f717c601296314db4376ef.jpg",
906
+ "image_caption": [
907
+ "Figure 18: $m$ -Krum against random-mode Byzantine attack in a real-world application. "
908
+ ],
909
+ "image_footnote": [],
910
+ "page_idx": 18
911
+ }
912
+ ]
parse/test/DY6uhcv4Xm/DY6uhcv4Xm_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/DY6uhcv4Xm/DY6uhcv4Xm_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/ETH1GDbSPw/ETH1GDbSPw.md ADDED
@@ -0,0 +1,350 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Imagen Video: High Definition Video Generation with Diffusion Models
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # Abstract
6
+
7
+ We present Imagen Video, a text-conditional video generation system based on a cascade of video diffusion models. Given a text prompt, Imagen Video generates high definition videos using a base video generation model and a sequence of interleaved spatial and temporal video super-resolution models. We describe how we scale up the system as a high definition text-to-video model including design decisions such as the choice of fully-convolutional temporal and spatial super-resolution models at certain resolutions, and the choice of the v-parameterization of diffusion models. In addition, we confirm and transfer findings from previous work on diffusion-based image generation to the video generation setting. Finally, we apply progressive distillation to our video models with classifier-free guidance for fast, high quality sampling. We find Imagen Video not only capable of generating videos of high fidelity, but also having a high degree of controllability and world knowledge, including the ability to generate diverse videos and text animations in various artistic styles and with 3D object understanding.
8
+
9
+ ![](images/7278d4c9f33331da8e8af9b951b25b288446ba78053005bae48faadaa9da97cf.jpg)
10
+ Figure 1: Imagen Video sample for the prompt: “A bunch of autumn leaves falling on a calm lake to form the text ‘Imagen Video’. Smooth.” The generated video is at $1 2 8 0 \times 7 6 8$ resolution, 5.3 second duration and 24 frames per second.
11
+
12
+ # 1 Introduction
13
+
14
+ Generative modeling has made tremendous progress with recent text-to-image systems like DALL-E 2 (Ramesh et al., 2022), Imagen (Saharia et al., 2022b), Parti (Yu et al., 2022), CogView (Ding et al., 2021) and Latent Diffusion (Rombach et al., 2022). Diffusion models (Sohl-Dickstein et al., 2015; Ho et al., 2020) in particular have found considerable success in multiple generative modeling tasks (Nichol & Dhariwal, 2021; Ho et al., 2022a; Dhariwal & Nichol, 2022) including density estimation (Kingma et al., 2021), text-to-speech (Chen et al., 2021a; Kong et al., 2021; Chen et al., 2021b), image-to-image (Saharia et al., 2022c;a; Whang et al., 2022), text-to-image (Rombach et al., 2022; Nichol et al., 2021; Ramesh et al., 2022; Saharia et al., 2022b) and 3D synthesis (Poole et al., 2022; Watson et al., 2022).
15
+
16
+ ![](images/1eb960de54321d1c0eb739ad32a1b354b6f33e5c432a29f1dcfd2bd5ee9df629.jpg)
17
+ A colorful professional animated logo for ’Imagen Video’ written using paint brush in cursive. Smooth animation.
18
+
19
+ ![](images/8b2f58e72050f92510ccaf16771c8d4531c5e2f54fd0a8c386e3926d4db218f7.jpg)
20
+ Blue flame transforming into the text “Imagen”. Smooth animation
21
+
22
+ ![](images/883adccdc4dbb074b9587f82f68592dfc4f2020a44d011f24553577566e66d42.jpg)
23
+
24
+ Wooden figurine surfing on a surfboard in space.
25
+
26
+ ![](images/ae128f4235e677ebff26bc35628c949da37817a1f991aad51a14a464f6f346b4.jpg)
27
+
28
+ Balloon full of water exploding in extreme slow motion.
29
+
30
+ ![](images/70375ded516a5c4193221cee18eb4528633968e19a9a72e007ce242db16e38e5.jpg)
31
+
32
+ Melting pistachio ice cream dripping down the cone.
33
+
34
+ ![](images/aa586e8c5fb6ed7653aafe39170a0524cfb04fa279348d10faa61221515b6097.jpg)
35
+
36
+ A british shorthair jumping over a couch.
37
+
38
+ ![](images/bff20f7b0156aa5827c480f65d371d77d14e8566a89e2766d38c35228533f2ea.jpg)
39
+ Coffee pouring into a cup.
40
+
41
+ Figure 2: Videos generated from various text prompts. Imagen Video produces diverse and temporallycoherent videos that are well-aligned with the given prompt.
42
+
43
+ ![](images/4d7e688166466d6c141b0ffdd85c547d4a2347c3358652df89c986300b16c69e.jpg)
44
+ A small hand-crafted wooden boat taking off to space.
45
+
46
+ ![](images/6f662944f0642b3bad14ef4d2b7a028ffac4828ab102982b6abbcb67bce14d5b.jpg)
47
+ A person riding a bike in the sunset.
48
+
49
+ ![](images/e7915d1eed1b5078a741ab2a4e7fd4aa5e0d034439b24753a12a479bf2b181d6.jpg)
50
+ Drone flythrough interior of Sagrada Familia cathedral
51
+
52
+ ![](images/bd441bd546a618fce6339bf087375abda89ac8f0ebaf7e7136d6682f3739361f.jpg)
53
+
54
+ Wooden figurine walking on a treadmill made out of exercise mat.
55
+
56
+ ![](images/a501fe5f233094e4b84e1c1686fd3ca4f120dcde28ac2c91bb9df555009797f1.jpg)
57
+ Origami dancers in white paper, 3D render, ultra-detailed, on white background, studio shot, dancing modern dance.
58
+
59
+ ![](images/de7ad70f69cca72ba1027beec906864801b5442478c1026f8e558fd8f832c360.jpg)
60
+ Campfire at night in a snowy forest with starry sky in the background.
61
+
62
+ ![](images/190bd2b24d98ab38702d79260a77f51ecd29f3569f68e2defb117a11ddb8fcc0.jpg)
63
+ An astronaut riding a horse.
64
+
65
+ Figure 3: Videos generated from various text prompts. Imagen Video produces diverse and temporallycoherent videos that are well-aligned with the given prompt.
66
+
67
+ ![](images/db86e191c3d0d8ac566432a1b352855849607a56afa2eb528793dd13ee33c57c.jpg)
68
+ A person riding a horse in the sunrise.
69
+
70
+ ![](images/18eec6a916fd82c5ef51a71cea291b74714119896a22f76139f1290312139811.jpg)
71
+ A happy elephant wearing a birthday hat walking under the sea.
72
+
73
+ ![](images/a438281876e28778822daefc812fdca67163a7c82a34505ac5b1fd898d75c6e9.jpg)
74
+ Studio shot of minimal kinetic sculpture made from thin wire shaped like a bird on white background.
75
+
76
+ ![](images/3383c92edaf0e151809f19912dc489314fc382f079a14a9b74b7d1a3743b2f39.jpg)
77
+ A bunch of colorful candies falling into a tray in the shape of text ’Imagen Video’. Smooth video.
78
+
79
+ ![](images/b88e7ef8b5d9d21c925572bba93936c5e91a31e3ec645f28425896ea4f5e7570.jpg)
80
+ Incredibly detailed science fiction scene set on an alien planet, view of a marketplace. Pixel art.
81
+
82
+ Figure 4: Videos generated from various text prompts. Imagen Video produces diverse and temporallycoherent videos that are well-aligned with the given prompt.
83
+
84
+ ![](images/ca9d9cd34b1bd01ca5374fdceb29bf7158a693cbdf1a83e7994261de1dcd8d07.jpg)
85
+ A bunch of autumn leaves falling on a calm lake to form the text ’Imagen Video’. Smooth.
86
+
87
+ ![](images/ba9bda2d9f8d0aa6326ecf96e3f1d211e9fcb480080e986750b9e5b1617bf453.jpg)
88
+
89
+ Pouring latte art into a silver cup with a golden spoon next to it.
90
+
91
+ ![](images/686c7925afa30dc99a85f5511bccd4f983092f8dfce212f04f11bdedff4530da.jpg)
92
+ Shoveling snow.
93
+
94
+ ![](images/47e6607f5ef4a202e1a6b5542e2a72e88f000e640c5afb5744dbe7286c6c9b33.jpg)
95
+ Drone flythrough of a tropical jungle covered in snow
96
+
97
+ ![](images/9865925f1d533f84b920f6910e84ca39a9b180d3a050f0e57ae20f6c2eed92e3.jpg)
98
+ A beautiful sunrise on mars, Curiosity rover. High definition, timelapse, dramatic colors
99
+
100
+ ![](images/681a6e74ef7c23a49b08b685a9c128659f022ef24774d950978133d4d8642e53.jpg)
101
+ A shark swimming in clear Carribean ocean.
102
+
103
+ ![](images/88b40bd17207d00bcbec5d2f8f5d5de4c7955b0797a0b4bd8d0547a7ecfc9c59.jpg)
104
+ A hand lifts a cup.
105
+
106
+ Figure 5: Videos generated from various text prompts. Imagen Video produces diverse and temporallycoherent videos that are well-aligned with the given prompt.
107
+
108
+ Our work aims to generate videos from text. Prior work on video generation has focused on more restricted datasets with autoregressive models (Ranzato et al., 2014; Shi et al., 2015; Finn et al., 2016; Kalchbrenner et al., 2017; Babaeizadeh et al., 2021), latent-variable models with autoregressive priors (Mathieu et al., 2016; Vondrick et al., 2016; Babaeizadeh et al., 2018; Kumar et al., 2020), and more recently non-autoregressive latent-variable approaches (Gupta et al., 2022). Diffusion models have also shown promise for video generation (Ho et al., 2022b) at moderate resolution. Yang et al. (2022) showed autoregressive generation with a RNN-based model with conditional diffusion observations. The concurrent work of Singer et al. (2022) also applied text-to-video modelling with diffusion models, but built on a pretrained text-to-image model. Harvey et al. (2022) generates videos up to 25 minutes in length with video diffusion models, however the domain is restricted.
109
+
110
+ In this work, we introduce Imagen Video, a text-to-video generation system based on video diffusion models (Ho et al., 2022b) that is capable of generating high definition videos with high frame fidelity, strong temporal consistency, and deep language understanding. Imagen Video scales from prior work of 64-frame 128 $\times$ 128 videos at 24 frames per second to 128 frame 1280 $\times$ 768 high-definition video at 24 frames per second. Imagen Video has a simple architecture: The model consists of a frozen T5 text encoder (Raffel et al., 2020), a base video diffusion model, and interleaved spatial and temporal super-resolution diffusion models. Our key contributions are as follows:
111
+
112
+ 1. We demonstrate the simplicity and effectiveness of cascaded diffusion video models for high definition video generation.
113
+ 2. We confirm that recent findings in the text-to-image setting transfer to video generation, such as the effectiveness of frozen encoder text conditioning and classifier-free guidance.
114
+ 3. We show new findings for video diffusion models that have implications for diffusion models in general, such as the effectiveness of the v-prediction parameterization for sample quality and the effectiveness of progressive distillation of guided diffusion models for the text-conditioned video generation setting.
115
+ 4. We demonstrate qualitative controllability in Imagen Video, such as 3D object understanding, generation of text animations, and generation of videos in various artistic styles.
116
+
117
+ # 2 Imagen Video
118
+
119
+ Our model, Imagen Video, is a cascade of video diffusion models (Ho et al., 2022a;b). It consists of 7 sub-models which perform text-conditional video generation, spatial super-resolution, and temporal superresolution. With the entire cascade, Imagen Video generates high definition 1280 $\times$ 768 (width $\times$ height) videos at 24 frames per second, for 128 frames ( $\approx 5 . 3$ seconds)—approximately 126 million pixels. We describe the components and techniques that constitute Imagen Video in the following sections.
120
+
121
+ # 2.1 Diffusion models
122
+
123
+ Imagen Video is built from diffusion models (Sohl-Dickstein et al., 2015; Song & Ermon, 2019; Ho et al., 2020) specified in continuous time (Tzen $\&$ Raginsky, 2019; Song et al., 2021; Kingma et al., 2021). We use the formulation of Kingma et al. (2021): the model is a latent variable model with latents $\mathbf { z } = \{ \mathbf { z } _ { t } | t \in [ 0 , 1 ] \}$ following a forward process $q ( \mathbf { z } | \mathbf { x } )$ starting at data $\mathbf { x } \sim p ( \mathbf { x } )$ . The forward process is a Gaussian process that satisfies the Markovian structure:
124
+
125
+ $$
126
+ \begin{array} { r } { q ( \mathbf { z } _ { t } | \mathbf { x } ) = \mathcal { N } ( \mathbf { z } _ { t } ; \alpha _ { t } \mathbf { x } , \sigma _ { t } ^ { 2 } \mathbf { I } ) , \quad q ( \mathbf { z } _ { t } | \mathbf { z } _ { s } ) = \mathcal { N } ( \mathbf { z } _ { t } ; ( \alpha _ { t } / \alpha _ { s } ) \mathbf { z } _ { s } , \sigma _ { t | s } ^ { 2 } \mathbf { I } ) } \end{array}
127
+ $$
128
+
129
+ where $0 \leq s < t \leq 1$ , $\sigma _ { t | s } ^ { 2 } = ( 1 - e ^ { \lambda _ { t } - \lambda _ { s } } ) \sigma _ { t } ^ { 2 }$ , and $\alpha _ { t } , \sigma _ { t }$ specify a noise schedule whose log signal-to-noise-ratio $\lambda _ { t } = \log [ \alpha _ { t } ^ { 2 } / \sigma _ { t } ^ { 2 } ]$ decreases monotonically with $t$ until $q ( \mathbf { z } _ { 1 } ) \approx \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ . We use a continuous time version of the cosine noise schedule (Nichol & Dhariwal, 2021). The generative model is a learned model that matches this forward process in the reverse time direction, generating $\mathbf { z } _ { t }$ starting from $t = 1$ and ending at $t = 0$ .
130
+
131
+ Learning to reverse the forward process for generation can be reduced to learning to denoise ${ \mathbf z } _ { t } \sim q ( { \mathbf z } _ { t } | { \mathbf x } )$ into an estimate $\hat { \mathbf { x } } _ { \theta } ( { \mathbf z } _ { t } , \lambda _ { t } ) \approx { \mathbf x }$ for all $t$ . Like (Song & Ermon, 2019; Ho et al., 2020) and most follow-up work, we optimize the model by minimizing a simple noise-prediction loss:
132
+
133
+ $$
134
+ \mathcal { L } ( \mathbf { x } ) = \mathbb { E } _ { \epsilon \sim \mathcal { N } ( 0 , \mathbf { I } ) , t \sim U ( 0 , 1 ) } \big [ \| \hat { \epsilon } _ { \boldsymbol { \theta } } ( \mathbf { z } _ { t } , \lambda _ { t } ) - \epsilon \| _ { 2 } ^ { 2 } \big ]
135
+ $$
136
+
137
+ where $\mathbf { z } _ { t } = \alpha _ { t } \mathbf { x } + \sigma _ { t } \mathbf { \epsilon } $ , and $\hat { \epsilon } _ { \boldsymbol { \theta } } ( \mathbf { z } _ { t } , \lambda _ { t } ) = \sigma _ { t } ^ { - 1 } ( \mathbf { z } _ { t } - \alpha _ { t } \hat { \mathbf { x } } _ { \boldsymbol { \theta } } ( \mathbf { z } _ { t } , \lambda _ { t } ) )$ . We will drop the dependence on $\lambda _ { t }$ to simplify notation. In practice, we parameterize our models in terms of the $\mathbf { v }$ -parameterization (Salimans & Ho, 2022), rather than predicting $\epsilon$ or $\mathbf { x }$ directly; see Section 2.4.
138
+
139
+ For conditional generative modeling, we provide the conditioning information $\mathbf { c }$ drawn jointly with $\mathbf { x }$ to the model as $\hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } _ { t } )$ . We use these conditional diffusion models for spatial and temporal super-resolution in our pipeline of diffusion models: in these cases, $\mathbf { c }$ includes both the text and the previous stage low resolution video as well as a signal $\lambda _ { t } ^ { \prime }$ that describes the strength of conditioning augmentation added to $\mathbf { c }$ . Saharia et al. (2022b) found it critical to condition all the super-resolution models with the text embedding, and we follow this approach.
140
+
141
+ We use the discrete time ancestral sampler (Ho et al., 2020), with sampling variances derived from lower and upper bounds on reverse process entropy (Sohl-Dickstein et al., 2015; Ho et al., 2020; Nichol $\&$ Dhariwal, 2021). This sampler can be formulated by using a reversed description of the forward process as $q ( \mathbf { z } _ { s } | \mathbf { z } _ { t } , \mathbf { x } ) =$ $\mathcal { N } ( \mathbf { z } _ { s } ; \tilde { \pmb { \mu } } _ { s | t } ( \mathbf { z } _ { t } , \mathbf { x } ) , \tilde { \sigma } _ { s | t } ^ { 2 } \mathbf { I } )$ (noting $s < t$ ), where
142
+
143
+ $$
144
+ \tilde { \mu } _ { s | t } ( \mathbf { z } _ { t } , \mathbf { x } ) = e ^ { \lambda _ { t } - \lambda _ { s } } ( \alpha _ { s } / \alpha _ { t } ) \mathbf { z } _ { t } + ( 1 - e ^ { \lambda _ { t } - \lambda _ { s } } ) \alpha _ { s } \mathbf { x } \quad \mathrm { a n d } \quad \tilde { \sigma } _ { s | t } ^ { 2 } = ( 1 - e ^ { \lambda _ { t } - \lambda _ { s } } ) \sigma _ { s } ^ { 2 } .
145
+ $$
146
+
147
+ Starting at ${ \bf z } _ { 1 } \sim \mathcal { N } ( { \bf 0 } , { \bf I } )$ , the ancestral sampler follows the rule
148
+
149
+ $$
150
+ \mathbf { z } _ { s } = \tilde { \mu } _ { s | t } ( \mathbf { z } _ { t } , \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) ) + \sqrt { ( \tilde { \sigma } _ { s | t } ^ { 2 } ) ^ { 1 - \gamma } ( \sigma _ { t | s } ^ { 2 } ) ^ { \gamma } } \epsilon
151
+ $$
152
+
153
+ where $\epsilon$ is standard Gaussian noise, $\gamma$ is a hyperparameter that controls the stochasticity of the sampler (Nichol & Dhariwal, 2021), and $s , t$ follow a uniformly spaced sequence from 1 to $0$ . See Section 3 for sampler hyperparameter settings.
154
+
155
+ Alternatively, the deterministic DDIM sampler (Song et al., 2020) can be used for sampling. This sampler is a numerical integration rule for the probability flow ODE (Song et al., 2021; Salimans & Ho, 2022), which describes how a sample from a standard normal distribution can be deterministically transformed into a sample from the video data distribution using the denoising model. The DDIM sampler is useful for progressive distillation for fast sampling, as described in Section 2.7.
156
+
157
+ # 2.2 Cascaded Diffusion Models and text conditioning
158
+
159
+ Cascaded Diffusion Models (Ho et al., 2022a) are an effective method for scaling diffusion models to high resolution outputs, finding considerable success in both class-conditional ImageNet (Ho et al., 2022a) and text-to-image generation (Ramesh et al., 2022; Saharia et al., 2022b). Cascaded diffusion models generate an image or video at a low resolution, then sequentially increase the resolution of the image or video through a series of super-resolution diffusion models. Cascaded Diffusion Models can model very high dimensional problems while still keeping each sub-model relatively simple. Imagen (Saharia et al., 2022b) also showed that by conditioning on text embeddings from a large frozen language model in conjunction with cascaded diffusion models, one can generate high quality $1 0 2 4 \times 1 0 2 4$ images from text descriptions. In this work we extend this approach to video generation.
160
+
161
+ Figure 6 summarizes the entire cascading pipeline of Imagen Video. In total, we have 1 frozen text encoder, 1 base video diffusion model, 3 SSR (spatial super-resolution), and 3 TSR (temporal super-resolution) models for a total of 7 video diffusion models, with a total of 11.6B diffusion model parameters. The data used to train these models is processed to the appropriate spatial and temporal resolutions by spatial resizing and frame skipping. At generation time, the SSR models increase spatial resolution for all input frames, whereas the TSR models increase temporal resolution by filling in intermediate frames between input frames. All models generate an entire block of frames simultaneously – so for instance, our SSR models do not suffer from obvious artifacts that would occur from naively running super-resolution on independent frames.
162
+
163
+ ![](images/6b59996bb4d772372726e02789aea0eee1b3f9ba382f99a8566a6e8d81ec47a7.jpg)
164
+ Figure 6: The cascaded sampling pipeline starting from a text prompt input to generating a 5.3-second, $1 2 8 0 \times 7 6 8$ video at 24fps. “SSR” and “TSR” denote spatial and temporal super-resolution respectively, and videos are labeled as frames $\times$ width $\times$ height. In practice, the text embeddings are injected into all models, not just the base model.
165
+
166
+ One benefit of cascaded models is that each diffusion model can be trained independently, allowing one to train all 7 models in parallel. Additionally, our super-resolution models are general purpose video superresolution models, and they can be applied to real videos or samples from generative models other than the ones presented in this paper. This is similar to how Imagen’s super-resolution models helped improve the fidelity of the images generated by Parti (Yu et al., 2022), which is an autoregressive text-to-image model. We intend to explore hybrid pipelines of multiple model classes further in future work.
167
+
168
+ Similar to Saharia et al. (2022b), we utilize contextual embeddings from a frozen T5-XXL text encoder (Raffel et al., 2020) for conditioning on the input text prompt. We find these embeddings to be critical for alignment between generated video and the text prompt. Similar to the findings of Saharia et al. (2022b), we observe evidence of deeper language understanding, enabling us to generate the videos displayed in Figs. 2 to 5.
169
+
170
+ # 2.3 Video diffusion architectures
171
+
172
+ Diffusion models for image generation typically use a 2D U-Net architecture (Ronneberger et al., 2015; Salimans et al., 2017; Ho et al., 2020) to represent the denoising model $\hat { \mathbf { x } } _ { \theta }$ . This is a multiscale model consisting of multiple layers of spatial attention and convolution at each resolution, combined with shortcuts between layers at the same resolution. In earlier work on Video Diffusion Models, Ho et al. (2022b) introduced the Video U-Net , which generalizes the 2D diffusion model architecture to 3D in a space-time separable fashion using temporal attention and convolution layers interleaved within spatial attention and convolution layers to capture dependencies between video frames. Our work builds on the Video U-Net architecture: see Figure 7. Following Video Diffusion Models, each of our denoising models $\hat { \mathbf { x } } _ { \theta }$ operate on multiple video frames simultaneously and thereby generate entire blocks of video frames at a time, which we find to be important to capture the temporal coherence of the generated video compared to frame-autoregressive approaches. Our spatial super-resolution (SSR) and temporal super-resolution (TSR) models condition on their input videos by concatenating an upsampled conditioning input channelwise to the noisy data $\mathbf { z } _ { t }$ , the same mechanism as SR3 (Saharia et al., 2022c) and Palette (Saharia et al., 2022a): spatial upsampling before concatenation is performed using bilinear resizing, and temporal upsampling before concatenation is performed by repeating frames or by filling in blank frames.
173
+
174
+ Our base video model, which is the first model in the pipeline that generates data at the lowest frame count and spatial resolution, uses temporal attention to mix information across time. Our SSR and TSR models, on the other hand, use temporal convolutions instead of temporal attention. The temporal attention in the base model enables Imagen Video to model long term temporal dependencies, while the temporal convolutions in the SSR and TSR models allow Imagen Video to maintain local temporal consistency during upsampling. The use of temporal convolutions lowers memory and computation costs over temporal attention—this is crucial because the very purpose of the TSR and SSR models is to operate at high frame rates and spatial resolutions. In our initial experiments, we did not find any significant improvements when using temporal attention over temporal convolutions in our SSR and TSR models, which we hypothesize is due to the significant amount of temporal correlation already present in the conditioning input to these models.
175
+
176
+ ![](images/2910e48845f75da3725a555562623a8a34ff8e36072bcf47c79400b54567845e.jpg)
177
+ Figure 7: Video U-Net space-time separable block. Spatial operations are performed independently over frames with shared parameters, whereas the temporal operation mixes activations over frames. Our base model uses spatial convolutions, spatial self-attention and temporal self-attention. For memory efficiency, our spatial and temporal super-resolution models use temporal convolutions instead of attention, and our models at the highest spatial resolution do not have spatial attention.
178
+
179
+ Our models also use spatial attention and spatial convolutions. The base model and the first two spatial super-resolution models have spatial attention in addition to spatial convolutions. We found this to improve sample fidelity. However, as we move to higher resolutions, we switch to fully convolutional architectures, like Saharia et al. (2022b), to minimize memory and compute costs in order to generate 1280 $\times$ 768 resolution data. The highest resolution SSR model in our pipeline is a fully convolutional model trained on random lower resolution spatial crops for training time memory efficiency, and we find that the model easily generalizes to the full resolution during sampling time.
180
+
181
+ # 2.4 v-prediction
182
+
183
+ We follow Salimans & Ho (2022) and use v-prediction parameterization ( $\mathbf { v } _ { t } \equiv \alpha _ { t } \mathbf { \epsilon } \epsilon - \sigma _ { t } \mathbf { x } ,$ for all our models. The $\mathbf { v } .$ -parameterization is particularly useful for numerical stability throughout the diffusion process to enable progressive distillation for our models. For models that operate at higher resolution in our pipeline, we also discovered that the v-parameterization avoids color shifting artifacts that are known to affect high resolution diffusion models, and in the video setting it avoids temporal color shifting that sometimes appears with $\epsilon$ -prediction models. Our use of v-parameterization also has the benefit of faster convergence of sample quality metrics: see Section 3.3.
184
+
185
+ # 2.5 Conditioning Augmentation
186
+
187
+ We use noise conditioning augmentation (Ho et al., 2022a) for all our temporal and spatial super-resolution models. Noise conditioning augmentation has been found to be critical for cascaded diffusion models for class-conditional generation (Ho et al., 2022a) as well as text-to-image models (Saharia et al., 2022b). In particular, it facilitates parallel training of different models in the cascade, as it reduces the sensitivity to domain gaps between the output of one stage of the cascade and the inputs used in training the subsequent stage.
188
+
189
+ Following Ho et al. (2022a), we apply Gaussian noise augmentation with a random signal-to-noise ratio to the conditioning input video during training, and this sampled signal-to-noise ratio is provided to the model as well. At sampling time we use a fixed signal-to-noise ratio such as 3 or 5, representing a small amount of augmentation that aids in removing artifacts in the samples from the previous stage while preserving most of the structure.
190
+
191
+ # 2.6 Video-Image Joint Training
192
+
193
+ We follow Ho et al. (2022b) in jointly training all the models in the Imagen Video pipeline on images and videos. During training, individual images are treated as single frame videos. We achieve this by packing individual independent images into a sequence of the same length as a video, and bypass the temporal convolution residual blocks by masking out their computation path. Similarly, we disable crossframe temporal attention by applying masking to the temporal attention maps. This strategy allows us to use to train our video models on image-text datasets that are significantly larger and more diverse than available video-text datasets. Consistent with Ho et al. (2022b), we observe that joint training with images significantly increases the overall quality of video samples. Another interesting artifact of joint training is the knowledge transfer from images to videos. For instance, while training on natural video data only enables the model to learn dynamics in natural settings, the model can learn about different image styles (such as sketch, painting, etc.) by training on images. As a result, this joint training enables the model to generate interesting video dynamics in different styles. See Fig. 8 for such examples.
194
+
195
+ # 2.6.1 Classifier Free Guidance
196
+
197
+ We found classifier free guidance (Ho & Salimans, 2021) to be critical for generating high fidelity samples which respect a given text prompt. This is consistent with earlier results on text-to-image models (Nichol et al., 2021; Ramesh et al., 2022; Saharia et al., 2022b; Yu et al., 2022).
198
+
199
+ In the conditional generation setting, the data $\mathbf { x }$ is generated conditional on a signal $\mathbf { c }$ , which here represents a contextualized embedding of the text prompt, and a conditional diffusion model can be trained by using this signal $\mathbf { c }$ as an additional input to the denoising model $\hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } )$ . After training, Ho & Salimans (2021) find that sample quality can be improved by adjusting the denoising prediction $\hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } )$ using
200
+
201
+ $$
202
+ \widetilde { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } ) = ( 1 + w ) \widehat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } ) - w \widehat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) ,
203
+ $$
204
+
205
+ where $w$ is the guidance strength, $\hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } )$ is the conditional model, and $\hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) ~ = ~ \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } ~ = ~ \varnothing )$ is an unconditional model. The unconditional model is jointly trained with the conditional model by dropping out the conditioning input $\mathbf { c }$ . The predictions of the adjusted denoising model $\tilde { \bf x } _ { \theta } ( { \bf z } _ { t } , { \bf c } )$ are clipped to respect the range of possible pixel values, which we discuss in more detail in the next section. Note that the linear transformation in Equation 5 can equivalently be performed in $\mathbf { v }$ -space $\left( \tilde { \mathbf { v } } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } ) = ( 1 + w ) \hat { \mathbf { v } } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } ) - \right.$ $w \hat { \mathbf { v } } _ { \theta } ( \mathbf { z } _ { t } )$ ) or $\epsilon$ -space $\tilde { \epsilon } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } ) = ( 1 + w ) \hat { \epsilon } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } ) - w \hat { \epsilon } _ { \theta } ( \mathbf { z } _ { t } ) )$ .
206
+
207
+ For $w > 0$ this adjustment has the effect of over-emphasizing the effect of conditioning on the signal $\mathbf { c }$ , which tends to produce samples of lower diversity but higher quality compared to sampling from the regular conditional model (Ho & Salimans, 2021). The method can be interpreted as a way to guide the samples towards areas where an implicit classifier $p ( \mathbf { c } | \mathbf { z } _ { t } )$ has high likelihood; as such, it is an adaptation of the explicit classifier guidance method proposed by Dhariwal $\&$ Nichol (2022).
208
+
209
+ # 2.6.2 Large Guidance Weights
210
+
211
+ When using large guidance weights, the resulting $\tilde { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } )$ must be projected back to the possible range of pixel values at every sampling step to prevent train-test mismatch. When using large guidance weights, the standard approach, i.e., clipping the values to the right range (e.g., np.clip(x, -1, 1)), leads to significant saturation artifacts in the generated videos. A similar effect was observed in Saharia et al. (2022b) for textto-image generation. Saharia et al. (2022b) use dynamic thresholding to alleviate this saturation issue. Specifically, dynamic clipping involves clipping the image to a dynamically chosen threshold $\mathbf { s }$ followed by scaling by $\tt s$ (i.e., np.clip(x, -s, s) / s) (Saharia et al., 2022b).
212
+
213
+ Although dynamic clipping can help with over-saturation, we did not find it sufficient in initial experiments. We therefore also experiment with letting $w$ oscillate between a high and a low guidance weight at each alternating sampling step, which we find significantly helps with these saturation issues. We call this sampling technique oscillating guidance. Specifically, we use a constant high guidance weight for a certain number of initial sampling steps, followed by oscillation between high and low guidance weights: this oscillation is implemented simply by alternating between a large weight (such as 15) and a small weight (such as 1) over the course of sampling. We hypothesize that a constant high guidance weight at the start of sampling helps break modes with heavy emphasis on text, while oscillating between high and low guidance weights helps maintain a strong text alignment (via high guidance sampling step) while limiting saturation artifacts (via low guidance sampling step). We however observed no improvement in sample fidelity and more visual artifacts when applying oscillating guidance to models past the 80 $\times$ 48 spatial resolution. Thus we only apply oscillating guidance to the base and the first two SR models.
214
+
215
+ # 2.7 Progressive Distillation with Guidance and Stochastic Samplers
216
+
217
+ Salimans & Ho (2022) proposed progressive distillation to enable fast sampling of diffusion models. This method distills a trained deterministic DDIM sampler (Song et al., 2020) to a diffusion model that takes many fewer sampling steps, without losing much perceptual quality. At each iteration of the distillation process, an $N$ -step DDIM sampler is distilled to a new model with $N / 2$ -steps. This procedure is repeated by halving the required sampling steps each iteration. Meng et al. (2022) extend this approach to samplers with guidance, and propose a new stochastic sampler for use with distilled models. Here we show that this approach also works very well for video generation.
218
+
219
+ We use a two-stage distillation approach to distill a DDIM sampler (Song et al., 2020) with classifier-free guidance. At the first stage, we learn a single diffusion model that matches the combined output from the jointly trained conditional and unconditional diffusion models, where the combination coefficients are determined by the guidance weight. Then we apply progressive distillation to that single model to produce models requiring fewer sampling steps at the second stage.
220
+
221
+ After distillation, we use a stochastic $N$ -step sampler: At each step, we first apply one deterministic DDIM update with twice the original step size (i.e., the same step size as a $N / 2$ -step sampler), and then we perform one stochastic step backward (i.e., perturbed with noise following the forward diffusion process) with the original step size, inspired by Karras et al. (2022). See Meng et al. (2022) for more details. Using this approach, we are able to distill all 7 video diffusion models down to just 8 sampling steps per model without any noticeable loss in perceptual quality.
222
+
223
+ # 3 Experiments
224
+
225
+ We train our models on a combination of an internal dataset consisting of 14 million video-text pairs and 60 million image-text pairs, and the publicly available LAION-400M image-text dataset (Schuhmann et al., 2021). To process the data into a form suitable for training our cascading pipeline, we spatially resize images and videos using antialiased bilinear resizing, and we temporally resize videos by skipping frames. Throughout our model development process, we evaluated Imagen Video on several different metrics, such as FID on individual frames (Heusel et al., 2017), FVD (Unterthiner et al., 2019) for temporal consistency, and frame-wise CLIP scores (Hessel et al., 2021; Park et al., 2021) for video-text alignment. Below, we explore the capabilities of our model and investigate its performance in regards to 1) scaling up the number of parameters in our model, 2) changing the parameterization of our model, and 3) distilling our models so that they are fast to sample from.
226
+
227
+ # 3.1 Unique video generation capabilities
228
+
229
+ We find that Imagen Video is capable of generating high fidelity video, and that it possesses several unique capabilities that are not traditionally found in unstructured generative models learned purely from data. For example, Fig. 8 shows that our model is capable of generating videos with artistic styles learned from image information, such as videos in the style of van Gogh paintings or watercolor paintings. Fig. 9 shows that Imagen Video possesses an understanding of 3D structure, as it is capable of generating videos of objects rotating while roughly preserving structure. While the 3D consistency over the course of rotation is not
230
+
231
+ ![](images/b004e146b69df389b282868202d21643cdcce59a70e00811de230efb4e553a71.jpg)
232
+ Drone flythrough of a pixel art of futuristic city.
233
+
234
+ Figure 8: Snapshots of frames from videos generated by Imagen Video demonstrating the ability of the mode to generate dynamics in different artistic styles.
235
+
236
+ ![](images/1221ffbdcd6a012e86f0f7ae55bf9572a1a4cc73e17dbc2816c7853da737fc93.jpg)
237
+ A 3D model of an elephant origami. Studio lighting.
238
+
239
+ ![](images/a9874e80b01e0778d489f71b11bd54576424d9316e72970675c0188dd6cafc84.jpg)
240
+ Figure 9: Snapshots of frames from videos generated by Imagen Video demonstrating the model’s under standing of 3D structures.
241
+
242
+ ![](images/97dea5c09c0516c0d2a02182394557275c599af5ef20c8ebd86e9614f41c37ad.jpg)
243
+ A colorful professional animated logo for ’Diffusion’ written using paint brush in cursive. Smooth animation.
244
+
245
+ Sprouts in the shape of text ’Imagen’ coming out of a fairytale book.
246
+
247
+ ![](images/342234d4e502eb9100353aedd56b6b2178aaac41c69626055fd6e62b0b83d2bc.jpg)
248
+ Thousands of fast brush strokes slowly forming the text ’Imagen Video’ on a light beige canvas. Smooth animation. Figure 10: Snapshots of frames from videos generated by Imagen Video demonstrating the ability of the model to render a variety of text with different style and dynamics.
249
+
250
+ exact, we believe Imagen Video shows that video models can serve as effective priors for methods that do force 3D consistency. Fig. 10 shows that Imagen Video is also reliably capable of generating text in a wide variety of animation styles, some of which would be difficult to animate using traditional tools. We see results such as these as an exciting indication of how general purpose generative models such as Imagen Video can significantly decrease the difficulty of high quality content generation.
251
+
252
+ # 3.2 Scaling
253
+
254
+ In Figure 11 we show that our base video model strongly benefits from scaling up the parameter count of the video U-Net. We performed this scaling by increasing the base channel count and depth of the network. This result is contrary to the text-to-image U-Net scaling results by Saharia et al. (2022b), which found limited benefit from diffusion model scaling when measured by image-text sample quality scores. We conclude that video modeling is a harder task for which performance is not yet saturated at current model sizes, implying future benefits to further model scaling for video generation.
255
+
256
+ ![](images/789e8cc4f7559686e6db1efe096b011df90ad9bd57a151db67d7f5d533171a51.jpg)
257
+ Figure 11: Scaling Comparison for the base $1 6 \times 4 0 \times 2 4$ video model on FVD and CLIP scores (on 0-100 scale). Both FVD and CLIP scores are computed on 4096 video samples. We see clear signs of improvement on both metrics when scaling from 500M to 1.6B to 5.6B parameters.
258
+
259
+ # 3.3 Comparing prediction parameterizations
260
+
261
+ In early experiments we found that training $\epsilon$ -prediction models (Ho et al., 2020) performed worse than $\mathbf { v }$ -prediction (Salimans & Ho, 2022) especially at high resolutions. Specifically, for high resolution SSR models, we observed that $\epsilon$ -prediction converges relatively slowly in terms of sample quality metrics and suffers from color shift and color inconsistency across frames in the generated videos. Fig. 12 shows the comparison between $\epsilon$ -prediction and $\mathbf { v }$ -prediction on a 80 $\times$ 48 → 320 $\times$ 192 video spatial super-resolution task. It is clear that $\epsilon$ -parameterization produces worse generations than $\mathbf { v }$ -parameterization. Fig. 13 shows the quantitative comparison between the two parameterizations as a function of training steps. We observe that $\mathbf { v }$ parameterization converges much more faster than $\epsilon$ parameterization.
262
+
263
+ # 3.4 Perceptual quality and distillation
264
+
265
+ In Table 1 we report perceptual quality metrics (CLIP score and CLIP R-Precision) for our model samples, as well as for their distilled version. Samples are generated and evaluated at 192 $\times$ 320 resolution for 128 frames at 24 frames per second. For CLIP score, we take the average score over all frames. For CLIP R-Precision (Park et al., 2021) we compute the top-1 accuracy (i.e. $R = 1$ ), treating the frames of a video sample as images sharing the same text label (the prompt). We repeat these over four different runs and report the mean and standard error.
266
+
267
+ We find that distillation provides a very favorable trade-off between sampling time and perceptual quality: the distilled cascade is about 18 $\times$ faster, while producing videos of similar quality to the samples from the original models. In terms of FLOPs, the distilled models are about 36 $\times$ more efficient: The original cascade evaluates each model twice (in parallel) to apply classifier-free guidance, while our distilled models do not, since they distilled the effect of guidance into a single model. We provide samples from our original and distilled cascade in Figure 14 for illustration.
268
+
269
+ ![](images/a6da3405e211d7c3d0b48d63a33d2636490901a003f68bd8bdb179bf98bb6721.jpg)
270
+ $8 0 \times 4 8$ input video frames
271
+ Figure 12: Comparison between $\epsilon$ -prediction (middle row) and v-prediction (bottom row) for a 8 $\times$ 80 $\times$ 48 8 $\times$ 320 $\times$ 192 spatial super-resolution architecture at 200k training steps. The frames from the $\epsilon$ -prediction model are generally worse, suffering from unnatural global color shifts across frames. The frames from the v-prediction model do not and are more consistent.
272
+
273
+ ![](images/afec2a06f98752ec7650e99490a85f9122e529bab0d49bc4763af3f3a487a8eb.jpg)
274
+ Figure 13: Comparison between $8 0 \times 4 8 3 2 0 \times 1 9 2$ SSR models trained with $\epsilon$ - and $\mathbf { v }$ -prediction parameterizations. We report FID evaluated on the first upsampled frame; FVD score is excessively noisy for the $\epsilon$ -prediction model. We observe that the sample quality of the $\epsilon$ -prediction model converges much more slowly than that of the v-prediction model.
275
+
276
+ # 4 Limitations and Societal Impact
277
+
278
+ Generative modeling has made tremendous progress, especially in recent text-to-image models (Saharia et al., 2022b; Ramesh et al., 2022; Rombach et al., 2022). Imagen Video is another step forward in generative modelling capabilities, advancing text-to-video AI systems. Video generative models can be used to positively impact society, for example by amplifying and augmenting human creativity. However, these generative models may also be misused, for example to generate fake, hateful, explicit or harmful content. We have taken multiple steps to minimize these concerns, for example in internal trials, we apply input text prompt filtering, and output video content filtering. However, there are several important safety and ethical challenges remaining. Imagen Video and its frozen T5-XXL text encoder were trained on problematic data (Bordia $\&$ Bowman, 2017; Birhane et al., 2021; Bender et al., 2021). While our internal testing suggests much of explicit and violent content can be filtered out, there still exists social biases and stereotypes which are challenging
279
+
280
+ <table><tr><td>Guidance w</td><td>Base Steps</td><td> SR Steps</td><td>CLIP Score</td><td>CLIP R-Precision</td><td>Sampling Time</td></tr><tr><td>constant=6</td><td>256</td><td>128</td><td>25.19±.03</td><td>92.12±.53</td><td>618 sec</td></tr><tr><td>oscillate(15,1)</td><td>256</td><td>128</td><td>25.02±.08</td><td>89.91±.96</td><td>618 sec</td></tr><tr><td>constant=6</td><td>256</td><td>8</td><td>25.29±.05</td><td>90.88±.50</td><td>135 sec</td></tr><tr><td>oscillate(15,1)</td><td>256</td><td>8</td><td>25.15±.09</td><td>88.78±.69</td><td>135 sec</td></tr><tr><td>constant=6</td><td>8</td><td>8</td><td>25.03±.05</td><td>89.68±.38</td><td>35 sec</td></tr><tr><td>oscillate(15,1)</td><td>8</td><td>8</td><td>25.12±.07</td><td>90.97±.46</td><td>35 sec</td></tr><tr><td> ground truth</td><td></td><td></td><td>24.27</td><td>86.18</td><td></td></tr></table>
281
+
282
+ Table 1: CLIP scores and CLIP R-Precision (Park et al., 2021) values for generated samples and ground truth videos on prompts from our test set. Cells highlighted in green represent distilled models. We compare three different combinations: original pipeline, distilled SR models on top of original base model, and fully distilled pipeline. The original base models use 256 sampling steps, and original SR models use 128 steps. All distilled models use 8 sampling steps per stage. Sampling from the original pipeline takes 618 seconds for one batch of samples, while sampling from the distilled pipeline takes 35 seconds, making the distilled pipeline about 18 $\times$ faster. We also explored two different classifier-free guidance settings for the base models: constant guidance with $w = 6$ and oscillating guidance which alternates between $w = 1 5$ and $w = 1$ , following Saharia et al. (2022b). When using oscillating guidance, the fully distilled pipeline performs the same as the original model, or even slightly better. When using fixed guidance, our fully distilled pipeline scores slightly lower than the original model, though the difference is minor. Combining the original base model with fixed guidance and distilled super-resolution models produced the highest CLIP score. For all models, generated samples obtain better perceptual quality metrics than the original ground truth data: By using classifier-free guidance our models sample from a distribution tilted towards these quality metrics, rather than from an accurate approximation of the original data distribution.
283
+
284
+ ![](images/b497801badbb304195e8c26f2c8d67c7fa5c01f65e1dfcc29bfb88e1439d2f27.jpg)
285
+ Figure 14: Frames from videos generated by Imagen Video for the text prompt “ $A$ teddy bear wearing sunglasses playing guitar next to a cactus.” The samples on the left are produced by our original model cascade, while the samples on the right are from our distilled cascade with 8 sampling steps per stage. Both used constant guidance with $w = 6$ and static clipping.
286
+
287
+ to detect and filter. We have decided not to release the Imagen Video model or its source code until these concerns are mitigated.
288
+
289
+ # 5 Conclusion
290
+
291
+ We presented Imagen Video: a text-conditional video generation system based on a cascade of video diffusion models. By extending the text-to-image diffusion models of Imagen (Saharia et al., 2022b) to the time domain, and training jointly on video and images, we obtained a model capable of generating high fidelity videos with good temporal consistency while maintaining the strong features of the original image system, such as the ability to accurately spell text. We transferred multiple methods from the image domain to video, such as $\mathbf { v }$ -parameterization (Salimans & Ho, 2022), conditioning augmentation (Ho et al., 2022a), and classifier-free guidance (Ho & Salimans, 2021), and found that these are also useful in the video setting. Video modeling is computationally demanding, and we found that progressive distillation (Salimans & Ho, 2022; Meng et al., 2022) is a valuable technique for speeding up video diffusion models at sampling time. Given the tremendous recent progress in generative modeling, we believe there is ample scope for further improvements in video generation capabilities in future work.
292
+
293
+ # References
294
+
295
+ Mohammad Babaeizadeh, Chelsea Finn, D. Erhan, Roy H. Campbell, and Sergey Levine. Stochastic variational video prediction. ArXiv, abs/1710.11252, 2018.
296
+ Mohammad Babaeizadeh, Mohammad Taghi Saffar, Suraj Nair, Sergey Levine, Chelsea Finn, and Dumitru Erhan. Fitvid: Overfitting in pixel-level video prediction, 2021. URL https://arxiv.org/abs/2106. 13195.
297
+ Emily M. Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. On the dangers of stochastic parrots: Can language models be too big? . In Proceedings of FAccT 2021, 2021.
298
+ Abeba Birhane, Vinay Uday Prabhu, and Emmanuel Kahembwe. Multimodal datasets: misogyny, pornography, and malignant stereotypes. In arXiv:2110.01963, 2021.
299
+ Shikha Bordia and Samuel R. Bowman. Identifying and Reducing Gender Bias in Word-Level Language Models. In NAACL, 2017.
300
+ Nanxin Chen, Yu Zhang, Heiga Zen, Ron J. Weiss, Mohammad Norouzi, and William Chan. WaveGrad: Estimating Gradients for Waveform Generation. In ICLR, 2021a.
301
+ Nanxin Chen, Yu Zhang, Heiga Zen, Ron J. Weiss, Mohammad Norouzi, Najim Dehak, and William Chan. WaveGrad 2: Iterative Refinement for Text-to-Speech Synthesis . In INTERSPEECH, 2021b.
302
+ Prafulla Dhariwal and Alex Nichol. Diffusion models beat gans on image synthesis. In NeurIPS, 2022.
303
+ Ming Ding, Zhuoyi Yang, Wenyi Hong, Wendi Zheng, Chang Zhou, Da Yin, Junyang Lin, Xu Zou, Zhou Shao, Hongxia Yang, and Jie Tang. Cogview: Mastering text-to-image generation via transformers, 2021. URL https://arxiv.org/abs/2105.13290.
304
+ Chelsea Finn, Ian J. Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. ArXiv, abs/1605.07157, 2016.
305
+ Agrim Gupta, Stephen Tian, Yunzhi Zhang, Jiajun Wu, Roberto Mart’in-Mart’in, and Li Fei-Fei. Maskvit: Masked visual pre-training for video prediction. ArXiv, abs/2206.11894, 2022.
306
+ William Harvey, Saeid Naderiparizi, Vaden Masrani, Christian Weilbach, and Frank Wood. Flexible diffusion modeling of long videos. ArXiv, abs/2205.11495, 2022.
307
+ Jack Hessel, Ari Holtzman, Maxwell Forbes, Ronan Le Bras, and Yejin Choi. Clipscore: A reference-free evaluation metric for image captioning. arXiv preprint arXiv:2104.08718, 2021.
308
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. arXiv preprint arXiv:1706.08500, 2017.
309
+ Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. In NeurIPS 2021 Workshop on Deep Generative Models and Downstream Applications, 2021.
310
+ Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising Diffusion Probabilistic Models. NeurIPS, 2020.
311
+
312
+ Jonathan Ho, Chitwan Saharia, William Chan, David J Fleet, Mohammad Norouzi, and Tim Salimans. Cascaded diffusion models for high fidelity image generation. JMLR, 2022a.
313
+ Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J. Fleet. Video Diffusion Models. In arXiv:2204.03458, 2022b.
314
+ Nal Kalchbrenner, Aäron van den Oord, Karen Simonyan, Ivo Danihelka, Oriol Vinyals, Alex Graves, and Koray Kavukcuoglu. Video pixel networks. ArXiv, abs/1610.00527, 2017.
315
+ Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusion-based generative models. arXiv preprint arXiv:2206.00364, 2022.
316
+ Diederik P Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. arXiv preprint arXiv:2107.00630, 2021.
317
+ Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. DiffWave: A Versatile Diffusion Model for Audio Synthesis. In ICLR, 2021.
318
+ Manoj Kumar, Mohammad Babaeizadeh, D. Erhan, Chelsea Finn, Sergey Levine, Laurent Dinh, and Durk Kingma. Videoflow: A conditional flow-based model for stochastic video generation. arXiv: Computer Vision and Pattern Recognition, 2020.
319
+ Tanya Marwah, Gaurav Mittal, and Vineeth N Balasubramanian. Attentive semantic video generation using captions. In Proceedings of the IEEE international conference on computer vision, pp. 1426–1434, 2017.
320
+ Michaël Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square error. CoRR, abs/1511.05440, 2016.
321
+ Chenlin Meng, Ruiqi Gao, Diederik P Kingma, Stefano Ermon, Jonathan Ho, and Tim Salimans. On distillation of guided diffusion models. arXiv preprint arXiv:2210.03142, 2022.
322
+ Gaurav Mittal, Tanya Marwah, and Vineeth N Balasubramanian. Sync-draw: Automatic video generation using deep recurrent attentive architectures. In Proceedings of the 25th ACM international conference on Multimedia, pp. 1096–1104, 2017.
323
+ Alex Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, pp. 8162–8171. PMLR, 2021.
324
+ Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Bob McGrew Pamela Mishkin, Ilya Sutskever, and Mark Chen. GLIDE: Towards Photorealistic Image Generation and Editing with TextGuided Diffusion Models. In arXiv:2112.10741, 2021.
325
+ Dong Huk Park, Samaneh Azadi, Xihui Liu, Trevor Darrell, and Anna Rohrbach. Benchmark for compositional text-to-image synthesis. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 1), 2021. URL https://openreview.net/forum?id= bKBhQhPeKaF.
326
+ Ben Poole, Ajay Jain, Jonathan T. Barron, and Ben Mildenhall. DreamFusion: Text-to-3D using 2D Diffusion. arXiv, 2022.
327
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer. JMLR, 21(140), 2020.
328
+ Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical Text-Conditional Image Generation with CLIP Latents. In arXiv, 2022.
329
+ Marc’Aurelio Ranzato, Arthur D. Szlam, Joan Bruna, Michaël Mathieu, Ronan Collobert, and Sumit Chopra. Video (language) modeling: a baseline for generative models of natural videos. ArXiv, abs/1412.6604, 2014.
330
+ Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-Resolution Image Synthesis with Latent Diffusion Models. In CVPR, 2022.
331
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pp. 234–241. Springer, 2015.
332
+ Chitwan Saharia, William Chan, Huiwen Chang, Chris A. Lee, Jonathan Ho, Tim Salimans, David J. Fleet, and Mohammad Norouzi. Palette: Image-to-Image Diffusion Models. In SIGGRAPH, 2022a.
333
+ Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S. Sara Mahdavi, Rapha Gontijo Lopes, Tim Salimans, Jonathan Ho, David J Fleet, and Mohammad Norouzi. Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding. In NeurIPS, 2022b.
334
+ Chitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2022c.
335
+ Tim Salimans and Jonathan Ho. Progressive Distillation for Fast Sampling of Diffusion Models. In ICLR, 2022.
336
+ Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P Kingma. PixelCNN $^ { + + }$ : Improving the PixelCNN with discretized logistic mixture likelihood and other modifications. In International Conference on Learning Representations, 2017.
337
+ Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-400m: Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint arXiv:2111.02114, 2021.
338
+ Xingjian Shi, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-Kin Wong, and Wang chun Woo. Convolutional lstm network: A machine learning approach for precipitation nowcasting. In NIPS, 2015.
339
+ Uriel Singer, Adam Polyak, Thomas Hayes, Xi Yin, Jie An, Songyang Zhang, Qiyuan Hu, Harry Yang, Oron Ashual, Oran Gafni, Devi Parikh, Sonal Gupta, and Yaniv Taigman. Make-A-Video: Text-to-Video Generation without Text-Video Data. In arXiv:2209.14792, 2022.
340
+ Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pp. 2256–2265. PMLR, 2015.
341
+ Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020.
342
+ Yang Song and Stefano Ermon. Generative Modeling by Estimating Gradients of the Data Distribution. NeurIPS, 2019.
343
+ Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In ICLR, 2021.
344
+ Belinda Tzen and Maxim Raginsky. Neural Stochastic Differential Equations: Deep Latent Gaussian Models in the Diffusion Limit. In arXiv:1905.09883, 2019.
345
+ Thomas Unterthiner, Sjoerd van Steenkiste, Karol Kurach, Raphaël Marinier, Marcin Michalski, and Sylvain Gelly. FVD: A new Metric for Video Generation. In ICLR 2022 Workshop: Deep Generative Models for Highly Structured Data, 2019.
346
+ Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. ArXiv, abs/1609.02612, 2016.
347
+ Daniel Watson, Ricardo Chan, William Martin-Brualla, Jonathan Ho, Andrea Tagliasacchi, and Mohammad Norouzi. Novel View Synthesis with Diffusion Models. arXiv, 2022.
348
+ Jay Whang, Mauricio Delbracio, Hossein Talebi, Chitwan Saharia, Alexandros G. Dimakis, and Peyman Milanfar. Deblurring via Stochastic Refinement. In CVPR, 2022.
349
+ Ruihan Yang, Prakhar Srivastava, and Stephan Mandt. Diffusion Probabilistic Modeling for Video Generation. In arXiv:2203.09481, 2022.
350
+ Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, Ben Hutchinson, Wei Han, Zarana Parekh, Xin Li, Han Zhang, and Yonghui Wu Jason Baldridge. Scaling Autoregressive Models for Content-Rich Text-to-Image Generation. In arXiv:2206.10789, 2022.
parse/test/ETH1GDbSPw/ETH1GDbSPw_content_list.json ADDED
@@ -0,0 +1,847 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Imagen Video: High Definition Video Generation with Diffusion Models ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Anonymous authors Paper under double-blind review ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "Abstract ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "We present Imagen Video, a text-conditional video generation system based on a cascade of video diffusion models. Given a text prompt, Imagen Video generates high definition videos using a base video generation model and a sequence of interleaved spatial and temporal video super-resolution models. We describe how we scale up the system as a high definition text-to-video model including design decisions such as the choice of fully-convolutional temporal and spatial super-resolution models at certain resolutions, and the choice of the v-parameterization of diffusion models. In addition, we confirm and transfer findings from previous work on diffusion-based image generation to the video generation setting. Finally, we apply progressive distillation to our video models with classifier-free guidance for fast, high quality sampling. We find Imagen Video not only capable of generating videos of high fidelity, but also having a high degree of controllability and world knowledge, including the ability to generate diverse videos and text animations in various artistic styles and with 3D object understanding. ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "image",
26
+ "img_path": "images/7278d4c9f33331da8e8af9b951b25b288446ba78053005bae48faadaa9da97cf.jpg",
27
+ "image_caption": [
28
+ "Figure 1: Imagen Video sample for the prompt: “A bunch of autumn leaves falling on a calm lake to form the text ‘Imagen Video’. Smooth.” The generated video is at $1 2 8 0 \\times 7 6 8$ resolution, 5.3 second duration and 24 frames per second. "
29
+ ],
30
+ "image_footnote": [],
31
+ "page_idx": 0
32
+ },
33
+ {
34
+ "type": "text",
35
+ "text": "1 Introduction ",
36
+ "text_level": 1,
37
+ "page_idx": 0
38
+ },
39
+ {
40
+ "type": "text",
41
+ "text": "Generative modeling has made tremendous progress with recent text-to-image systems like DALL-E 2 (Ramesh et al., 2022), Imagen (Saharia et al., 2022b), Parti (Yu et al., 2022), CogView (Ding et al., 2021) and Latent Diffusion (Rombach et al., 2022). Diffusion models (Sohl-Dickstein et al., 2015; Ho et al., 2020) in particular have found considerable success in multiple generative modeling tasks (Nichol & Dhariwal, 2021; Ho et al., 2022a; Dhariwal & Nichol, 2022) including density estimation (Kingma et al., 2021), text-to-speech (Chen et al., 2021a; Kong et al., 2021; Chen et al., 2021b), image-to-image (Saharia et al., 2022c;a; Whang et al., 2022), text-to-image (Rombach et al., 2022; Nichol et al., 2021; Ramesh et al., 2022; Saharia et al., 2022b) and 3D synthesis (Poole et al., 2022; Watson et al., 2022). ",
42
+ "page_idx": 0
43
+ },
44
+ {
45
+ "type": "image",
46
+ "img_path": "images/1eb960de54321d1c0eb739ad32a1b354b6f33e5c432a29f1dcfd2bd5ee9df629.jpg",
47
+ "image_caption": [
48
+ "A colorful professional animated logo for ’Imagen Video’ written using paint brush in cursive. Smooth animation. "
49
+ ],
50
+ "image_footnote": [],
51
+ "page_idx": 1
52
+ },
53
+ {
54
+ "type": "image",
55
+ "img_path": "images/8b2f58e72050f92510ccaf16771c8d4531c5e2f54fd0a8c386e3926d4db218f7.jpg",
56
+ "image_caption": [
57
+ "Blue flame transforming into the text “Imagen”. Smooth animation "
58
+ ],
59
+ "image_footnote": [],
60
+ "page_idx": 1
61
+ },
62
+ {
63
+ "type": "image",
64
+ "img_path": "images/883adccdc4dbb074b9587f82f68592dfc4f2020a44d011f24553577566e66d42.jpg",
65
+ "image_caption": [],
66
+ "image_footnote": [],
67
+ "page_idx": 1
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "Wooden figurine surfing on a surfboard in space. ",
72
+ "page_idx": 1
73
+ },
74
+ {
75
+ "type": "image",
76
+ "img_path": "images/ae128f4235e677ebff26bc35628c949da37817a1f991aad51a14a464f6f346b4.jpg",
77
+ "image_caption": [],
78
+ "image_footnote": [],
79
+ "page_idx": 1
80
+ },
81
+ {
82
+ "type": "text",
83
+ "text": "Balloon full of water exploding in extreme slow motion. ",
84
+ "page_idx": 1
85
+ },
86
+ {
87
+ "type": "image",
88
+ "img_path": "images/70375ded516a5c4193221cee18eb4528633968e19a9a72e007ce242db16e38e5.jpg",
89
+ "image_caption": [],
90
+ "image_footnote": [],
91
+ "page_idx": 1
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "Melting pistachio ice cream dripping down the cone. ",
96
+ "page_idx": 1
97
+ },
98
+ {
99
+ "type": "image",
100
+ "img_path": "images/aa586e8c5fb6ed7653aafe39170a0524cfb04fa279348d10faa61221515b6097.jpg",
101
+ "image_caption": [],
102
+ "image_footnote": [],
103
+ "page_idx": 1
104
+ },
105
+ {
106
+ "type": "text",
107
+ "text": "A british shorthair jumping over a couch. ",
108
+ "page_idx": 1
109
+ },
110
+ {
111
+ "type": "image",
112
+ "img_path": "images/bff20f7b0156aa5827c480f65d371d77d14e8566a89e2766d38c35228533f2ea.jpg",
113
+ "image_caption": [
114
+ "Coffee pouring into a cup. "
115
+ ],
116
+ "image_footnote": [],
117
+ "page_idx": 1
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "Figure 2: Videos generated from various text prompts. Imagen Video produces diverse and temporallycoherent videos that are well-aligned with the given prompt. ",
122
+ "page_idx": 1
123
+ },
124
+ {
125
+ "type": "image",
126
+ "img_path": "images/4d7e688166466d6c141b0ffdd85c547d4a2347c3358652df89c986300b16c69e.jpg",
127
+ "image_caption": [
128
+ "A small hand-crafted wooden boat taking off to space. "
129
+ ],
130
+ "image_footnote": [],
131
+ "page_idx": 2
132
+ },
133
+ {
134
+ "type": "image",
135
+ "img_path": "images/6f662944f0642b3bad14ef4d2b7a028ffac4828ab102982b6abbcb67bce14d5b.jpg",
136
+ "image_caption": [
137
+ "A person riding a bike in the sunset. "
138
+ ],
139
+ "image_footnote": [],
140
+ "page_idx": 2
141
+ },
142
+ {
143
+ "type": "image",
144
+ "img_path": "images/e7915d1eed1b5078a741ab2a4e7fd4aa5e0d034439b24753a12a479bf2b181d6.jpg",
145
+ "image_caption": [
146
+ "Drone flythrough interior of Sagrada Familia cathedral "
147
+ ],
148
+ "image_footnote": [],
149
+ "page_idx": 2
150
+ },
151
+ {
152
+ "type": "image",
153
+ "img_path": "images/bd441bd546a618fce6339bf087375abda89ac8f0ebaf7e7136d6682f3739361f.jpg",
154
+ "image_caption": [],
155
+ "image_footnote": [],
156
+ "page_idx": 2
157
+ },
158
+ {
159
+ "type": "text",
160
+ "text": "Wooden figurine walking on a treadmill made out of exercise mat. ",
161
+ "page_idx": 2
162
+ },
163
+ {
164
+ "type": "image",
165
+ "img_path": "images/a501fe5f233094e4b84e1c1686fd3ca4f120dcde28ac2c91bb9df555009797f1.jpg",
166
+ "image_caption": [
167
+ "Origami dancers in white paper, 3D render, ultra-detailed, on white background, studio shot, dancing modern dance. "
168
+ ],
169
+ "image_footnote": [],
170
+ "page_idx": 2
171
+ },
172
+ {
173
+ "type": "image",
174
+ "img_path": "images/de7ad70f69cca72ba1027beec906864801b5442478c1026f8e558fd8f832c360.jpg",
175
+ "image_caption": [
176
+ "Campfire at night in a snowy forest with starry sky in the background. "
177
+ ],
178
+ "image_footnote": [],
179
+ "page_idx": 2
180
+ },
181
+ {
182
+ "type": "image",
183
+ "img_path": "images/190bd2b24d98ab38702d79260a77f51ecd29f3569f68e2defb117a11ddb8fcc0.jpg",
184
+ "image_caption": [
185
+ "An astronaut riding a horse. "
186
+ ],
187
+ "image_footnote": [],
188
+ "page_idx": 2
189
+ },
190
+ {
191
+ "type": "text",
192
+ "text": "Figure 3: Videos generated from various text prompts. Imagen Video produces diverse and temporallycoherent videos that are well-aligned with the given prompt. ",
193
+ "page_idx": 2
194
+ },
195
+ {
196
+ "type": "image",
197
+ "img_path": "images/db86e191c3d0d8ac566432a1b352855849607a56afa2eb528793dd13ee33c57c.jpg",
198
+ "image_caption": [
199
+ "A person riding a horse in the sunrise. "
200
+ ],
201
+ "image_footnote": [],
202
+ "page_idx": 3
203
+ },
204
+ {
205
+ "type": "image",
206
+ "img_path": "images/18eec6a916fd82c5ef51a71cea291b74714119896a22f76139f1290312139811.jpg",
207
+ "image_caption": [
208
+ "A happy elephant wearing a birthday hat walking under the sea. "
209
+ ],
210
+ "image_footnote": [],
211
+ "page_idx": 3
212
+ },
213
+ {
214
+ "type": "image",
215
+ "img_path": "images/a438281876e28778822daefc812fdca67163a7c82a34505ac5b1fd898d75c6e9.jpg",
216
+ "image_caption": [
217
+ "Studio shot of minimal kinetic sculpture made from thin wire shaped like a bird on white background. "
218
+ ],
219
+ "image_footnote": [],
220
+ "page_idx": 3
221
+ },
222
+ {
223
+ "type": "image",
224
+ "img_path": "images/3383c92edaf0e151809f19912dc489314fc382f079a14a9b74b7d1a3743b2f39.jpg",
225
+ "image_caption": [
226
+ "A bunch of colorful candies falling into a tray in the shape of text ’Imagen Video’. Smooth video. "
227
+ ],
228
+ "image_footnote": [],
229
+ "page_idx": 3
230
+ },
231
+ {
232
+ "type": "image",
233
+ "img_path": "images/b88e7ef8b5d9d21c925572bba93936c5e91a31e3ec645f28425896ea4f5e7570.jpg",
234
+ "image_caption": [
235
+ "Incredibly detailed science fiction scene set on an alien planet, view of a marketplace. Pixel art. "
236
+ ],
237
+ "image_footnote": [],
238
+ "page_idx": 3
239
+ },
240
+ {
241
+ "type": "text",
242
+ "text": "Figure 4: Videos generated from various text prompts. Imagen Video produces diverse and temporallycoherent videos that are well-aligned with the given prompt. ",
243
+ "page_idx": 3
244
+ },
245
+ {
246
+ "type": "image",
247
+ "img_path": "images/ca9d9cd34b1bd01ca5374fdceb29bf7158a693cbdf1a83e7994261de1dcd8d07.jpg",
248
+ "image_caption": [
249
+ "A bunch of autumn leaves falling on a calm lake to form the text ’Imagen Video’. Smooth. "
250
+ ],
251
+ "image_footnote": [],
252
+ "page_idx": 4
253
+ },
254
+ {
255
+ "type": "image",
256
+ "img_path": "images/ba9bda2d9f8d0aa6326ecf96e3f1d211e9fcb480080e986750b9e5b1617bf453.jpg",
257
+ "image_caption": [],
258
+ "image_footnote": [],
259
+ "page_idx": 4
260
+ },
261
+ {
262
+ "type": "text",
263
+ "text": "Pouring latte art into a silver cup with a golden spoon next to it. ",
264
+ "page_idx": 4
265
+ },
266
+ {
267
+ "type": "image",
268
+ "img_path": "images/686c7925afa30dc99a85f5511bccd4f983092f8dfce212f04f11bdedff4530da.jpg",
269
+ "image_caption": [
270
+ "Shoveling snow. "
271
+ ],
272
+ "image_footnote": [],
273
+ "page_idx": 4
274
+ },
275
+ {
276
+ "type": "image",
277
+ "img_path": "images/47e6607f5ef4a202e1a6b5542e2a72e88f000e640c5afb5744dbe7286c6c9b33.jpg",
278
+ "image_caption": [
279
+ "Drone flythrough of a tropical jungle covered in snow "
280
+ ],
281
+ "image_footnote": [],
282
+ "page_idx": 4
283
+ },
284
+ {
285
+ "type": "image",
286
+ "img_path": "images/9865925f1d533f84b920f6910e84ca39a9b180d3a050f0e57ae20f6c2eed92e3.jpg",
287
+ "image_caption": [
288
+ "A beautiful sunrise on mars, Curiosity rover. High definition, timelapse, dramatic colors "
289
+ ],
290
+ "image_footnote": [],
291
+ "page_idx": 4
292
+ },
293
+ {
294
+ "type": "image",
295
+ "img_path": "images/681a6e74ef7c23a49b08b685a9c128659f022ef24774d950978133d4d8642e53.jpg",
296
+ "image_caption": [
297
+ "A shark swimming in clear Carribean ocean. "
298
+ ],
299
+ "image_footnote": [],
300
+ "page_idx": 4
301
+ },
302
+ {
303
+ "type": "image",
304
+ "img_path": "images/88b40bd17207d00bcbec5d2f8f5d5de4c7955b0797a0b4bd8d0547a7ecfc9c59.jpg",
305
+ "image_caption": [
306
+ "A hand lifts a cup. "
307
+ ],
308
+ "image_footnote": [],
309
+ "page_idx": 4
310
+ },
311
+ {
312
+ "type": "text",
313
+ "text": "Figure 5: Videos generated from various text prompts. Imagen Video produces diverse and temporallycoherent videos that are well-aligned with the given prompt. ",
314
+ "page_idx": 4
315
+ },
316
+ {
317
+ "type": "text",
318
+ "text": "Our work aims to generate videos from text. Prior work on video generation has focused on more restricted datasets with autoregressive models (Ranzato et al., 2014; Shi et al., 2015; Finn et al., 2016; Kalchbrenner et al., 2017; Babaeizadeh et al., 2021), latent-variable models with autoregressive priors (Mathieu et al., 2016; Vondrick et al., 2016; Babaeizadeh et al., 2018; Kumar et al., 2020), and more recently non-autoregressive latent-variable approaches (Gupta et al., 2022). Diffusion models have also shown promise for video generation (Ho et al., 2022b) at moderate resolution. Yang et al. (2022) showed autoregressive generation with a RNN-based model with conditional diffusion observations. The concurrent work of Singer et al. (2022) also applied text-to-video modelling with diffusion models, but built on a pretrained text-to-image model. Harvey et al. (2022) generates videos up to 25 minutes in length with video diffusion models, however the domain is restricted. ",
319
+ "page_idx": 5
320
+ },
321
+ {
322
+ "type": "text",
323
+ "text": "In this work, we introduce Imagen Video, a text-to-video generation system based on video diffusion models (Ho et al., 2022b) that is capable of generating high definition videos with high frame fidelity, strong temporal consistency, and deep language understanding. Imagen Video scales from prior work of 64-frame 128 $\\times$ 128 videos at 24 frames per second to 128 frame 1280 $\\times$ 768 high-definition video at 24 frames per second. Imagen Video has a simple architecture: The model consists of a frozen T5 text encoder (Raffel et al., 2020), a base video diffusion model, and interleaved spatial and temporal super-resolution diffusion models. Our key contributions are as follows: ",
324
+ "page_idx": 5
325
+ },
326
+ {
327
+ "type": "text",
328
+ "text": "1. We demonstrate the simplicity and effectiveness of cascaded diffusion video models for high definition video generation. \n2. We confirm that recent findings in the text-to-image setting transfer to video generation, such as the effectiveness of frozen encoder text conditioning and classifier-free guidance. \n3. We show new findings for video diffusion models that have implications for diffusion models in general, such as the effectiveness of the v-prediction parameterization for sample quality and the effectiveness of progressive distillation of guided diffusion models for the text-conditioned video generation setting. \n4. We demonstrate qualitative controllability in Imagen Video, such as 3D object understanding, generation of text animations, and generation of videos in various artistic styles. ",
329
+ "page_idx": 5
330
+ },
331
+ {
332
+ "type": "text",
333
+ "text": "2 Imagen Video ",
334
+ "text_level": 1,
335
+ "page_idx": 5
336
+ },
337
+ {
338
+ "type": "text",
339
+ "text": "Our model, Imagen Video, is a cascade of video diffusion models (Ho et al., 2022a;b). It consists of 7 sub-models which perform text-conditional video generation, spatial super-resolution, and temporal superresolution. With the entire cascade, Imagen Video generates high definition 1280 $\\times$ 768 (width $\\times$ height) videos at 24 frames per second, for 128 frames ( $\\approx 5 . 3$ seconds)—approximately 126 million pixels. We describe the components and techniques that constitute Imagen Video in the following sections. ",
340
+ "page_idx": 5
341
+ },
342
+ {
343
+ "type": "text",
344
+ "text": "2.1 Diffusion models ",
345
+ "text_level": 1,
346
+ "page_idx": 5
347
+ },
348
+ {
349
+ "type": "text",
350
+ "text": "Imagen Video is built from diffusion models (Sohl-Dickstein et al., 2015; Song & Ermon, 2019; Ho et al., 2020) specified in continuous time (Tzen $\\&$ Raginsky, 2019; Song et al., 2021; Kingma et al., 2021). We use the formulation of Kingma et al. (2021): the model is a latent variable model with latents $\\mathbf { z } = \\{ \\mathbf { z } _ { t } | t \\in [ 0 , 1 ] \\}$ following a forward process $q ( \\mathbf { z } | \\mathbf { x } )$ starting at data $\\mathbf { x } \\sim p ( \\mathbf { x } )$ . The forward process is a Gaussian process that satisfies the Markovian structure: ",
351
+ "page_idx": 5
352
+ },
353
+ {
354
+ "type": "equation",
355
+ "img_path": "images/91e32dd5f663fe175f4fe9874f7db7b0f12fcefcf05a707499a151a1035386b8.jpg",
356
+ "text": "$$\n\\begin{array} { r } { q ( \\mathbf { z } _ { t } | \\mathbf { x } ) = \\mathcal { N } ( \\mathbf { z } _ { t } ; \\alpha _ { t } \\mathbf { x } , \\sigma _ { t } ^ { 2 } \\mathbf { I } ) , \\quad q ( \\mathbf { z } _ { t } | \\mathbf { z } _ { s } ) = \\mathcal { N } ( \\mathbf { z } _ { t } ; ( \\alpha _ { t } / \\alpha _ { s } ) \\mathbf { z } _ { s } , \\sigma _ { t | s } ^ { 2 } \\mathbf { I } ) } \\end{array}\n$$",
357
+ "text_format": "latex",
358
+ "page_idx": 5
359
+ },
360
+ {
361
+ "type": "text",
362
+ "text": "where $0 \\leq s < t \\leq 1$ , $\\sigma _ { t | s } ^ { 2 } = ( 1 - e ^ { \\lambda _ { t } - \\lambda _ { s } } ) \\sigma _ { t } ^ { 2 }$ , and $\\alpha _ { t } , \\sigma _ { t }$ specify a noise schedule whose log signal-to-noise-ratio $\\lambda _ { t } = \\log [ \\alpha _ { t } ^ { 2 } / \\sigma _ { t } ^ { 2 } ]$ decreases monotonically with $t$ until $q ( \\mathbf { z } _ { 1 } ) \\approx \\mathcal { N } ( \\mathbf { 0 } , \\mathbf { I } )$ . We use a continuous time version of the cosine noise schedule (Nichol & Dhariwal, 2021). The generative model is a learned model that matches this forward process in the reverse time direction, generating $\\mathbf { z } _ { t }$ starting from $t = 1$ and ending at $t = 0$ . ",
363
+ "page_idx": 5
364
+ },
365
+ {
366
+ "type": "text",
367
+ "text": "Learning to reverse the forward process for generation can be reduced to learning to denoise ${ \\mathbf z } _ { t } \\sim q ( { \\mathbf z } _ { t } | { \\mathbf x } )$ into an estimate $\\hat { \\mathbf { x } } _ { \\theta } ( { \\mathbf z } _ { t } , \\lambda _ { t } ) \\approx { \\mathbf x }$ for all $t$ . Like (Song & Ermon, 2019; Ho et al., 2020) and most follow-up work, we optimize the model by minimizing a simple noise-prediction loss: ",
368
+ "page_idx": 6
369
+ },
370
+ {
371
+ "type": "equation",
372
+ "img_path": "images/db4bd1a4a4cd023b03677a900aa10cb38dbaf8e9b28230ce0e6a05cc97c09a70.jpg",
373
+ "text": "$$\n\\mathcal { L } ( \\mathbf { x } ) = \\mathbb { E } _ { \\epsilon \\sim \\mathcal { N } ( 0 , \\mathbf { I } ) , t \\sim U ( 0 , 1 ) } \\big [ \\| \\hat { \\epsilon } _ { \\boldsymbol { \\theta } } ( \\mathbf { z } _ { t } , \\lambda _ { t } ) - \\epsilon \\| _ { 2 } ^ { 2 } \\big ]\n$$",
374
+ "text_format": "latex",
375
+ "page_idx": 6
376
+ },
377
+ {
378
+ "type": "text",
379
+ "text": "where $\\mathbf { z } _ { t } = \\alpha _ { t } \\mathbf { x } + \\sigma _ { t } \\mathbf { \\epsilon } $ , and $\\hat { \\epsilon } _ { \\boldsymbol { \\theta } } ( \\mathbf { z } _ { t } , \\lambda _ { t } ) = \\sigma _ { t } ^ { - 1 } ( \\mathbf { z } _ { t } - \\alpha _ { t } \\hat { \\mathbf { x } } _ { \\boldsymbol { \\theta } } ( \\mathbf { z } _ { t } , \\lambda _ { t } ) )$ . We will drop the dependence on $\\lambda _ { t }$ to simplify notation. In practice, we parameterize our models in terms of the $\\mathbf { v }$ -parameterization (Salimans & Ho, 2022), rather than predicting $\\epsilon$ or $\\mathbf { x }$ directly; see Section 2.4. ",
380
+ "page_idx": 6
381
+ },
382
+ {
383
+ "type": "text",
384
+ "text": "For conditional generative modeling, we provide the conditioning information $\\mathbf { c }$ drawn jointly with $\\mathbf { x }$ to the model as $\\hat { \\mathbf { x } } _ { \\theta } ( \\mathbf { z } _ { t } , \\mathbf { c } _ { t } )$ . We use these conditional diffusion models for spatial and temporal super-resolution in our pipeline of diffusion models: in these cases, $\\mathbf { c }$ includes both the text and the previous stage low resolution video as well as a signal $\\lambda _ { t } ^ { \\prime }$ that describes the strength of conditioning augmentation added to $\\mathbf { c }$ . Saharia et al. (2022b) found it critical to condition all the super-resolution models with the text embedding, and we follow this approach. ",
385
+ "page_idx": 6
386
+ },
387
+ {
388
+ "type": "text",
389
+ "text": "We use the discrete time ancestral sampler (Ho et al., 2020), with sampling variances derived from lower and upper bounds on reverse process entropy (Sohl-Dickstein et al., 2015; Ho et al., 2020; Nichol $\\&$ Dhariwal, 2021). This sampler can be formulated by using a reversed description of the forward process as $q ( \\mathbf { z } _ { s } | \\mathbf { z } _ { t } , \\mathbf { x } ) =$ $\\mathcal { N } ( \\mathbf { z } _ { s } ; \\tilde { \\pmb { \\mu } } _ { s | t } ( \\mathbf { z } _ { t } , \\mathbf { x } ) , \\tilde { \\sigma } _ { s | t } ^ { 2 } \\mathbf { I } )$ (noting $s < t$ ), where ",
390
+ "page_idx": 6
391
+ },
392
+ {
393
+ "type": "equation",
394
+ "img_path": "images/a7b880d8eadfc62c0f843b873189b1cb8c4885c743fc1fd90542e4ff2258635f.jpg",
395
+ "text": "$$\n\\tilde { \\mu } _ { s | t } ( \\mathbf { z } _ { t } , \\mathbf { x } ) = e ^ { \\lambda _ { t } - \\lambda _ { s } } ( \\alpha _ { s } / \\alpha _ { t } ) \\mathbf { z } _ { t } + ( 1 - e ^ { \\lambda _ { t } - \\lambda _ { s } } ) \\alpha _ { s } \\mathbf { x } \\quad \\mathrm { a n d } \\quad \\tilde { \\sigma } _ { s | t } ^ { 2 } = ( 1 - e ^ { \\lambda _ { t } - \\lambda _ { s } } ) \\sigma _ { s } ^ { 2 } .\n$$",
396
+ "text_format": "latex",
397
+ "page_idx": 6
398
+ },
399
+ {
400
+ "type": "text",
401
+ "text": "Starting at ${ \\bf z } _ { 1 } \\sim \\mathcal { N } ( { \\bf 0 } , { \\bf I } )$ , the ancestral sampler follows the rule ",
402
+ "page_idx": 6
403
+ },
404
+ {
405
+ "type": "equation",
406
+ "img_path": "images/9a4f0f1639000ce1432966e3bf67c71de0417417382e4f2966860af208c6efa2.jpg",
407
+ "text": "$$\n\\mathbf { z } _ { s } = \\tilde { \\mu } _ { s | t } ( \\mathbf { z } _ { t } , \\hat { \\mathbf { x } } _ { \\theta } ( \\mathbf { z } _ { t } ) ) + \\sqrt { ( \\tilde { \\sigma } _ { s | t } ^ { 2 } ) ^ { 1 - \\gamma } ( \\sigma _ { t | s } ^ { 2 } ) ^ { \\gamma } } \\epsilon\n$$",
408
+ "text_format": "latex",
409
+ "page_idx": 6
410
+ },
411
+ {
412
+ "type": "text",
413
+ "text": "where $\\epsilon$ is standard Gaussian noise, $\\gamma$ is a hyperparameter that controls the stochasticity of the sampler (Nichol & Dhariwal, 2021), and $s , t$ follow a uniformly spaced sequence from 1 to $0$ . See Section 3 for sampler hyperparameter settings. ",
414
+ "page_idx": 6
415
+ },
416
+ {
417
+ "type": "text",
418
+ "text": "Alternatively, the deterministic DDIM sampler (Song et al., 2020) can be used for sampling. This sampler is a numerical integration rule for the probability flow ODE (Song et al., 2021; Salimans & Ho, 2022), which describes how a sample from a standard normal distribution can be deterministically transformed into a sample from the video data distribution using the denoising model. The DDIM sampler is useful for progressive distillation for fast sampling, as described in Section 2.7. ",
419
+ "page_idx": 6
420
+ },
421
+ {
422
+ "type": "text",
423
+ "text": "2.2 Cascaded Diffusion Models and text conditioning ",
424
+ "text_level": 1,
425
+ "page_idx": 6
426
+ },
427
+ {
428
+ "type": "text",
429
+ "text": "Cascaded Diffusion Models (Ho et al., 2022a) are an effective method for scaling diffusion models to high resolution outputs, finding considerable success in both class-conditional ImageNet (Ho et al., 2022a) and text-to-image generation (Ramesh et al., 2022; Saharia et al., 2022b). Cascaded diffusion models generate an image or video at a low resolution, then sequentially increase the resolution of the image or video through a series of super-resolution diffusion models. Cascaded Diffusion Models can model very high dimensional problems while still keeping each sub-model relatively simple. Imagen (Saharia et al., 2022b) also showed that by conditioning on text embeddings from a large frozen language model in conjunction with cascaded diffusion models, one can generate high quality $1 0 2 4 \\times 1 0 2 4$ images from text descriptions. In this work we extend this approach to video generation. ",
430
+ "page_idx": 6
431
+ },
432
+ {
433
+ "type": "text",
434
+ "text": "Figure 6 summarizes the entire cascading pipeline of Imagen Video. In total, we have 1 frozen text encoder, 1 base video diffusion model, 3 SSR (spatial super-resolution), and 3 TSR (temporal super-resolution) models for a total of 7 video diffusion models, with a total of 11.6B diffusion model parameters. The data used to train these models is processed to the appropriate spatial and temporal resolutions by spatial resizing and frame skipping. At generation time, the SSR models increase spatial resolution for all input frames, whereas the TSR models increase temporal resolution by filling in intermediate frames between input frames. All models generate an entire block of frames simultaneously – so for instance, our SSR models do not suffer from obvious artifacts that would occur from naively running super-resolution on independent frames. ",
435
+ "page_idx": 6
436
+ },
437
+ {
438
+ "type": "image",
439
+ "img_path": "images/6b59996bb4d772372726e02789aea0eee1b3f9ba382f99a8566a6e8d81ec47a7.jpg",
440
+ "image_caption": [
441
+ "Figure 6: The cascaded sampling pipeline starting from a text prompt input to generating a 5.3-second, $1 2 8 0 \\times 7 6 8$ video at 24fps. “SSR” and “TSR” denote spatial and temporal super-resolution respectively, and videos are labeled as frames $\\times$ width $\\times$ height. In practice, the text embeddings are injected into all models, not just the base model. "
442
+ ],
443
+ "image_footnote": [],
444
+ "page_idx": 7
445
+ },
446
+ {
447
+ "type": "text",
448
+ "text": "",
449
+ "page_idx": 7
450
+ },
451
+ {
452
+ "type": "text",
453
+ "text": "One benefit of cascaded models is that each diffusion model can be trained independently, allowing one to train all 7 models in parallel. Additionally, our super-resolution models are general purpose video superresolution models, and they can be applied to real videos or samples from generative models other than the ones presented in this paper. This is similar to how Imagen’s super-resolution models helped improve the fidelity of the images generated by Parti (Yu et al., 2022), which is an autoregressive text-to-image model. We intend to explore hybrid pipelines of multiple model classes further in future work. ",
454
+ "page_idx": 7
455
+ },
456
+ {
457
+ "type": "text",
458
+ "text": "Similar to Saharia et al. (2022b), we utilize contextual embeddings from a frozen T5-XXL text encoder (Raffel et al., 2020) for conditioning on the input text prompt. We find these embeddings to be critical for alignment between generated video and the text prompt. Similar to the findings of Saharia et al. (2022b), we observe evidence of deeper language understanding, enabling us to generate the videos displayed in Figs. 2 to 5. ",
459
+ "page_idx": 7
460
+ },
461
+ {
462
+ "type": "text",
463
+ "text": "2.3 Video diffusion architectures ",
464
+ "text_level": 1,
465
+ "page_idx": 7
466
+ },
467
+ {
468
+ "type": "text",
469
+ "text": "Diffusion models for image generation typically use a 2D U-Net architecture (Ronneberger et al., 2015; Salimans et al., 2017; Ho et al., 2020) to represent the denoising model $\\hat { \\mathbf { x } } _ { \\theta }$ . This is a multiscale model consisting of multiple layers of spatial attention and convolution at each resolution, combined with shortcuts between layers at the same resolution. In earlier work on Video Diffusion Models, Ho et al. (2022b) introduced the Video U-Net , which generalizes the 2D diffusion model architecture to 3D in a space-time separable fashion using temporal attention and convolution layers interleaved within spatial attention and convolution layers to capture dependencies between video frames. Our work builds on the Video U-Net architecture: see Figure 7. Following Video Diffusion Models, each of our denoising models $\\hat { \\mathbf { x } } _ { \\theta }$ operate on multiple video frames simultaneously and thereby generate entire blocks of video frames at a time, which we find to be important to capture the temporal coherence of the generated video compared to frame-autoregressive approaches. Our spatial super-resolution (SSR) and temporal super-resolution (TSR) models condition on their input videos by concatenating an upsampled conditioning input channelwise to the noisy data $\\mathbf { z } _ { t }$ , the same mechanism as SR3 (Saharia et al., 2022c) and Palette (Saharia et al., 2022a): spatial upsampling before concatenation is performed using bilinear resizing, and temporal upsampling before concatenation is performed by repeating frames or by filling in blank frames. ",
470
+ "page_idx": 7
471
+ },
472
+ {
473
+ "type": "text",
474
+ "text": "Our base video model, which is the first model in the pipeline that generates data at the lowest frame count and spatial resolution, uses temporal attention to mix information across time. Our SSR and TSR models, on the other hand, use temporal convolutions instead of temporal attention. The temporal attention in the base model enables Imagen Video to model long term temporal dependencies, while the temporal convolutions in the SSR and TSR models allow Imagen Video to maintain local temporal consistency during upsampling. The use of temporal convolutions lowers memory and computation costs over temporal attention—this is crucial because the very purpose of the TSR and SSR models is to operate at high frame rates and spatial resolutions. In our initial experiments, we did not find any significant improvements when using temporal attention over temporal convolutions in our SSR and TSR models, which we hypothesize is due to the significant amount of temporal correlation already present in the conditioning input to these models. ",
475
+ "page_idx": 7
476
+ },
477
+ {
478
+ "type": "image",
479
+ "img_path": "images/2910e48845f75da3725a555562623a8a34ff8e36072bcf47c79400b54567845e.jpg",
480
+ "image_caption": [
481
+ "Figure 7: Video U-Net space-time separable block. Spatial operations are performed independently over frames with shared parameters, whereas the temporal operation mixes activations over frames. Our base model uses spatial convolutions, spatial self-attention and temporal self-attention. For memory efficiency, our spatial and temporal super-resolution models use temporal convolutions instead of attention, and our models at the highest spatial resolution do not have spatial attention. "
482
+ ],
483
+ "image_footnote": [],
484
+ "page_idx": 8
485
+ },
486
+ {
487
+ "type": "text",
488
+ "text": "",
489
+ "page_idx": 8
490
+ },
491
+ {
492
+ "type": "text",
493
+ "text": "Our models also use spatial attention and spatial convolutions. The base model and the first two spatial super-resolution models have spatial attention in addition to spatial convolutions. We found this to improve sample fidelity. However, as we move to higher resolutions, we switch to fully convolutional architectures, like Saharia et al. (2022b), to minimize memory and compute costs in order to generate 1280 $\\times$ 768 resolution data. The highest resolution SSR model in our pipeline is a fully convolutional model trained on random lower resolution spatial crops for training time memory efficiency, and we find that the model easily generalizes to the full resolution during sampling time. ",
494
+ "page_idx": 8
495
+ },
496
+ {
497
+ "type": "text",
498
+ "text": "2.4 v-prediction ",
499
+ "text_level": 1,
500
+ "page_idx": 8
501
+ },
502
+ {
503
+ "type": "text",
504
+ "text": "We follow Salimans & Ho (2022) and use v-prediction parameterization ( $\\mathbf { v } _ { t } \\equiv \\alpha _ { t } \\mathbf { \\epsilon } \\epsilon - \\sigma _ { t } \\mathbf { x } ,$ for all our models. The $\\mathbf { v } .$ -parameterization is particularly useful for numerical stability throughout the diffusion process to enable progressive distillation for our models. For models that operate at higher resolution in our pipeline, we also discovered that the v-parameterization avoids color shifting artifacts that are known to affect high resolution diffusion models, and in the video setting it avoids temporal color shifting that sometimes appears with $\\epsilon$ -prediction models. Our use of v-parameterization also has the benefit of faster convergence of sample quality metrics: see Section 3.3. ",
505
+ "page_idx": 8
506
+ },
507
+ {
508
+ "type": "text",
509
+ "text": "2.5 Conditioning Augmentation ",
510
+ "text_level": 1,
511
+ "page_idx": 8
512
+ },
513
+ {
514
+ "type": "text",
515
+ "text": "We use noise conditioning augmentation (Ho et al., 2022a) for all our temporal and spatial super-resolution models. Noise conditioning augmentation has been found to be critical for cascaded diffusion models for class-conditional generation (Ho et al., 2022a) as well as text-to-image models (Saharia et al., 2022b). In particular, it facilitates parallel training of different models in the cascade, as it reduces the sensitivity to domain gaps between the output of one stage of the cascade and the inputs used in training the subsequent stage. ",
516
+ "page_idx": 8
517
+ },
518
+ {
519
+ "type": "text",
520
+ "text": "Following Ho et al. (2022a), we apply Gaussian noise augmentation with a random signal-to-noise ratio to the conditioning input video during training, and this sampled signal-to-noise ratio is provided to the model as well. At sampling time we use a fixed signal-to-noise ratio such as 3 or 5, representing a small amount of augmentation that aids in removing artifacts in the samples from the previous stage while preserving most of the structure. ",
521
+ "page_idx": 8
522
+ },
523
+ {
524
+ "type": "text",
525
+ "text": "",
526
+ "page_idx": 9
527
+ },
528
+ {
529
+ "type": "text",
530
+ "text": "2.6 Video-Image Joint Training ",
531
+ "text_level": 1,
532
+ "page_idx": 9
533
+ },
534
+ {
535
+ "type": "text",
536
+ "text": "We follow Ho et al. (2022b) in jointly training all the models in the Imagen Video pipeline on images and videos. During training, individual images are treated as single frame videos. We achieve this by packing individual independent images into a sequence of the same length as a video, and bypass the temporal convolution residual blocks by masking out their computation path. Similarly, we disable crossframe temporal attention by applying masking to the temporal attention maps. This strategy allows us to use to train our video models on image-text datasets that are significantly larger and more diverse than available video-text datasets. Consistent with Ho et al. (2022b), we observe that joint training with images significantly increases the overall quality of video samples. Another interesting artifact of joint training is the knowledge transfer from images to videos. For instance, while training on natural video data only enables the model to learn dynamics in natural settings, the model can learn about different image styles (such as sketch, painting, etc.) by training on images. As a result, this joint training enables the model to generate interesting video dynamics in different styles. See Fig. 8 for such examples. ",
537
+ "page_idx": 9
538
+ },
539
+ {
540
+ "type": "text",
541
+ "text": "2.6.1 Classifier Free Guidance ",
542
+ "text_level": 1,
543
+ "page_idx": 9
544
+ },
545
+ {
546
+ "type": "text",
547
+ "text": "We found classifier free guidance (Ho & Salimans, 2021) to be critical for generating high fidelity samples which respect a given text prompt. This is consistent with earlier results on text-to-image models (Nichol et al., 2021; Ramesh et al., 2022; Saharia et al., 2022b; Yu et al., 2022). ",
548
+ "page_idx": 9
549
+ },
550
+ {
551
+ "type": "text",
552
+ "text": "In the conditional generation setting, the data $\\mathbf { x }$ is generated conditional on a signal $\\mathbf { c }$ , which here represents a contextualized embedding of the text prompt, and a conditional diffusion model can be trained by using this signal $\\mathbf { c }$ as an additional input to the denoising model $\\hat { \\mathbf { x } } _ { \\theta } ( \\mathbf { z } _ { t } , \\mathbf { c } )$ . After training, Ho & Salimans (2021) find that sample quality can be improved by adjusting the denoising prediction $\\hat { \\mathbf { x } } _ { \\theta } ( \\mathbf { z } _ { t } , \\mathbf { c } )$ using ",
553
+ "page_idx": 9
554
+ },
555
+ {
556
+ "type": "equation",
557
+ "img_path": "images/06f3a1abdc1bdf6b554de868a970a4328c5556b6f081c78cb6270b02b7c614fc.jpg",
558
+ "text": "$$\n\\widetilde { \\mathbf { x } } _ { \\theta } ( \\mathbf { z } _ { t } , \\mathbf { c } ) = ( 1 + w ) \\widehat { \\mathbf { x } } _ { \\theta } ( \\mathbf { z } _ { t } , \\mathbf { c } ) - w \\widehat { \\mathbf { x } } _ { \\theta } ( \\mathbf { z } _ { t } ) ,\n$$",
559
+ "text_format": "latex",
560
+ "page_idx": 9
561
+ },
562
+ {
563
+ "type": "text",
564
+ "text": "where $w$ is the guidance strength, $\\hat { \\mathbf { x } } _ { \\theta } ( \\mathbf { z } _ { t } , \\mathbf { c } )$ is the conditional model, and $\\hat { \\mathbf { x } } _ { \\theta } ( \\mathbf { z } _ { t } ) ~ = ~ \\hat { \\mathbf { x } } _ { \\theta } ( \\mathbf { z } _ { t } , \\mathbf { c } ~ = ~ \\varnothing )$ is an unconditional model. The unconditional model is jointly trained with the conditional model by dropping out the conditioning input $\\mathbf { c }$ . The predictions of the adjusted denoising model $\\tilde { \\bf x } _ { \\theta } ( { \\bf z } _ { t } , { \\bf c } )$ are clipped to respect the range of possible pixel values, which we discuss in more detail in the next section. Note that the linear transformation in Equation 5 can equivalently be performed in $\\mathbf { v }$ -space $\\left( \\tilde { \\mathbf { v } } _ { \\theta } ( \\mathbf { z } _ { t } , \\mathbf { c } ) = ( 1 + w ) \\hat { \\mathbf { v } } _ { \\theta } ( \\mathbf { z } _ { t } , \\mathbf { c } ) - \\right.$ $w \\hat { \\mathbf { v } } _ { \\theta } ( \\mathbf { z } _ { t } )$ ) or $\\epsilon$ -space $\\tilde { \\epsilon } _ { \\theta } ( \\mathbf { z } _ { t } , \\mathbf { c } ) = ( 1 + w ) \\hat { \\epsilon } _ { \\theta } ( \\mathbf { z } _ { t } , \\mathbf { c } ) - w \\hat { \\epsilon } _ { \\theta } ( \\mathbf { z } _ { t } ) )$ . ",
565
+ "page_idx": 9
566
+ },
567
+ {
568
+ "type": "text",
569
+ "text": "For $w > 0$ this adjustment has the effect of over-emphasizing the effect of conditioning on the signal $\\mathbf { c }$ , which tends to produce samples of lower diversity but higher quality compared to sampling from the regular conditional model (Ho & Salimans, 2021). The method can be interpreted as a way to guide the samples towards areas where an implicit classifier $p ( \\mathbf { c } | \\mathbf { z } _ { t } )$ has high likelihood; as such, it is an adaptation of the explicit classifier guidance method proposed by Dhariwal $\\&$ Nichol (2022). ",
570
+ "page_idx": 9
571
+ },
572
+ {
573
+ "type": "text",
574
+ "text": "2.6.2 Large Guidance Weights ",
575
+ "text_level": 1,
576
+ "page_idx": 9
577
+ },
578
+ {
579
+ "type": "text",
580
+ "text": "When using large guidance weights, the resulting $\\tilde { \\mathbf { x } } _ { \\theta } ( \\mathbf { z } _ { t } , \\mathbf { c } )$ must be projected back to the possible range of pixel values at every sampling step to prevent train-test mismatch. When using large guidance weights, the standard approach, i.e., clipping the values to the right range (e.g., np.clip(x, -1, 1)), leads to significant saturation artifacts in the generated videos. A similar effect was observed in Saharia et al. (2022b) for textto-image generation. Saharia et al. (2022b) use dynamic thresholding to alleviate this saturation issue. Specifically, dynamic clipping involves clipping the image to a dynamically chosen threshold $\\mathbf { s }$ followed by scaling by $\\tt s$ (i.e., np.clip(x, -s, s) / s) (Saharia et al., 2022b). ",
581
+ "page_idx": 9
582
+ },
583
+ {
584
+ "type": "text",
585
+ "text": "Although dynamic clipping can help with over-saturation, we did not find it sufficient in initial experiments. We therefore also experiment with letting $w$ oscillate between a high and a low guidance weight at each alternating sampling step, which we find significantly helps with these saturation issues. We call this sampling technique oscillating guidance. Specifically, we use a constant high guidance weight for a certain number of initial sampling steps, followed by oscillation between high and low guidance weights: this oscillation is implemented simply by alternating between a large weight (such as 15) and a small weight (such as 1) over the course of sampling. We hypothesize that a constant high guidance weight at the start of sampling helps break modes with heavy emphasis on text, while oscillating between high and low guidance weights helps maintain a strong text alignment (via high guidance sampling step) while limiting saturation artifacts (via low guidance sampling step). We however observed no improvement in sample fidelity and more visual artifacts when applying oscillating guidance to models past the 80 $\\times$ 48 spatial resolution. Thus we only apply oscillating guidance to the base and the first two SR models. ",
586
+ "page_idx": 9
587
+ },
588
+ {
589
+ "type": "text",
590
+ "text": "",
591
+ "page_idx": 10
592
+ },
593
+ {
594
+ "type": "text",
595
+ "text": "2.7 Progressive Distillation with Guidance and Stochastic Samplers ",
596
+ "text_level": 1,
597
+ "page_idx": 10
598
+ },
599
+ {
600
+ "type": "text",
601
+ "text": "Salimans & Ho (2022) proposed progressive distillation to enable fast sampling of diffusion models. This method distills a trained deterministic DDIM sampler (Song et al., 2020) to a diffusion model that takes many fewer sampling steps, without losing much perceptual quality. At each iteration of the distillation process, an $N$ -step DDIM sampler is distilled to a new model with $N / 2$ -steps. This procedure is repeated by halving the required sampling steps each iteration. Meng et al. (2022) extend this approach to samplers with guidance, and propose a new stochastic sampler for use with distilled models. Here we show that this approach also works very well for video generation. ",
602
+ "page_idx": 10
603
+ },
604
+ {
605
+ "type": "text",
606
+ "text": "We use a two-stage distillation approach to distill a DDIM sampler (Song et al., 2020) with classifier-free guidance. At the first stage, we learn a single diffusion model that matches the combined output from the jointly trained conditional and unconditional diffusion models, where the combination coefficients are determined by the guidance weight. Then we apply progressive distillation to that single model to produce models requiring fewer sampling steps at the second stage. ",
607
+ "page_idx": 10
608
+ },
609
+ {
610
+ "type": "text",
611
+ "text": "After distillation, we use a stochastic $N$ -step sampler: At each step, we first apply one deterministic DDIM update with twice the original step size (i.e., the same step size as a $N / 2$ -step sampler), and then we perform one stochastic step backward (i.e., perturbed with noise following the forward diffusion process) with the original step size, inspired by Karras et al. (2022). See Meng et al. (2022) for more details. Using this approach, we are able to distill all 7 video diffusion models down to just 8 sampling steps per model without any noticeable loss in perceptual quality. ",
612
+ "page_idx": 10
613
+ },
614
+ {
615
+ "type": "text",
616
+ "text": "3 Experiments ",
617
+ "text_level": 1,
618
+ "page_idx": 10
619
+ },
620
+ {
621
+ "type": "text",
622
+ "text": "We train our models on a combination of an internal dataset consisting of 14 million video-text pairs and 60 million image-text pairs, and the publicly available LAION-400M image-text dataset (Schuhmann et al., 2021). To process the data into a form suitable for training our cascading pipeline, we spatially resize images and videos using antialiased bilinear resizing, and we temporally resize videos by skipping frames. Throughout our model development process, we evaluated Imagen Video on several different metrics, such as FID on individual frames (Heusel et al., 2017), FVD (Unterthiner et al., 2019) for temporal consistency, and frame-wise CLIP scores (Hessel et al., 2021; Park et al., 2021) for video-text alignment. Below, we explore the capabilities of our model and investigate its performance in regards to 1) scaling up the number of parameters in our model, 2) changing the parameterization of our model, and 3) distilling our models so that they are fast to sample from. ",
623
+ "page_idx": 10
624
+ },
625
+ {
626
+ "type": "text",
627
+ "text": "3.1 Unique video generation capabilities ",
628
+ "text_level": 1,
629
+ "page_idx": 10
630
+ },
631
+ {
632
+ "type": "text",
633
+ "text": "We find that Imagen Video is capable of generating high fidelity video, and that it possesses several unique capabilities that are not traditionally found in unstructured generative models learned purely from data. For example, Fig. 8 shows that our model is capable of generating videos with artistic styles learned from image information, such as videos in the style of van Gogh paintings or watercolor paintings. Fig. 9 shows that Imagen Video possesses an understanding of 3D structure, as it is capable of generating videos of objects rotating while roughly preserving structure. While the 3D consistency over the course of rotation is not ",
634
+ "page_idx": 10
635
+ },
636
+ {
637
+ "type": "image",
638
+ "img_path": "images/b004e146b69df389b282868202d21643cdcce59a70e00811de230efb4e553a71.jpg",
639
+ "image_caption": [
640
+ "Drone flythrough of a pixel art of futuristic city. "
641
+ ],
642
+ "image_footnote": [],
643
+ "page_idx": 11
644
+ },
645
+ {
646
+ "type": "text",
647
+ "text": "Figure 8: Snapshots of frames from videos generated by Imagen Video demonstrating the ability of the mode to generate dynamics in different artistic styles. ",
648
+ "page_idx": 11
649
+ },
650
+ {
651
+ "type": "image",
652
+ "img_path": "images/1221ffbdcd6a012e86f0f7ae55bf9572a1a4cc73e17dbc2816c7853da737fc93.jpg",
653
+ "image_caption": [
654
+ "A 3D model of an elephant origami. Studio lighting. "
655
+ ],
656
+ "image_footnote": [],
657
+ "page_idx": 11
658
+ },
659
+ {
660
+ "type": "image",
661
+ "img_path": "images/a9874e80b01e0778d489f71b11bd54576424d9316e72970675c0188dd6cafc84.jpg",
662
+ "image_caption": [
663
+ "Figure 9: Snapshots of frames from videos generated by Imagen Video demonstrating the model’s under standing of 3D structures. "
664
+ ],
665
+ "image_footnote": [],
666
+ "page_idx": 11
667
+ },
668
+ {
669
+ "type": "image",
670
+ "img_path": "images/97dea5c09c0516c0d2a02182394557275c599af5ef20c8ebd86e9614f41c37ad.jpg",
671
+ "image_caption": [
672
+ "A colorful professional animated logo for ’Diffusion’ written using paint brush in cursive. Smooth animation. "
673
+ ],
674
+ "image_footnote": [],
675
+ "page_idx": 11
676
+ },
677
+ {
678
+ "type": "text",
679
+ "text": "Sprouts in the shape of text ’Imagen’ coming out of a fairytale book. ",
680
+ "page_idx": 11
681
+ },
682
+ {
683
+ "type": "image",
684
+ "img_path": "images/342234d4e502eb9100353aedd56b6b2178aaac41c69626055fd6e62b0b83d2bc.jpg",
685
+ "image_caption": [
686
+ "Thousands of fast brush strokes slowly forming the text ’Imagen Video’ on a light beige canvas. Smooth animation. Figure 10: Snapshots of frames from videos generated by Imagen Video demonstrating the ability of the model to render a variety of text with different style and dynamics. "
687
+ ],
688
+ "image_footnote": [],
689
+ "page_idx": 11
690
+ },
691
+ {
692
+ "type": "text",
693
+ "text": "exact, we believe Imagen Video shows that video models can serve as effective priors for methods that do force 3D consistency. Fig. 10 shows that Imagen Video is also reliably capable of generating text in a wide variety of animation styles, some of which would be difficult to animate using traditional tools. We see results such as these as an exciting indication of how general purpose generative models such as Imagen Video can significantly decrease the difficulty of high quality content generation. ",
694
+ "page_idx": 12
695
+ },
696
+ {
697
+ "type": "text",
698
+ "text": "3.2 Scaling ",
699
+ "text_level": 1,
700
+ "page_idx": 12
701
+ },
702
+ {
703
+ "type": "text",
704
+ "text": "In Figure 11 we show that our base video model strongly benefits from scaling up the parameter count of the video U-Net. We performed this scaling by increasing the base channel count and depth of the network. This result is contrary to the text-to-image U-Net scaling results by Saharia et al. (2022b), which found limited benefit from diffusion model scaling when measured by image-text sample quality scores. We conclude that video modeling is a harder task for which performance is not yet saturated at current model sizes, implying future benefits to further model scaling for video generation. ",
705
+ "page_idx": 12
706
+ },
707
+ {
708
+ "type": "image",
709
+ "img_path": "images/789e8cc4f7559686e6db1efe096b011df90ad9bd57a151db67d7f5d533171a51.jpg",
710
+ "image_caption": [
711
+ "Figure 11: Scaling Comparison for the base $1 6 \\times 4 0 \\times 2 4$ video model on FVD and CLIP scores (on 0-100 scale). Both FVD and CLIP scores are computed on 4096 video samples. We see clear signs of improvement on both metrics when scaling from 500M to 1.6B to 5.6B parameters. "
712
+ ],
713
+ "image_footnote": [],
714
+ "page_idx": 12
715
+ },
716
+ {
717
+ "type": "text",
718
+ "text": "3.3 Comparing prediction parameterizations ",
719
+ "text_level": 1,
720
+ "page_idx": 12
721
+ },
722
+ {
723
+ "type": "text",
724
+ "text": "In early experiments we found that training $\\epsilon$ -prediction models (Ho et al., 2020) performed worse than $\\mathbf { v }$ -prediction (Salimans & Ho, 2022) especially at high resolutions. Specifically, for high resolution SSR models, we observed that $\\epsilon$ -prediction converges relatively slowly in terms of sample quality metrics and suffers from color shift and color inconsistency across frames in the generated videos. Fig. 12 shows the comparison between $\\epsilon$ -prediction and $\\mathbf { v }$ -prediction on a 80 $\\times$ 48 → 320 $\\times$ 192 video spatial super-resolution task. It is clear that $\\epsilon$ -parameterization produces worse generations than $\\mathbf { v }$ -parameterization. Fig. 13 shows the quantitative comparison between the two parameterizations as a function of training steps. We observe that $\\mathbf { v }$ parameterization converges much more faster than $\\epsilon$ parameterization. ",
725
+ "page_idx": 12
726
+ },
727
+ {
728
+ "type": "text",
729
+ "text": "3.4 Perceptual quality and distillation ",
730
+ "text_level": 1,
731
+ "page_idx": 12
732
+ },
733
+ {
734
+ "type": "text",
735
+ "text": "In Table 1 we report perceptual quality metrics (CLIP score and CLIP R-Precision) for our model samples, as well as for their distilled version. Samples are generated and evaluated at 192 $\\times$ 320 resolution for 128 frames at 24 frames per second. For CLIP score, we take the average score over all frames. For CLIP R-Precision (Park et al., 2021) we compute the top-1 accuracy (i.e. $R = 1$ ), treating the frames of a video sample as images sharing the same text label (the prompt). We repeat these over four different runs and report the mean and standard error. ",
736
+ "page_idx": 12
737
+ },
738
+ {
739
+ "type": "text",
740
+ "text": "We find that distillation provides a very favorable trade-off between sampling time and perceptual quality: the distilled cascade is about 18 $\\times$ faster, while producing videos of similar quality to the samples from the original models. In terms of FLOPs, the distilled models are about 36 $\\times$ more efficient: The original cascade evaluates each model twice (in parallel) to apply classifier-free guidance, while our distilled models do not, since they distilled the effect of guidance into a single model. We provide samples from our original and distilled cascade in Figure 14 for illustration. ",
741
+ "page_idx": 12
742
+ },
743
+ {
744
+ "type": "image",
745
+ "img_path": "images/a6da3405e211d7c3d0b48d63a33d2636490901a003f68bd8bdb179bf98bb6721.jpg",
746
+ "image_caption": [
747
+ "$8 0 \\times 4 8$ input video frames ",
748
+ "Figure 12: Comparison between $\\epsilon$ -prediction (middle row) and v-prediction (bottom row) for a 8 $\\times$ 80 $\\times$ 48 8 $\\times$ 320 $\\times$ 192 spatial super-resolution architecture at 200k training steps. The frames from the $\\epsilon$ -prediction model are generally worse, suffering from unnatural global color shifts across frames. The frames from the v-prediction model do not and are more consistent. "
749
+ ],
750
+ "image_footnote": [],
751
+ "page_idx": 13
752
+ },
753
+ {
754
+ "type": "image",
755
+ "img_path": "images/afec2a06f98752ec7650e99490a85f9122e529bab0d49bc4763af3f3a487a8eb.jpg",
756
+ "image_caption": [
757
+ "Figure 13: Comparison between $8 0 \\times 4 8 3 2 0 \\times 1 9 2$ SSR models trained with $\\epsilon$ - and $\\mathbf { v }$ -prediction parameterizations. We report FID evaluated on the first upsampled frame; FVD score is excessively noisy for the $\\epsilon$ -prediction model. We observe that the sample quality of the $\\epsilon$ -prediction model converges much more slowly than that of the v-prediction model. "
758
+ ],
759
+ "image_footnote": [],
760
+ "page_idx": 13
761
+ },
762
+ {
763
+ "type": "text",
764
+ "text": "4 Limitations and Societal Impact ",
765
+ "text_level": 1,
766
+ "page_idx": 13
767
+ },
768
+ {
769
+ "type": "text",
770
+ "text": "Generative modeling has made tremendous progress, especially in recent text-to-image models (Saharia et al., 2022b; Ramesh et al., 2022; Rombach et al., 2022). Imagen Video is another step forward in generative modelling capabilities, advancing text-to-video AI systems. Video generative models can be used to positively impact society, for example by amplifying and augmenting human creativity. However, these generative models may also be misused, for example to generate fake, hateful, explicit or harmful content. We have taken multiple steps to minimize these concerns, for example in internal trials, we apply input text prompt filtering, and output video content filtering. However, there are several important safety and ethical challenges remaining. Imagen Video and its frozen T5-XXL text encoder were trained on problematic data (Bordia $\\&$ Bowman, 2017; Birhane et al., 2021; Bender et al., 2021). While our internal testing suggests much of explicit and violent content can be filtered out, there still exists social biases and stereotypes which are challenging ",
771
+ "page_idx": 13
772
+ },
773
+ {
774
+ "type": "table",
775
+ "img_path": "images/3e4a030f9c6d910b6ae7437a8f7f1c0f96a01de739df18d614ace8792d8ed6c2.jpg",
776
+ "table_caption": [],
777
+ "table_footnote": [],
778
+ "table_body": "<table><tr><td>Guidance w</td><td>Base Steps</td><td> SR Steps</td><td>CLIP Score</td><td>CLIP R-Precision</td><td>Sampling Time</td></tr><tr><td>constant=6</td><td>256</td><td>128</td><td>25.19±.03</td><td>92.12±.53</td><td>618 sec</td></tr><tr><td>oscillate(15,1)</td><td>256</td><td>128</td><td>25.02±.08</td><td>89.91±.96</td><td>618 sec</td></tr><tr><td>constant=6</td><td>256</td><td>8</td><td>25.29±.05</td><td>90.88±.50</td><td>135 sec</td></tr><tr><td>oscillate(15,1)</td><td>256</td><td>8</td><td>25.15±.09</td><td>88.78±.69</td><td>135 sec</td></tr><tr><td>constant=6</td><td>8</td><td>8</td><td>25.03±.05</td><td>89.68±.38</td><td>35 sec</td></tr><tr><td>oscillate(15,1)</td><td>8</td><td>8</td><td>25.12±.07</td><td>90.97±.46</td><td>35 sec</td></tr><tr><td> ground truth</td><td></td><td></td><td>24.27</td><td>86.18</td><td></td></tr></table>",
779
+ "page_idx": 14
780
+ },
781
+ {
782
+ "type": "text",
783
+ "text": "Table 1: CLIP scores and CLIP R-Precision (Park et al., 2021) values for generated samples and ground truth videos on prompts from our test set. Cells highlighted in green represent distilled models. We compare three different combinations: original pipeline, distilled SR models on top of original base model, and fully distilled pipeline. The original base models use 256 sampling steps, and original SR models use 128 steps. All distilled models use 8 sampling steps per stage. Sampling from the original pipeline takes 618 seconds for one batch of samples, while sampling from the distilled pipeline takes 35 seconds, making the distilled pipeline about 18 $\\times$ faster. We also explored two different classifier-free guidance settings for the base models: constant guidance with $w = 6$ and oscillating guidance which alternates between $w = 1 5$ and $w = 1$ , following Saharia et al. (2022b). When using oscillating guidance, the fully distilled pipeline performs the same as the original model, or even slightly better. When using fixed guidance, our fully distilled pipeline scores slightly lower than the original model, though the difference is minor. Combining the original base model with fixed guidance and distilled super-resolution models produced the highest CLIP score. For all models, generated samples obtain better perceptual quality metrics than the original ground truth data: By using classifier-free guidance our models sample from a distribution tilted towards these quality metrics, rather than from an accurate approximation of the original data distribution. ",
784
+ "page_idx": 14
785
+ },
786
+ {
787
+ "type": "image",
788
+ "img_path": "images/b497801badbb304195e8c26f2c8d67c7fa5c01f65e1dfcc29bfb88e1439d2f27.jpg",
789
+ "image_caption": [
790
+ "Figure 14: Frames from videos generated by Imagen Video for the text prompt “ $A$ teddy bear wearing sunglasses playing guitar next to a cactus.” The samples on the left are produced by our original model cascade, while the samples on the right are from our distilled cascade with 8 sampling steps per stage. Both used constant guidance with $w = 6$ and static clipping. "
791
+ ],
792
+ "image_footnote": [],
793
+ "page_idx": 14
794
+ },
795
+ {
796
+ "type": "text",
797
+ "text": "to detect and filter. We have decided not to release the Imagen Video model or its source code until these concerns are mitigated. ",
798
+ "page_idx": 14
799
+ },
800
+ {
801
+ "type": "text",
802
+ "text": "5 Conclusion ",
803
+ "text_level": 1,
804
+ "page_idx": 14
805
+ },
806
+ {
807
+ "type": "text",
808
+ "text": "We presented Imagen Video: a text-conditional video generation system based on a cascade of video diffusion models. By extending the text-to-image diffusion models of Imagen (Saharia et al., 2022b) to the time domain, and training jointly on video and images, we obtained a model capable of generating high fidelity videos with good temporal consistency while maintaining the strong features of the original image system, such as the ability to accurately spell text. We transferred multiple methods from the image domain to video, such as $\\mathbf { v }$ -parameterization (Salimans & Ho, 2022), conditioning augmentation (Ho et al., 2022a), and classifier-free guidance (Ho & Salimans, 2021), and found that these are also useful in the video setting. Video modeling is computationally demanding, and we found that progressive distillation (Salimans & Ho, 2022; Meng et al., 2022) is a valuable technique for speeding up video diffusion models at sampling time. Given the tremendous recent progress in generative modeling, we believe there is ample scope for further improvements in video generation capabilities in future work. ",
809
+ "page_idx": 14
810
+ },
811
+ {
812
+ "type": "text",
813
+ "text": "",
814
+ "page_idx": 15
815
+ },
816
+ {
817
+ "type": "text",
818
+ "text": "References ",
819
+ "text_level": 1,
820
+ "page_idx": 15
821
+ },
822
+ {
823
+ "type": "text",
824
+ "text": "Mohammad Babaeizadeh, Chelsea Finn, D. Erhan, Roy H. Campbell, and Sergey Levine. Stochastic variational video prediction. ArXiv, abs/1710.11252, 2018. \nMohammad Babaeizadeh, Mohammad Taghi Saffar, Suraj Nair, Sergey Levine, Chelsea Finn, and Dumitru Erhan. Fitvid: Overfitting in pixel-level video prediction, 2021. URL https://arxiv.org/abs/2106. 13195. \nEmily M. Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. On the dangers of stochastic parrots: Can language models be too big? . In Proceedings of FAccT 2021, 2021. \nAbeba Birhane, Vinay Uday Prabhu, and Emmanuel Kahembwe. Multimodal datasets: misogyny, pornography, and malignant stereotypes. In arXiv:2110.01963, 2021. \nShikha Bordia and Samuel R. Bowman. Identifying and Reducing Gender Bias in Word-Level Language Models. In NAACL, 2017. \nNanxin Chen, Yu Zhang, Heiga Zen, Ron J. Weiss, Mohammad Norouzi, and William Chan. WaveGrad: Estimating Gradients for Waveform Generation. In ICLR, 2021a. \nNanxin Chen, Yu Zhang, Heiga Zen, Ron J. Weiss, Mohammad Norouzi, Najim Dehak, and William Chan. WaveGrad 2: Iterative Refinement for Text-to-Speech Synthesis . In INTERSPEECH, 2021b. \nPrafulla Dhariwal and Alex Nichol. Diffusion models beat gans on image synthesis. In NeurIPS, 2022. \nMing Ding, Zhuoyi Yang, Wenyi Hong, Wendi Zheng, Chang Zhou, Da Yin, Junyang Lin, Xu Zou, Zhou Shao, Hongxia Yang, and Jie Tang. Cogview: Mastering text-to-image generation via transformers, 2021. URL https://arxiv.org/abs/2105.13290. \nChelsea Finn, Ian J. Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. ArXiv, abs/1605.07157, 2016. \nAgrim Gupta, Stephen Tian, Yunzhi Zhang, Jiajun Wu, Roberto Mart’in-Mart’in, and Li Fei-Fei. Maskvit: Masked visual pre-training for video prediction. ArXiv, abs/2206.11894, 2022. \nWilliam Harvey, Saeid Naderiparizi, Vaden Masrani, Christian Weilbach, and Frank Wood. Flexible diffusion modeling of long videos. ArXiv, abs/2205.11495, 2022. \nJack Hessel, Ari Holtzman, Maxwell Forbes, Ronan Le Bras, and Yejin Choi. Clipscore: A reference-free evaluation metric for image captioning. arXiv preprint arXiv:2104.08718, 2021. \nMartin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. arXiv preprint arXiv:1706.08500, 2017. \nJonathan Ho and Tim Salimans. Classifier-free diffusion guidance. In NeurIPS 2021 Workshop on Deep Generative Models and Downstream Applications, 2021. \nJonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising Diffusion Probabilistic Models. NeurIPS, 2020. ",
825
+ "page_idx": 15
826
+ },
827
+ {
828
+ "type": "text",
829
+ "text": "",
830
+ "page_idx": 15
831
+ },
832
+ {
833
+ "type": "text",
834
+ "text": "Jonathan Ho, Chitwan Saharia, William Chan, David J Fleet, Mohammad Norouzi, and Tim Salimans. Cascaded diffusion models for high fidelity image generation. JMLR, 2022a. \nJonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J. Fleet. Video Diffusion Models. In arXiv:2204.03458, 2022b. \nNal Kalchbrenner, Aäron van den Oord, Karen Simonyan, Ivo Danihelka, Oriol Vinyals, Alex Graves, and Koray Kavukcuoglu. Video pixel networks. ArXiv, abs/1610.00527, 2017. \nTero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusion-based generative models. arXiv preprint arXiv:2206.00364, 2022. \nDiederik P Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. arXiv preprint arXiv:2107.00630, 2021. \nZhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. DiffWave: A Versatile Diffusion Model for Audio Synthesis. In ICLR, 2021. \nManoj Kumar, Mohammad Babaeizadeh, D. Erhan, Chelsea Finn, Sergey Levine, Laurent Dinh, and Durk Kingma. Videoflow: A conditional flow-based model for stochastic video generation. arXiv: Computer Vision and Pattern Recognition, 2020. \nTanya Marwah, Gaurav Mittal, and Vineeth N Balasubramanian. Attentive semantic video generation using captions. In Proceedings of the IEEE international conference on computer vision, pp. 1426–1434, 2017. \nMichaël Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square error. CoRR, abs/1511.05440, 2016. \nChenlin Meng, Ruiqi Gao, Diederik P Kingma, Stefano Ermon, Jonathan Ho, and Tim Salimans. On distillation of guided diffusion models. arXiv preprint arXiv:2210.03142, 2022. \nGaurav Mittal, Tanya Marwah, and Vineeth N Balasubramanian. Sync-draw: Automatic video generation using deep recurrent attentive architectures. In Proceedings of the 25th ACM international conference on Multimedia, pp. 1096–1104, 2017. \nAlex Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, pp. 8162–8171. PMLR, 2021. \nAlex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Bob McGrew Pamela Mishkin, Ilya Sutskever, and Mark Chen. GLIDE: Towards Photorealistic Image Generation and Editing with TextGuided Diffusion Models. In arXiv:2112.10741, 2021. \nDong Huk Park, Samaneh Azadi, Xihui Liu, Trevor Darrell, and Anna Rohrbach. Benchmark for compositional text-to-image synthesis. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 1), 2021. URL https://openreview.net/forum?id= bKBhQhPeKaF. \nBen Poole, Ajay Jain, Jonathan T. Barron, and Ben Mildenhall. DreamFusion: Text-to-3D using 2D Diffusion. arXiv, 2022. \nColin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer. JMLR, 21(140), 2020. \nAditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical Text-Conditional Image Generation with CLIP Latents. In arXiv, 2022. \nMarc’Aurelio Ranzato, Arthur D. Szlam, Joan Bruna, Michaël Mathieu, Ronan Collobert, and Sumit Chopra. Video (language) modeling: a baseline for generative models of natural videos. ArXiv, abs/1412.6604, 2014. \nRobin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-Resolution Image Synthesis with Latent Diffusion Models. In CVPR, 2022. \nOlaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pp. 234–241. Springer, 2015. \nChitwan Saharia, William Chan, Huiwen Chang, Chris A. Lee, Jonathan Ho, Tim Salimans, David J. Fleet, and Mohammad Norouzi. Palette: Image-to-Image Diffusion Models. In SIGGRAPH, 2022a. \nChitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S. Sara Mahdavi, Rapha Gontijo Lopes, Tim Salimans, Jonathan Ho, David J Fleet, and Mohammad Norouzi. Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding. In NeurIPS, 2022b. \nChitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2022c. \nTim Salimans and Jonathan Ho. Progressive Distillation for Fast Sampling of Diffusion Models. In ICLR, 2022. \nTim Salimans, Andrej Karpathy, Xi Chen, and Diederik P Kingma. PixelCNN $^ { + + }$ : Improving the PixelCNN with discretized logistic mixture likelihood and other modifications. In International Conference on Learning Representations, 2017. \nChristoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-400m: Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint arXiv:2111.02114, 2021. \nXingjian Shi, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-Kin Wong, and Wang chun Woo. Convolutional lstm network: A machine learning approach for precipitation nowcasting. In NIPS, 2015. \nUriel Singer, Adam Polyak, Thomas Hayes, Xi Yin, Jie An, Songyang Zhang, Qiyuan Hu, Harry Yang, Oron Ashual, Oran Gafni, Devi Parikh, Sonal Gupta, and Yaniv Taigman. Make-A-Video: Text-to-Video Generation without Text-Video Data. In arXiv:2209.14792, 2022. \nJascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pp. 2256–2265. PMLR, 2015. \nJiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020. \nYang Song and Stefano Ermon. Generative Modeling by Estimating Gradients of the Data Distribution. NeurIPS, 2019. \nYang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In ICLR, 2021. \nBelinda Tzen and Maxim Raginsky. Neural Stochastic Differential Equations: Deep Latent Gaussian Models in the Diffusion Limit. In arXiv:1905.09883, 2019. \nThomas Unterthiner, Sjoerd van Steenkiste, Karol Kurach, Raphaël Marinier, Marcin Michalski, and Sylvain Gelly. FVD: A new Metric for Video Generation. In ICLR 2022 Workshop: Deep Generative Models for Highly Structured Data, 2019. \nCarl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. ArXiv, abs/1609.02612, 2016. \nDaniel Watson, Ricardo Chan, William Martin-Brualla, Jonathan Ho, Andrea Tagliasacchi, and Mohammad Norouzi. Novel View Synthesis with Diffusion Models. arXiv, 2022. \nJay Whang, Mauricio Delbracio, Hossein Talebi, Chitwan Saharia, Alexandros G. Dimakis, and Peyman Milanfar. Deblurring via Stochastic Refinement. In CVPR, 2022. \nRuihan Yang, Prakhar Srivastava, and Stephan Mandt. Diffusion Probabilistic Modeling for Video Generation. In arXiv:2203.09481, 2022. \nJiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, Ben Hutchinson, Wei Han, Zarana Parekh, Xin Li, Han Zhang, and Yonghui Wu Jason Baldridge. Scaling Autoregressive Models for Content-Rich Text-to-Image Generation. In arXiv:2206.10789, 2022. ",
835
+ "page_idx": 16
836
+ },
837
+ {
838
+ "type": "text",
839
+ "text": "",
840
+ "page_idx": 17
841
+ },
842
+ {
843
+ "type": "text",
844
+ "text": "",
845
+ "page_idx": 18
846
+ }
847
+ ]
parse/test/ETH1GDbSPw/ETH1GDbSPw_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/ETH1GDbSPw/ETH1GDbSPw_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/KOZu91CzbK/KOZu91CzbK_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/dtvJF1Vy2i/dtvJF1Vy2i.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/dtvJF1Vy2i/dtvJF1Vy2i_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/dtvJF1Vy2i/dtvJF1Vy2i_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/dtvJF1Vy2i/dtvJF1Vy2i_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/gDlsMWost9/gDlsMWost9.md ADDED
@@ -0,0 +1,633 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MULTIMODAL CHAIN-OF-THOUGHT REASONING IN LANGUAGE MODELS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Large language models (LLMs) have shown impressive performance on complex reasoning by leveraging chain-of-thought (CoT) prompting to generate intermediate reasoning chains as the rationale to infer the answer. However, existing CoT studies have primarily focused on the language modality. We propose Multimodal-CoT that incorporates language (text) and vision (images) modalities into a two-stage framework that separates rationale generation and answer inference. In this way, answer inference can leverage better generated rationales that are based on multimodal information. Experimental results on ScienceQA and A-OKVQA benchmark datasets show the effectiveness of our proposed approach. With Multimodal-CoT, our model under 1 billion parameters achieves new state-of-the-art performance on the ScienceQA benchmark. Our analysis indicates that Multimodal-CoT offers the advantages of mitigating hallucination. Code is publicly available at Anonymous.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Imagine reading a textbook with no figures or tables. Our ability to knowledge acquisition is greatly strengthened by jointly modeling diverse data modalities, such as vision, language, and audio. Recently, large language models (LLMs) (Brown et al., 2020; Thoppilan et al., 2022; Rae et al., 2021; Chowdhery et al., 2022) have shown impressive performance in complex reasoning by generating intermediate reasoning steps before inferring the answer. The intriguing technique is called chain-of-thought (CoT) reasoning (Wei et al., 2022b; Kojima et al., 2022; Zhang et al., 2023c).
12
+
13
+ However, existing studies related to CoT reasoning are largely isolated in the language modality (Wang et al., 2022c; Zhou et al., 2022; Lu et al., 2022b; Fu et al., 2022), with little consideration of multimodal scenarios. To elicit CoT reasoning in multimodality, we advocate a MultimodalCoT paradigm. Given the inputs in different modalities, Multimodal-CoT decomposes multistep problems into intermediate reasoning steps (rationale) and then infers the answer. Since vision and language are the most popular modalities, we focus on those two modalities in this work. An example is shown in Figure 1.
14
+
15
+ ![](images/07d32c2ef1074fdca5e620ea784a63e9d8a30d30d35acbbde5409252be1d22ad.jpg)
16
+ Figure 1: Example of the multimodal CoT task.
17
+
18
+ In general, there are two ways to elicit Multimodal-CoT reasoning as follows: (i) prompting LLMs and (ii) fine-tuning small models.1
19
+
20
+ The most immediate way to perform Multimodal-CoT is to transform the input of different modalities into a unified modality and prompt LLMs to perform CoT (Zhang et al., 2023a; Lu et al., 2023; Liu et al., 2023; Alayrac et al., 2022; Hao et al., 2022; Yasunaga et al., 2022). For example, it is possible to generate a caption for an image by a captioning model and then concatenate the caption with the original language input to be fed into LLMs (Lu et al., 2022a). However, there is severe information loss in the captioning process; thus, using image captions (as opposed to vision features) may suffer from a lack of mutual synergy in the representation space of different modalities. In addition, LLMs either have paywalls or resource-consuming to deploy locally.
21
+
22
+ To facilitate the interaction between modalities, another potential solution is to fine-tune smaller language models (LMs) by fusing multimodal features (Zhang et al., 2023b). As this approach allows the flexibility of adjusting model architectures to incorporate multimodal features, we study fine-tuning models in this work instead of prompting LLMs. The key challenge is that language models under 100 billion parameters tend to generate hallucinated rationales that mislead the answer inference (Ho et al., 2022; Magister et al., 2022; Ji et al., 2022).
23
+
24
+ To mitigate the challenge of hallucination, we propose Multimodal-CoT that incorporates language (text) and vision (images) modalities into a two-stage framework that separates rationale generation and answer inference.2 In this way, answer inference can leverage better generated rationales that are based on multimodal information. Our experiments are conducted on the ScienceQA (Lu et al., 2022a) and A-OKVQA (Schwenk et al., 2022) datasets, which are the latest multimodal reasoning benchmarks with annotated reasoning chains.
25
+
26
+ Our method achieves new state-of-the-art performance on the ScienceQA benchmark. We find that Multimodal-CoT is beneficial in mitigating hallucination and boosting convergence. Our contributions are summarized as follows:
27
+
28
+ (i) To the best of our knowledge, this work is the first to study CoT reasoning in different modalities in scientific peer-reviewed literature.
29
+ (ii) We propose a two-stage framework by fine-tuning language models to fuse vision and language representations to perform Multimodal-CoT. The model is able to generate informative rationales to facilitate inferring final answers.
30
+ (iii) Our method achieves new state-of-the-art performance on the ScienceQA benchmark. Our work elicits the analysis of why the naive way of employing CoT fails in the context and how incorporating vision features alleviates the problem. The approach has been shown to be generally effective across tasks and backbone models.
31
+
32
+ # 2 BACKGROUND
33
+
34
+ This section reviews studies eliciting CoT reasoning by prompting and fine-tuning language models.
35
+
36
+ # 2.1 COT REASONING WITH LLMS
37
+
38
+ Recently, CoT has been widely used to elicit the multi-step reasoning abilities of LLMs (Wei et al., 2022b). Concretely, CoT techniques encourage the LLM to generate intermediate reasoning chains for solving a problem. Studies have shown that LLMs can perform CoT reasoning with two major paradigms of techniques: Zero-Shot-CoT (Kojima et al., 2022) and Few-Shot-CoT (Wei et al., 2022b; Zhang et al., 2023c). For Zero-Shot-CoT, Kojima et al. (2022) showed that LLMs are decent zero-shot reasoners by adding a prompt like “Let’s think step by step” after the test question to invoke CoT reasoning. For Few-Shot-CoT, a few step-by-step reasoning demonstrations are used as conditions for inference. Each demonstration has a question and a reasoning chain that leads to the final answer. The demonstrations are commonly obtained by hand-crafting or automatic generation. These two techniques, hand-crafting and automatic generation are thus referred to as Manual-CoT (Wei et al., 2022b) and Auto-CoT (Zhang et al., 2023c).
39
+
40
+ With effective demonstrations, Few-Shot-CoT often achieves stronger performance than Zero-ShotCoT and has attracted more research interest. Therefore, most recent studies focused on how to improve Few-Shot-CoT. Those studies are categorized into two major research lines: (i) optimizing the demonstrations; (ii) optimizing the reasoning chains. Table 1 compares typical CoT techniques.
41
+
42
+ Optimizing Demonstrations The performance of Few-Shot-CoT relies on the quality of demonstrations. As reported in Wei et al. (2022b), using demonstrations written by different annotators results in dramatic accuracy disparity in reasoning tasks. Beyond hand-crafting the demonstrations, recent studies have investigated ways to optimize the demonstration selection process. Notably, Rubin et al. (2022) retrieved the semantically similar demonstrations with the test instance. However, this approach shows a degraded performance when there are mistakes in the reasoning chains (Zhang et al., 2023c). To address the limitation, Zhang et al. (2023c) found that the key is the diversity of demonstration questions and proposed Auto-CoT: (i) partition questions of a given dataset into a few clusters; (ii) sample a representative question from each cluster and generate its reasoning chain using Zero-Shot-CoT with simple heuristics. In addition, reinforcement learning (RL) and complexitybased selection strategies were proposed to obtain effective demonstrations. Fu et al. (2022) chose examples with complex reasoning chains (i.e., with more reasoning steps) as the demonstrations. Lu et al. (2022b) trained an agent to find optimal in-context examples from a candidate pool and maximize the prediction rewards on given training examples when interacting with GPT-3.5.
43
+
44
+ Table 1: Representative CoT techniques (FT: fine-tuning; KD: knowledge distillation). Segment 1: in-context learning techniques; Segment 2: fine-tuning techniques. To the best of our knowledge, our work is the first to study CoT reasoning in different modalities in scientific peer-reviewed literature. Besides, we focus on 1B-models, without relying on the outputs of LLMs.
45
+
46
+ <table><tr><td>Models</td><td>Mutimodal Model/Engine Training</td><td></td><td></td><td>CoTRole</td><td>CoT Source</td></tr><tr><td>Zero-Shot-CoT (Keimal.t l2)</td><td>xxxx</td><td>GPT-M5(17B)</td><td>ICL</td><td>Reasoning</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>HTemprated</td></tr><tr><td>Self-Consistency-CoT (Wang et al.,2022b)</td><td></td><td>Codex (175B)</td><td>ICL</td><td>Reasoning</td><td>Hand-crafted</td></tr><tr><td>Least-to-Most Prompting (Zhou et al., 2022)</td><td></td><td>Codex (175B)</td><td>ICL</td><td>Reasoning</td><td>Hand-crafted</td></tr><tr><td>Retrieval-CoT (Zhang et al., 2023c)</td><td>X</td><td>GPT-3.5 (175B)</td><td>ICL</td><td>Reasoning</td><td>Auto-generated</td></tr><tr><td>PromptPG-CoT (Lu et al., 2022b)</td><td>X</td><td>GPT-3.5 (175B)</td><td>ICL</td><td>Reasoning</td><td>Hand-crafted</td></tr><tr><td>Auto-CoT (Zhang et al., 2023c)</td><td>X</td><td>Codex (175B)</td><td>ICL</td><td>Reasoning</td><td>Auto-generated</td></tr><tr><td>Complexity-CoT (Fu et al.,2022)</td><td>X</td><td>GPT-3.5 (175B)</td><td>ICL</td><td>Reasoning</td><td>Hand-crafted</td></tr><tr><td>Few-Shot-PoT (Chen et al., 2022)</td><td>×</td><td>GPT-3.5 (175B)</td><td>ICL</td><td>Reasoning</td><td>Hand-crafted</td></tr><tr><td>UnifiedQA (Lu et al., 2022a)</td><td>X</td><td>T5 (770M)</td><td>FT</td><td>Explanation</td><td>Crawled</td></tr><tr><td>Fine-Tuned T5 XXL (Magister et al.,2022)</td><td>X</td><td>T5 (11B)</td><td>KD</td><td></td><td>Reasoning LLM-generated</td></tr><tr><td>Fine-Tune-CoT (Ho et al.,2022)</td><td></td><td>GPT-3 (6.7B)</td><td>KD</td><td></td><td>Reasoning LLM-generated</td></tr><tr><td>Multimodal-CoT (our work)</td><td>√</td><td>T5 (770M)</td><td>FT</td><td>Reasoning</td><td>Crawled</td></tr></table>
47
+
48
+ Optimizing Reasoning Chains A notable way to optimize reasoning chains is problem decomposition. Zhou et al. (2022) proposed least-to-most prompting to decompose complex problems into sub-problems and then solve these sub-problems sequentially. As a result, solving a given subproblem is facilitated by the answers to previously solved sub-problems. Similarly, Khot et al. (2022) used diverse decomposition structures and designed different prompts to answer each sub-question. In addition to prompting the reasoning chains as natural language texts, Chen et al. (2022) proposed program-of-thoughts (PoT), which modeled the reasoning process as a program and prompted LLMs to derive the answer by executing the generated programs. Another trend is to vote over multiple reasoning paths for a test question. Wang et al. (2022b) introduced a self-consistency decoding strategy to sample multiple outputs of LLMs and then took a majority over the final answers. Wang et al. (2022c) and Li et al. (2022c) introduced randomness in the input space to produce more diverse outputs for voting.
49
+
50
+ # 2.2 ELICITING COT REASONING BY FINE-TUNING MODELS
51
+
52
+ A recent interest is eliciting CoT reasoning by fine-tuning language models. Lu et al. (2022a) finetuned the encoder-decoder T5 model on a large-scale dataset with CoT annotations. However, a dramatic performance decline is observed when using CoT to infer the answer, i.e., generating the reasoning chain before the answer (reasoning). Instead, CoT is only used as an explanation after the answer. Magister et al. (2022) and Ho et al. (2022) employed knowledge distillation by fine-tuning a student model on the chain-of-thought outputs generated by a larger teacher model. Wang et al. (2022a) proposed an iterative context-aware prompting approach to dynamically synthesize prompts conditioned on the current step’s contexts.
53
+
54
+ There is a key challenge in training 1B-models to be CoT reasoners. As observed by Wei et al. (2022b), models under 100 billion parameters tend to produce illogical CoT that leads to wrong answers. In other words, it might be harder for 1B-models to generate effective CoT than directly generating the answer. It becomes even more challenging in a multimodal setting where answering the question also requires understanding the multimodal inputs. In the following part, we will explore the challenge of Multimodal-CoT and investigate how to perform effective multi-step reasoning.
55
+
56
+ # 3 CHALLENGE OF MULTIMODAL-COT
57
+
58
+ Existing studies have suggested that the CoT reasoning ability may emerge in language models at a certain scale, e.g., over 100 billion parameters (Wei et al., 2022a). However, it remains an unresolved challenge to elicit such reasoning abilities in 1B-models, let alone in the multimodal scenario. This work focuses on 1B-models as they can be fine-tuned and deployed with consumer-grade GPUs (e.g., 32G memory). In this section, we will investigate why 1B-models fail at CoT reasoning and study how to design an effective approach to overcome the challenge.
59
+
60
+ # 3.1 TOWARDS THE ROLE OF COT
61
+
62
+ To begin with, we fine-tune a text-only baseline for CoT reasoning on the ScienceQA benchmark (Lu et al., 2022a). We adopt FLAN-AlpacaBase as the backbone language model.3 Our task is modeled as a text generation problem, where the model takes the textual information as the input and generates the output sequence that consists of the rationale and the answer. As an example shown in Figure 1, the model takes the concatenation of tokens of the question text (Q), the context text (C), and multiple options (M) as the input. To study the effect of CoT, we compare the performance with three variants: (i) $\tt N o - C o T$ which predicts the answer directly $\mathrm { ( Q C M \to A ) }$ ); (ii) Reasoning where answer inference is conditioned to the rationale $( \mathbf { Q C M } { } \mathbf { R A } )$ ; (iii) Explanation where the rationale is used for explaining the answer inference $\mathrm { Q C M } { } \mathrm { A R }$ ).
63
+
64
+ Surprisingly, we observe a $\downarrow 1 2 . 3 1 \%$ accuracy decrease $8 1 . 6 3 \% 6 9 . 3 2 \% )$ if the model predicts rationales before answers $( \mathrm { Q C M } { } \mathrm { R A } )$ ). The results imply that the rationales might not necessarily contribute to predicting the right answer. According to Lu et al. (2022a), the plausible reason might be that the model exceeds the maximum token limits before ob
65
+
66
+ Table 2: Effects of CoT in the one-stage setting.
67
+
68
+ <table><tr><td>Method</td><td>Format</td><td>Accuracy</td></tr><tr><td>No-CoT</td><td>QCM→A</td><td>81.63</td></tr><tr><td>Reasoning</td><td>QCM→RA</td><td>69.32</td></tr><tr><td>Explanation</td><td>QCM→AR</td><td>69.68</td></tr></table>
69
+
70
+ taining the required answer or stops generating the prediction early. However, we find that the maximum length of the generated outputs (RA) is always less than 400 tokens, which is below the length limit of language models (i.e., 512 in T5 models). Therefore, it deserves a more in-depth investigation into why the rationales harm answer inference.
71
+
72
+ # 3.2 MISLEADING BY HALLUCINATED RATIONALES
73
+
74
+ To dive into how the rationales affect the answer prediction, we separate the CoT problem into two stages, rationale generation and answer inference.4 We report the RougeL score and accuracy for the rationale generation and answer inference, respectively. Table 3 shows the results based on the two-stage framework. Although the two-stage baseline
75
+
76
+ Table 3: Two-stage setting of (i) rationale generation (RougeL) and (ii) answer inference (Accuracy).
77
+
78
+ <table><tr><td colspan="3">Method () QCM→R(ii) QCMR→A</td></tr><tr><td>Two-Stage Framework</td><td>90.73</td><td>78.57</td></tr><tr><td>w/Captions</td><td>90.88</td><td>79.37</td></tr><tr><td>w/ Vision Features</td><td>93.46</td><td>85.31</td></tr></table>
79
+
80
+ model achieves a 90.73 RougeL score of the rationale generation, the answer inference accuracy is only $7 8 . 5 7 \%$ . Compared with the $\mathrm { Q C M } { } \mathbf { A }$ variant $( 8 1 . 6 3 \% )$ in Table 2, the result shows that the generated rationale in the two-stage framework does not improve answer accuracy.
81
+
82
+ Then, we randomly sample 50 error cases and find that the model tends to generate hallucinated rationales that mislead the answer inference. As an example shown in Figure 2, the model (left part) hallucinates that, “The south pole of one magnet is closest to the south pole of the other magnet”,
83
+
84
+ # Problem
85
+
86
+ Question: Will these magnets attract or repel each other?
87
+ Context: Two magnets are placed as shown. Hint: Magnets that attract pull together. Magnets that repel push apart.
88
+
89
+ ![](images/1b79406f9760e1759adbdb0129a29f1320d84e4451c8dc5dcff6a39b759a7411.jpg)
90
+
91
+ Options: (A) attract
92
+
93
+ (B) repel
94
+
95
+ Gold Rationale: Will these magnets attract or repel? To find out, look at which poles are closest to each other. The north pole of one magnet is closest to the south pole of the other magnet. Poles that are different attract. So, these magnets will attract each other. Answer: The answer is (A).
96
+
97
+ # Baseline
98
+
99
+ # $^ +$ Vision Features
100
+
101
+ Generated Rationale: Will these magnets attract or repel? To find out, look at which poles are closest to each other. The south pole of one magnet is closest to the south pole of the other magnet. Poles that are the same repel. So, these magnets will repel each other.
102
+ Answer: The answer is (B).
103
+
104
+ Generated Rationale: Will these magnets attract or repel? To find out, look at which poles are closest to each other. The north pole of one magnet is closest to the south pole of the other magnet. Poles that are different attract. So, these magnets will attract each other.
105
+
106
+ Answer: The answer is (A).
107
+
108
+ Figure 2: Example of the two-stage framework without vision features (baseline) and with vision features (ours) for generating rationales and predicting answers. The upper part presents the problem details with a gold rationale, and the lower part shows the outputs of the baseline and our method incorporated with vision features. We observe that the baseline fails to predict the right answer due to the misleading by hallucinated rationales. More examples are shown in Appendix A.1.
109
+
110
+ due to the lack of reference to the vision content. We find that such mistakes occur at a ratio of $56 \%$ among the error cases (Figure 3(a)).
111
+
112
+ # 3.3 MULTIMODALITY CONTRIBUTES TO EFFECTIVE RATIONALES
113
+
114
+ We speculate that such a phenomenon of hallucination is due to a lack of necessary vision contexts for performing effective Multimodal-CoT. To inject vision information, a simple way is to transform the image into a caption (Lu et al., 2022a) and then append the caption in the input of both stages. However, as shown in Table 3, using captions only yields marginal performance gains $( \uparrow 0 . 8 0 \% )$ . Then, we explore an advanced technique by incorporating vision features into the language model. Concretely, we feed the image to the ViT model (Dosovitskiy et al., 2021b) to extract vision features. Then we fuse the vision features with the encoded language representations before feeding the decoder (more details will be presented in Section 4). Interestingly, with vision features, the RougeL score of the rationale generation has boosted to $9 3 . 4 6 \%$ $\mathrm { Q C M } { } \mathrm { R } _ { } ^ { \circ }$ ), which correspondingly contributes to better answer accuracy of $8 5 . 3 1 \%$ $\mathrm { Q C M R { \to } A } )$ ).
115
+
116
+ With those effective rationales, the phenomenon of hallucination is mitigated — $6 0 . 7 \%$ hallucination mistakes in Section 3.2 have been corrected (Figure 3(b)), as an example shown in Figure 2 (right part).5 The analysis so far compellingly shows that vision features are indeed beneficial for generating effective rationales and contributing to accurate answer inference. As the two-stage method achieves better performance than one-stage methods, we choose the two-stage method in our MultimodalCoT framework.
117
+
118
+ ![](images/dee09c5bdfcbf08f50490b7bdef5763aeee70099a5e6d8b224071fa17eb2830d.jpg)
119
+ Figure 3: The ratio of (a) hallucination mistakes and (b) correction rate w/ vision features.
120
+
121
+ # 4 MULTIMODAL-COT
122
+
123
+ In light of the discussions in Section 3, we propose Multimodal-CoT to incorporate language (text) and vision (images) modalities into a two-stage framework. The key motivation is the anticipation that the answer inference can leverage better generated rationales that are based on multimodal information. In this section, we will overview the procedure of the framework and elaborate on the technical design of the model architecture.
124
+
125
+ ![](images/1498dee95e1c67f15539f915e026d7ecbeafd29dc20f37970084a47193206852.jpg)
126
+ Figure 4: Overview of our Multimodal-CoT framework. Multimodal-CoT consists of two stages: (i) rationale generation and (ii) answer inference. Both stages share the same model structure but differ in the input and output. In the first stage, we feed the model with language and vision inputs to generate rationales. In the second stage, we append the original language input with the rationale generated from the first stage. Then, we feed the updated language input with the original vision input to the model to infer the answer.
127
+
128
+ # 4.1 FRAMEWORK OVERVIEW
129
+
130
+ Multimodal-CoT consists of two operation stages: (i) rationale generation and (ii) answer inference. Both stages share the same model structure but differ in the input $X$ and output $Y$ . The overall procedure is illustrated in Figure 4. We will take vision-language as an example to show how Multimodal-CoT works.
131
+
132
+ In the rationale generation stage, we feed the model with $X = \{ X _ { \mathrm { l a n g u a g e } } ^ { 1 } , X _ { \mathrm { v i s i o n } } \}$ where $X _ { \mathrm { l a n g u a g e } } ^ { 1 }$ represents the language input in the first stage and $X _ { \mathrm { v i s i o n } }$ represents the vision input, i.e., the image. For example, $X$ can be instantiated as a concatenation of question, context, and options of a multiple choice reasoning problem (Lu et al., 2022a) as shown in Figure 4. The goal is to learn a rationale generation model $R = F ( X )$ where $R$ is the rationale.
133
+
134
+ In the answer inference stage, the rationale to construct the language input in the sec $R$ is apped stage, ge inpwhere $X _ { \mathrm { l a } } ^ { 1 }$ nguagenotes $X _ { \mathrm { l a n g u a g e } } ^ { 2 } = X _ { \mathrm { l a n g u a g e } } ^ { 1 } \circ R$ $\circ$ concatenation. Then, we feed the updated input X′ = {X2language, Xvision} to the answer inference model to infer the final answer $A = F ( X ^ { \prime } )$ .
135
+
136
+ In both stages, we train two models with the same architecture independently. They take the annotated elements (e.g., $X R$ , $X R A$ , respectively) from the training set for supervised learning. During inference, given $X$ , the rationales for the test sets are generated using the model trained in the first stage; they are used in the second stage for answer inference.
137
+
138
+ # 4.2 MODEL ARCHITECTURE
139
+
140
+ Given language input $X _ { \mathrm { l a n g u a g e } } ~ \in ~ \{ X _ { \mathrm { l a n g u a g e } } ^ { 1 } , X _ { \mathrm { l a n g u a g e } } ^ { 2 } \}$ and vision input $X _ { \mathrm { v i s i o n } }$ , we compute the probability of generating target text $Y$ (either the rationale or the answer in Figure 4) of length $N$ by
141
+
142
+ $$
143
+ p ( { \cal Y } | { \cal X } _ { \mathrm { l a n g u a g e } } , { \cal X } _ { \mathrm { v i s i o n } } ) = \prod _ { i = 1 } ^ { N } p _ { \theta } ( Y _ { i } \mid { \cal X } _ { \mathrm { l a n g u a g e } } , { \cal X } _ { \mathrm { v i s i o n } } , { \cal Y } _ { < i } ) ,
144
+ $$
145
+
146
+ where $p _ { \theta } \left( Y _ { i } \mid X _ { \mathrm { l a n g u a g e } } , X _ { \mathrm { v i s i o n } } , Y _ { < i } \right)$ is implemented with a Transformer-based network (Vaswani et al., 2017). The network has three major procedures: encoding, interaction, and decoding. Specifically, we feed the language text into a Transformer encoder to obtain a textual representation, which is interacted and fused with the vision representation before being fed into the Transformer decoder.
147
+
148
+ Encoding The model $F ( X )$ takes both the language and vision inputs and obtains the text representation $H _ { \mathrm { l a n g u a g e } }$ and the image feature $H _ { \mathrm { v i s i o n } }$ by the following functions:
149
+
150
+ $$
151
+ \begin{array} { r c l } { H _ { \mathrm { l a n g u a g e } } } & { = } & { \mathrm { L a n g u a g e E n c o d e r } ( X _ { \mathrm { l a n g u a g e } } ) , } \\ { H _ { \mathrm { v i s i o n } } } & { = } & { W _ { h } \cdot \mathrm { V i s i o n E x t r a c t o r } ( X _ { \mathrm { v i s i o n } } ) , } \end{array}
152
+ $$
153
+
154
+ where LanguageEncoder(·) is implemented as a Transformer model. We use the hidden states of the last layer in the Transformer encoder as the language representation $H _ { \mathrm { l a n g u a g e } } \in \mathbb { R } ^ { n \times d }$ where $n$ denotes the length of the language input, and $d$ is the hidden dimension. Meanwhile, VisionExtractor(·) is used to vectorize the input image into vision features. Inspired by the recent success of Vision Transformers (Dosovitskiy et al., 2021a), we fetch the patch-level features by frozen vision extraction models, such as ViT (Dosovitskiy et al., 2021b). After obtaining the patch-level vision features, we apply a learnable projection matrix $W _ { h }$ to convert the shape of VisionExtractor $( X _ { \mathrm { v i s i o n } } )$ into that of $H _ { \mathrm { l a n g u a g e } }$ ; thus we have $H _ { \mathrm { v i s i o n } } \in \mathbb { R } ^ { m \times d }$ where $m$ is the number of patches.
155
+
156
+ Note that our approach is general to both scenarios with or without image context. For the questions without associated images, we use all-zero vectors as the “blank features” with the same shape as the normal image features to tell the model to ignore them.
157
+
158
+ Interaction After obtaining language and vision representations, we use a single-head attention network to correlate text tokens with image patches, where the query $( Q )$ , key $( K )$ and value $( V )$ are $H _ { \mathrm { l a n g u a g e } }$ , $H _ { \mathrm { v i s i o n } }$ and $H _ { \mathrm { v i s i o n } }$ , respectively. The attention output $H _ { \mathrm { v i s i o n } } ^ { \mathrm { a t t n } } \in \mathbb { R } ^ { n \times d }$ is defined as:
159
+
160
+ $$
161
+ H _ { \mathrm { v i s i o n } } ^ { \mathrm { a t t n } } = \mathrm { S o f t m a x } ( \frac { Q K ^ { \top } } { \sqrt { d _ { k } } } ) V ,
162
+ $$
163
+
164
+ where $d _ { k }$ is the same as the dimension of $H _ { \mathrm { l a n g u a g e } }$ because a single head is used.
165
+
166
+ Then, we apply the gated fusion mechanism (Zhang et al., 2020; Wu et al., 2021; Li et al., 2022a) to fuse $H _ { \mathrm { l a n g u a g e } }$ and $H _ { \mathrm { v i s i o n } }$ . The fused output $\dot { H } _ { \mathrm { f u s e } } \in \mathbb { R } ^ { n \times d }$ is obtained by:
167
+
168
+ $$
169
+ \begin{array} { r c l } { { \lambda } } & { { = } } & { { \mathrm { S i g m o i d } ( W _ { l } H _ { \mathrm { l a n g u a g e } } + W _ { v } H _ { \mathrm { v i s i o n } } ^ { \mathrm { a t t n } } ) , } } \\ { { { \cal H } _ { \mathrm { f u s e } } } } & { { = } } & { { ( 1 - \lambda ) \cdot { \cal H } _ { \mathrm { l a n g u a g e } } + \lambda \cdot { \cal H } _ { \mathrm { v i s i o n } } ^ { \mathrm { a t t n } } , } } \end{array}
170
+ $$
171
+
172
+ where $W _ { l }$ and $W _ { v }$ are learnable parameters.
173
+
174
+ Decoding Finally, the fused output $H _ { \mathrm { f u s e } }$ is fed into the Transformer decoder to predict the target $Y$
175
+
176
+ # 5 EXPERIMENTS
177
+
178
+ This section will present the benchmark dataset, the implementation of our technique, and the baselines for comparisons. Then, we will report our main results and findings.
179
+
180
+ # 5.1 DATASET
181
+
182
+ Our method is evaluated on the ScienceQA (Lu et al., 2022a) and A-OKVQA (Schwenk et al., 2022) benchmark datasets. ScienceQA is a large-scale multimodal science question dataset with annotated lectures and explanations. It contains $2 1 k$ multimodal multiple choice questions with rich domain diversity across 3 subjects, 26 topics, 127 categories, and 379 skills. There are $1 2 k , 4 k$ , and $4 k$ questions in the training, validation, and test splits, respectively. A-OKVQA is a knowledgebased visual question answering benchmark, which has $2 5 k$ questions requiring a broad base of commonsense and world knowledge to answer. It has $1 7 k / 1 k / 6 k$ questions for train/val/test. To keep consistency with ScienceQA, we use the multiple-choice setting.
183
+
184
+ # 5.2 IMPLEMENTATION
185
+
186
+ The following part presents the experimental settings of Multimodal-CoT and the baseline methods.
187
+
188
+ Experimental Settings We adopt the T5 encoder-decoder architecture (Raffel et al., 2020) under Base (200M) and large (700M) settings in our framework. We apply FLAN-Alpaca to initialize our model weights.6 We will show that Multimodal-CoT is generally effective with other backbone LMs, such as UnifiedQA (Khashabi et al., 2020) and FLAN-T5 (Chung et al., 2022) (Section 6.1). The vision features are obtained by the frozen ViT-large encoder (Dosovitskiy et al., 2021b). We fine-tune the models up to 20 epochs, with a learning rate of 5e-5. The maximum input sequence length is 512. The batch size is 8. Our experiments are run on 8 NVIDIA Tesla V100 32G GPUs.
189
+
190
+ Table 4: Main results $( \% )$ . Size $=$ backbone model size from the ScienceQA leaderboard (“-” means unavailable or unknown). Question classes: $\mathbf { N A T } =$ natural science, $\mathrm { S O C = }$ social science, $\mathrm { L A N } =$ language science, TXT $=$ text context, $\mathbf { I M G } =$ image context, $\mathbf { N O } = \mathbf { n o }$ context, ${ \mathrm { G } } 1 { - } 6 =$ grades 1-6, $G 7 - 1 2 =$ grades 7-12. Segment 1: Human performance; Segment 2: VQA baselines; Segment 3: LM baselines, i.e., UnifiedQA and few-shot learning LLMs; Segment 4: Fine-tuned large vision-language models; Segment 5: Our Multimodal-CoT results. Prior published best results are marked with an underline. Our best average result is in bold face. $\dagger$ denotes concurrent studies after this work.
191
+
192
+ <table><tr><td>Model</td><td>Size</td><td>NAT</td><td>SOC</td><td>LAN</td><td>TXT</td><td>IMG</td><td>NO</td><td>G1-6</td><td>G7-12</td><td>Avg</td></tr><tr><td>Human</td><td></td><td>90.23</td><td>84.97</td><td>87.48</td><td>89.60</td><td>87.50</td><td>88.10</td><td>91.59</td><td>82.42</td><td>88.40</td></tr><tr><td>MCAN (Yu et al., 2019)</td><td>95M</td><td>56.08</td><td>46.23</td><td>58.09</td><td>59.43</td><td>51.17</td><td>55.40</td><td>51.65</td><td>59.72</td><td>54.54</td></tr><tr><td>Top-Down (Anderson et al., 2018)</td><td>70M</td><td>59.50</td><td>54.33</td><td>61.82</td><td>62.90</td><td>54.88</td><td>59.79</td><td>57.27</td><td>62.16</td><td>59.02</td></tr><tr><td>BAN (Kim et al., 2018)</td><td>112M</td><td>60.88</td><td>46.57</td><td>66.64</td><td>62.61</td><td>52.60</td><td>65.51</td><td>56.83</td><td>63.94</td><td>59.37</td></tr><tr><td>DFAF (Gao et al.,2019)</td><td>74M</td><td>64.03</td><td>48.82</td><td>63.55</td><td>65.88</td><td>54.49</td><td>64.11</td><td>57.12</td><td>67.17</td><td>60.72</td></tr><tr><td>ViLT (Kim et al., 2021)</td><td>113M</td><td>60.48</td><td>63.89</td><td>60.27</td><td>63.20</td><td>61.38</td><td>57.00</td><td>60.72</td><td>61.90</td><td>61.14</td></tr><tr><td>Patch-TRM (Lu et al.,2021)</td><td>90M</td><td>65.19</td><td>46.79</td><td>65.55</td><td>66.96</td><td>55.28</td><td>64.95</td><td>58.04</td><td>67.50</td><td>61.42</td></tr><tr><td>VisualBERT (Li et al., 2019)</td><td>111M</td><td>59.33</td><td>69.18</td><td>61.18</td><td>62.71</td><td>62.17</td><td>58.54</td><td>62.96</td><td>59.92</td><td>61.87</td></tr><tr><td>UnifiedQA (Lu et al., 2022a)</td><td>223M</td><td>71.00</td><td>76.04</td><td>78.91</td><td>66.42</td><td>66.53</td><td>81.81</td><td>77.06</td><td>68.82</td><td>74.11</td></tr><tr><td>GPT-3.5 (text-davinci-002) (Luet al.,2022a)</td><td>173B</td><td>75.44</td><td>70.87</td><td>78.09</td><td>74.68</td><td>67.43</td><td>79.93</td><td>78.23</td><td>69.68</td><td>75.17</td></tr><tr><td>GPT-3.5 (text-davinci-003)</td><td>173B</td><td>77.71</td><td>68.73</td><td>80.18</td><td>75.12</td><td>67.92</td><td>81.81</td><td>80.58</td><td>69.08</td><td>76.47</td></tr><tr><td>ChatGPT (Lu et al., 2023)</td><td></td><td>78.82</td><td>70.98</td><td>83.18</td><td>77.37</td><td>67.92</td><td>86.13</td><td>80.72</td><td>74.03</td><td>78.31</td></tr><tr><td>GPT-4 (Lu et al.,2023)</td><td>=</td><td>85.48</td><td>72.44</td><td>90.27</td><td>82.65</td><td>71.49</td><td>92.89</td><td>86.66</td><td>79.04</td><td>83.99</td></tr><tr><td>Chameleon (ChatGPT) (Lu et al.,2023)t</td><td>=</td><td>81.62</td><td>70.64</td><td>84.00</td><td>79.77</td><td>70.80</td><td>86.62</td><td>81.86</td><td>76.53</td><td>79.93</td></tr><tr><td>Chameleon (GPT-4) (Lu et al.,2023)†</td><td>-</td><td>89.83</td><td>74.13</td><td>89.82</td><td>88.27</td><td>77.64</td><td>92.13</td><td>88.03</td><td>83.72</td><td>86.54</td></tr><tr><td>LLaMA-Adapter (Zhang et al.,2023a)t</td><td>6B</td><td>84.37</td><td>88.30</td><td>84.36</td><td>83.72</td><td>80.32</td><td>86.90</td><td>85.83</td><td>84.05</td><td>85.19</td></tr><tr><td>LLaVA (Liu et al.,2023)†</td><td>13B</td><td>90.36</td><td>95.95</td><td>88.00</td><td>89.49</td><td>88.00</td><td>90.66</td><td>90.93</td><td>90.90</td><td>90.92</td></tr><tr><td>InstructBLIP (Dai et al.,2023)t</td><td>11B</td><td>-</td><td>-</td><td></td><td></td><td>90.70</td><td>1</td><td>-</td><td></td><td></td></tr><tr><td>Mutimodal-CoTBase</td><td>223M</td><td>84.06</td><td>92.35</td><td>82.18</td><td>82.75</td><td>82.75</td><td>84.74</td><td>85.79</td><td>84.44</td><td>85.31</td></tr><tr><td>Mutimodal-CoTLarge</td><td>738M</td><td>91.03</td><td>93.70</td><td>86.64</td><td>90.13</td><td>88.25</td><td>89.48</td><td>91.12</td><td>89.26</td><td>90.45</td></tr></table>
193
+
194
+ Baseline Models Our baselines include (i) Visual question answering (VQA) models (Anderson et al., 2018; Kim et al., 2018; Yu et al., 2019; Gao et al., 2019; Kim et al., 2021; Lu et al., 2021; Li et al., 2019); (ii) LMs, including the Text-to-text UnifiedQA model (Khashabi et al., 2020) and fewshot learning LLMs (GPT-3.5, ChatGPT, GPT-4, and Chameleon (Lu et al., 2023)); (iii) Fine-tuned large vision-language model LLaMA-Adapter (Zhang et al., 2023a), LLaVA (Liu et al., 2023), and InstructBLIP (Dai et al., 2023). More details are presented in Appendix B.1.
195
+
196
+ # 5.3 MAIN RESULTS
197
+
198
+ Table 4 shows the main results in the ScienceQA benchmark. Mutimodal- ${ \bf \cdot C o T _ { L a r g e } }$ achieves substantial performance gains over the prior best model in publications $( 8 6 . 5 4 \% 9 0 . 4 5 \% )$ ). The efficacy of Multimodal-CoT is further supported by the results obtained from the A-OKVQA benchmark (Table 5). Our ablation study (Appendix C.1) reveals that both the integration of vision features and the two-stage framework design contribute to the overall performance. Furthermore, MultimodalCoT demonstrates the ability to mitigate hallucination (Section 3.3) and improve convergence (Appendix C.2).
199
+
200
+ Table 5: Results on the A-OKVQA dataset. Baseline results are from (Chen et al., 2023) and Schwenk et al. (2022).
201
+
202
+ <table><tr><td>Model</td><td>Accuracy</td></tr><tr><td>BERT</td><td>32.93</td></tr><tr><td>GPT-3 (Curie)</td><td>35.07</td></tr><tr><td>IPVR (OPT-66B)</td><td>48.6</td></tr><tr><td>ViLBERT</td><td>49.1</td></tr><tr><td>LXMERT</td><td>51.4</td></tr><tr><td>Language-only Baseline</td><td>47.86</td></tr><tr><td>Multimodal-CoTBase</td><td>50.57</td></tr></table>
203
+
204
+ It is worth noting that Chameleon, LLaMA-Adapter, LLaVA, and InstructBLIP are concurrent works released several months after our work. We show that our method is orthogonal to those latest multimodal models (e.g., InstructBLIP) and can be potentially used with them together to improve generality further, i.e., scaled to scenarios where human-annotated rationales are unavailable (Appendix C.3), thereby establishing the effectiveness across diverse tasks.
205
+
206
+ # 6 ANALYSIS
207
+
208
+ The following analysis will investigate whether Multimodal-CoT is generally effective with different backbone models and vision features. We will also conduct an error analysis to explore the limitations to inspire future studies. We use models under the base size for analysis unless otherwise stated.
209
+
210
+ # 6.1 EFFECTIVENESS ACROSS BACKBONES
211
+
212
+ To test the generality of the benefits of our approach to other backbone models, we alter the underlying LMs to other variants in different types. As shown in Table 6, our approach is generally effective for the widely used backbone models.
213
+
214
+ Table 6: Using different backbone LMs. More detailed results are presented in Appendix C.5.
215
+
216
+ <table><tr><td>Method</td><td>Accuracy</td></tr><tr><td>Prior Best (Lu et al.,2022a)</td><td>75.17</td></tr><tr><td>MM-CoTon UnifiedQA</td><td>82.55</td></tr><tr><td>MM-CoT on FLAN-T5</td><td>83.19</td></tr><tr><td> MM-CoT on FLAN-Alpaca</td><td>85.31</td></tr></table>
217
+
218
+ # 6.2 USING DIFFERENT VISION FEATURES
219
+
220
+ Different vision features may affect the model performance. We compare three widely-used types of vision features, ViT (Dosovitskiy et al., 2021b), CLIP (Radford et al., 2021), DETR (Carion et al., 2020), and ResNet (He et al., 2016). ViT, CLIP, and DETR are patch-like features. For the ResNet features, we repeat the pooled features of ResNet-50 to the same
221
+
222
+ Table 7: Using different vision features.
223
+
224
+ <table><tr><td>Feature</td><td>Feature Shape</td><td>Accuracy</td></tr><tr><td>ViT</td><td>(145,1024)</td><td>85.31</td></tr><tr><td>CLIP</td><td>(49,2048)</td><td>84.27</td></tr><tr><td>DETR</td><td>(100,256)</td><td>83.16</td></tr><tr><td>ResNet</td><td>(512,2048)</td><td>82.86</td></tr></table>
225
+
226
+ length with the text sequence to imitate the patch-like features, where each patch is the same as the pooled image features. More details of the vision features are presented in Appendix B.2.
227
+
228
+ Table 7 shows the comparative results of vision features. We observe that ViT achieves relatively better performance. Therefore, we use ViT by default in Multimodal-CoT.
229
+
230
+ # 6.3 ERROR ANALYSIS
231
+
232
+ To gain deeper insights into the behavior of Multimodal-CoT and facilitate future research, we manually analyzed randomly selected examples generated by our approach. The categorization results are illustrated in Figure 5. We examined 50 samples that yielded incorrect answers and categorized them accordingly. The examples from each category can be found in Appendix D.
233
+
234
+ The most prevalent error type is commonsense mistakes, accounting for $80 \%$ of the errors. These mistakes occur when the model is faced with questions that require commonsense knowledge, such as interpreting maps, counting objects in images, or utilizing the alphabet. The second error type is logical mistakes, constituting $14 \%$ of the errors, which involve contradictions in the reasoning process. Additionally, we have observed cases where incorrect answers are provided despite the CoT being either empty or correct, amounting to $6 \%$ of the errors. The CoT in these cases may not necessarily influence the final answer.
235
+
236
+ ![](images/2d933e7c87b910403264da98dbed7fb6f237a3f9c47e6e0a0d161d14f54f9dd8.jpg)
237
+ Figure 5: Categorization analysis.
238
+
239
+ The analysis reveals potential avenues for future research. Enhancements can be made to MultimodalCoT by: (i) integrating more informative visual features and strengthening the interaction between language and vision to enable comprehension of maps and numerical counting; (ii) incorporating commonsense knowledge; and (iii) implementing a filtering mechanism, such as using only relevant CoTs to infer answers and disregarding irrelevant ones.
240
+
241
+ # 7 CONCLUSION
242
+
243
+ We formally study the problem of multimodal CoT. We propose Multimodal-CoT that incorporates language and vision modalities into a two-stage framework that separates rationale generation and answer inference, so answer inference can leverage better generated rationales from multimodal information. With Multimodal-CoT, our model under 1 billion parameters achieves new state-ofthe-art performance on the ScienceQA benchmark. Analysis shows that Multimodal-CoT has the merits of mitigating hallucination and enhancing convergence speed. Our error analysis identifies the potential to leverage more effective vision features, inject commonsense knowledge, and apply filtering mechanisms to improve CoT reasoning in future studies.
244
+
245
+ # REFERENCES
246
+
247
+ Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katherine Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. Advances in Neural Information Processing Systems, 35:23716– 23736, 2022.
248
+
249
+ Peter Anderson, Xiaodong He, Chris Buehler, Damien Teney, Mark Johnson, Stephen Gould, and Lei Zhang. Bottom-up and top-down attention for image captioning and visual question answering. In 2018 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, Salt Lake City, UT, USA, June 18-22, 2018, pp. 6077–6086. IEEE Computer Society, 2018. doi: 10.1109/CVPR. 2018.00636.
250
+ Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin (eds.), Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
251
+ Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part I, pp. 213–229, 2020.
252
+ Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey E. Hinton. Big self-supervised models are strong semi-supervised learners. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin (eds.), Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
253
+ Wenhu Chen, Xueguang Ma, Xinyi Wang, and William W Cohen. Program of thoughts prompting: Disentangling computation from reasoning for numerical reasoning tasks. ArXiv preprint, abs/2211.12588, 2022.
254
+ Zhenfang Chen, Qinhong Zhou, Yikang Shen, Yining Hong, Hao Zhang, and Chuang Gan. See, think, confirm: Interactive prompting between vision and language models for knowledge-based visual reasoning. ArXiv preprint, abs/2301.05226, 2023.
255
+ Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Ben Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garcia, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. Palm: Scaling language modeling with pathways. ArXiv preprint, abs/2204.02311, 2022.
256
+ Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language models. ArXiv preprint, abs/2210.11416, 2022.
257
+ Wenliang Dai, Junnan Li, Dongxu Li, Anthony Meng Huat Tiong, Junqi Zhao, Weisheng Wang, Boyang Li, Pascale Fung, and Steven Hoi. Instructblip: Towards general-purpose vision-language models with instruction tuning, 2023.
258
+
259
+ Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021a.
260
+
261
+ Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021b.
262
+
263
+ Yao Fu, Hao Peng, Ashish Sabharwal, Peter Clark, and Tushar Khot. Complexity-based prompting for multi-step reasoning. ArXiv preprint, abs/2210.00720, 2022.
264
+
265
+ Peng Gao, Zhengkai Jiang, Haoxuan You, Pan Lu, Steven C. H. Hoi, Xiaogang Wang, and Hongsheng Li. Dynamic fusion with intra- and inter-modality attention flow for visual question answering. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16-20, 2019, pp. 6639–6648. Computer Vision Foundation / IEEE, 2019. doi: 10.1109/CVPR.2019.00680.
266
+
267
+ Yaru Hao, Haoyu Song, Li Dong, Shaohan Huang, Zewen Chi, Wenhui Wang, Shuming Ma, and Furu Wei. Language models are general-purpose interfaces. ArXiv preprint, abs/2206.06336, 2022.
268
+
269
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, pp. 770–778. IEEE Computer Society, 2016. doi: 10.1109/CVPR.2016.90.
270
+
271
+ Namgyu Ho, Laura Schmid, and Se-Young Yun. Large language models are reasoning teachers. ArXiv preprint, abs/2212.10071, 2022.
272
+
273
+ Jie Huang and Kevin Chen-Chuan Chang. Towards reasoning in large language models: A survey. ArXiv preprint, abs/2212.10403, 2022.
274
+
275
+ Ziwei Ji, Nayeon Lee, Rita Frieske, Tiezheng Yu, Dan Su, Yan Xu, Etsuko Ishii, Yejin Bang, Andrea Madotto, and Pascale Fung. Survey of hallucination in natural language generation. ACM Computing Surveys, 2022.
276
+
277
+ Daniel Khashabi, Sewon Min, Tushar Khot, Ashish Sabharwal, Oyvind Tafjord, Peter Clark, and Hannaneh Hajishirzi. UNIFIEDQA: Crossing format boundaries with a single QA system. In Findings of the Association for Computational Linguistics: EMNLP 2020, pp. 1896–1907, Online, 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.findings-emnlp.171.
278
+
279
+ Tushar Khot, Harsh Trivedi, Matthew Finlayson, Yao Fu, Kyle Richardson, Peter Clark, and Ashish Sabharwal. Decomposed prompting: A modular approach for solving complex tasks. ArXiv preprint, abs/2210.02406, 2022.
280
+
281
+ Jin-Hwa Kim, Jaehyun Jun, and Byoung-Tak Zhang. Bilinear attention networks. In Samy Bengio, Hanna M. Wallach, Hugo Larochelle, Kristen Grauman, Nicolo Cesa-Bianchi, and Roman Garnett \` (eds.), Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, December 3-8, 2018, Montreal, Canada ´ , pp. 1571–1581, 2018.
282
+
283
+ Wonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings of Machine Learning Research, pp. 5583–5594. PMLR, 2021.
284
+
285
+ Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. ArXiv preprint, abs/2205.11916, 2022.
286
+
287
+ Bei Li, Chuanhao Lv, Zefan Zhou, Tao Zhou, Tong Xiao, Anxiang Ma, and JingBo Zhu. On vision features in multimodal machine translation. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 6327–6337, Dublin, Ireland, 2022a. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.438.
288
+ Junnan Li, Dongxu Li, Caiming Xiong, and Steven C. H. Hoi. BLIP: bootstrapping language-image pre-training for unified vision-language understanding and generation. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato (eds.), ´ International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, volume 162 of Proceedings of Machine Learning Research, pp. 12888–12900. PMLR, 2022b.
289
+ Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. Visualbert: A simple and performant baseline for vision and language. ArXiv preprint, abs/1908.03557, 2019.
290
+ Yifei Li, Zeqi Lin, Shizhuo Zhang, Qiang Fu, Bei Chen, Jian-Guang Lou, and Weizhu Chen. On the advance of making language models better reasoners. ArXiv preprint, abs/2206.02336, 2022c.
291
+ Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. ArXiv preprint, abs/2304.08485, 2023.
292
+ Pan Lu, Liang Qiu, Jiaqi Chen, Tony Xia, Yizhou Zhao, Wei Zhang, Zhou Yu, Xiaodan Liang, and Song-Chun Zhu. Iconqa: A new benchmark for abstract diagram understanding and visual language reasoning. In The 35th Conference on Neural Information Processing Systems (NeurIPS) Track on Datasets and Benchmarks, 2021.
293
+ Pan Lu, Swaroop Mishra, Tony Xia, Liang Qiu, Kai-Wei Chang, Song-Chun Zhu, Oyvind Tafjord, Peter Clark, and Ashwin Kalyan. Learn to explain: Multimodal reasoning via thought chains for science question answering. Advances in Neural Information Processing Systems, 35:2507–2521, 2022a.
294
+ Pan Lu, Liang Qiu, Kai-Wei Chang, Ying Nian Wu, Song-Chun Zhu, Tanmay Rajpurohit, Peter Clark, and Ashwin Kalyan. Dynamic prompt learning via policy gradient for semi-structured mathematical reasoning. ArXiv preprint, abs/2209.14610, 2022b.
295
+ Pan Lu, Liang Qiu, Wenhao Yu, Sean Welleck, and Kai-Wei Chang. A survey of deep learning for mathematical reasoning. ArXiv preprint, abs/2212.10535, 2022c.
296
+ Pan Lu, Baolin Peng, Hao Cheng, Michel Galley, Kai-Wei Chang, Ying Nian Wu, Song-Chun Zhu, and Jianfeng Gao. Chameleon: Plug-and-play compositional reasoning with large language models. In The Thirty-seventh Conference on Neural Information Processing Systems (NeurIPS 2023), 2023.
297
+ Lucie Charlotte Magister, Jonathan Mallinson, Jakub Adamek, Eric Malmi, and Aliaksei Severyn. Teaching small language models to reason. ArXiv preprint, abs/2212.08410, 2022.
298
+ Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings of Machine Learning Research, pp. 8748–8763. PMLR, 2021.
299
+ Jack W. Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, Eliza Rutherford, Tom Hennigan, Jacob Menick, Albin Cassirer, Richard Powell, George van den Driessche, Lisa Anne Hendricks, Maribeth Rauh, Po-Sen Huang, Amelia Glaese, Johannes Welbl, Sumanth Dathathri, Saffron Huang, Jonathan Uesato, John Mellor, Irina Higgins, Antonia Creswell, Nat McAleese, Amy Wu, Erich Elsen, Siddhant Jayakumar, Elena Buchatskaya, David Budden, Esme Sutherland, Karen Simonyan, Michela Paganini, Laurent Sifre, Lena Martens, Xiang Lorraine Li, Adhiguna Kuncoro, Aida Nematzadeh, Elena Gribovskaya, Domenic Donato, Angeliki Lazaridou, Arthur Mensch, Jean-Baptiste Lespiau, Maria Tsimpoukelli, Nikolai Grigorev, Doug Fritz, Thibault Sottiaux, Mantas Pajarskas, Toby Pohlen, Zhitao Gong, Daniel Toyama, Cyprien de Masson d’Autume,
300
+
301
+ Yujia Li, Tayfun Terzi, Vladimir Mikulik, Igor Babuschkin, Aidan Clark, Diego de Las Casas, Aurelia Guy, Chris Jones, James Bradbury, Matthew Johnson, Blake Hechtman, Laura Weidinger, Iason Gabriel, William Isaac, Ed Lockhart, Simon Osindero, Laura Rimell, Chris Dyer, Oriol Vinyals, Kareem Ayoub, Jeff Stanway, Lorrayne Bennett, Demis Hassabis, Koray Kavukcuoglu, and Geoffrey Irving. Scaling language models: Methods, analysis & insights from training gopher. ArXiv preprint, abs/2112.11446, 2021.
302
+
303
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 21:140:1–140:67, 2020.
304
+
305
+ Ohad Rubin, Jonathan Herzig, and Jonathan Berant. Learning to retrieve prompts for in-context learning. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 2655–2671, Seattle, United States, 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.naacl-main.191.
306
+
307
+ Dustin Schwenk, Apoorv Khandelwal, Christopher Clark, Kenneth Marino, and Roozbeh Mottaghi. A-okvqa: A benchmark for visual question answering using world knowledge. In Computer Vision– ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23–27, 2022, Proceedings, Part VIII, pp. 146–162. Springer, 2022.
308
+
309
+ Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B Hashimoto. Alpaca: A strong, replicable instruction-following model. Stanford Center for Research on Foundation Models. https://crfm. stanford. edu/2023/03/13/alpaca. html, 2023.
310
+
311
+ Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, YaGuang Li, Hongrae Lee, Huaixiu Steven Zheng, Amin Ghafouri, Marcelo Menegali, Yanping Huang, Maxim Krikun, Dmitry Lepikhin, James Qin, Dehao Chen, Yuanzhong Xu, Zhifeng Chen, Adam Roberts, Maarten Bosma, Vincent Zhao, Yanqi Zhou, Chung-Ching Chang, Igor Krivokon, Will Rusch, Marc Pickett, Pranesh Srinivasan, Laichee Man, Kathleen Meier-Hellstern, Meredith Ringel Morris, Tulsee Doshi, Renelito Delos Santos, Toju Duke, Johnny Soraker, Ben Zevenbergen, Vinodkumar Prabhakaran, Mark Diaz, Ben Hutchinson, Kristen Olson, Alejandra Molina, Erin Hoffman-John, Josh Lee, Lora Aroyo, Ravi Rajakumar, Alena Butryna, Matthew Lamm, Viktoriya Kuzmina, Joe Fenton, Aaron Cohen, Rachel Bernstein, Ray Kurzweil, Blaise Aguera-Arcas, Claire Cui, Marian Croak, Ed Chi, and Quoc Le. Lamda: Language models for dialog applications. ArXiv preprint, abs/2201.08239, 2022.
312
+
313
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pp. 5998–6008, 2017.
314
+
315
+ Boshi Wang, Xiang Deng, and Huan Sun. Iteratively prompt pre-trained language models for chain of thought. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pp. 2714–2730, Abu Dhabi, United Arab Emirates, 2022a. Association for Computational Linguistics.
316
+
317
+ Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. ArXiv preprint, abs/2203.11171, 2022b.
318
+
319
+ Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Rationale-augmented ensembles in language models. ArXiv preprint, abs/2207.00747, 2022c.
320
+
321
+ Jason Wei, Yi Tay, Rishi Bommasani, Colin Raffel, Barret Zoph, Sebastian Borgeaud, Dani Yogatama, Maarten Bosma, Denny Zhou, Donald Metzler, Ed H. Chi, Tatsunori Hashimoto, Oriol Vinyals, Percy Liang, Jeff Dean, and William Fedus. Emergent abilities of large language models. Transactions on Machine Learning Research, 2022a. Survey Certification.
322
+
323
+ Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. ArXiv preprint, abs/2201.11903, 2022b.
324
+ Zhiyong Wu, Lingpeng Kong, Wei Bi, Xiang Li, and Ben Kao. Good for misconceived reasons: An empirical revisiting on the need for visual context in multimodal machine translation. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 6153–6166, Online, 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021. acl-long.480.
325
+ Michihiro Yasunaga, Armen Aghajanyan, Weijia Shi, Rich James, Jure Leskovec, Percy Liang, Mike Lewis, Luke Zettlemoyer, and Wen-tau Yih. Retrieval-augmented multimodal language modeling. Proceedings of the 40th International Conference on Machine Learning, PMLR, pp. 39755–39769, 2022.
326
+ Zhou Yu, Jun Yu, Yuhao Cui, Dacheng Tao, and Qi Tian. Deep modular co-attention networks for visual question answering. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16-20, 2019, pp. 6281–6290. Computer Vision Foundation / IEEE, 2019. doi: 10.1109/CVPR.2019.00644.
327
+ Renrui Zhang, Jiaming Han, Aojun Zhou, Xiangfei Hu, Shilin Yan, Pan Lu, Hongsheng Li, Peng Gao, and Yu Qiao. Llama-adapter: Efficient fine-tuning of language models with zero-init attention. ArXiv preprint, abs/2303.16199, 2023a.
328
+ Zhuosheng Zhang, Kehai Chen, Rui Wang, Masao Utiyama, Eiichiro Sumita, Zuchao Li, and Hai Zhao. Neural machine translation with universal visual representation. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020.
329
+ Zhuosheng Zhang, Kehai Chen, Rui Wang, Masao Utiyama, Eiichiro Sumita, Zuchao Li, and Hai Zhao. Universal multimodal representation for language understanding. IEEE Transactions on Pattern Analysis and Machine Intelligence, pp. 1–18, 2023b. doi: 10.1109/TPAMI.2023.3234170.
330
+ Zhuosheng Zhang, Aston Zhang, Mu Li, and Alex Smola. Automatic chain of thought prompting in large language models. In The Eleventh International Conference on Learning Representations, 2023c.
331
+ Denny Zhou, Nathanael Scharli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuurmans, ¨ Olivier Bousquet, Quoc Le, and Ed Chi. Least-to-most prompting enables complex reasoning in large language models. ArXiv preprint, abs/2205.10625, 2022.
332
+
333
+ # A EXTENDED ANALYSIS FOR THE CHALLENGE OF MULTIMODAL-COT
334
+
335
+ A.1 ADDITIONAL EXAMPLES OF MISLEADING THROUGH HALLUCINATED RATIONALES
336
+
337
+ Based on our case studies (Section 3.2), we have observed a tendency for the baseline model to generate hallucinated rationales. Here, we present additional examples to illustrate this phenomenon, as depicted in Figure 6.
338
+
339
+ # Problem
340
+
341
+ Question: Which solution has a higher concentration of yellow particles? Context: The diagram below is a model of two solutions. Each yellow ball represents one particle of solute.
342
+
343
+ (C) neither; their concentrations are the same
344
+
345
+ Gold Rationale: In Solution A and Solution B, the yellow particles represent the solute. To figure out which solution has a higher concentration of yellow particles, look at both the number of yellow particles and the volume of the solvent in each container. Use the concentration formula to find the number of yellow particles per milliliter. Solution B has more yellow particles per milliliter. So, Solution B has a higher concentration of yellow particles.
346
+
347
+ Answer: The answer is (A).
348
+
349
+ ![](images/b9dde1b997af327dca0a0ef1a89382f5f5f92473406cd39ce5a36ba2a500557b.jpg)
350
+
351
+ # Baseline
352
+
353
+ Rationale: In Solution A and Solution B, the yellow particles represent the solute. To figure out which solution has a higher concentration of yellow particles, look at both the number of yellow particles and the volume of the solvent in each container. Use the concentration formula to find the number of yellow particles per milliliter. Solution A has more yellow particles per milliliter. So, Solution A has a higher concentration of yellow particles.
354
+
355
+ Answer: The answer is (B).
356
+
357
+ # $^ +$ Vision Features
358
+
359
+ Rationale: In Solution A and Solution B, the yellow particles represent the solute. To figure out which solution has a higher concentration of yellow particles, look at both the number of yellow particles and the volume of the solvent in each container. Use the concentration formula to find the number of yellow particles per milliliter. Solution B has more yellow particles per milliliter. So, Solution B has a higher concentration of yellow particles.
360
+
361
+ Answer: The answer is (A).
362
+
363
+ # Problem
364
+
365
+ Question: Think about the magnetic force between the magnets in each pair. Which of the following statements is true?
366
+
367
+ Context: The images below show two pairs of magnets. The magnets in different pairs do not affect each other. All the magnets shown are made of the same material.
368
+
369
+ <table><tr><td rowspan="3">Options:</td><td>(A)The magnitude of the magnetic force is smaller in Pair 2.</td></tr><tr><td>(B)The magnitude of the magnetic force is smaller in Pair 1.</td></tr><tr><td>(C)The magnitude of the magnetic force is the same in both pairs.</td></tr></table>
370
+
371
+ ![](images/d1d75dd94ca0fb7d73b2811c22fffa0594f42f670af1a4b0c2c756d18bb8c54c.jpg)
372
+
373
+ Gold Rationale: The magnets in Pair 1 attract. The magnets in Pair 2 repel. But whether the magnets attract or repel affects only the direction of the magnetic force. It does not affect the magnitude of the magnetic force. Both magnet sizes and distance affect the magnitude of the magnetic force. The sizes of the magnets in Pair 1 are the same as in Pair 2. The distance between the magnets is also the same. So, the magnitude of the magnetic force is the same in both pairs.
374
+
375
+ Answer: The answer is (C).
376
+
377
+ # Baseline
378
+
379
+ Rationale: Distance affects the magnitude of the magnetic force. When there is a greater distance between magnets, the magnitude of the magnetic force between them is smaller. There is a greater distance between the magnets in Pair 2 than in Pair 1. So, the magnitude of the magnetic force is smaller in Pair 2 than in Pair 1. Answer: The answer is (B).
380
+
381
+ # $^ +$ Vision Features
382
+
383
+ Rationale: The magnets in Pair 1 attract. The magnets in Pair 2 repel. But whether the magnets attract or repel affects only the direction of the magnetic force. It does not affect the magnitude of the magnetic force. Both magnet sizes and distance affect the magnitude of the magnetic force. The sizes of the magnets in Pair 1 are the same as in Pair 2. The distance between the magnets is also the same. So, the magnitude of the magnetic force is the same in both pairs. Answer: The answer is (C).
384
+
385
+ Figure 6: Examples of the two-stage framework without vision features (baseline) and with vision features (ours) for generating rationales and predicting answers. The upper part presents the problem details, and the lower part shows the outputs of the baseline and our method.
386
+
387
+ # A.2 TWO-STAGE TRAINING PERFORMANCE WITH DIFFERENT SIZES OF LMS
388
+
389
+ In Section 3, we observed that the inclusion of vision features has a positive impact on the generation of more effective rationales, consequently resulting in improved answer accuracy. In addition to incorporating vision features, another approach to addressing the issue of incorrect rationales is to scale the size of the language model (LM). Figure 7 showcases the answer accuracy achieved by our two-stage training framework, both with and without the integration of vision features. Notably, when employing a larger LM, the baseline accuracy (without vision features) experiences a significant enhancement. This finding suggests that scaling the LM size could potentially alleviate the problem of incorrect rationales. However, it is crucial to acknowledge that the performance still falls considerably short of utilizing vision features. This outcome further validates the effectiveness of our Multimodal-CoT methodology across varying LM sizes.
390
+
391
+ ![](images/313b8b98c30cc054ca99f44b93b2309c85bd5cef9f2776f879152defc5477685.jpg)
392
+ Figure 7: Answer accuracy with different sizes of LMs.
393
+
394
+ A.3 DISCUSSION OF THE POSSIBLE PARADIGMS TO ACHIEVE MULTIMODAL-COT
395
+
396
+ As discussed in Section 1, there are two primary approaches to facilitate Multimodal-CoT reasoning: (i) prompting LLMs and (ii) fine-tuning small models. The common approach in the first approach is to unify the input from different modalities and prompt LLMs to perform reasoning (Zhang et al., $2 0 2 3 \mathrm { a }$ ; Lu et al., 2023; Liu et al., 2023; Alayrac et al., 2022; Hao et al., 2022; Yasunaga et al., 2022). For instance, one way to achieve this is by extracting the caption of an image using a captioning model and then concatenating the caption with the original language input to feed LLMs. By doing so, visual information is conveyed to LLMs as text, effectively bridging the gap between modalities. This approach can be represented as the input-output format ¡image caption, question $^ +$ caption answer¿. We refer to this approach as Caption-based Reasoning (Figure 8a). It is worth noting that the effectiveness of this approach depends on the quality of the image caption, which may be susceptible to errors introduced during the transfer from image captioning to answer inference.
397
+
398
+ In contrast, an intriguing aspect of CoT is the ability to decompose complex problems into a series of simpler problems and solve them step by step. This transformation leads to a modification of the standard format ¡question answer¿ into ¡question rationale answer¿. Rationales, being more likely to reflect the reasoning processes leading to the answer, play a crucial role in this paradigm. Consequently, we refer to approaches following this paradigm as CoT-based Reasoning. The nomenclature has been widely adopted in the literature (Huang & Chang, 2022; Zhang et al., 2023c; Lu et al., 2022c).
399
+
400
+ ![](images/5ed0881faeb6b162a35e26099c5d3246bfa7a62bf08913a029d4f97ba3e52ac4.jpg)
401
+ Figure 8: Paradigms to achieve Multimodal-CoT.
402
+
403
+ Our work aligns with the paradigms of CoT-based Reasoning in the context of multimodal scenarios, specifically employing the ¡question $^ +$ image rationale answer¿ framework (Figure 8b). This approach confers advantages on two fronts. Firstly, the Multimodal-CoT framework leverages feature-level interactions between vision and language inputs, enabling the model to gain a deeper understanding of the input information and facilitating more effective inference of answers by incorporating well-founded rationales. Our analysis has demonstrated that Multimodal-CoT offers notable benefits by mitigating hallucination and enhancing convergence, resulting in superior performance on our benchmark datasets. Secondly, the lightweight nature of Multimodal-CoT renders it compatible with resource constraints and circumvents any potential paywalls.
404
+
405
+ # B EXPERIMENTAL DETAILS
406
+
407
+ # B.1 BASELINE METHODS
408
+
409
+ We utilized three categories of methods as our baselines:
410
+
411
+ (i) Visual question answering (VQA) models, including MCAN (Yu et al., 2019), Top-Down (Anderson et al., 2018), BAN (Kim et al., 2018), DFAF (Gao et al., 2019), ViLT (Kim et al., 2021), Patch-TRM (Lu et al., 2021), and VisualBERT (Li et al., 2019). These VQA baselines take the question, context, and choices as textual input, while utilizing the image as visual input. They employ a linear classifier to predict the score distribution over the choice candidates.
412
+
413
+ (ii) LMs, including the text-to-text UnifiedQA model (Khashabi et al., 2020) and few-shot learning LLMs (GPT-3.5, ChatGPT, GPT-4, and Chameleon (Lu et al., 2023)). UnifiedQA (Khashabi et al., 2020) is adopted as it is the best fine-tuning model in Lu et al. (2022a). UnifiedQA takes the textual information as the input and outputs the answer choice. The image is converted into a caption extracted by an image captioning model following Lu et al. (2022a). UnifiedQA treats our task as a text generation problem. In Lu et al. (2022a), it is trained to generate a target answer text, i.e., one of the candidate options. Then, the most similar option is selected as the final prediction to evaluate the question answering accuracy. For GPT-3.5 models (Chen et al., 2020), we use the text-davinci-002 and text-davinci-003 engines due to their strong performance. In addition, we also include the comparison with ChatGPT and GPT-4. The inference is based on the few-shot prompting, where two in-context examples from the training set are concatenated before the test instance. The few-shot demonstrations are the same as those in Lu et al. (2022a).
414
+
415
+ (iii) Fine-tuned large vision-language model. We select the recently released LLaMA-Adapter (Zhang et al., 2023a), LLaVA (Liu et al., 2023), and InstructBLIP (Dai et al., 2023) as the competitive large vision-language baselines. The backbone model is the 7B LLaMA model fine-tuned with $5 2 k$ self-instruct demonstrations. To adapt to our tasks, the model is further fine-tuned on the ScienceQA dataset.
416
+
417
+ For UnifiedQA and GPT-family models, CoT is applied after the answer (Lu et al., 2022a). Besides the above baselines, we develop a stronger baseline by slightly modifying the output format of UnifiedQA. Instead of predicting the answer texts, our baseline directly predicts the choice, e.g., the answer is $B$ . This setting helps our baseline achieve better results than the existing UnifiedQA. Therefore, we use the stronger method as the language-only baseline for analysis.
418
+
419
+ # B.2 DETAILS OF VISION FEATURES
420
+
421
+ In Section 6.2, we compared four types of vision features, ViT (Dosovitskiy et al., 2021b), CLIP (Radford et al., 2021), DETR (Carion et al., 2020), and ResNet (He et al., 2016). The specific models are: (i) ViT: vit large patch32 384,7 (ii) CLIP: RN101;8 (iii) DETR: detr resnet101 dc5;9 (iv) ResNet: we use the averaged pooled features of a pre-trained ResNet50 CNN.
422
+
423
+ Table 8 presents the dimension of the vision features (after the function VisionExtractor(·) in Eq. 3). For ResNet-50, we repeat the pooled features of ResNet-50 to the same length as the text sequence to imitate the patch-like features, where each patch is the same as the pooled image features.
424
+
425
+ Table 8: Feature shape of vision features
426
+
427
+ <table><tr><td>Method</td><td>Feature Shape</td></tr><tr><td>ViT</td><td>(145,1024)</td></tr><tr><td>CLIP</td><td>(49,2048)</td></tr><tr><td>DETR</td><td>(100,256)</td></tr><tr><td>ResNet</td><td>(512,2048)</td></tr></table>
428
+
429
+ # B.3 DATASETS
430
+
431
+ Our method is evaluated on the ScienceQA (Lu et al., 2022a) and A-OKVQA (Schwenk et al., 2022) benchmark datasets.
432
+
433
+ • ScienceQA is a large-scale multimodal science question dataset with annotated lectures and explanations. It contains $2 1 k$ multimodal multiple choice questions with rich domain diversity across 3 subjects, 26 topics, 127 categories, and 379 skills. The dataset is split into training, validation, and test splits with $1 2 k$ , $4 k$ , and $4 k$ questions, respectively.
434
+
435
+ • A-OKVQA is a knowledge-based visual question answering benchmark, which has $2 5 k$ questions requiring a broad base of commonsense and world knowledge to answer. Each question is annotated with rationales that explain why a particular answer was correct according to necessary facts or knowledge. It has $1 7 k / 1 k / 6 k$ questions for train/val/test.
436
+
437
+ For ScienceQA, our model is evaluated on the test set. For A-OKVQA, our model is evaluated on the validation set as the test set is hidden.
438
+
439
+ # B.4 IMPLEMENTATION DETAILS OF MULTIMODAL-COT
440
+
441
+ As the Multimodal-CoT task requires generating the reasoning chains and leveraging the vision features, we adopt the T5 encoder-decoder architecture (Raffel et al., 2020) under Base (200M) and large (700M) settings in our framework. We apply FLAN-Alpaca to initialize our model weights.10 We will show that Multimodal-CoT is generally effective with other backbone LMs, such as UnifiedQA (Khashabi et al., 2020) and FLAN-T5 (Chung et al., 2022) (Section 6.1). The vision features are obtained by the frozen ViT-large encoder (Dosovitskiy et al., 2021b). Since using image captions can slightly improve model performance, as shown in Section 3.3, we append the image captions to the context following Lu et al. (2022a). The captions are generated by InstructBLIP (Dai et al., 2023). We fine-tune the models up to 20 epochs, with a learning rate selected in $\{ 5 \mathrm { e } { - } 5 , 8 \mathrm { e } { - } 5 \}$ . The maximum input sequence lengths for rationale generation and answer inference are 512 and 64, respectively. The batch size is 8. Our experiments are run on 8 NVIDIA Tesla V100 32G GPUs.
442
+
443
+ # C FURTHER ANALYSIS
444
+
445
+ # C.1 ABLATION STUDY
446
+
447
+ Ablation study results in Table 9 show that both the integration of vision features and the two-stage framework design contribute to the overall performance. These findings provide strong evidence for the effectiveness of multimodality and highlight the potential for achieving CoT reasoning using 1B-models through our proposed two-stage framework.
448
+
449
+ Table 9: Ablation results of Multimodal-CoT.
450
+
451
+ <table><tr><td>Model</td><td>Base</td><td>Large</td></tr><tr><td>Multimodal-CoT</td><td>85.31</td><td>90.45</td></tr><tr><td> w/o Two-Stage Framework</td><td>82.62</td><td>84.56</td></tr><tr><td>w/o Vision Features</td><td>78.57</td><td>83.97</td></tr></table>
452
+
453
+ Figure 9 shows the validation accuracy curve of the baseline and Multimodal-CoT across different training epochs. “One-stage” is based on the $\mathrm { Q C M } { } \mathbf { A }$ input-output format as it achieves the best performance in Table 2 and “Two-stage” is our two-stage framework. We find that the two-stage methods achieve relatively higher accuracy at the beginning than the one-stage baselines that generate the answer directly without CoT. However, without the vision features, the two-stage baseline could not yield better results as the training goes on due to the low-quality rationales (as observed in Section 3). In contrast, using vision features helps generate more effective rationales that contribute to better answer accuracy in our two-stage multimodal variant.
454
+
455
+ ![](images/d652b35e78bba2b459fa4aeb6fbb863cc7b29a5f3b02d808b5f6a299c993af30.jpg)
456
+ Figure 9: Accuracy curve of the No-CoT baseline and Multimodal-CoT variants.
457
+
458
+ C.3 WHEN MULTIMODAL-COT MEETS LARGE MODELS
459
+
460
+ A recent flame is to leverage large language models or large vision-language models to generate reasoning chains for multimodal question answering problems (Zhang et al., 2023a; Lu et al., 2023; Liu et al., 2023; Alayrac et al., 2022; Hao et al., 2022; Yasunaga et al., 2022). We are interested in whether we can use large models to generate the rationales for Multimodal-CoT; thus breaking the need for datasets with human-annotated rationales. During the first-stage training of Multimodal-CoT, our target rationales are based on human annotation in the benchmark datasets. Now, we replace the target rationales with those generated by an LLM or a vision-language model. Concretely, we feed the questions with images (IMG) and the question without images (TXT) to InstructBLIP (Dai et al., 2023) (Figure 10a) and ChatGPT (Figure 10b) for zero-shot inference, respectively. Then, we use the generated pseudo-rationales as the target rationales for training instead of relying on the human annotation of reasoning chains.
461
+
462
+ Table 10 shows the comparison results. We see that using the generated rationales achieves comparable performance to using human-annotated rationales for training. In addition, the performance is also much better than directly prompting those baseline models to obtain the answer (in the $\mathrm { Q C M } { } \mathbf { A }$ inference format).
463
+
464
+ Table 10: Result comparison with large models. We also present the results of InstructBLIP and ChatGPT baselines for reference. The inference format for the two baselines is $\mathbf { Q C M } { \xrightarrow { } } \mathbf { A } .$ .
465
+
466
+ <table><tr><td>Model</td><td>IMG</td><td>TXT</td><td>AVG</td></tr><tr><td>InstructBLIP ChatGPT</td><td>60.50 56.52</td><td>1 67.16</td><td>1 65.95</td></tr><tr><td>Multimodal-CoT w/ Annotation</td><td>88.25</td><td>90.13</td><td>90.45</td></tr><tr><td>Multimodal-CoT w/ Generation</td><td>83.54</td><td>85.73</td><td>87.76</td></tr></table>
467
+
468
+ ![](images/ba99e1bd6b35be9d424e8cce630f86bfde9827a33ef634aff6b990d3aac62c0e.jpg)
469
+ Figure 10: Rationale generation examples
470
+
471
+ We see that Multimodal-CoT can work effectively with large models. The findings above compellingly show the feasibility of adaptation to scenarios without human-annotated rationales, thereby establishing the effectiveness of our approach across diverse tasks.
472
+
473
+ # C.4 ALIGNMENT STRATEGIES FOR MULTIMODAL INTERACTION
474
+
475
+ We are interested in whether using different alignment strategies for multimodal interaction may contribute to different behaviors of multimodal-CoT. To this end, we tried another alignment strategy, i.e., image-grounded text encoder, in BLIP Li et al. (2022b). This alignment approach injects visual information by inserting one additional cross-attention layer between the self-attention layer and the feed-forward network for each transformer block of the text encoder. Our current strategy in the paper is similar to the unimodal encoder as in BLIP, which is used for comparison.
476
+
477
+ Table 11: Result comparison with different alignment strategies for multimodal interaction.
478
+
479
+ <table><tr><td>Model</td><td>Accuracy</td></tr><tr><td>Direct Answering</td><td>82.62</td></tr><tr><td>Unimodal encoder</td><td>85.31</td></tr><tr><td>Image-grounded text encoder</td><td>84.60</td></tr></table>
480
+
481
+ In Table 11, we see that using other alignment strategies also contributes to better performance than direct answering.
482
+
483
+ # C.5 DETAILED RESULTS OF MULTIMODAL-COT ON DIFFERENT BACKBONE MODELS
484
+
485
+ To test the generality of the benefits of our approach to other backbone models, we alter the underlying LMs to other variants of different types. As detailed results shown in Table 12, our approach is generally effective for the widely used backbone models.
486
+
487
+ Table 12: Detailed results of Multimodal-CoT on different backbone models.
488
+
489
+ <table><tr><td>Model</td><td>NAT</td><td>SOC</td><td>LAN</td><td>TXT</td><td>IMG</td><td>NO</td><td>G1-6</td><td>G7-12</td><td>Avg</td></tr><tr><td>MM-CoTon UnifiedQA</td><td>80.60</td><td>89.43</td><td>81.00</td><td>80.50</td><td>80.61</td><td>81.74</td><td>82.38</td><td>82.86</td><td>82.55</td></tr><tr><td>MM-CoT on FLAN-T5</td><td>81.39</td><td>90.89</td><td>80.64</td><td>80.79</td><td>80.47</td><td>82.58</td><td>83.48</td><td>82.66</td><td>83.19</td></tr><tr><td>MM-CoT on FLAN-Alpaca</td><td>84.06</td><td>92.35</td><td>82.18</td><td>82.75</td><td>82.75</td><td>84.74</td><td>85.79</td><td>84.44</td><td>85.31</td></tr></table>
490
+
491
+ # D EXAMPLES OF CASE STUDIES
492
+
493
+ To gain deeper insights into the behavior of Multimodal-CoT and facilitate future research, we manually analyzed randomly selected examples generated by our approach. The categorization results are illustrated in Figure 11. We examined 50 samples that yielded incorrect answers and categorized them accordingly.
494
+
495
+ ![](images/f175665c6b9ce357bd2631897223260fcdf2b2f0daf3bfc91aa755cd5167ba64.jpg)
496
+ Figure 11: Categorization analysis.
497
+
498
+ The most prevalent error type is commonsense mistakes, accounting for $80 \%$ of the errors. These mistakes occur when the model is faced with questions that require commonsense knowledge, such as interpreting maps (Figure 12a), counting objects in images (Figure 12b), or utilizing the alphabet (Figure 12c).
499
+
500
+ The second error type is logical mistakes, constituting $14 \%$ of the errors, which involve comparison mistakes (Figure 13a) and contradictions in the reasoning process (Figure 13b).
501
+
502
+ Additionally, we have observed cases where incorrect answers are provided despite the CoT being either empty or correct, amounting to $6 \%$ of the errors. The CoT in these cases may not necessarily influence the final answer (Figure 14).
503
+
504
+ The analysis reveals potential avenues for future research. Enhancements can be made to MultimodalCoT by: (i) integrating more informative visual features and strengthening the interaction between language and vision to enable comprehension of maps and numerical counting; (ii) incorporating commonsense knowledge; and (iii) implementing a filtering mechanism, such as using only relevant CoTs to infer answers and disregarding irrelevant ones.
505
+
506
+ # Problem
507
+
508
+ Question: Which of these cities is marked on the map?
509
+
510
+ Context: N/A
511
+
512
+ Options: (A) Las Vegas (B) San Francisco (C) Phoenix (D) Salt Lake City
513
+
514
+ Rationale : The city is Las Vegas, Nevada. Salt Lake City, Phoenix, and San Francisco are marked with gray circles on the map below.
515
+ Answer: The answer is (A).
516
+
517
+ # Prediction
518
+
519
+ Rationale: The city is San Francisco, California. Salt Lake City, Las Vegas, and Phoenix are marked with gray circles on the map below.
520
+ Answer: The answer is (B).
521
+
522
+ (a) Mistakes about maps.
523
+
524
+ # Problem
525
+
526
+ Question: Complete the text to describe the diagram. Solute particles moved in both directions across the permeable membrane. But more solute particles moved across the membrane (). When there was an equal concentration on both sides, the particles reached equilibrium.
527
+
528
+ Context: The diagram below shows a solution with one solute. Each solute particle is represented by a green ball. The solution fills a closed container that is divided in half by a membrane. The membrane, represented by a dotted line, is permeable to the solute particles. The diagram shows how the solution can change over time during the process of diffusion.
529
+
530
+ Options: (A) to the left than to the right (B) to the right than to the left
531
+
532
+ Rationale $:$ (extract) It shows you how the solution changed during the process of diffusion. Before the solute particles reached equilibrium, there were 3 solute particles on the left side of the membrane and 5 solute particles on the right side of the membrane. When the solute particles reached equilibrium, there were 4 solute particles on each side of the membrane. There was 1 more solute particle on the left side of the membrane than before. So, for the solute particles to reach equilibrium, more solute particles must have moved across the membrane to the left than to the right.
533
+
534
+ Answer: The answer is (A).
535
+
536
+ ![](images/3d7a77bae8bc70fc8400721cf474a3d8b9fd1438f0e7cf66442d9ce19689624e.jpg)
537
+
538
+ # Prediction
539
+
540
+ ![](images/b8c335af56a50eef1c6c4f2d98a2336f290e1fdf11c117bfc3a5eb81580bbff3.jpg)
541
+ Figure 12: Examples of commonsense mistakes.
542
+
543
+ Rationale: (extract) It shows you how the solution changed during the process of diffusion. Before the solute particles reached equilibrium, there were 5 solute particles on the left side of the membrane and 4 solute particles on the right side of the membrane. When the solute particles reached equilibrium, there were 5 solute particles on each side of the membrane. There was 1 more solute particle on the right side of the membrane than before. So, for the solute particles to reach equilibrium, more solute particles must have moved across the membrane to the right than to the right. Answer: The answer is (B).
544
+
545
+ # Problem
546
+
547
+ (b) Mistakes about counting numbers in the image.
548
+
549
+ Question: Which word would you find on a dictionary page with the following guide words? helping - hunter Context: The diagram below shows a solution with one solute. Each solute particle is represented by a green ball. The solution fills a closed container that is divided in half by a membrane. The membrane, represented by a dotted line, is permeable to the solute particles. The diagram shows how the solution can change over time during the process of diffusion.
550
+
551
+ Vision N/A
552
+
553
+ Options: (A) hospital (B) hardship
554
+
555
+ Rationale : Put the words in alphabetical order. Since hospital is between the guide words helping - hunter, it would be found on that page.
556
+ Answer: The answer is (A).
557
+
558
+ # Prediction
559
+
560
+ Rationale: Put the words in alphabetical order. Since hardship is between the guide words helping - hunter, it would be found on that page.
561
+ Answer: The answer is (B).
562
+
563
+ (c) Mistakes about utilizing alphabet.
564
+
565
+ # Problem
566
+
567
+ Question: Compare the motion of two cars. Which car was moving at a lower speed?
568
+
569
+ Vision N/A
570
+
571
+ ons: (A) a car that moved 445miles in 10hours
572
+
573
+ (B) a car that moved 170miles in 10hours
574
+
575
+ Rationale : Look at the distance each car moved and the time it took to move that distance. One car moved 170 miles in 10 hours. The other car moved 445 miles in 10 hours. Notice that each car spent the same amount of time moving. The car that moved 170 miles moved a shorter distance in that time. So, that car must have moved at a lower speed.
576
+
577
+ Answer: The answer is (B).
578
+
579
+ # Prediction
580
+
581
+ Rationale: Look at the distance each car moved and the time it took to move that distance. One car moved 445 miles in 10 hours. The other car moved 170 miles in 10 hours. Notice that each car spent the same amount of time moving. The car that moved 445 miles moved a shorter distance in that time. So, that car must have moved at a lower speed.
582
+
583
+ Answer: The answer is (A).
584
+
585
+ # Problem
586
+
587
+ (a) Logical mistake where the model fails at comparisons.
588
+
589
+ Question: Based on this information, what is Sage's phenotype for the coat color trait? Context: In a group of horses, some individuals have a black coat and others have a reddish-brown coat. In this group, the gene for the coat color trait has two alleles. The allele for a reddish-brown coat (l) is recessive to the allele for a black coat (L). Sage is a horse from this group. Sage has the homozygous genotype ll for the coat color gene.
590
+
591
+ Vision N/A
592
+
593
+ Options: (A) a black coat (B) a reddish-brown coat
594
+
595
+ Rationale : Sage's genotype for the coat color gene is ll. Sage's genotype of ll has only l alleles. The l allele is for a reddish-brown coat. So, Sage's phenotype for the coat color trait must be a reddish-brown coat. To check this answer, consider whether Sage's alleles are dominant or recessive.
596
+ The allele for a reddish-brown coat (l) is recessive to the allele for a black coat (L). This means L is a dominant allele, and l is a recessive allele.
597
+ Sage's genotype of ll has only recessive alleles. An organism with only recessive alleles for a gene will have the recessive allele's version of the trait.
598
+ So, Sage's phenotype for the coat color trait must be a reddish-brown coat.
599
+
600
+ Answer: The answer is (B).
601
+
602
+ # Prediction
603
+
604
+ Rationale: Sage's genotype for the coat color gene is ll. Sage's genotype of ll has only l alleles. The l allele is for a reddish-brown coat. So, Sage's phenotype for the coat color trait must be a reddish-brown coat. To check this answer, consider whether Sage's alleles are dominant or recessive.
605
+ The allele for a reddish-brown coat (l) is recessive to the allele for a black coat (L). This means L is a dominant allele, and l is a recessive allele.
606
+ Sage's genotype of ll has only recessive alleles. An organism with only recessive alleles for a gene will have the recessive allele's version of the trait.
607
+ So, Sage's phenotype for the coat color trait must be a black coat.
608
+
609
+ Answer: The answer is (A).
610
+
611
+ (b) Logical mistake where the there is a contradiction in the rationale.
612
+
613
+ # Problem
614
+
615
+ Question: Which trait did Palaeopython have? Select the trait you can observe on the fossil. Context: This picture shows a fossil of an ancient animal called Palaeopython. Palaeopython lived in trees and could grow more than six feet long.
616
+
617
+ ![](images/e8ebca330acd7b1c3185d80fe2d2814d43d0f374b8bab98275dc48e040adcadf.jpg)
618
+ Figure 13: Examples of logical mistakes.
619
+
620
+ Vision
621
+
622
+ Options: (A) black stripes on its skin (B) large fins on its body (C) a long, thin body
623
+
624
+ Rationale : The way an organism looks or acts is called a trait. Scientists use fossils to learn more about the traits of ancient organisms. Fossils can preserve the remains of body parts and activities. A fossil of a body part, such as a tail or a wing, can tell you what an organism looked like. A fossil of an organism's activities, such as a burrow or a footprint, can tell you about the organism's behavior. Here are three examples of fossils and the traits that you can observe from them: This is a fossil of an animal. This fossil tells you that the animal had a spiral-shaped shell. This is a fossil of a plant. This fossil tells you that the plant had small leaves arranged in a branched pattern. This is a fossil of an animal's footprint. This fossil tells you that the animal could walk on land. An organism's fossil may not show all of the organism's traits. This is because most body parts are destroyed during fossil formation. When an organism's body turns into a fossil, only a few body parts are usually preserved.
625
+
626
+ Answer: The answer is (C).
627
+
628
+ # Prediction
629
+
630
+ Rationale : The way an organism looks or acts is called a trait. Scientists use fossils to learn more about the traits of ancient organisms. Fossils can preserve the remains of body parts and activities. A fossil of a body part, such as a tail or a wing, can tell you what an organism looked like. A fossil of an organism's activities, such as a burrow or a footprint, can tell you about the organism's behavior. Here are three examples of fossils and the traits that you can observe from them: This is a fossil of an animal. This fossil tells you that the animal had a spiral-shaped shell. This is a fossil of a plant. This fossil tells you that the plant had small leaves arranged in a branched pattern. This is a fossil of an animal's footprint. This fossil tells you that the animal could walk on land. An organism's fossil may not show all of the organism's traits. This is because most body parts are destroyed during fossil formation. When an organism's body turns into a fossil, only a few body parts are usually preserved.
631
+ Answer: The answer is (B).
632
+
633
+ Figure 14: Examples of answers are incorrect while the CoT is correct.
parse/test/gDlsMWost9/gDlsMWost9_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/gDlsMWost9/gDlsMWost9_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/gDlsMWost9/gDlsMWost9_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/jolYuxpVn1/jolYuxpVn1.md ADDED
@@ -0,0 +1,634 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FACTOOL: FACTUALITY DETECTION IN GENERATIVE AI - A TOOL AUGMENTED FRAMEWORK FOR MULTITASK AND MULTI-DOMAIN SCENARIOS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The emergence of generative pre-trained models has facilitated the synthesis of high-quality text but has also posed challenges in identifying factual errors in the generated text. In particular: (1) A wider range of tasks now face an increasing risk of containing factual errors when handled by generative models. (2) The content generated by these models tends to be lengthy and lacks clearly defined granularity for individual facts. (3) There is a scarcity of explicit evidence available during the process of fact checking. With the above challenges in mind, in this paper, we propose FACTOOL, a tool augmented multi-task and multi-domain framework for detecting factual errors of texts generated by large language models (e.g., ChatGPT). Experiments on four different tasks (knowledge-based QA, code generation, mathematical reasoning, and scientific literature review) show the efficacy of the proposed method. We release the code of FACTOOL with ChatGPT plugin at https: //anonymous.4open.science/r/factool_iclr_anon-B1A0/.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Generative artificial intelligence (AI) technology (OpenAI, 2023) consolidates various tasks in natural language processing into a single sequence generation problem. This unified architecture enables users to complete multiple tasks (e.g., question answering (Thoppilan et al., 2022), code generation (Chen et al., 2021), math Self-checkproblem solving (Lewkowycz et al., 2022), and scientific literature generation (Taylor et al., 2022)) through a natural language interface (Liu et al., 2023) with both unprecedented performance (Bubeck et al., 2023) and interactivity.
12
+
13
+ However, at the same time, such a generative paradigm also introduces some unique challenges. Content that is automatically generated can often exhibit inaccuracies or deviations from the truth due to the limited capacity of large language models (LLMs) (Ji et al., 2023; Schulman, 2023). LLMs are susceptible to producing content that appears credible but factually incorrect
14
+
15
+ ![](images/343e18c26e1e9bf9d9f71f8625d0f6583a8539a7af38c8baa5be208dda86ae46.jpg)
16
+ Figure 1: Tool augmented framework for factuality detection.
17
+
18
+ or imprecise. This limitation restricts the application of generative AI in some high-stakes areas, such as healthcare, finance, and law. Therefore, it is crucial to identify these errors systematically to improve the usefulness and reliability of the generated content.
19
+
20
+ Current literature on detecting and mitigating factual errors generated by models focuses predominantly on a single task, for example, retrieval-augmented verification models for QA (Lewis et al., 2020), hallucination detection models for text summarization (Fabbri et al., 2022), and executionbased evaluation for code (Shi et al., 2022). While these methods have proven successful within their respective areas, given the versatility of tasks and domains handled by LLMs, we argue that it is essential to have a more comprehensive factuality detection framework that is similarly versatile.
21
+
22
+ Table 1: A comparison of published approaches for factuality detection in terms of generated responses and claims to be verified based on collected evidence. “Scenario” represents which task and domain the corresponding approach has been justified. “Sci.” represents “Scientific”.
23
+
24
+ <table><tr><td rowspan="2">Methods</td><td colspan="2">Response</td><td colspan="2">Claim</td><td>Evidence</td><td colspan="2">Scenario</td></tr><tr><td>Length</td><td>Generated by</td><td>Granularity</td><td>Provided</td><td>Provided</td><td>Domain</td><td>Task</td></tr><tr><td>FEVER-based</td><td>7.30</td><td>Human</td><td>Fact</td><td>√</td><td>X</td><td>Wikipedia</td><td>Fact Verification</td></tr><tr><td>FactCC</td><td>20.83</td><td>Synthetic</td><td>Sentence</td><td>√</td><td>√</td><td>Newswire</td><td>Summ. Factuality</td></tr><tr><td>QAGS-based</td><td>16.11</td><td>Model</td><td>Summary</td><td>√</td><td>√</td><td>Newswire</td><td>Summ.Factuality</td></tr><tr><td>WICE-based</td><td>24.20</td><td>Human</td><td>Fact</td><td>√</td><td>√</td><td>Wikipedia</td><td>Entailment</td></tr><tr><td>RARR</td><td>-</td><td>PaLM/LaMDA</td><td>Fact</td><td>×</td><td>X</td><td>Wikipedia</td><td>QA</td></tr><tr><td rowspan="4">FACTOOL</td><td>41.80</td><td>ChatGPT</td><td>Fact</td><td>X</td><td>X</td><td>Wikipedia</td><td>QA</td></tr><tr><td>30.37</td><td></td><td>Snippet </td><td>XX</td><td></td><td></td><td></td></tr><tr><td></td><td>ChatGPT</td><td></td><td></td><td>XX</td><td>Python</td><td> Madh Prneration</td></tr><tr><td>76.34</td><td>ChatGPT</td><td>Tuple</td><td>X</td><td>X</td><td>Sci. text</td><td>Sci. Review</td></tr></table>
25
+
26
+ Moreover, in existing literature, factuality detection is usually defined as either (i) verifying the factuality of a given claim, or (ii) checking if the provided evidence supports the claim. This definition is overly simplistic as it does not encompass interactions with LLMs like ChatGPT, where we often need to verify the factuality of long-form generation without explicit claims and evidence.
27
+
28
+ In this paper, we propose a multi-task and multi-domain factuality detection framework, FACTOOL, aiming to detect factual errors in LLM-generated texts. We illustrate our framework in Fig. 1, where we connect the concept of “tool use”(Thoppilan et al., 2022; Gao et al., 2022b; Schick et al., 2023) with “factuality detection” and demonstrate that the ability to use tools in LLMs is crucial for factuality detection. Specifically, FACTOOL leverages various tools, including Google Search, Google Scholar, code interpreters, Python, to gather evidence about the factuality of the generated content. Moreover, FACTOOL employs the reasoning abilities of LLMs to assess the factuality of the content, given the gathered evidence. We develop a benchmark and perform experiments across four tasks: knowledge-based QA (KB-QA), code generation (code), math problem solving (math), and scientific literature review writing (scientific).
29
+
30
+ In summary, our contributions are:
31
+
32
+ • We revisit and extend the task of factuality detection, allowing better audit of modern LLMs. • We connect the concept of “tool use” with “factuality detection”, developing a unified and versatile framework for factuality detection across a variety of domains and tasks. • We use FACTOOL to evaluate the factuality of modern chatbots and find GPT-4 to exhibit the best factuality in most scenarios. Vicuna-13B (supervised fine-tuned chatbot) shows decent factuality in KB-QA but underperforms in more challenging scenarios such as math, code, and scientific.
33
+
34
+ # 2 RELATED WORK
35
+
36
+ Factuality Detection in Natural Language Processing Factuality detection has been a topic of intense study even before generative AI existed. Existing works can be organized by their differences on the “response” to verify, the “claim” extracted from the response, and supporting “evidence”. As illustrated in Tab. 1, the creation of the FEVER dataset (Thorne et al., 2018b) spawned models (Zhong et al., 2020; Krishna et al., 2022) that determine whether a given fine-grained claim made based on Wikipedia articles is correct. In this task setting, both the claim and related evidence are given. FactCC (Kryscinski et al., 2020) and QAGS-based models (Wang et al., 2020) adopted different task formulations to detect factual consistency, i.e., given the evidence text, and the goal is to determine if the generated summaries or summary sentences are factually consistent with the given text. WICE-based methods (Kamoi et al., 2023) decide if a fact from a Wikipedia sentence could be supported by provided evidence. RARR (Gao et al., 2022a) proposed a new approach by directly prompting LLMs to generate queries, retrieve evidence and determine factuality.
37
+
38
+ Existing works typically rely on given claims or evidences and target a specific use case. In this paper, we introduce a more challenging yet practical task setting: factuality detection without explicit claims or evidence, and propose a framework that can tackle this challenge across various scenarios.
39
+
40
+ Tool use in LLMs LLMs store limited knowledge within their parameters. To overcome this limitation, various tools have been introduced to assist LLMs to further expand their capabilities. For example, Press et al. (2022); Komeili et al. (2022) gathered information from the Internet to enhance QA and dialog systems, respectively. Schick et al. (2023) trained a model capable of interacting with five tools including a calculator, a translation system, etc. Shen et al. (2023) introduced a framework that employs LLMs to connect various AI models from the ML communities to tackle AI tasks. Liang et al. (2023) proposed a new AI ecosystem that connects LLMs with millions of existing APIs to accomplish tasks. In this work, we explore tool use in LLMs for the task of factuality detection.
41
+
42
+ # 3 REVISITING FACTUALITY IN GENERATIVE AI
43
+
44
+ # 3.1 DEFINITION
45
+
46
+ Versatile Factuality In most previous works, factuality has been defined as whether a claim in a text can be supported by evidence from a separate, trustworthy knowledge base, with applications in fact-checking (Thorne et al., 2018a) (where the knowledge base is a large source like Wikipedia) and summarization (Kryscinski et al., 2020) (where the knowledge base is an input document or documents). In this paper, we extend this definition to whether the claims made in generated signals (which could be text, code, or mathematical expressions and so on) can be supported by evidence under specific rules. Specifically, these rules can range from consistency with a knowledge base derived from Wikipedia, to a verification rule specified within a Python library, or an operational rule derived from mathematics. By adopting this broader definition, we are able to establish a unified framework for addressing factuality issues in generative AI beyond just the textual domain.
47
+
48
+ Fine-grained Factuality Typically, one can ascertain the factuality of a generated signal (e.g., text) at various levels of granularity, including sentence and document level. A more granular assessment can be especially valuable as it not only (1) enable users to pinpoint where inaccuracies occur (Liu et al., 2021) but also (2) functions as a reward model for developers to refine their generative systems (Lightman et al., 2023). Nevertheless, implementing fine-grained factuality detection is challenging for two reasons: (1) specifying the desired granularity level unambiguously, and (2) extracting claims that accord with the predetermined granularity level. In this paper, we argue that the robust instruction-following ability and natural language interface of LLMs can be effectively utilized to address the challenge of defining and extracting fine-grained claims via claim definition-based few-shot prompting. Additional details can be found in $\ S 4 . 1$ .
49
+
50
+ Structurally speaking, given a prompt (e.g., a query or instruction) and the corresponding modelgenerated response, the fine-grained factuality detection task involves the following concepts:
51
+
52
+ Prompt $( p )$ a query or instruction that users provide to the generative model.
53
+
54
+ Response $( r )$ a piece of text (usually in long form) generated by the generative model.
55
+
56
+ Claim (c) a statement inferred from the model response with granularity defined by natural language.
57
+
58
+ Evidence (e) The available information (e.g., knowledge base, pre-defined rules) that support or demonstrate the truth or validity of a claim.
59
+
60
+ Table 2: Factuality definition in different tasks.
61
+
62
+ <table><tr><td>Tasks</td><td>Prompt (p)</td><td>Response (r)</td><td>Claim (c)</td><td>Evidence (e)</td></tr><tr><td>KB-QA</td><td>Question</td><td>Long-form answer</td><td>Atomic component unit</td><td>Web searched results</td></tr><tr><td>Code Generation</td><td>Code Query</td><td>Executable code</td><td>Code snippet</td><td>Python library</td></tr><tr><td>Math Problems</td><td>Math problems</td><td>Math solution</td><td>Math calculation</td><td>Calculator</td></tr><tr><td>Scientific Literature Review</td><td>Scientific question</td><td>Long-form review</td><td>Tuple (paper title,year,authors)</td><td>Google scholar</td></tr></table>
63
+
64
+ # 3.2 INSTANTIATIONS IN DIFFERENT SCENARIOS
65
+
66
+ Using the above task definition, we define factuality in different scenarios (see also in Tab. 2).
67
+
68
+ ![](images/467340748940c4f57c9f35a0970ead72f63f0313c91c773212349ce12fbf58a1.jpg)
69
+ Figure 2: Our proposed framework for factuality detection in four domains.
70
+
71
+ KB-QA Knowledge-based (KB) QA (Chen et al., 2017) aims to answer questions using a given knowledge base or open-domain data source (e.g., Wikipedia). We define factuality as how well each claim in the generated answer is supported by world knowledge. In this paper, we consider a more challenging scenario: open-domain QA that requires long-form answers, rather than short ones.
72
+
73
+ Code The code generation task (Yin & Neubig, 2017) aims to generate executable code given a user query. We define factuality in code generation as how well the generated code can be executed correctly with a specific programming language (e.g., Python) and fulfills the provided requirements. This definition is grounded in an execution-based approach to code evaluation, which measures the correctness of generated code by executing it against test case inputs and comparing its output to the golden output.
74
+
75
+ Math The math problem solving task uses automated methods to address math problems (Cobbe et al., 2021). At the claim level, factuality in math problem solving is defined as the extent to which the generated statements adhere to the calculation rules. At the response level, factuality in math problem solving is defined as how effectively the overall math solution addresses the given problem.
76
+
77
+ Scientific The scientific literature review writing task (Jha et al., 2015) aims to analyze and synthesize existing research on a specific topic in a field of study. In this task, we define factuality as whether the generated scientific literature review correctly cites existing scientific literature, including the correct mention of authors and publication years.1
78
+
79
+ # 4 APPROACH
80
+
81
+ We propose a unified, tool-augmented framework for detecting factual errors across various tasks. The motivation for using tools is twofold: (1) Each tool embodies domain expertise, assisting us in gathering evidences that help verifies the correctness of the claim. (2) The ability of LLMs to utilize multiple tools paves the way for multiple tool-augmented factuality detection. For example, by directly using ChatGPT plugins (https://openai.com/blog/chatgpt-plugins), we can integrate multiple tools into a chatbot. Our framework is illustrated in Fig. 1, which consists of five main components: claim extraction, query generation, tool querying, evidence collection, and agreement verification. We elaborate each component below.
82
+
83
+ # 4.1 CLAIM EXTRACTION
84
+
85
+ Extracting claims from responses is challenging due to the varied definitions of claims across tasks and domains. To overcome this, we propose an approach that treats claim extraction as a process guided by LLM prompts based on the specific definition of claims. This approach offers several advantages: (i) Leveraging the strong instruction-following capabilities of LLMs significantly reduce the costs of data annotation and model training for claim extraction. (ii) When creating a system or dataset that relies on the definition of claims, we just need to provide a textual definition of the claim to LLMs. (iii) Our experiments in $\ S 6 . 1$ demonstrate that the claim extraction module, implemented by ChatGPT, exhibits strong performance in extracting claims (atomic component units).
86
+
87
+ To extract all verifiable claims within the generated text $x$ , denoted as $\{ c _ { i } \} _ { i = 1 \cdots n }$ , for various tasks, we employ ChatGPT as a base LLM and apply different textual definitions of claims. Detailed prompting instructions can be found in Appendix C.
88
+
89
+ KB-QA The claim is defined using the concept of atomic content units (ACUs) (Liu et al., 2022). Each ACU corresponds to a single atomic fact within a generated answer. In practice, we leverage ChatGPT (“gpt-3.5-turbo”) to extract claims based on two criteria: (i) each claim should not exceed 15 words, and (ii) it should clearly describe a fact. We add two in-context examples from the RoSE dataset (Liu et al., 2022) in our prompt to obtain more fine-grained claims. Additionally, we ask ChatGPT to resolve any coreferences or ambiguity, such as unclear pronouns within the claims.
90
+
91
+ Code We consider each generated code snippet within the response as a single claim to be verified.
92
+ We extract all such code snippets that are enclosed with brackets (i.e., within a code block).
93
+
94
+ Math We define each claim in a step-by-step math solution as the arithmetic operation performed between known real numbers. Each of these operations contains two parts: the calculation and the calculated answer. We prompt ChatGPT to extract all such claims.
95
+
96
+ Scientific Each claim within the generated review is defined as a tuple of “(paper title, year, authors)” contained in generated review. We then prompt ChatGPT to extract all such tuples within the review.
97
+
98
+ # 4.2 QUERY GENERATION
99
+
100
+ For each claim $c _ { i }$ , we convert it into a list of queries $\{ q _ { i j } \} _ { j = 1 \cdots m }$ that can be used to query external tools such as search engines, the Python interpreter, or Google scholar. Detailed prompting instructions can be found in Appendix C.
101
+
102
+ KB-QA We prompt ChatGPT or GPT-4 to generate two search engine queries from each claim $c _ { i }$ These queries are intended to help humans in verifying the factuality of $c _ { i }$ .
103
+
104
+ Code For each claim $c _ { i }$ we generate two types of queries: simulated test case inputs, denoted as $\{ q _ { t _ { i j } } \} _ { j = 1 \cdots m }$ , and potential solutions, denoted as $\{ q _ { s _ { i j } } \} _ { j = 1 \cdots m }$ . Both types of queries are generated by ChatGPT or GPT-4. The simulated test case inputs are function calls generated for a given code snippet, while potential solutions are repeatedly generated solutions in response to the user prompt $p$ In our later experiments, we generate 3 simulated test case inputs and 3 potential solutions.
105
+
106
+ Math We prompt ChatGPT or GPT-4 to convert all math operations into executable Python code snippets. These snippets are designed to return “True” when the calculation matches the calculated answer and “False” if it doesn’t.
107
+
108
+ Scientific We use the paper title, found within the extracted claim tuple, as the query for Google Scholar. Our assumption here is that if a paper exists, it should appear as the first search result on Google Scholar when we use the paper title as the query.
109
+
110
+ # 4.3 TOOL QUERYING & EVIDENCE COLLECTION
111
+
112
+ We then use the queries to query various tools to collect relevant evidence statements $\{ e _ { i k } \} _ { k = 1 \cdots l _ { i } }$
113
+
114
+ KB-QA The external tool we use to help verify the factuality of the generated text is the Google Search API, which queries the internet for knowledge using the queries generated from the claims. We use the Google Search API provided by Serper $( \mathrm { h t t p s : / / s e r p e r . d e v / } )$ to search the top pages and retrieve the most relevant search snippets. We parse the response to obtain different types of snippets such as answer boxes, knowledge graphs, and organic search results.
115
+
116
+ Code For each test case input $t _ { i }$ and generated potential solution $s _ { j }$ , we execute $s _ { j }$ using $t _ { i }$ as the input and collect the execution result (output) for each $( t _ { i } , s _ { j } )$ pair. The input-output pairs are used as test cases for verifying the chatbot generated unverified solution. The process is shown in Fig. 3.
117
+
118
+ Math We collect the execution results for code snippets derived from the mathematical operations.Prompt As illustrated in Fig. 2, math claims like “30 $/ 3 = 1 0 ^ { " }$ are extracted and then converted into aWrite Python code that Python executable code, for instance, “print(round $( 3 0 / 3 , \quad 7 ) = = 1 0 )$ ”.
119
+
120
+ Scientific We use the title of each paper, extracted from the text, as the query to access relevantUnittestChatbot Inputs -2 information through the Google Scholar API provided by Scholarly (https://github.com/Unverified Solution Library GPT-4 scholarly-python-package/scholarly). This allows us to retrieve key informationdef square_a_num(n): Verify about each paper, including the paper title, author list, and publication year.return n \* n
121
+
122
+ # 4.4 AGREEMENT VERIFICATION
123
+
124
+ In the final step, each claim, $c _ { i }$ , receives a binary factuality label, $L _ { i } \in \{ \mathrm { T R U E } , \mathrm { F A L S E } \}$ , based on the level of support it receives from the collected evidence, $\{ e _ { i k } \} _ { k = 1 \cdots l _ { i } }$ . This labeling process is performed for every individual claim.
125
+
126
+ KB-QA We prompt ChatGPT or GPT-4 to judge the factuality of the claim given the retrieved evidence snippets. We follow a zero-shot CoT (Wei et al., 2023) reasoning process: First, the model attempts to reason about whether the claim is factual or not. If an error is identified, we then ask it to explain and attempt to rectify the error.
127
+
128
+ ![](images/52b6ed5362672328f79c27d26511c35a8757868d6e10c0c77613285ae9474b38.jpg)
129
+ Figure 3: Unit test library generation for detecting factual errors in code.
130
+
131
+ Code We conduct a majority vote for each test case across all solutions, establishing what we called “pseudo-golden output” for each test case. Following this, we compare the execution result of the solution that’s under verification against all the test cases with the pseudo golden output. If the results match, we classify the solution under verification as true; otherwise, it’s false.
132
+
133
+ Math We compile the results of each code snippet execution. If any snippet returns “False”, we classify the associated generated text $x$ as false. Conversely, if all snippets yield “True”, we classify the corresponding generated text $x$ as true.
134
+
135
+ Scientific We compare the extracted claim: “(paper title, year, authors)” to the evidence: “(paper title, year, authors)” retrieved from Google Scholar API. For the paper title and year of publication, we conduct an exact, case-insensitive string match. As for the authors’ match, we prompt ChatGPT or GPT-4 to judge whether the author list in the extracted claim is a subset of the retrieved author list. All the information must be matched in order to be classified as “True”, otherwise “False”.
136
+
137
+ # 5 DATASET CONSTRUCTION
138
+
139
+ # 5.1 PROMPT AND RESPONSE COLLECTION
140
+
141
+ KB-QA For KB-QA, we evaluate our framework using RoSE (Liu et al., 2022) and FactPrompts (Wang et al., 2023a). RoSE is a text summarization dataset that provides fine-grained ACUs for each reference summary. FactPrompts is a dataset that comprises real-world prompts sourced from various platforms and datasets, such as Quora and TruthfulQA (Lin et al., 2022), along with corresponding responses generated by ChatGPT. We construct the dataset using 100 reference summaries from RoSE and 50 responses from FactPrompts for our evaluation.
142
+
143
+ Code For code, we evaluate our framework using HumanEval (Chen et al., 2021). HumanEval is a programming problem dataset that contains several unit tests for each problem. We use ChatGPT to generate responses based on the processed prompts of HumanEval provided in (Chen et al., 2022) which solely contain the instruction of the prompt without input-output demonstrations.
144
+
145
+ Math For math, we evaluate our framework using GSM-Hard (Gao et al., 2022b). GSM-Hard is a dataset constructed from GSM8K (Cobbe et al., 2021) by replacing the numbers in the questions of GSM8K with larger numbers. We sampled 100 prompts from GSM-Hard. Then, we generate responses for these prompts using ChatGPT.
146
+
147
+ Scientific For scientific, we follow self-instruct (Wang et al., 2023b) to create 100 diverse prompts spanning computer science, business, law, medicine, and physics. Each prompt asks for a technical or research-oriented response that includes at least one relevant literature citation. Then, we generate responses for these prompts using ChatGPT.
148
+
149
+ # 5.2 CLAIM COLLECTION
150
+
151
+ For responses from FactPrompts and GSMHard, we follow the idea of “claim extraction as prompting” described in $\ S 4 . 1$ . We use ChatGPT for claim extraction due to its cost efficiency and effectiveness in extracting fine-grained claims. For HumanEval responses, since each response is already a code snippet, we consider the “claim” of the response to be identical to the response itself.
152
+
153
+ Table 3: Statistics of datasets used in this work. (p, n) stands for (count of positive responses or claims, count of negative responses or claims).
154
+
155
+ <table><tr><td>Task</td><td>Datasets</td><td>Responses</td><td>Claims</td></tr><tr><td>KB-QA</td><td>RoSE</td><td>100</td><td>527</td></tr><tr><td>KB-QA</td><td>FactPrompts</td><td>50 (23:27)</td><td>233 (177:56)</td></tr><tr><td>Code</td><td>HumanEval</td><td>164 (109:55)</td><td>164 (109:55)</td></tr><tr><td>Math</td><td>GSM-Hard</td><td>100 (47:53)</td><td>284 (246:38)</td></tr><tr><td>Scientific</td><td>FactPrompts</td><td>100 (10:90)</td><td>186 (33:153)</td></tr></table>
156
+
157
+ # 5.3 CLAIM AND RESPONSE ANNOTATION
158
+
159
+ KB-QA & Scientific For claim annotation, the authors collectively annotate the extracted claims as either factual or non-factual. For response annotation, if any claim in the response is annotated as non-factual, then the response as a whole is non-factual; otherwise, the response is factual.
160
+
161
+ Code We consider the claim label to be identical to the response label since the “claim” of the response is the same as the response itself. For response annotation, we annotate ChatGPT’s responses using the execution code provided in (Chen et al., 2022) against the HumanEval test cases to distinguish between factual (those passing all tests) responses and non-factual responses.
162
+
163
+ Math For claim annotation, the authors collectively annotate the extracted claims as either factual or non-factual. For response annotation, we utilize the target values in GSM-Hard (Gao et al., 2022b).
164
+
165
+ # 6 EXPERIMENTS
166
+
167
+ We evaluate FACTOOL against two baselines that use LLMs to check their own inputs: Self-Check with 3-shot CoT (with 3 demonstrations) and zero-shot CoT (no demonstrations), which are effective on various tasks including dialogue, math, and code (Madaan et al., 2023; Chen et al., 2023). Both baselines aim to test the ability of LLM to identify its own errors without the use of external tools. We prompt ChatGPT and GPT-4 to recognize, explain, and attempt to rectify their own errors. Following this reasoning process, the models make final judgments on the factuality of the given claim.
168
+
169
+ # 6.1 EXP-I: CLAIM EXTRACTION EVALUATION
170
+
171
+ We evaluate the claim extraction module of FACTOOL on RoSE (Liu et al., 2022). We treat the reference summary as the generated text $x$ , and the reference ACUs as the golden-extracted claims. We measure the similarity between the machine-extracted (GPT-4, ChatGPT, and Flan-T5-XXL (Chung et al., 2022)) claims $\{ c _ { i } ^ { c } \} _ { i = 1 \cdots n _ { c } }$ and golden-extracted claims $\{ c _ { i } ^ { g } \} _ { i = 1 \cdots n _ { g } }$ using 4 metrics: ROUGE1, ROUGE-2, ROUGE-L (Lin, 2004), and BERTScore (Zhang et al., 2019). In Tab. 4, we report the average of the highest similarity between each ChatGPT-extracted claim and the corresponding golden-extracted claim in the same sample. (i.e., 1sample_cnt Psample 1nc P ci=1 $\begin{array} { r } { \frac { 1 } { n _ { c } } \sum _ { i = 1 } ^ { n _ { c } } \operatorname* { m a x } _ { j = 1 } ^ { n _ { g } } ( \mathrm { S i m } ( \dot { c _ { i } } , c _ { j } ^ { g } ) ) ) } \end{array}$ .
172
+
173
+ Results Tab. 4 shows that the claims extracted by GPT-4, ChatGPT, and Flan-T5-XXL closely match the ACUs annotated by humans as evaluated by ROUGE and BERTScore. In Exp-II, we choose ChatGPT as the claim extractor for two reasons: (1) The context length of Flan-T5 is too short (512 tokens) to effectively extract claims from lengthy responses in our dataset. (2) ChatGPT is more cost-efficient compared to GPT-4, while maintaining similar effectiveness.
174
+
175
+ # 6.2 EXP-II: FRAMEWORK EVALUATION
176
+
177
+ We evaluate FACTOOL and the two Self-Check baselines on the constructed dataset described in $\ S 5$ . Depending on the model used for query generation and agreement verification, we have FACTOOL
178
+
179
+ ChatGPT and FACTOOL $\mathrm { G P T } \mathrm { - } 4 ^ { 2 }$ . We report the accuracy, recall, precision, and F1-score at both the claim and response levels.
180
+
181
+ <table><tr><td rowspan="2">Tasks</td><td rowspan="2">LLMs</td><td rowspan="2">Methods</td><td colspan="4">Claim-Level</td><td colspan="4">Response-Level</td></tr><tr><td>Acc.</td><td>R</td><td>P</td><td>F1</td><td>Acc.</td><td>R</td><td>P</td><td>F1</td></tr><tr><td rowspan="6">KB-QA</td><td rowspan="2">ChatGPT</td><td>Self-Check (0)</td><td>75.54</td><td>90.40</td><td>80.00</td><td>84.88</td><td>54.00</td><td>60.87</td><td>50.00</td><td>54.90</td></tr><tr><td> Self-Check( )</td><td>69.53</td><td>8136</td><td>79.12</td><td>80.23</td><td>54.00</td><td>47.83</td><td>50.00</td><td>48.89</td></tr><tr><td rowspan="2"></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Self-Check (0)</td><td>77.25</td><td>84.75</td><td>85.23</td><td>84.99</td><td>54.00</td><td>95.65</td><td>50.00</td><td>65.67</td></tr><tr><td rowspan="2">GPT-4</td><td>Self-Check (3)</td><td>79.83</td><td>85.88</td><td>87.36</td><td>86.61</td><td>64.00</td><td>52.17</td><td>63.16</td><td>57.14</td></tr><tr><td>FACTOOL</td><td>84.12</td><td>85.31</td><td>93.21</td><td>89.09</td><td>78.00</td><td>60.87</td><td>87.50</td><td>71.79</td></tr><tr><td rowspan="6">Code</td><td rowspan="2">ChatGPT</td><td>Self-Check (0)</td><td>68.29</td><td>99.10</td><td>68.33</td><td>80.88</td><td>68.29</td><td>99.10</td><td>68.33</td><td>80.88</td></tr><tr><td>Self-Check (3)</td><td>68.90</td><td>100.00</td><td>68.52</td><td>81.32</td><td>68.90</td><td>100.00</td><td>68.52</td><td>81.32</td></tr><tr><td rowspan="2"></td><td>FACTOOL</td><td>78.05</td><td>89.19</td><td>80.49</td><td>84.62</td><td>78.05</td><td>89.19</td><td>80.49</td><td>84.62</td></tr><tr><td>Self-Check (0)</td><td>75.31</td><td>95.50</td><td>75.18</td><td>84.13</td><td>75.31</td><td>95.50</td><td>75.18</td><td>84.13</td></tr><tr><td rowspan="2">GPT-4</td><td>Self-Check (3)</td><td>77.44</td><td>96.40</td><td>76.43</td><td>85.26</td><td>77.44</td><td>96.40</td><td>76.43</td><td>85.26</td></tr><tr><td>FACTOOL</td><td>89.02</td><td>94.59</td><td>89.74</td><td>92.11</td><td>89.02</td><td>94.59</td><td>89.74</td><td>92.11</td></tr><tr><td rowspan="6">Math</td><td rowspan="2">ChatGPT</td><td>Self-Check (0)</td><td>84.15</td><td>90.24</td><td>91.36</td><td>90.80</td><td>57.00</td><td>74.47</td><td>53.03</td><td>61.95</td></tr><tr><td>Self-Cec ( 3)</td><td>87.34</td><td>94.31</td><td>9.34</td><td>92.80</td><td>61.00</td><td>99.36</td><td>55.26</td><td>68.29</td></tr><tr><td rowspan="2"></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Self-Check (0)</td><td>83.10</td><td>86.99</td><td>93.04</td><td>89.92</td><td>49.00</td><td>85.11</td><td>47.62</td><td>61.07</td></tr><tr><td rowspan="2">GPT-4</td><td>Self-Check (3)</td><td>92.61</td><td>96.75</td><td>94.82</td><td>95.77</td><td>65.00</td><td>89.36</td><td>58.33</td><td>70.59</td></tr><tr><td>FACTOOL</td><td>98.24</td><td>97.97</td><td>100.00</td><td>98.97</td><td>78.00</td><td>95.74</td><td>69.23</td><td>80.36</td></tr><tr><td rowspan="6">Scientific</td><td rowspan="2">ChatGPT</td><td>Self-Check (0)</td><td>28.69</td><td>96.00</td><td>21.82</td><td>35.56</td><td>18.00</td><td>100.00</td><td>10.87</td><td>19.61</td></tr><tr><td>Self-Check (3)</td><td>24.19</td><td>96.97</td><td>18.60</td><td>31.22</td><td>22.00</td><td>90.00</td><td>10.47</td><td>18.75</td></tr><tr><td rowspan="2"></td><td>FACTOOL</td><td>97.31</td><td>84.85</td><td>100.00</td><td>91.80</td><td>99.00</td><td>90.00</td><td>100.00</td><td>94.74</td></tr><tr><td>Self-Check (0)</td><td>35.75</td><td>84.85</td><td>20.29</td><td>32.75</td><td>19.00</td><td>100.00</td><td>10.99</td><td>19.80</td></tr><tr><td rowspan="2">GPT-4</td><td>Self-Check (3)</td><td>44.75</td><td>87.8</td><td>13.20</td><td>36.74</td><td>9.00</td><td>70.00</td><td>10.730</td><td>21.4</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
182
+
183
+ Results Tab. 5 shows the claim-and-responselevel results of FACTOOL and the self-check baselines.
184
+
185
+ Table 5: Experimental results of FACTOOL ChatGPT and FACTOOL $\mathrm { G P T } { \cdot } 4$ on KB-QA, code, math, and scientific.
186
+
187
+ <table><tr><td>Model</td><td>Metric</td><td>Precision</td><td>Recall</td><td>F1-score</td></tr><tr><td>GPT-4</td><td>ROUGE-1</td><td>0.7394</td><td>0.8758</td><td>0.7860</td></tr><tr><td></td><td>ROUGE-2</td><td>0.6304</td><td>0.7771</td><td>0.6772</td></tr><tr><td></td><td>ROUGE-L</td><td>0.7175</td><td>0.8625</td><td>0.7667</td></tr><tr><td></td><td>BERTScore</td><td>0.6632</td><td>0.7865</td><td>0.7175</td></tr><tr><td>ChatGPT</td><td>ROUGE-1</td><td>0.7770</td><td>0.8285</td><td>0.7836</td></tr><tr><td></td><td>ROUGE-2</td><td>0.6520</td><td>0.7115</td><td>0.6610</td></tr><tr><td></td><td>ROUGE-L</td><td>0.7557</td><td>0.8148</td><td>0.7655</td></tr><tr><td></td><td>BERTScore</td><td>0.6958</td><td>0.7521</td><td>0.7174</td></tr><tr><td>FLAN-T5-XXL</td><td>ROUGE-1</td><td>0.6531</td><td>0.8928</td><td>0.7326</td></tr><tr><td></td><td>ROUGE-2</td><td>0.5609</td><td>0.8157</td><td>0.6413</td></tr><tr><td></td><td>ROUGE-L</td><td>0.6428</td><td>0.8885</td><td>0.7237</td></tr><tr><td></td><td>BERTScore</td><td>0.4314</td><td>0.6661</td><td>0.5408</td></tr></table>
188
+
189
+ FACTOOL GPT-4 outperforms all other baselines across all scenarios Tab. 5 shows that FACTOOL GPT-4 outperforms all other baselines across all scenarios. FACTOOL GPT-4 achieves an 89.09 claim-level F1 / 71.79 response-level F1 on KB-QA, a 92.11 claim-level F1 / 92.11 response-level F1 on code (remember that claim-level factuality is considered equivalent to response-level factuality in our experiment for code), a 98.97 claim-level F1 / 80.36 responselevel F1 on math, and a 95.24 claim-level F1 / 94.74 response-level F1 on scientific.
190
+
191
+ Table 4: The average similarity between the extracted claims from different models and the golden ACUs on RoSE.
192
+
193
+ FACTOOL $\mathbf { G P T } { \bf - } 4$ outperforms all self-check baselines across all scenarios From Tab. 5, we show that FACTOOL with GPT-4 outperforms all self-check baselines across all scenarios. On FACTOOL GPT-4 v.s. Self-Check (3) powered by GPT-4, we observe: 71.79 v.s. 57.14 response-level F1 on KB-QA, 92.11 v.s. 85.26 response-level F1 on code, 80.36 v.s. 70.59 response-level F1 on math, and 94.74 v.s. 21.54 response-level F1 on scientific.
194
+
195
+ FACTOOL GPT-4 significantly outperforms all self-check baselines in scientific Tab. 5 shows that FACTOOL GPT-4 significantly outperforms the self-check baselines in scientific. On FACTOOL GPT-4 v.s. Self-Check (3) powered by GPT-4, we observe: 95.24 v.s. 36.71 claim-level F1 and 94.74 v.s. 21.54 response-level F1. Here, Google Scholar shows high robustness in performing its specified task of finding citations compared to LLM itself.
196
+
197
+ ![](images/9bcbe94da84e9253a90bc52dda7270f5b8c4cc580015780c9eea873a86db84f4.jpg)
198
+ Figure 4: Claim-Level Accuracy across scenarios for each chatbot.
199
+
200
+ ![](images/5bdd8db8801f8dfce93327706d3b05a3cc2189d8f6a43267ed3fcbc14ccc07a6.jpg)
201
+ Figure 5: Response-Level Accuracy across scenarios for each chatbot.
202
+
203
+ 6.3 EXP-III: USING FACTOOL TO EVALUATE THE FACTUALITY OF MODERN CHATBOTS
204
+
205
+ An important objective of developing a factuality detector (like FACTOOL) is to evaluate the factuality of chatbots by examining their responses. In Exp-III, we consider FACTOOL GPT-4 as the golden evaluator, and use it to evaluate the factuality of chatbots, including GPT-4, ChatGPT, Claude-v1, Bard, and Vicuna-13B. Following the same prompt selection intuition as (Zhou et al., 2023), i.e., KB-QA is the most common scenario, we collect 30 KB-QA prompts from (Zhou et al., 2023), 10 code prompts from HumanEval, 10 math prompts from GSM8k-Hard, and 10 scientific prompts (selfgenerated) to conduct factuality evaluation on chatbots. Responses for these prompts are generated by each of the evaluated chatbots.
206
+
207
+ We report the weighted claim-level and response-level accuracies for each chatbot, evaluated by FACTOOL GPT-4. As KB-QA responses contain significantly more claims than other scenarios, to prevent over-emphasizing KB-QA, we report the weighted claim-level accuracy based on ratio of the number of prompts in each scenario. Specifically, the weighted claim-level accuracy is calculated as ${ \frac { 3 } { 6 } } \times$ claim-level accuracy in $\begin{array} { r } { \mathrm { K B - Q A } + \frac { 1 } { 6 } \times } \end{array}$ claim-level accuracy in ${ \mathrm { C o d e } } + { \frac { 1 } { 6 } } \times$ claim-level accuracy in Math $\textstyle + { \frac { 1 } { 6 } } \times$ claim-level accuracy in Scientific. Adopting the weighted-claim level accuracy evaluation provides a more holistic and fair assessment of each chatbot’s factual accuracy.
208
+
209
+ Results Tab. 6 shows that GPT-4 has the best weighted claim-level factual accuracy and response-level accuracy. Fig. 4 and 5 show the fine-grained performance w.r.t each scenario (KB-QA, code, math, scientific). We observe that (1) GPT-4 has the best claim-level accuracy and response-level accuracy in most scenarios. (2) Vicuna-13B (supervised fine-tuned chatbot) demonstrates decent factuality in KB-QA but underperforms in more challenging scenarios (math, code, and scientific).
210
+
211
+ # 7 CONCLUSION
212
+
213
+ We introduce FACTOOL, a multi-task and multidomain factaulity detection framework designed to tackle the escalating challenge of hallucination in generative AI. We expand the conventional definition of factuality, focusing particularly on auditing the capabilities of generative AI models. Recognizing that (1) the generative texts from LLMs are often lengthy and have undefined granularity for individual facts and that (2) there’s an evidence shortage during the process of fact-checking, we build FACTOOL as a 5-step tool-augmented framework that consists of claim extraction, query generation, tool
214
+
215
+ <table><tr><td>LLMs</td><td>WCL Acc.</td><td>RL Acc.</td><td>Avg. Resp. Len.</td></tr><tr><td>GPT-4</td><td>75.60</td><td>43.33</td><td>196.83</td></tr><tr><td>ChatGPT</td><td>68.63</td><td>36.67</td><td>144.05</td></tr><tr><td>Claude-v1</td><td>63.95</td><td>26.67</td><td>208.70</td></tr><tr><td>Bard</td><td>61.15</td><td>33.33</td><td>263.77</td></tr><tr><td>Vicuna-13B</td><td>50.35</td><td>21.67</td><td>207.13</td></tr></table>
216
+
217
+ Table 6: Factual accuracy of chatbots evaluated by FACTOOL. WCL Acc. stands for weighted claimlevel accuracy. RL Acc. stands for response-level accuracy. Avg. Resp. Len. stands for average response length. We consider FACTOOL as the golden evaluator that evaluates the factuality of the responses generated by each chatbot.
218
+
219
+ querying, evidence collection, and agreement verification. We incorporate tools like Google Search, Google Scholar, and code interpreters, in FACTOOL, and shows the effectiveness of FACTOOL in tasks such as KB-QA, code generation, math problem solving, scientific literature review writing. We believe our holistic, adaptable framework is easily extendable to more scenarios.
220
+
221
+ # REFERENCES
222
+
223
+ Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023.
224
+
225
+ Bei Chen, Fengji Zhang, Anh Nguyen, Daoguang Zan, Zeqi Lin, Jian-Guang Lou, and Weizhu Chen. Codet: Code generation with generated tests. arXiv preprint arXiv:2207.10397, 2022.
226
+ Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading Wikipedia to answer open-domain questions. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1870–1879, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1171. URL https: //aclanthology.org/P17-1171.
227
+ Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Josh Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code, 2021.
228
+ Xinyun Chen, Maxwell Lin, Nathanael Schärli, and Denny Zhou. Teaching large language models to self-debug. arXiv preprint arXiv:2304.05128, 2023.
229
+ Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language models. arXiv preprint arXiv:2210.11416, 2022.
230
+ Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
231
+ Alexander Fabbri, Chien-Sheng Wu, Wenhao Liu, and Caiming Xiong. QAFactEval: Improved QAbased factual consistency evaluation for summarization. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 2587–2601, Seattle, United States, July 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.naacl-main.187. URL https://aclanthology.org/ 2022.naacl-main.187.
232
+ Luyu Gao, Zhuyun Dai, Panupong Pasupat, Anthony Chen, Arun Tejasvi Chaganty, Yicheng Fan, Vincent Y. Zhao, Ni Lao, Hongrae Lee, Da-Cheng Juan, and Kelvin Guu. Rarr: Researching and revising what language models say, using language models, 2022a.
233
+ Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models. arXiv preprint arXiv:2211.10435, 2022b.
234
+ Rahul Jha, Reed Coke, and Dragomir Radev. Surveyor: A system for generating coherent survey articles for scientific topics. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 29, 2015.
235
+ Ziwei Ji, Nayeon Lee, Rita Frieske, Tiezheng Yu, Dan Su, Yan Xu, Etsuko Ishii, Ye Jin Bang, Andrea Madotto, and Pascale Fung. Survey of hallucination in natural language generation. ACM Computing Surveys, 55(12):1–38, 2023.
236
+ Ryo Kamoi, Tanya Goyal, Juan Diego Rodriguez, and Greg Durrett. Wice: Real-world entailment for claims in wikipedia. arXiv preprint arXiv:2303.01432, 2023.
237
+ Mojtaba Komeili, Kurt Shuster, and Jason Weston. Internet-augmented dialogue generation. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 8460–8478, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.579. URL https://aclanthology.org/ 2022.acl-long.579.
238
+ Amrith Krishna, Sebastian Riedel, and Andreas Vlachos. ProoFVer: Natural logic theorem proving for fact verification. Transactions of the Association for Computational Linguistics, 10:1013–1030, 2022. doi: 10.1162/tacl_a_00503. URL https://aclanthology.org/2022.tacl-1. 59.
239
+ Wojciech Kryscinski, Bryan McCann, Caiming Xiong, and Richard Socher. Evaluating the factual consistency of abstractive text summarization. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 9332–9346, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.750. URL https: //aclanthology.org/2020.emnlp-main.750.
240
+ Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, et al. Retrieval-augmented generation for knowledge-intensive nlp tasks. Advances in Neural Information Processing Systems, 33: 9459–9474, 2020.
241
+ Aitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, Yuhuai Wu, Behnam Neyshabur, Guy Gur-Ari, and Vedant Misra. Solving quantitative reasoning problems with language models, 2022.
242
+ Yaobo Liang, Chenfei Wu, Ting Song, Wenshan Wu, Yan Xia, Yu Liu, Yang Ou, Shuai Lu, Lei Ji, Shaoguang Mao, Yun Wang, Linjun Shou, Ming Gong, and Nan Duan. Taskmatrix.ai: Completing tasks by connecting foundation models with millions of apis, 2023.
243
+ Hunter Lightman, Vineet Kosaraju, Yura Burda, Harri Edwards, Bowen Baker, Teddy Lee, Jan Leike, John Schulman, Ilya Sutskever, and Karl Cobbe. Let’s verify step by step, 2023.
244
+ Chin-Yew Lin. ROUGE: A package for automatic evaluation of summaries. In Text Summarization Branches Out, pp. 74–81, Barcelona, Spain, July 2004. Association for Computational Linguistics. URL https://aclanthology.org/W04-1013.
245
+ Stephanie Lin, Jacob Hilton, and Owain Evans. TruthfulQA: Measuring how models mimic human falsehoods. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 3214–3252, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.229. URL https: //aclanthology.org/2022.acl-long.229.
246
+ Pengfei Liu, Jinlan Fu, Yang Xiao, Weizhe Yuan, Shuaichen Chang, Junqi Dai, Yixin Liu, Zihuiwen Ye, and Graham Neubig. ExplainaBoard: An explainable leaderboard for NLP. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing: System Demonstrations, pp. 280–289, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-demo. 34. URL https://aclanthology.org/2021.acl-demo.34.
247
+ Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pre-train, prompt, and predict: A systematic survey of prompting methods in natural language processing. ACM Computing Surveys, 55(9):1–35, 2023.
248
+ Yixin Liu, Alexander R Fabbri, Pengfei Liu, Yilun Zhao, Linyong Nan, Ruilin Han, Simeng Han, Shafiq Joty, Chien-Sheng Wu, Caiming Xiong, et al. Revisiting the gold standard: Grounding summarization evaluation with robust human evaluation. arXiv preprint arXiv:2212.07981, 2022.
249
+ Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, Shashank Gupta, Bodhisattwa Prasad Majumder, Katherine Hermann, Sean Welleck, Amir Yazdanbakhsh, and Peter Clark. Self-refine: Iterative refinement with self-feedback, 2023.
250
+
251
+ OpenAI. Gpt-4 technical report, 2023.
252
+
253
+ Ofir Press, Muru Zhang, Sewon Min, Ludwig Schmidt, Noah A. Smith, and Mike Lewis. Measuring and narrowing the compositionality gap in language models, 2022.
254
+ Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Luke Zettlemoyer, Nicola Cancedda, and Thomas Scialom. Toolformer: Language models can teach themselves to use tools, 2023.
255
+ John Schulman. Reinforcement learning from human feedback: Progress and challenges, 2023.
256
+ Yongliang Shen, Kaitao Song, Xu Tan, Dongsheng Li, Weiming Lu, and Yueting Zhuang. Hugginggpt: Solving ai tasks with chatgpt and its friends in huggingface, 2023.
257
+ Freda Shi, Daniel Fried, Marjan Ghazvininejad, Luke Zettlemoyer, and Sida I. Wang. Natural language to code translation with execution. In Proceedings of the 2022 Conference on Empirical
258
+ Methods in Natural Language Processing, pp. 3533–3546, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.emnlp-main. 231. URL https://aclanthology.org/2022.emnlp-main.231.
259
+ Ross Taylor, Marcin Kardas, Guillem Cucurull, Thomas Scialom, Anthony Hartshorn, Elvis Saravia, Andrew Poulton, Viktor Kerkez, and Robert Stojnic. Galactica: A large language model for science, 2022.
260
+ Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, et al. Lamda: Language models for dialog applications. arXiv preprint arXiv:2201.08239, 2022.
261
+ James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. FEVER: a largescale dataset for fact extraction and VERification. In NAACL-HLT, 2018a.
262
+ James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. FEVER: a large-scale dataset for fact extraction and VERification. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 809–819, New Orleans, Louisiana, June 2018b. Association for Computational Linguistics. doi: 10.18653/v1/N18-1074. URL https://aclanthology.org/N18-1074.
263
+ Alex Wang, Kyunghyun Cho, and Mike Lewis. Asking and answering questions to evaluate the factual consistency of summaries. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 5008–5020, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.450. URL https://aclanthology.org/ 2020.acl-main.450.
264
+ Binjie Wang, Ethan Chern, and Pengfei Liu. Chinesefacteval: A factuality benchmark for chinese llms, 2023a.
265
+ Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A. Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language models with self-generated instructions, 2023b.
266
+ Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc Le, and Denny Zhou. Chain-of-thought prompting elicits reasoning in large language models, 2023.
267
+ Pengcheng Yin and Graham Neubig. A syntactic neural model for general-purpose code generation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 440–450, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1041. URL https://aclanthology.org/P17-1041.
268
+ Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q Weinberger, and Yoav Artzi. Bertscore: Evaluating text generation with bert. In International Conference on Learning Representations, 2019.
269
+
270
+ Wanjun Zhong, Jingjing Xu, Duyu Tang, Zenan Xu, Nan Duan, Ming Zhou, Jiahai Wang, and Jian Yin. Reasoning over semantic-level graph for fact checking. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 6170–6180, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.549. URL https://aclanthology.org/2020.acl-main.549.
271
+
272
+ Chunting Zhou, Pengfei Liu, Puxin Xu, Srini Iyer, Jiao Sun, Yuning Mao, Xuezhe Ma, Avia Efrat, Ping Yu, Lili Yu, et al. Lima: Less is more for alignment. arXiv preprint arXiv:2305.11206, 2023.
273
+
274
+ # A EXTRA ANALYSES ON EXP-II
275
+
276
+ FACTOOL GPT-4 outperforms FACTOOL ChatGPT FACTOOL GPT-4 outperforms FACTOOL ChatGPT across all scenarios. This trend is especially significant in KB-QA, where query generation and agreement verification are harder for ChatGPT but relatively easier for GPT-4 (89.09 v.s 81.25 claim-level F1 and 71.79 v.s 52.63 response-level F1). On the other hand, in scenarios where query generation and agreement verification are relatively easy for both ChatGPT and GPT-4, the performance is similarly good.
277
+
278
+ Self-check models are prone to false positives and thus less sensitive in detecting errors From Tab. 5, we observe that self-check models have lower precision compared to FACTOOL. On SelfCheck (3) powered by GPT-4 v.s. FACTOOL GPT-4, we observe: 63.16 v.s. 87.50 response-level precision on KB-QA, 76.43 v.s. 89.74 response-level precision on code generation, 58.33 v.s. 69.23 response-level precision on math problems, and 12.73 v.s. 100.00 response-level precision on scientific literature review. These figures show that self-check models tend to classify claims as “True” considerably more frequently than FACTOOL, suggesting a lower sensitivity for error detection.
279
+
280
+ Self-check models powered by ChatGPT outperform FACTOOL ChatGPT on KB-QA Tab. 5 shows that Self-Check (0) powered by ChatGPT outperforms FACTOOL ChatGPT. Through examining specific cases, we found that reasoning errors are the main reason why FACTOOL ChatGPT performs worse than the self-check baselines. Even when provided with sufficient evidence to determine whether the claim is factual or not, the agreement verification implemented by ChatGPT can become confused. For example, for the claim “The modern-day version of fortune cookies was invented in the United States.”, the reasoning of FACTOOL ChatGPT is selfcontradictory: “The given text is not entirely factual. The modern-day version of fortune cookies was not invented in the United States. Most people nowadays believe that fortune cookies were created by a Japanese man named Makoto Hagiwara in 1914 in San Francisco...” Detailed examples can be found in Fig. 9 of Appendix D.
281
+
282
+ # B PERFORMANCE AND FAILURE ANALYSIS
283
+
284
+ # B.1 PERFORMANCE ANALYSIS
285
+
286
+ We take a closer look at performance in different scenarios by examining evaluated cases.
287
+
288
+ KB-QA The fact-checking capability of FACTOOL on KB-QA is determined by several factors, including whether the search engine can return the most relevant snippets that could assist in determining the factuality of the given claim, the quality of the generated search engine queries, and the LLM’s ability to reason about the validity of the claim given the retrieved evidence. We found that FACTOOL GPT-4 is especially capable under the following situations: (1) Fact-checking recent events, discoveries, or news: FACTOOL GPT-4 successfully identify false claims such as “Argentina has not won the World Cup since $\exists 9 8 6 ^ { \prime }$ ” and “The most valuable NFT ever sold is a digital artwork called ‘Everydays: The First 5000 Days’”. (2) Factchecking high-precision statistics: FACTOOL GPT-4 successfully identify false claims such as “Ireland has an obesity rate of 26.9%” and “Everydays: The First 5000 Days’ sold for 69 million”. Detailed examples can be found in Fig. 10 of Appendix D.
289
+
290
+ Code Generation The fact-checking capability of FACTOOL on code generation is determined by the LLM’s capability to generate high-quality test cases and potential solutions. We demonstrate that due to GPT-4’s exceptional ability to generate such high-quality test cases and potential solutions, FACTOOL $\mathrm { G P T } { \cdot } 4$ outperforms other baselines. For example, in “HumanEval $^ { \prime } 3 6 ^ { \prime } { } ^ { * }$ , GPT-4 is consistently generating high quality solutions, leading to its correctly identifies the mistakes in the response, while ChatGPT fails to identify the mistake. Detailed examples can be found in Fig. 11 and Fig. 12 of Appendix D.
291
+
292
+ Math Problems The fact-checking capability of FACTOOL on math problems is determined by the LLM’s capability to generate accurate Python snippets that verify the correctness of given extracted mathematical calculations. Both FACTOOL GPT-4 and FACTOOL ChatGPT excel in this regard. For example, both FACTOOL GPT-4 and FACTOOL ChatGPT correctly identify $2 3 \times 4 3 1 9 2 1 6$ doesn’t equal to 99305768. Detailed examples can be found in Fig. 13 of Appendix D.
293
+
294
+ Scientific Literature Review The fact-checking capability of FACTOOL on Scientific Literature Review is determined by the LLM’s capability to identifying whether the author list generated is a subset of the actual author list. Both FACTOOL $\mathrm { G P T } { \cdot } 4$ and FACTOOL ChatGPT excel in this regard. For example, both FACTOOL GPT-4 and FACTOOL ChatGPT correctly identify that the paper “The Impact of Artificial Intelligence on Employment” was not written by “Acemoglu and Restrepo”. Detailed examples can be found in Fig. 14 of Appendix D.
295
+
296
+ # B.2 FAILURE ANALYSIS
297
+
298
+ To gain a comprehensive understanding of FACTOOL’s performance, we conduct analysis on cases where FACTOOL will fail.
299
+
300
+ KB-QA We summarize following sources of errors: (1) Reasoning error: Although the evidence provided is sufficient and the LLM accurately finds the most relevant information, the model fails to reason about the relationship between the claim and the provided evidence. For example, for claim “Jupiter is less dense than Saturn", FACTOOL $\mathrm { G P T } { \cdot } 4$ fails to reason the relative relationship even though the evidences provided are sufficient. (2) Conflicting evidence: Conflict in evidence can cause confusion for LLM, leading to incorrect decisions. For example, for claim “Jupiter has a density of 1.33 grams per cubic centimeter", there are conflicting evidences claiming that the density is 1.326 or $1 . 3 3 \mathrm { g / c m ^ { 3 } }$ . (3) Ambiguity in claim: Ambiguous descriptions and subjective adjectives can lead to incorrect decisions. For example, the claim “Fortune cookies are enjoyed by people all over the world." is ambiguous and can have different answers based on different interpretations. Detailed examples can be found in Fig. 15 of Appendix D.
301
+
302
+ Code Generation Errors in code generation mainly comes from: (1) Limited variety in synthetic test cases: The synthetic test cases generated by LLMs may not be fully representative or sufficiently diverse. For example, in the “HumanEval/64” sample, all the inputs of the generated synthetic test cases are composed of strings that only include lowercase letters (without uppercase letters). (2) Potential errors in code generation: The generated potential solutions could contain errors or bugs. Despite implementing a majority voting system to lessen this issue, it cannot completely eliminate the chance of bugs in the code generation process. For example, in the “HumanEval/79” sample, all the generated solutions failed to correctly “decimal_to_binary(0)” as “db0db”. Detailed examples can be found in Fig. 16 of Appendix D.
303
+
304
+ Math Problems There are two major types of errors in factuality detection for math problems: (1) Round-off error: Round-off errors can occur during numerical calculations in Python. For example, FACTOOL $\mathrm { G P T } { \cdot } 4$ incorrectly classify the math calculation $^ { \cdot \cdot } 6 0 4 4 4 0 3 4 \quad / \quad 1 2 = 5 0 3 7 0 0 2 . 8 3 ^ { \cdot }$ as “False”. (2) Reasoning error: Since the claims extracted by FACTOOL only involve mathematical calculations, FACTOOL will not verify the reasoning process of the mathematical solution. For example, for the question “Kylar went to the store to buy glasses for his new apartment. One glass costs $\$ 5$ , but every second glass costs only $60 \%$ of the price. Kylar wants to buy 5364765 glasses. How much does he need to pay for them?”, the ChatGPT generated response contains reasoning error that incorrectly substitute the total cost as $^ { * * } 5 , 3 6 4 , 7 6 5 \ \star 5 ^ { * }$ . However, since FACTOOL only checks math calculation errors, FACTOOL GPT-4 did not identify the reasoning error. Detailed examples can be found in Fig. 17 of Appendix D.
305
+
306
+ Scientific Literature Review There are two major types of errors in factuality detection for scientific literature review: (1) Errors in title matching: Title matching can sometimes be problematic due to abbreviations in the generated citations or the retrieved title. For example, although the paper “MDMA-assisted psychotherapy for treatment of PTSD: study design and rationale for phase 3 trials based on pooled analysis of six phase 2 randomized controlled trials exists, FACTOOL GPT-4 identify the paper title as incorrect. (2) Errors in author matching: the author matching process might sometimes not be robust. For example, although the authors of “Language Models are Unsupervised Multitask Learners" are indeed “Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever, FACTOOL GPT-4 identify the author list as incorrect. Detailed examples can be found in Fig. 18 of Appendix D.
307
+
308
+ # C PROMPTS
309
+
310
+ We list the claim extraction, query generation, and agreement verification prompts used in this paper. All the prompts listed are user prompts. We use the same system prompt “You are a brilliant assistant.”
311
+
312
+ # [KB-Based QA]
313
+
314
+ You are given a piece of text that includes knowledge claims. A claim is a statement that asserts something as true or false, which can be verified by humans.
315
+
316
+ # [Task]
317
+
318
+ Your task is to accurately identify and extract every claim stated in the provided text. Then, resolve any coreference (pronouns or other referring expressions) in the claim for clarity. Each claim should be concise (less than 15 words) and self-contained.
319
+
320
+ Your response MUST be a list of dictionaries. Each dictionary should contains the key "claim", which correspond to the extracted claim (with all coreferences resolved). You MUST only respond in the format as described below. DO NOT RESPOND WITH ANYTHING ELSE. ADDING ANY OTHER EXTRA NOTES THAT VIOLATE THE RESPONSE FORMAT IS BANNED. START YOUR RESPONSE WITH ’[’.
321
+
322
+ # [Response Format]
323
+
324
+ [{"claim": "Ensure that the claim is fewer than 15 words and conveys a complete idea. Resolve any coreference (pronouns or other referring expressions) in the claim for clarity." },... ]
325
+
326
+ # Here are two examples:
327
+
328
+ # [text]:
329
+
330
+ Tomas Berdych defeated Gael Monfis 6-1, 6- 4 on Saturday. The sixth-seed reaches Monte Carlo Masters final for the first time . Berdych will face either Rafael Nadal or Novak Djokovic in the final.
331
+
332
+ #
333
+
334
+ [{"claim": "Tomas Berdych defeated Gael Monfis 6-1, 6-4"}, {"claim": "Tomas Berdych defeated Gael Monfis 6-1, 6-4 on Saturday"}, {"claim": "Tomas Berdych reaches Monte Carlo Masters final"}, {"claim": "Tomas Berdych is the sixth-seed"}, {"claim": "Tomas Berdych reaches Monte Carlo Masters final for the first time"}, {"claim": "Berdych will face either Rafael Nadal or Novak Djokovic"}, {"claim": "Berdych will face either Rafael Nadal or Novak Djokovic in the final"}]
335
+
336
+ #
337
+
338
+ Tinder only displays the last 34 photos - but users can easily see more. Firm also said it had improved its mutual friends feature.
339
+
340
+ # [response]:
341
+
342
+ [{"claim": "Tinder only displays the last photos"}, {"claim": "Tinder only displays the last 34 photos"}, {"claim": "Tinder users can easily see more photos"}, {"claim": "Tinder said it had improved its feature"}, {"claim": "Tinder said it had improved its mutual friends feature"}] Now complete the following:
343
+
344
+ [text]: {input_text} [response]:
345
+
346
+ # [Math Problems]
347
+
348
+ You are given a math problem and a potential solution to the math problem.
349
+
350
+ # [Task]
351
+
352
+ Your task is to identify all the math calculations that involve arithmetic operations between known real numbers within the potential solution. However, do not include math calculations that contain variable(s).
353
+
354
+ Your response MUST be a list of dictionaries. Each dictionary should contains 2 key - "math_calculation" and "calculated_answer", which correspond to the extracted math calculation, and the calculated answer within the potential solution. You MUST only respond in the format as described below. DO NOT RESPOND WITH ANYTHING ELSE. ADDING ANY OTHER EXTRA NOTES THAT VIOLATE THE RESPONSE FORMAT IS BANNED. START YOUR RESPONSE WITH ’[’.
355
+
356
+ # [Response format]:
357
+
358
+ [{"math_calculation": "Extracted math calculation involving real numbers within the potential solution. Do not include math calculations that contains variable(s). Do not include units such as \$, $\%$ , etc.", "calculated_answer": "The calculated answer for the extracted math calculation."},...]
359
+
360
+ # Here are two examples:
361
+
362
+ # [math problem]:
363
+
364
+ What is the area of a circle with a diameter of 10 inches?
365
+
366
+ # [potential solution]:
367
+
368
+ To find the area, we first calculate the radius as the diameter divided by 2, so the radius is $1 0 / 2 = 5$ inches. Then, we use the formula for the area of a circle, which is $\pi r ^ { 2 }$ . Plugging in the radius we get, Area $\ c = \pi 5 ^ { 2 } = 7 8 . 5 \bar { 4 }$ square inches.
369
+
370
+ #
371
+
372
+ [{"math_calculation": $" 1 0 / 2 "$ , "calculated_answer": "5"}, {"math_calculation": $" \pi * 5 ^ { 2 \ : , }$ , "calculated_answer": $\mathrm { " } 7 8 . 5 4 \mathrm { " } \} ]$
373
+
374
+ # [math problem]:
375
+
376
+ A store originally sold a shirt for \$45. They are offering a $20 \%$ discount on the shirt. How much will the shirt cost now?
377
+
378
+ # [potential solution]:
379
+
380
+ # [Scientific Literature Review]
381
+
382
+ You are given a piece of text that mentions some scientific literature.
383
+
384
+ # [Task]
385
+
386
+ Your task is to accurately find all papers mentioned in the text and identify the title, author(s), and publication year for each paper. The response should be a list of dictionaries, with each dictionary having keys "paper_title", "paper_author(s)", and "paper_pub_year", which correspond to the title of the paper, the authors of the paper, and the publication year of the paper.
387
+
388
+ # The following is the given text:
389
+
390
+ #
391
+
392
+ {input_text}
393
+
394
+ You MUST only respond in the format as described below. DO NOT RESPOND WITH ANYTHING ELSE. ADDING ANY OTHER EXTRA NOTES THAT VIOLATE THE RESPONSE FORMAT IS BANNED. START YOUR RESPONSE WITH ’[’.
395
+
396
+ # [Response Format]:
397
+
398
+ [ { "paper_title": "Title of the paper.", "paper_author(s)": "Author(s) of the paper.", "paper_pub_year": "Year of the paper published." }, ... ]
399
+
400
+ # [KB-based QA]
401
+
402
+ You are a query generator designed to help users verify a given claim using search engines. Your primary task is to generate a Python list of two effective and skeptical search engine queries. These queries should assist users in critically evaluating the factuality of a provided claim using search engines. You should only respond in format as described below (a Python list of queries). PLEASE STRICTLY FOLLOW THE FORMAT. DO NOT RETURN ANYTHING ELSE. START YOUR RESPONSE WITH ’[’. [response format]: [’query1’, ’query2’]
403
+ Here are 3 examples: [claim]: The CEO of twitter is Bill Gates. [response]: ["Who is the CEO of twitter?", "CEO Twitter"]
404
+ [claim]: Michael Phelps is the most decorated Olympian of all time. [response]: ["Who is the most decorated Olympian of all time?", "Michael Phelps"]
405
+ [claim]: ChatGPT is created by Google. [response]: ["Who created ChatGPT?", "ChatGPT"]
406
+ Now complete the following: [claim]: input [response]:
407
+
408
+ # [Math Problems]
409
+
410
+ You are given a math calculation and its corresponding calculated answer.
411
+
412
+ # [Task]
413
+
414
+ Your task is to write an executable Python snippet that validate the accuracy of the math calculation against the calculated answer. The Python snippet should print ’True’ if the calculated answer is correct, and ’False’ otherwise.
415
+ Your response MUST be a dictionary with key "python_snippet", which correspond to the executable python snippet.
416
+ [math calculation]: {math_calculation}
417
+ [calculated answer]: {calculated_answer}
418
+ You MUST only respond in the format as described below. DO NOT RESPOND WITH ANYTHING ELSE. ADDING ANY OTHER EXTRA NOTES THAT VIOLATE THE RESPONSE FORMAT IS BANNED. START YOUR RESPONSE WITH ’{’.
419
+
420
+ # [Response format]:
421
+
422
+ { "python_snippet": "An executable Python snippet that validates the accuracy of the math calculation against the calculated answer. The Python snippet should print ’True’ if the calculated answer is correct, and ’False’ otherwise." }
423
+
424
+ # [Code Potential Solution Generation]
425
+
426
+ Please solve the given coding question. Make sure that the solution is optimized and correct. You MUST use Python to solve the coding question. Your response MUST be a dictionary with keys "reasoning" and "python_solution", which correspond to the reasoning and Python implementations of the function {entry_point}. The following is the given coding question - [coding question]: {input_question} You MUST only respond in the format as described below. DO NOT RESPOND WITH ANYTHING ELSE. ADDING ANY OTHER EXTRA NOTES THAT VIOLATE THE RESPONSE FORMAT IS BANNED. START YOUR RESPONSE WITH ’{’. [response format]: { "reasoning": "Reasoning for solution.", "python_solution": "Python implementation of the function {entry_point}. Include only the implementation of the function itself. Ensure the output of the function aligns with its specified return type." }
427
+
428
+ # [Code Unit test Generation]
429
+
430
+ Please generate 3 distinct function calls for the given coding question to test the functionality of the function {entry_point} that attempts to solve the provided coding question.
431
+ Your response must be a dictionary with 3 keys - "function_call_1", "function_call_2", "function_call_3", which correspond to the 3 distinct function calls for function {entry_point}. The following is the given coding question -
432
+ [coding question]: {input_question}
433
+ You MUST only respond in the format as described below. DO NOT RESPOND WITH ANYTHING ELSE. ADDING ANY OTHER EXTRA NOTES THAT VIOLATE THE RESPONSE FORMAT IS BANNED. START YOUR RESPONSE WITH ’{’.
434
+ [response format]: { "function_call_1": "First function call for function {entry_point}. Do not include anything else.", "function_call ${ } _ { - 2 " }$ : "Second function call for function {entry_point}. Do not include anything else.", "function_call_3": "Third function call for function {entry_point}. Do not include anything else." }
435
+
436
+ #
437
+
438
+ You are given a piece of text. Your task is to identify whether there are any factual errors within the text. When you are judging the factuality of the given text, you could reference the provided evidences if needed. The provided evidences may be helpful. Some evidences may contradict to each other. You must be careful when using the evidences to judge the factuality of the given text. When The response should be a dictionary with four keys - "reasoning", "factuality", "error", and "correction", which correspond to the reasoning, whether the given text is factual or not (Boolean - True or False), the factual error present in the text, and the corrected text. The following is the given text [text]: claim The following is the provided evidences [evidences]: evidence You should only respond in format as described below. DO NOT RETURN ANYTHING ELSE. START YOUR RESPONSE WITH $\because \{ \{ \} ^ { * }$ . [response format]: {{ "reasoning": "Why is the given text factual or non-factual? Be careful when you said something is non-factual. When you said something is non-factual, you must provide mulitple evidences to support your decision.", "error": "None if the text is factual; otherwise, describe the error.", "correction": "The corrected text if there is an error.", "factuality": True if the given text is factual, False otherwise. }}
439
+
440
+ # [Scientific Literature Review]
441
+
442
+ Please generate 3 distinct function calls for the given coding question to test the You are provided with two inputs, a string (string1) containing several names, and a list (list1) also containing names. Your task is to assess whether all the last names mentioned in string1 are included in list1.
443
+ You should only respond in format as described below. DO NOT RETURN ANYTHING ELSE. START YOUR RESPONSE WITH ’{{’. [response format]: {{ "reasoning": "Explanation on whether all the last names in string1 are found within list1", "factuality": This will be True if all last names from string1 are present in list1, and False otherwise. }}
444
+ Example 1: [string1]: "J. Devlin and M. Chang" [list1]: ["Devlin", $\ " \mathbf { M }$ Chang", "Kristina Toutanova"] [response]: "reasoning": "string1 contains 2 last names ’Devlin’ and ’Chang’. Both of these last names are present in list1.", "factuality": True
445
+ Example 2: [string1]: "Tom Brown et. al" [list1]: ["Y. Lecun", "G. Hinton"] [response]: "reasoning": "string 1 contains 1 last name ’Brown’. Brown is not present in list1.", "factuality": False
446
+ Complete the following: [string1]: string1 [list1]: list2 [response]:
447
+
448
+ # D EXAMPLE CASES OF FACTOOL
449
+
450
+ We list the example cases of FACTOOL in each scenario.
451
+
452
+ ![](images/888001434b4c7c87cdd7cc97203373ff0a6955bc66ecde1b48b38bf1e33668bb.jpg)
453
+
454
+ # [Fact-checking recent events, discoveries, or news]
455
+
456
+ # [Fact-checking high-precision statistics]
457
+
458
+ {
459
+ "claim": "Argentina has not won the World Cup since 1986",
460
+ "label": false,
461
+ "with_tool_classification": false,
462
+ "with_tool_reasoning": "The given text states that Argentina has not won the World Cup since 1986. However, multiple pieces of evidence suggest that Argentina won the World Cup in 2022.",
463
+ "queries": ["Argentina World Cup wins since 1986", "Last time Argentina won World Cup"],
464
+ "evidences": ["Argentina is one of the most successful teams in the tournament’s history, having won three World Cups: in 1978, 1986, 2022. Argentina has also been runner up three times: in 1930, 1990 and 2014. In 18 World Cup tournaments, Argentina has 47 victories in 88 matches.", "Argentina is one of the most successful teams in the tournament’s history, having won three World Cups: in 1978, 1986, 2022. Argentina has also been runner up ...", "Previously, the last time Argentina won the World Cup was 1986, when it defeated Germany to win its second title in three tournaments.", "Argentina have won the FIFA World Cup three times 2013 in 1978, 1986 and ˘ 2022. They have reached the final six times, including a second-place ...", "The Argentines have won two FIFA World Cups, in 1978 and 1986. They have placed second three times before, in 1930, 1990, and 2014.", "Argentina last won the FIFA World Cup in 1986, defeating West Germany in the championship round, 3-2. Argentina World Cup Wins. Argentina’s ..."]
465
+ }
466
+ {
467
+ "claim": "The most valuable NFT ever sold is a digital artwork called ’Everydays: The First 5000 Days’ ",
468
+ "label": false,
469
+ "with_tool_classification": false,
470
+ "with_tool_reasoning": "The given text states that the most valuable NFT ever sold is ’Everydays: The First 5000 Days’. According to the provided evidence, ’The First 5000 Days’ is the second most expensive NFT ever sold, with ’Merge’ being the most expensive one.",
471
+ "queries": ["Most valuable NFT ever sold", "Everydays: The First 5000 Days"],
472
+ "evidences": ["The Most Expensive NFTs Ever Sold 1. Merge - 2014 US \$91.8M. Pak - Merge. . . . 2. The First 5000 Days - 2014 US\$69.3M. Beeple - 2014 The First 5000 Days. . . . 3. Clock - 2014 US\$52.7M. Julian Assange & Pak - 2014 Clock. . . . 4. HUMAN ONE - 2014 US\$29M. Beeple - 2014 HUMAN ONE. . . . 5. CryptoPunk #5822 - 2014 US\$23.7M. CryptoPunk #5822.", "Everydays: the First 5000 Days: Work of art.", "Everydays: the First 5000 Days is a digital work of art created by Mike Winkelmann, known professionally as Beeple. The work is a collage of 5000 digital images created by Winkelmann for his Everydays series.", "Everydays: the First 5000 Days Artist: Mike Winkelmann.", "Everydays: the First 5000 Days Owner: Vignesh Sundaresan (MetaKovan).", "Everydays: the First 5000 Days Medium: Digital (JPEG)."]
473
+ }
474
+ {
475
+ "task_id": "HumanEval/2",
476
+ "prompt":
477
+
478
+ d e f t r u n c a t e _ n u m b e r ( number : f l o a t ) $- >$ f l o a t : " " " G i v e n a p o s i t i v e f l o a t i n g p o i n t n u m b e r , i t c a n b e d e c o m p o s e d i n t o a n d i n t e g e r p a r t ( l a r g e s t i n t e g e r s m a l l e r t h a n g i v e n n u m b e r ) a n d d e c i m a l s ( l e f t o v e r p a r t a l w a y s s m a l l e r t h a n 1 ) . R e t u r n t h e d e c i m a l p a r t o f t h e n u m b e r . " " "
479
+
480
+ "entry_point": "truncate_number", "completion":
481
+
482
+ d e f t r u n c a t e _ n u m b e r ( n u m b e r : f l o a t ) $- >$ f l o a t : i n t e g e r _ p a r t $=$ n u m b e r / / 1 d e c i m a l _ p a r t $=$ n u m b e r − i n t e g e r _ p a r t r e t u r n d e c i m a l _ p a r t
483
+
484
+ "result": "passed",
485
+ "passed": true,
486
+ "with_tool_classification": true,
487
+ "testcases_input": ["truncate_number(4.56)", "tr
488
+ cate_number(0.123)", "truncate_number(19.999)"],
489
+ "multi_solutions": [
490
+
491
+ d e f t r u n c a t e _ n u m b e r ( n u m b e r : f l o a t ) $- >$ f l o a t : r e t u r n number − i n t ( number )
492
+
493
+ d e f t r u n c a t e _ n u m b e r ( n u m b e r : f l o a t ) $- >$ f l o a t : r e t u r n number − i n t ( number )
494
+
495
+ d e f t r u n c a t e _ n u m b e r ( number : f l o a t ) $- >$ f l o a t : r e t u r n number − i n t ( number )
496
+
497
+ d e f t r u n c a t e _ n u m b e r ( number : f l o a t ) $- >$ f l o a t : i n t e g e r _ p a r t $=$ n u m b e r / / 1 d e c i m a l _ p a r t $=$ n u m b e r − i n t e g e r _ p a r t r e t u r n d e c i m a l _ p a r t
498
+
499
+ ]
500
+ "exec_result": [[0.5599999999999996, 0.5599999999999996, 0.5599999999999996, 0.5599999999999996], [0.123, 0.123, 0.123, 0.123], [0.9989999999999988, 0.9989999999999988, 0.9989999999999988, 0.9989999999999988]]
501
+ }
502
+ {
503
+ "task_id": "HumanEval/57",
504
+ "prompt":
505
+
506
+ d e f m o n o t o n i c ( l : l i s t ) : " " " R e t u r n T r u e i f l i s t e l e m e n t s a r e m o n o t o n i c a l l y i n c r e a s i n g o r d e c r e a s i n g . " " "
507
+
508
+ "entry_point": "monotonic", "completion":
509
+
510
+ d e f m o n o t o n i c ( l : l i s t ) : i f l e n $( \mathrm { ~ l ~ } ) \ < = \ 1$ : r e t u r n True i n c r e a s i n g $=$ a l l ( $\mathrm { ~ l ~ } [ \mathrm { ~ i ~ } ] \ \ < = \ \mathrm { ~ l ~ } [ \mathrm { ~ i ~ } + 1 ]$ f o r i i n r a n g e ( l e n ( l ) − 1 ) ) d e c r e a s i $\mathrm { ~ \bf ~ { ~ \underline { ~ } { ~ g ~ } ~ } ~ } = \mathrm { ~ \bf ~ a ~ l ~ l ~ } ( \mathrm { ~ \bf ~ l ~ } [ \mathrm { ~ i ~ } ] \mathrm { ~ \bf ~ { ~ \underline { ~ } { ~ } { ~ \bf ~ \succ ~ } ~ } ~ } = \mathrm { ~ \bf ~ l ~ } [ \mathrm { ~ i ~ } + 1 ] $ f o r i i n r a n g e ( l e n ( l ) − 1 ) ) r e t u r n i n c r e a s i n g o r d e c r e a s i n g
511
+
512
+ "result": "passed",
513
+ "passed": true,
514
+ "with_tool_classification": true,
515
+ "testcases_input": ["monotonic([1, 2, 3, 4, 5])", "monotonic([5, 4, 3,
516
+ 2, 1])", "monotonic([1, 3, 5, 4, 7])"],
517
+
518
+ "multi_solutions": [
519
+
520
+ d e f m o n o t o n i c ( l : l i s t ) : i f l e n ( l ) $< ~ 2$ : r e t u r n True i n c r e a s i n g $=$ d e c r e a s i n g $=$ T r u e f o r i i n r a n g e ( l e n ( l ) − 1 ) : i f $\begin{array} { r } { \mathrm { ~ l ~ [ ~ i ~ ] ~ } < \mathrm { ~ l ~ [ ~ i ~ \ + ~ \ 1 ~ ] ~ } ; } \end{array}$ : d e c r e a s i n g $=$ F a l s e i f $\mathrm { ~ l ~ } [ \mathrm { ~ i ~ } ] ~ > ~ \mathrm { ~ l ~ } [ \mathrm { ~ i ~ } ~ + ~ 1 ]$ : i n c r e a s i n g $=$ F a l s e i f n o t i n c r e a s i n g and n o t d e c r e a s i n g : r e t u r n F a l s e r e t u r n True
521
+
522
+ d e f m o n o t o n i c ( l : l i s t ) : i f l e n $( \ 1 \ ) \ < \ 2$ : r e t u r n True d i r e c t i o n $= \mathrm { ~ l ~ } [ 1 ] \ - \ 1 [ 0 ]$ f o r i i n r a n g e ( 2 , l e n ( l ) ) : i f d i r e c t i o n $\scriptstyle = = \atop \ 0$ : d i r e c t i o n $\mathbf { \Sigma } = \mathrm { ~ l ~ } [ \mathrm { ~ i ~ } ] \ \mathbf { \Sigma } - \mathrm { ~ l ~ } [ \mathrm { ~ i ~ } - 1 ]$ c o n t i n u e i f $\begin{array} { r l } { \mathrm { ~ ( ~ l ~ [ ~ i ~ ] ~ - ~ } \mathrm { ~ l ~ [ ~ i ~ - ~ 1 ~ ] ~ ) ~ } } & { { } : } \end{array}$ $^ *$ d i r e c t i o n $< ~ 0$ : r e t u r n F a l s e r e t u r n True
523
+
524
+ d e f m o n o t o n i c ( l : l i s t ) : i f l e n $( \ 1 \ ) \ < \ 2$ : r e t u r n True d i r e c t i o n $= \mathrm { ~ l ~ } [ 1 ] \ - \ 1 [ 0 ]$ f o r i i n r a n g e ( 2 , l e n ( l ) ) : i f d i r e c t i o n $\scriptstyle = = \atop \ 0$ : d i r e c t i o n $\mathbf { \Sigma } = \mathrm { ~ l ~ [ ~ i ~ ] ~ } - \mathrm { ~ l ~ [ ~ i ~ \mathbf ~ { ~ - ~ } ~ } 1 ]$ c o n t i n u e i f $\left( \mathrm { ~ l ~ } [ \mathrm { ~ i ~ } ] \ - \ \mathrm { ~ l ~ } [ \mathrm { ~ i ~ } \ - \ \mathrm { ~ 1 ~ } ] \right)$ $| { \bf \Phi } ) { \bf \Psi } *$ d i r e c t i o n $< ~ 0$ : r e t u r n F a l s e r e t u r n True
525
+
526
+ d e f m o n o t o n i c ( l : l i s t ) : i f l e n ( l ) $\scriptstyle < = \ 1$ : r e t u r n True i n c r e a s i n $\begin{array} { r } { \mathrm { ~ ~ \gamma ~ } _ { \mathrm { ~ \bf ~ \tau ~ } } = \mathrm { ~ \bf ~ a ~ l ~ l ~ } ( \mathrm { ~ l ~ } [ \mathrm { ~ i ~ } ] \mathrm { ~ ~ \Sigma ~ } < = \mathrm { ~ \bf ~ l ~ } [ \mathrm { ~ i ~ } + 1 ] } \end{array}$ f o r i i n r a n g e ( l e n ( l ) − 1 ) ) d e c r e a s i n $\begin{array} { r } { \mathrm { ~ ~ \gamma ~ } _ { \mathrm { ~ \bf ~ \tau ~ } } = \mathrm { ~ \bf ~ a ~ l ~ l ~ } ( \mathrm { ~ \bf ~ l ~ } [ \mathrm { ~ i ~ } ] \mathrm { ~ ~ \Sigma ~ } > = \mathrm { ~ \bf ~ l ~ } [ \mathrm { ~ i ~ } + 1 ] } \end{array}$ f o r i i n r a n g e ( l e n ( l ) − 1 ) ) r e t u r n i n c r e a s i n g o r d e c r e a s i n g
527
+
528
+ ]
529
+ "exec_result": [[true, true, true, true], [true, true, true, true], [false,
530
+ false, false, false]]
531
+ }
532
+
533
+ ![](images/07fb9d099a1981d08c7633b913c45461b92b16b7803ae8389a31954bde419c54.jpg)
534
+ Figure 12: Examples of code claims verified by FACTOOL ChatGPT and FACTOOL GPT-4. The queries generated, evidences collected, the reasoning process, and the final decisions of FACTOOL ChatGPT and FACTOOL GPT-4 are reported.
535
+
536
+ ![](images/754b856f63ece987c362ea370674506f47529e2ea2115d7f456d9707856106b3.jpg)
537
+ Figure 13: Examples of math claims verified by FACTOOL ChatGPT and FACTOOL GPT-4. The full response of FACTOOL $\mathrm { G P T } { \cdot } 4$ is reported, including the queries generated, evidences collected, the reasoning process, and the final decision.
538
+
539
+ ![](images/17aa842bfda47df39e2e977883bacbbe97b84488a26f901ce27ba695f942f075.jpg)
540
+ Figure 14: Examples of scientific claims verified by FACTOOL ChatGPT and FACTOOL GPT-4. The full response of FACTOOL ChatGPT and FACTOOL $\mathrm { G P T } { \cdot } 4$ is reported, including the queries generated, evidences collected, the reasoning process, and the final decision.
541
+
542
+ <table><tr><td>[Reasoning Error] &quot;claim&quot;:&quot;Jupiter is less dense than Saturn&quot;, &quot;label&quot;: false, &quot;with_tool_classification&quot;: true, &quot;with_tool_reasoning&quot;:&quot;The given text is fac- tual because both provided evidences support the claim that Jupiter is less dense than Saturn. The first evidence provides numerical data on the densities of Jupiter and Saturn,and the sec- ond evidence confirms that Saturn is the least</td><td>[Conflicting Evidences] &quot;claim&quot;: &quot;Jupiter has a density of 1.33 grams per cubic centimeter&quot;, &quot;label&quot;: true, &quot;with_tool_classification&quot;: false, &quot;with_tool_reasoning&quot;:&quot;The given text is mostly in line with the provided evidences. There is a minor discrepancy between the two evidences,with one stating the density of Jupiter as 1.326 g/cm00b3 and the other as 1.33 g/cm0ob3. However, the difference is minimal</td><td>[Ambiguity in descriptions] &quot;claim&quot;: &quot;Fortune cookies are enjoyed by peo- ple all over the world.&quot;, &quot;label&quot;: false, &quot;with_tool_classification&quot;: true, &quot;with_tool_reasoning&quot;:&quot;The given text states that fortune cookies are enjoyed by people all over the world. While the evidence provided does not explicitly mention the global enjoy- ment of fortune cookies,it does mention that</td></tr><tr><td>dense planet in the solar system.&quot;, &quot;queries&quot;: [&quot;Jupiter Vs Saturn density&quot;,&quot;Which planet is less dense Jupiter or Saturn?&quot;], &quot;evidences&quot;:[&quot;The density of Jupiter is 1,33 g/cmOOb3 whereas the density of Saturn is only 0,687 g/cmoob3.If Saturn were the same den- sityas Jupiter, it would have a radius of 30.079 km.&quot;,&quot;Jupiter is the largest planet in the solar system,but it&#x27;s Saturn2O14the solar system&#x27;s second largest planet2O14that takes the prize for least dense. Aug 1,2019&quot;] 1</td><td>and could be due to rounding.&quot;, &quot;queries&quot;:[&quot;Jupiter density grams per cubic centimeter&quot;,&quot;Density of Jupiter&quot;], &quot;evidences&quot;:[&quot;Density of Jupiter: However,at 1.326 g/cm3,it is also the second-most dense of the gas giants.Feb 17,2016&quot;,&quot;1.33 g/cm00b3&quot;]</td><td>3 billion fortune cookies are made each year globally, with the majority consumed in the US. This suggests that fortune cookies are indeed en- joyed by people in various parts of the world.&quot;, &quot;queries&quot;:[&quot;Originof fortune cookies&quot;,&quot;Popu- larity of fortune cookies worldwide&quot;], &quot;evidences&quot;:[&quot;Japan&quot;,&quot;Thereareapproxi- mately 3 billion fortune cookies made each year globally,the majority of them consumed in the US.The largest manufacturer of the cookies is Wonton Food,Inc.,headquartered in Brooklyn, New York.They make over 4.5 million fortune cookies per day.&quot;]</td></tr></table>
543
+
544
+ # [Limited variety in synthetic testcases]
545
+
546
+ "task_id": "HumanEval/64",
547
+ "prompt": "Write a function vowels_count(s) which takes a string representing a word as input and returns the number of vowels in the string. Vowels in this case are ’a’, ’e’, ’i’, ’o’, ’u’. Here, ’y’ is also a vowel, but only when it is at the end of the given word.", "entry_point": "vowels_count",
548
+
549
+ "completion":
550
+
551
+ d e f v o w e l s _ c o u n t ( s ) : vowels $\mathbf { \Sigma } = \mathbf { \Sigma } [ \mathbf { \Sigma } ^ { \prime } { \bf { a } } ^ { \prime }$ , ' e ' , ' i ' , ' o ' , ' u ' ] c o u n t $\mathit { \Theta } = \mathit { \Theta } 0$ f o r i i n r a n g e ( l e n ( s ) ) : i f s [ i ] i n v o w e l s : c o u n t $\scriptstyle + = \ 1$ i f i == l e n ( s ) − 1 and $\mathbf { { s } } \left[ \mathrm { ~ i ~ } \right] \mathbf { { \sigma } } = \mathbf { { \sigma } } ^ { \prime } \mathbf { { y } } ^ { \prime }$ c o u n t $\scriptstyle + = \ 1$ r e t u r n c o u n t
552
+
553
+ "result": "failed: AssertionError: Test $2 "$ ,
554
+ "passed": false,
555
+ "with_tool_classification": true,
556
+ "testcases_input": ["vowels_count(’encyclopedia’)", "vow
557
+ els_count(’rhythm’)", "vowels_count(’beautiful’)"],
558
+ "multi_solutions": [
559
+
560
+ d e f v o w e l s _ c o u n t ( s ) : vowels $=$ ' a e i o u ' c o u n t $\mathit { \Theta } = \mathit { \Theta } 0$ f o r i , c i n e n u m e r a t e ( s ) : i f c . l o w e r ( ) i n v o w e l s : c o u n t $\scriptstyle + = \ 1$ e l i f c . l o w e r $\mathrm { ( ) \Sigma \ = \Sigma ^ { \prime } \times \Sigma ^ { \prime } }$ and $\begin{array} { r l r } { \mathbf { i } } & { { } = } & { \mathbf { l e n } } \end{array}$ ( c o u n t $\scriptstyle + = \ 1$ r e t u r n c o u n t
561
+
562
+ d e f v o w e l s _ c o u n t ( s ) : vowels $=$ ' a e i o u ' c o u n t $\mathit { \Theta } = \mathit { \Theta } 0$ f o r c h a r i n s : i f c h a r . l o w e r ( ) i n v o w e l s : c o u n t $\scriptstyle + = \ 1$ i f s [ − 1 ] . l o w e r $\mathrm { ~ ~ ( ~ ) ~ } = = \mathrm { ~ ~ ' ~ } { \bf y } ^ { \mathrm { ~ ~ } }$ : c o u n t $\scriptstyle + = 1$ r e t u r n c o u n t
563
+
564
+ d e f v o w e l s _ c o u n t ( s ) : vowels $=$ ' a e i o u ' c o u n t $\mathit { \Theta } = \mathit { \Theta } 0$ f o r c h a r i n s : i f c h a r . l o w e r ( ) i n v o w e l s : c o u n t $\scriptstyle + = \ 1$ i f s [ − 1 ] . l o w e r $\mathrm { ~ ~ ( ~ ) ~ } = = \mathrm { ~ ~ ' ~ } { \bf y } ^ { \mathrm { ~ ~ } }$ ' : c o u n t $\scriptstyle + = 1$ r e t u r n c o u n t
565
+
566
+ d e f v o w e l s _ c o u n t ( s ) : vowels $\mathbf { \Sigma } = \mathbf { \Sigma } [ \mathbf { \Sigma } ^ { \prime } { \bf { a } } ^ { \prime }$ , ' e ' , ' i ' , ' o ' , ' u ' ] c o u n t $\mathit { \Theta } = \mathit { \Theta } 0$ f o r i i n r a n g e ( l e n ( s ) ) : i f s [ i ] i n v o w e l s : c o u n t $\scriptstyle + = \ 1$ i f $\mathbf { i } \ \mathbf { \Sigma } = \ \mathbf { l e n } \left( \textrm { s } \right) \ - \ \mathbf { l }$ and $\mathbf { { s } } \left[ \mathrm { ~ i ~ } \right] \mathbf { { \sigma } } = \mathbf { { \sigma } } ^ { \prime } \mathbf { { y } } ^ { \prime }$ : c o u n t $\scriptstyle + = \ 1$ r e t u r n c o u n t
567
+
568
+ ]
569
+ "exec_result": [[5, 5, 5, 5], [0, 0, 0, 0], [5, 5, 5, 5]]
570
+ }
571
+
572
+ # [Potential errors in code generation]
573
+
574
+ "task_id": "HumanEval/79",
575
+ "prompt":
576
+ d e f d e c i m a l _ t o _ b i n a r y ( d e c i m a l ) :
577
+ " " " You w i l l b e g i v e n a n u m b e r i n d e c i m a l f o r m
578
+ a n d y o u r t a s k i s t o c o n v e r t i t t o b i n a r y f o r m a t .
579
+ T h e f u n c t i o n s h o u l d r e t u r n a s t r i n g ,
580
+ w i t h e a c h c h a r a c t e r r e p r e s e n t i n g a b i n a r y n u m b e r .
581
+ E a c h c h a r a c t e r i n t h e s t r i n g w i l l b e ' 0 ' o r ' 1 ' .
582
+ T h e r e w i l l b e an e x t r a c o u p l e o f
583
+ c h a r a c t e r s ' d b ' a t t h e b e g i n n i n g
584
+ a n d a t t h e e n d o f t h e s t r i n g .
585
+ T h e e x t r a c h a r a c t e r s a r e t h e r e
586
+ t o h e l p w i t h t h e f o r m a t .
587
+ "entry_point": "decimal_to_binary",
588
+ "completion":
589
+ d e f d e c i m a l _ t o _ b i n a r y ( d e c i m a l ) : b i n a r y _ l i s t $\begin{array} { r l } { \mathbf { \tau } } & { { } = \mathbf { \tau } \left[ \begin{array} { l } { \mathbf { \tau } } \end{array} \right] } \end{array}$ y w h i l e d e c i m a l $> ~ 0$ : r e m a i n d e r $=$ d e c i m a l $\% 2$ b i n a r y _ l i s t . a p p e n d ( s t r ( r e m a i n d e r ) ) d e c i m a l $=$ d e c i m a l / / 2 b i n a r y _ l i s t . r e v e r s e ( ) b i n a r y _ s t r i n g $=$ ' ' . j o i n ( b i n a r y _ l i s t ) r e t u r n ' db ' $^ +$ b i n a r y _ s t r i n g $^ +$ ' d b '
590
+ "result": "failed: AssertionError: ",
591
+ "passed": false,
592
+ s ) − 1 :"with_tool_classification": true,
593
+ "testcases_input": ["decimal_to_binary(10)", "deci
594
+ mal_to_binary(255)", "decimal_to_binary(0)"],
595
+ "multi_solutions": [ d e f d e c i m a l _ t o _ b i n a r y ( d e c i m a l ) : binary_num $=$ ' ' w h i l e d e c i m a l $> ~ 0$ : r e m a i n d e r $=$ d e c i m a l $\% 2$ d e c i m a l $=$ d e c i m a l / / 2 binary_num $=$ s t r ( r e m a i n d e r ) $^ +$ binary_num r e t u r n ' db ' $^ +$ binary_num $^ +$ ' d b ' d e f d e c i m a l _ t o _ b i n a r y ( d e c i m a l ) : b i n a r y $=$ w h i l e d e c i m a l $> ~ 0$ : r e m a i n d e r $=$ d e c i m a l $\% 2$ d e c i m a l $=$ d e c i m a l / / 2 b i n a r y $=$ s t r ( r e m a i n d e r ) $^ +$ b i n a r y r e t u r n ' db ' $^ +$ b i n a r y $^ +$ ' d b ' d e f d e c i m a l _ t o _ b i n a r y ( d e c i m a l ) : b i n a r y $=$ w h i l e d e c i m a l $> ~ 0$ : r e m a i n d e r $=$ d e c i m a l $\% 2$ d e c i m a l $=$ d e c i m a l / / 2 b i n a r y $=$ s t r ( r e m a i n d e r ) $^ +$ b i n a r y r e t u r n ' db ' $^ +$ b i n a r y $^ +$ ' d b ' d e f d e c i m a l _ t o _ b i n a r y ( d e c i m a l ) : b i n a r y _ l i s t $\begin{array} { r l } { \mathbf { \Psi } } & { { } = \mathbf { \Psi } \left[ \begin{array} { l } { \mathbf { \Psi } } \\ { \mathbf { \Psi } } \end{array} \right] } \end{array}$ w h i l e d e c i m a l $> ~ 0$ : r e m a i n d e r $=$ d e c i m a l $\% 2$ b i n a r y _ l i s t . a p p e n d ( s t r ( r e m a i n d e r ) ) d e c i m a l $=$ d e c i m a l / / 2 b i n a r y _ l i s t . r e v e r s e ( ) b i n a r y _ s t r i n g $=$ ' ' . j o i n ( b i n a r y _ l i s t ) r e t u r n $^ { \prime } \mathrm { d } \mathsf { b } ^ { \prime } +$ b i n a r y _ s t r i n g $\therefore \cdot \mathrm { d } \mathrm { b }$
596
+ ],
597
+ "exec_result": [["db1010db", "db1010db", "db1010db",
598
+ "db1010db"], ["db11111111db", "db11111111db", "db11111111db",
599
+ "db11111111db"], ["dbdb", "dbdb", "dbdb", "dbdb"]]
600
+ } [Round-off error]
601
+ "math_calculation": "60444034 / 12",
602
+ "calculated_answer": "5037002.83",
603
+ "label": true,
604
+ "query": "python_snippet": "calculation $=$ 60444034 / 12; answer $=$ 5037002.83; print(abs(calculation - answer) $<$ 1e-9)",
605
+ "exec_result": "False",
606
+ "with_tool_classification": false
607
+ [Reasoning error]
608
+ "input": "Kylar went to the store to buy glasses for his new apartment. One glass costs $\$ 5$ , but every second glass costs only $60 \%$ of the price. Kylar wants to buy 5364765 glasses. How much does he need to pay for them?",
609
+ "target": 21459061.0,
610
+ "response": "Let’s assume that Kylar buys x glasses at the full price of $\$ 5$ each. Therefore, he will buy (5364765 - x) glasses at a discounted price of $60 \%$ of $\$ 5$ , which is $\$ 3$ . Now, we can set up the equation:
611
+ $5 \mathrm { x } + 3 ( 5 3 6 4 7 6 5 - \mathrm { x } ) = \mathrm { t o }$ tal cost
612
+ Simplifying the equation, we get:
613
+ $5 { \mathrm { x } } + 1 6 0 9 4 2 9 5 - 3 { \mathrm { x } } = { \mathrm { t } }$ otal cost
614
+ $2 { \mathrm { x } } + 1 6 0 9 4 2 9 5 =$ total cost
615
+ Therefore, the total cost of all the glasses will be $2 \mathrm { x } + 1 6 0 9 4 2 9 5$ dollars. Now, we just need to find the value of $\mathbf { X }$ . We know that Kylar wants to buy 5364765 glasses, so we can substitute this value in the equation:
616
+ $2 { \mathrm { x } } + 1 6 0 9 4 2 9 5 =$ total cost
617
+ $2 \mathrm { x } + 1 6 0 9 4 2 9 5 = 5 { , } 3 6 4 { , } 7 6 5 { ^ \circ } ^ { \circ } { } ^ { \circ } { } ^ { \circ } { }$
618
+ $2 \mathrm { x } + 1 6 0 9 4 2 9 5 = 2 6 8 2 3 8 2 5$
619
+ $2 \mathrm { x } = 1 0 7 2 9 5 3 0$
620
+ $\mathrm { x } = 5 3 6 4 7 6 5$
621
+ Therefore, Kylar needs to pay $2 \mathrm { x } + 1 6 0 9 4 2 9 5$ dollars, which is: 2 $5 3 6 4 7 6 5 ) + 1 6 0 9 4 2 9 5 = 2 6 8 2 3 8 2 \div$ 5.
622
+ Hence, Kylar needs to pay \$26823825 for all the glasses.",
623
+ "answer": "26823825",
624
+ "annotation": false,
625
+ "claims": [{"math_calculation": "5364765 - x", "calculated_answer": $" 5 3 6 4 7 6 5 \mathrm { ~ - ~ } \mathbf { x } "$ , "label": true}, {"math_calculation": " $" 0 . 6 0 \ \ast \ 5 "$ , "calculated_answer": "3", "label": true}, {"math_calculation": "5x", "calculated_answer": $" 5 \mathrm { { X } " }$ , "label": true}, {"math_calculation": "3(5364765 - x)", "calculated_answer": "16094295 - 3x", "label": true}, {"math_calculation": $" 5 x + 1 6 0 9 4 2 9 5 - 3 \mathrm { x " }$ , "calculated_answer": " $1 6 0 9 4 2 9 5 + 2 \mathbf { x } ^ { \prime \prime }$ , "label": true}, {"math_calculation": $" 2 x + 1 6 0 9 4 2 9 5 "$ , "calculated_answer": "total cost", "label": "null"}, {"math_calculation": "5364765 $^ *$ $5 "$ , "calculated_answer": "26823825", "label": true}, {"math_calculation": "2(5364765)", "calculated_answer": "10729530", "label": true}, {"math_calculation": $" 2 \mathbf { X } "$ , "calculated_answer": "10729530", "label": "null"}]
626
+ "math_calculation": "5364765 - $\mathbf { X } ^ { \prime \prime }$ , "calculated_answer": "5364765 - $\mathbf { X } ^ { \prime \prime }$ , "label": true, "query": "python_snippet": $\mathbf { \ddot { X } } = 0$ ; math_calculation $=$ $5 3 6 4 7 6 5 - \mathbf { X } ^ { \prime }$ ; calculated_answer $= 5 3 6 4 7 6 5 - \mathbf { X } ;$ ; print(math_calculation $= =$ calculated_answer)", "exec_result": "True", "with_tool_classification": true "math_calculation": $" 0 . 6 0 ~ \ \ast ~ 5 "$ , "calculated_answer": "3", "label": true, "query": "python_snippet": "calculation $= 0 . 6 0 ~ ^ { \ast } ~ 5$ ; answer $= 3$ ; print(calculation $= =$ answer)", "exec_result": "True", "with_tool_classification": true "math_calculation": " $\ " \mathrm { s x } \ " $ , "calculated_answer": " $" 5 \mathrm { { x } " }$ , "label": true, "query": "python_snippet": "def validate_calculation(calculation, answer): return calculation $= =$ answer; print(validate_calculation(’5x’, ’5x’))", "exec_result": "True", "with_tool_classification": true "math_calculation": $" 3 ( 5 3 6 4 7 6 5 \mathrm { ~ - ~ } \mathrm { ~ x } )$ ", "calculated_answer": $" 1 6 0 9 4 2 9 5 \ : - \ : 3 \mathrm { x } "$ , "label": true, "query": "python_snippet": $\ " \mathbf { X } = 1$ ; result1 $= 3 ~ ^ { * }$ (5364765 - x); res $\mathrm { \ u l t } 2 = 1 6 0 9 4 2 9 5 \cdot 3$ $^ { * } \textbf { X }$ ; print(result1 $= =$ result2)", "exec_result": "True", "with_tool_classification": true "math_calculation": $" 5 x + 1 6 0 9 4 2 9 5 - 3 \mathrm { x " }$ , "calculated_answer": $" 1 6 0 9 4 2 9 5 + 2 \mathbf { x } "$ , "label": true, "query": "python_snippet": $" \mathbf { X } = 1$ ; prin $( ( 5 * _ { \mathrm { ~ X ~ } } + 1 6 0 9 4 2 9 5 - 3 \mathit { \Psi } ^ { * } \mathrm { ~ X ~ } ) = = ( 1 6 0 9 4 2 9 5 + 2 \mathit { \Psi } ^ { * } \mathrm { ~ X ~ } ) ) ^ { \mathfrak { V } }$ , "exec_result": "True", "with_tool_classification": true "math_calculation": $" 2 x + 1 6 0 9 4 2 9 5 "$ , "calculated_answer": "total cost", "label": "null", "query": "python_snippet": $\ " \mathbf { X } = 5$ ; math_calculation $= 2 \ast _ { \mathrm { \mathbf { X } } } + 1 6 0 9 4 2 9 5$ ; calculated_answer $= 1 6 0 9 4 3 0 5$ ; print(math_calculation $= =$ calculated_answer)", "exec_result": "True", "with_tool_classification": true "math_calculation": $\prime 5 3 6 4 7 6 5 ^ { \ast } 5 "$ , "calculated_answer": "26823825", "label": true, "query": "python_snippet": "calculation $= 5 3 6 4 7 6 5 \ast 5$ ; answer $= 2 6 8 2 3 8 2 5$ ; print(calculation $= =$ answer)", "exec_result": "True", "with_tool_classification": true "math_calculation": "2(5364765)", "calculated_answer": $" 1 0 7 2 9 5 3 0 "$ , "label": true, "query": "python_snippet": "calculation $= 2 \ast 5 3 6 4 7 6 5$ ; answer $= 1 0 7 2 9 5 3 0$ ; print(calculation $= =$ answer)", "exec_result": "True", "with_tool_classification": true "math_calculation": $" 2 \mathbf { X } "$ , "calculated_answer": "10729530", "label": "null", "query": "python_snippet": $" \mathrm { x } = 5 3 6 4 7 6 5$ ; $\operatorname { p r i n t } ( 2 { } ^ { * } { \textbf { x } } = =$ 10729530)", "exec_result": "True", "with_tool_classification": true
627
+ }
628
+
629
+ Figure 17: Some error cases of FACTOOL on math. The full response of FACTOOL $\mathrm { G P T } { \cdot } 4$ is reported, including the queries generated, evidences collected, the reasoning process, and the final decision is also reported.
630
+
631
+ # [Errors in title matching]
632
+
633
+ ![](images/6da600d837f71a8cab6c2f701df4964108366260f205dc5fc0b7eb14314a8f76.jpg)
634
+ Figure 18: Some error cases of FACTOOL on scientific. The full response of FACTOOL $\mathrm { G P T } { \cdot } 4$ is reported, including the queries generated, evidences collected, the reasoning process, and the final decision is also reported.
parse/test/jolYuxpVn1/jolYuxpVn1_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/jolYuxpVn1/jolYuxpVn1_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/jolYuxpVn1/jolYuxpVn1_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/p6xslUyvka/p6xslUyvka.md ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Detecting Anomalies within Time Series using Local Neural Transformations
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # Abstract
6
+
7
+ We develop a new method to detect anomalies within time series, which is essential in many application domains, reaching from self-driving cars, finance, and marketing to medical diagnosis and epidemiology. The method is based on self-supervised deep learning that has played a key role in facilitating deep anomaly detection on images, where powerful image transformations are available. However, such transformations are widely unavailable for time series. Addressing this, we develop Local Neural Transformations (LNT), a method learning local transformations of time series from data. The method produces an anomaly score for each time step and thus can be used to detect anomalies within time series. We prove in a theoretical analysis that our novel training objective is more suitable for transformation learning than previous deep Anomaly detection (AD) methods. Our experiments demonstrate that LNT can find anomalies in speech segments from the LibriSpeech data set and better detect interruptions to cyber-physical systems than previous work. Visualization of the learned transformations gives insight into the type of transformations that LNT learns.
8
+
9
+ # 1 Introduction
10
+
11
+ Anomaly detection (AD) in time series is significant in many industrial, medical, and scientific applications. For instance, undetected anomalies in water treatment facilities or chemical plants can bring harm to millions of people. Such systems need to be constantly monitored for anomalies.
12
+
13
+ While AD has been an important field in machine learning for several decades (Ruff et al., 2020), promising performance gains have been primarily reported in applying deep learning methods to high-dimensional data such as images (Golan & El-Yaniv, 2018; Wang et al., 2019; Hendrycks et al., 2019; Bergman & Hoshen, 2020). Time series exhibit complex temporal dependencies and can be even more diverse than natural images. Consequently, time series anomaly detection with deep learning approaches has been widely studied in recent years Zhou et al. (2019); Shen et al. (2020); Malhotra et al. (2016); Li et al. (2019); de Haan & Löwe (2021); Deng & Hooi (2021); Carmona et al. (2021). While unsupervised methods based on density estimation can yield poor results for AD (Nalisnick et al., 2018), a recent trend relying on self-supervision has proven superior performance. As detailed below, this paper attempts to integrate recent ideas from self-supervised AD of non-temporal data with modern deep learning architectures for sequence modeling.
14
+
15
+ In this line of work, one uses auxiliary tasks, often based on data augmentation, both for training and anomaly scoring. Data augmentation usually relies on hand-designed data transformations such as rotations for images (Golan & El-Yaniv, 2018; Wang et al., 2019; Hendrycks et al., 2019). Qiu et al. (2021) showed that these transformations could instead be learned, thereby making self-supervised AD applicable to specialized domains beyond images. While this approach can identify an entire sequence as anomalous, it can still not be applied to detecting anomalies within time series (i.e., on a sub-sequence level).
16
+
17
+ But this adaption is not straightforward: For AD within time series, both local semantics (the dynamics within a time window) and contextualized semantics (how the time window relates to the remaining time series) matter. To capture both, we propose an end-to-end approach that combines time series representations (Oord et al., 2018) with a novel transformation learning objective. As a result, the local transformations create different views of the data in the latent space (Rudolph et al., 2017) (as opposed to applying them to the data directly as in Qiu et al. (2021)).
18
+
19
+ We develop Local Neural Transformations (LNT): a novel objective that combines representation learning with transformation learning. The encoder for feature extraction and the neural transformations are trained jointly on this loss. We show that the learned latent transformations can correspond to interpretable effects: in one experiment on speech data (details in Section 5), LNT learns transformations that insert delays. Neural transformations are much more general than hand-crafted transformations, which for time series could be time warping, reflections, or shifts: as we illustrate, they can transform the data in ways unintuitive to humans but valuable for the downstream task of AD.
20
+
21
+ We prove theoretically (Section 4) and show empirically (Section 5) that combining representation and transformation learning is beneficial for detecting anomalies within time series. LNT outperforms various AD techniques on benchmark data, including a baseline using the Contrastive Predictive Coding (CPC) loss as the anomaly score (de Haan & Löwe, 2021). We evaluate the methods on public AD datasets for time series from cyber-physical systems. Furthermore, we detect artificial anomalies in speech data, which is challenging due to its complex temporal dynamics. In some experiments, LNT outperforms many strong baselines.
22
+
23
+ To summarize, our contributions in this work are:
24
+
25
+ 1. A new method, LNT, for AD within time series. It unifies time series representations with a novel approach for learning local transformations. A open-source pytorch implementation is available at $[ ] ^ { 1 }$
26
+ 2. A theoretical analysis. We prove that both learning paradigms complement each other to avoid trivial solutions not appropriate for detecting anomalies.
27
+ 3. An empirical study showing that LNT can detect anomalies within real cyber-physical data streams on par or better than many existing methods.
28
+
29
+ # 2 Related Work
30
+
31
+ We first describe related work in time series AD, which is the problem we tackle in this work. We then describe related methods, specifically advances in self-supervised AD.
32
+
33
+ # 2.1 Time series anomaly detection
34
+
35
+ There are two types of anomalies in time series: local and global anomalies. Global anomalies are entire time series, with a single anomaly score for the entire series. Local anomalies occur at isolated timestamps or short time intervals within the time series, so each time point must be assigned with an anomaly score. This is the setting that we consider in this work. Existing methods for local AD in time series using deep learning can be divided into four categories, discussed in detail below: (i) methods based on sequence forecasting, (ii) autoencoders, (iii) generative sequence models, and (iv) other approaches.
36
+
37
+ Forecasting methods A straightforward approach to detect anomalies in time series is to use the error of a time-series forecaster (predicting the value of the next time step from the time series’ past history) as an anomaly score. The rationale behind is that a forecaster trained on mostly normal data will err less on normal than on abnormal data. We may use any time-series regression method as the forecaster, and various methods have been studied, including neural architectures such as recurrent neural networks (RNNs) (Malhotra et al., 2015; Filonov et al., 2016) and temporal convolutional neural networks (TCNs) (He & Zhao, 2019; Munir et al., 2019), where the convolution operation is applied along the temporal dimension only.
38
+
39
+ Autoencoders To detect anomalies within time series, AEs have been combined with various neural network architectures, including RNNs (Malhotra et al., 2016) and TCNs (Thill et al., 2020) or variants (Zhang et al., 2019). Audibert et al. (2020) propose an architecture based purely on dense layers using a combination of two AEs connected with the adversarial loss. Again, the rational of using such approaches for AD is that after training on normal data, a high reconstruction error can be used to detect anomalies.
40
+
41
+ Deep generative models Variational autoencoders (VAEs) (Kingma & Welling, 2014) have frequently been combined with RNNs (Sölch et al., 2016; Park et al., 2018) to detect anomalies within time series. Pereira & Silveira (2018) combine an RNN with temporal self-attention. Guo et al. (2018) use gated recurrent units (GRUs) in combination with a gaussian mixture model. Su et al. (2019) augment a GRU-based VAE with a normalizing flow and a linear Gaussian state-space model. Generative adversarial networks (Goodfellow et al., 2014) have been used for AD within time series, taking either the discriminator’s error (Liang et al., 2021) or the generator’s residuals (Zhou et al., 2019) as an anomaly score. Li et al. (2019) use a weighted combination of both. These approaches have been combined with TCNs (Zhou et al., 2019) and RNNs (Niu et al., 2020; Geiger et al., 2020).
42
+
43
+ Other methods Some of the above-described approaches have been used in combination. For instance, Zhao et al. (2020) combine TCNs and LSTMs. Shen et al. (2020) combine a dilated RNN with a deep multisphere hypersphere classifier on the cluster centers of a hierarchical clustering procedure, with regularizers encouraging orthogonal centers at each layer and prediction regularizers encouraging useful representations in intermediate layers. Deng & Hooi (2021) construct a graph with nodes for each feature and edges representing relations between features; these are learned and combined with a graph-based attention mechanism. Carmona et al. (2021) employ a TCN as an encoder to train a hypersphere classifier in the latent space, with the option of including known anomalies into training.
44
+
45
+ # 2.2 Self-supervised anomaly detection
46
+
47
+ Recently, there has been growing interest in tackling AD with self-supervised learning. The core idea of self-supervised learning is to devise training tasks, often based on data augmentation, that guide the model to learn useful representations of the data. In self-supervised AD, performance on the auxiliary tasks can be used for anomaly scoring. This is justified by the principle of inlier priority (Wang et al., 2019) which posits that a self-supervised approach will prioritize solving its training task for inliers. End-to-end detection methods based on transformation prediction (Golan & El-Yaniv, 2018; Hendrycks et al., 2019) have been designed for image AD. However, they require effective hand-crafted transformations while for data types beyond images, it is hard to design effective transformations by hand. Previous works proposed to utilize random affine transformations (Bergman & Hoshen, 2020) or data-driven neural transformations (Qiu et al., 2021) for AD. Neural transformations have been used to detect entire anomalous sequences. However, when the neural transformation learning approach of Qiu et al. (2021) is applied to the task of local anomaly detection, it can lead to trivial transformations that are not suitable for AD. Our work proves this and introduces a novel local transformation learning objective.
48
+
49
+ Alternatively, de Haan & Löwe (2021) propose to use the training criterion of CPC, a self-supervised approach without data augmentation, for anomaly detection. CPC learns local time series representations via contrastive predictions of future representations (Oord et al., 2018). However, the CPC loss is not a good fit for scoring anomalies since it requires a random draw of negative samples, which leads to a biased estimation or high memory cost during test time (de Haan & Löwe, 2021). Our work overcomes this.
50
+
51
+ # 3 Method
52
+
53
+ In this work, we propose Local Neural Transformations (LNT), a new framework for detecting anomalies within time series data. LNT has two components: feature extraction and feature transformations. Given an input sequence, an encoder produces an embedding for each time step, encoding relevant information from the current time window. These features are then transformed by applying distinct neural networks to each embedding, producing different latent views. The views are trained to fulfill two requirements; the views should be diverse and semantically meaningful, i.e., they should reflect both local dynamics as well as how the observations fit into the larger context of the time series. Both are encouraged via self-supervision.
54
+
55
+ Specifically, two aspects of LNT are self-supervised: it combines two different contrastive losses. One of the contrastive losses, CPC, guides the representation learning that guarantees the encoder of LNT to produce good semantic time series representations that generalize well to unseen test data. The second contrastive loss, a novel dynamic deterministic contrastive loss (DDCL), contrasts different latent views of each time step to encourage the latent views to be diverse and semantically representative of the time series, both in a local and in a contextualized sense.
56
+
57
+ LNT follows the general paradigm of self-supervised AD. During training, the capability to contrast the data views produced by the transformations improves for the normal data, while it deteriorates for anomalies. The main components of LNT are the encoder producing local representations of the input and local neural transformations, which are neural networks that transform the local representations into different views. The encoder and the local neural transformations are trained using the two losses, one guiding the quality of representations, the other guiding the quality of the transformations. The losses are combined to produce an anomaly score $\ell _ { t }$ for each time step in the input time series $x _ { 1 : t } : = ( x _ { 1 } , \ldots , x _ { t } ) ^ { T } : x _ { t } \in \mathbb { R } ^ { d }$ , representing the likelihood that the observation in this time step is an anomaly. Formally, we assume a time series $x _ { 1 : t }$ to be observations of random variables $X _ { 1 : t }$ . Further, we assume that its data generating distribution factorizes with context variables as detailed in the definition below.
58
+
59
+ Definition 1 (Temporal Anomaly). Let $x _ { 1 : t } : = ( x _ { 1 } , \ldots , x _ { t } ) ^ { T } \in \mathbb { R } ^ { T \times d }$ be a multivariate time series and $p$ a distribution that factorizes with context variables $C _ { 1 : t }$ as $\begin{array} { r } { p ( x _ { 1 : T } ) = \int \prod _ { t } p ( X _ { t } = x _ { t } | C _ { t } ) p ( C _ { t } | C _ { t - 1 } ) d C _ { 1 : t } } \end{array}$ and $x _ { 1 : t } \sim p$ . We call an observation $\tilde { x } _ { t }$ an anomaly iff $\tilde { x } _ { t } \ne p ( x _ { t } | x _ { 1 : t - 1 } )$ , i.e. it is sampled from a different data generating distribution.
60
+
61
+ Given time series data $\{ x _ { 1 : t } \}$ it is unclear how to choose a good context representation $C _ { 1 : t }$ that is able to explain all the effects like trends, seasonality, or change points in a time series. This aspect renders it a challenging representation learning problem. Also, good context variables $C _ { t }$ might evolve on a coarse time scale than the measurements recorded for a time series. Note that from definition 1 not every change point is necessarily an anomaly as long as similar changes have been sufficiently observed during training and are accounted for in $p ( C _ { t } | C _ { t - 1 } )$ . In that way a time series with non-stationary dynamics and many change points (compare LibriSpeech, section 5.1) can be normal.
62
+
63
+ Before presenting local transformation learning and the DDCL in Section 3.2, we will first describe the encoder and the CPC-loss in Section 3.1. Then, we discuss how a trained model is used to detect anomalies. Finally, in Section 4, we provide theoretical arguments for combining transformation learning with representation learning. All notations used throughout the remainder of the section are summarized in table 4.
64
+
65
+ # 3.1 Local Time Series Representations
66
+
67
+ The LNT architecture has two components, a feature extractor (encoder) and an anomaly detector (local neural transformations). The encoder maps a sequence of samples to a sequence of local latent representations $z _ { t }$ and is trained using the principles of Contrastive Predictive Coding ( $\mathit { C P C }$ ) (Oord et al., 2018). We use the same architecture as Oord et al. (2018). The representations produced by the encoder $z _ { t } = g _ { \mathrm { e n c } } ( x _ { t } )$ are summarized with an autoregressive module into context vectors $c _ { t } = g _ { \mathrm { a r } } ( z _ { \leq t } )$ . For different choices of $t$ and prediction steps $k$ , we built mini batches by randomly sampling a set $X$ of size $N$ from the training data that each contains one positive pair $\left( { { x } _ { t } } , { { x } _ { t + k } } \right)$ and $N - 1$ negative pairs $( x _ { t } , x _ { j } )$ , with $x _ { j }$ being any other sample $( j \neq t + k )$ from the same mini batch but for a different choice of $t$ and $k$ . The CPC loss contrasts linear $k$ -step future predictions $W _ { k } c _ { t }$ against negative samples:
68
+
69
+ $$
70
+ \mathcal { L } _ { \mathrm { C P C } } = - \mathbb { E } _ { X \sim \mathcal { D } } \left[ \log \frac { \exp ( z _ { t + k } ^ { T } W _ { k } c _ { t } ) } { \sum _ { X } \exp ( z _ { j } ^ { T } W _ { k } c _ { t } ) } \right] .
71
+ $$
72
+
73
+ It encourages the context representation $c _ { t }$ to be predictive of nearby local representations $z _ { t + k }$ . Optimizing Equation (1) relates to maximizing the mutual information (Tschannen et al., 2019) between the context representation $c _ { t }$ and nearby time points $x _ { t + k }$ to produce good representations ( $\scriptstyle { \mathcal { L } } t$ and $c _ { t }$ ) that can be used in downstream tasks, including AD.
74
+
75
+ ![](images/0108ddd8737b02c33d6181f9bdd7435fa480498a63a8ed32f1366a92605b6e6f.jpg)
76
+ Figure 1: LNT on latent representations $z _ { t }$ resulting in transformed views $\mathcal { T } _ { l } ( z _ { t } )$ - it can be viewed as pushing and pulling representations in latent space with the Dynamic Deterministic Contrastive Loss (DDCL)
77
+
78
+ # 3.2 Local Neural Transformations
79
+
80
+ The second part of the LNT architecture introduces an auxiliary task for AD. The time series representations $z _ { t }$ are processed by local neural transformations to produce different views of each embedding. This operation relates to data augmentation but has two major differences: First, the transformations are not applied at the data level but in the latent space, producing latent views of each time window. Second, the transformations are not hand-crafted as is often done in computer vision, where rotation, cropping and blurring are popular augmentations, but are instead directly learned during training (Tamkin et al., 2020; Qiu et al., 2021).
81
+
82
+ The neural transformations are $L$ neural networks $\pi ( \cdot )$ with parameters $\theta _ { l }$ . They are applied to each latent representation $z _ { t }$ to produce different latent views $z _ { t } ^ { ( l ) } = \mathcal { T } _ { l } ( z _ { t } )$ , as shown in Figure 1. Each of the transformed views is encouraged to be predictive of the context at different time horizons $k$ by a loss contribution
83
+
84
+ $$
85
+ \ell _ { t } ^ { ( k , l ) } ( x _ { \le t } ) = - \log \frac { h \bigl ( z _ { t } ^ { ( l ) } , W _ { k } c _ { t - k } \bigr ) } { h \bigl ( z _ { t } ^ { ( l ) } , W _ { k } c _ { t - k } \bigr ) + \sum _ { m \neq l } h \bigl ( z _ { t } ^ { ( l ) } , z _ { t } ^ { ( m ) } \bigr ) } ,
86
+ $$
87
+
88
+ which simultaneously pushes different views of the same latent representations apart from each other. The notation h(zi, zj ) := exp zi zj∥zi∥∥zj∥ is defined as the exponentiated cosine similarity in the embedding space. Unlike most contrastive losses, where the negative samples are drawn from a noise distribution (Gutmann $\&$ Hyvärinen, 2012), the other views to contrast against are constructed deterministically from the same input (Qiu et al., 2021). The loss contributions of each time-step $t$ , each transformation $\it l$ , and each time horizon $k$ are combined to produce the Dynamic Deterministic Contrastive Loss (DDCL):
89
+
90
+ $$
91
+ \mathcal { L } _ { \mathrm { { D D C L } } } = \mathbb { E } _ { \boldsymbol { x } _ { 1 : T } \sim \mathcal { D } } \left[ \sum _ { k = 1 } ^ { K } \sum _ { t = 1 } ^ { T } \sum _ { l = 1 } ^ { L } \ell _ { t } ^ { ( k , l ) } ( \boldsymbol { x } _ { \le t } ) \right] .
92
+ $$
93
+
94
+ During training, the two objectives (Equations (1) and (3)) are optimized jointly using a unified loss,
95
+
96
+ $$
97
+ \mathcal { L } = \mathcal { L } _ { \mathrm { C P C } } + \lambda \cdot \mathcal { L } _ { \mathrm { D D C L } }
98
+ $$
99
+
100
+ and a balancing hyperparameter $\lambda$ . All contrasting operations are performed on the mini batch described before, but the deterministic contrasting of distinct transformations $m \neq { l }$ in DDCL causes the mini batch of latent representations to grow by a factor of $L$ . Since for each $\mathbf { \boldsymbol { \mathscr { L } } } _ { t }$ a set $\{ z _ { t } ^ { ( } 0 ) , \ldots , z _ { t } ^ { ( } L ) \}$ of $L$ distinct views needs to be stored.
101
+
102
+ As depicted by orange arrows in Figure 1, $\mathcal { L }$ DDCL can intuitively be interpreted as pushing and pulling different representations in latent space. The numerator pulls the learned transformations $z _ { t + k } ^ { ( l ) }$ close to $W _ { k } c _ { t }$ ensuring semantic views, while the denominator pushes different views apart, ensuring diversity in the learned transformations.
103
+
104
+ # 3.2.1 Scoring of Anomalies
105
+
106
+ After training LNT on a dataset of typical time series, we can use the DDCL for AD. Given a test sequence $x _ { 1 : T }$ , we evaluate the contribution of individual time steps to $\mathcal { L } _ { \mathrm { D D C L } }$ (Equation (3)). The score for each time point $t$ in the sequence is,
107
+
108
+ $$
109
+ \ell _ { t } ( \boldsymbol { x } _ { \le t } ) = \sum _ { k = 1 } ^ { K } \sum _ { l = 1 } ^ { L } \ell _ { t } ^ { ( k , l ) } ( \boldsymbol { x } _ { \le t } )
110
+ $$
111
+
112
+ The higher the score, the more likely the series exhibits abnormal behavior at time $t$ . Unlike CPC-based AD (de Haan & Löwe, 2021), this anomaly score has the advantage of being deterministic and thus there is no need to draw negative samples from a proposal or noise distribution.
113
+
114
+ # 4 Analysis
115
+
116
+ Our experiments in Section 5.5 show that LNT empirically outperforms CPC on various AD tasks. However, since the LNT architecture is trained on two losses jointly (the DDCL and CPC losses), the natural question arises: are both losses necessary or could we just train on the DDCL loss alone? The following analysis demonstrates the value of considering both losses jointly.
117
+
118
+ # 4.1 Ablation Analysis
119
+
120
+ The following theorem shows that, if we trained the LNT architecture (i.e. the encoder and transformations $\tau _ { i }$ ) only on the $\mathcal { L } _ { \mathrm { D D C L } }$ loss (without the $\mathcal { L } _ { \mathrm { C P C } }$ loss), the optimal solution would collapse to a constant encoder, a phenomenon known as the manifold collapse in deep AD (Ruff et al., 2018). Thus the CPC loss acts as a regularizer in our DDCL framework to avoid the manifold collapse; it is thus strictly necessary.
121
+
122
+ Theorem 1. Let $g _ { e n c } ^ { \theta }$ and $g _ { a r } ^ { \theta }$ be arbitrary encoders (including biases) with learned parameters $\theta$ , and let $\mathcal { L } _ { D D C L } ^ { \theta }$ be the corresponding DDCL loss. Then there exist constant encoders $g _ { e n c } ^ { \tilde { \theta } }$ and $g _ { a r } ^ { \tilde { \theta } }$ (i.e., $\exists \tilde { \theta } , a , b \ \forall x , z :$ $g _ { e n c } ^ { \tilde { \theta } } ( x ) = a , g _ { a r } ^ { \tilde { \theta } } ( z ) = b$ ) with
123
+
124
+ $$
125
+ \begin{array} { r } { \mathcal { L } _ { D D C L } ^ { \tilde { \theta } } \leq \mathcal { L } _ { D D C L } ^ { \theta } . } \end{array}
126
+ $$
127
+
128
+ Proof. Let $g _ { e n c } ^ { \theta }$ and $g _ { a r } ^ { \theta }$ be arbitrary encoders (including biases) with learned parameters $\theta$ (for notational simplicity of the proof we understand the additional parameter as included into ), and let be the corresponding DDCL loss. We observe from Equation (3) that $\mathcal { L } _ { \mathrm { D D C L } } ^ { \theta }$ DDCL decomposes into a sum of loss contributions $\ell _ { t } ^ { ( k , l ) } ( x _ { \leq t } ; \theta )$ . Let
129
+
130
+ $$
131
+ ( x _ { \le t ^ { * } } ^ { * } , k ^ { * } , t ^ { * } ) = \arg \operatorname* { m i n } \sum _ { l = 1 } ^ { L } \ell _ { t } ^ { ( k , l ) } ( x _ { \le t } ; \theta ) ,
132
+ $$
133
+
134
+ be the indices of the summands with the smallest contribution to the sum, for a given fixed $\theta$ . This means $x ^ { * }$ is the sample, $k ^ { * }$ the time horizon, and $t ^ { * }$ the time point associated with the smallest loss contribution to $\mathcal { L } _ { \mathrm { D D C L } }$ . Put
135
+
136
+ $$
137
+ \ell ^ { * } : = \sum _ { l = 1 } ^ { L } \ell _ { t } ^ { ( k ^ { * } , l ) } ( x _ { \le t ^ { * } } ; \theta ) .
138
+ $$
139
+
140
+ Since our encoders are equipped with bias terms there exist constant encoders $g _ { e n c } ^ { \theta }$ and $g _ { a r } ^ { \theta }$ (i.e., $\exists \tilde { \theta } , a , b \forall x , z :$ $g _ { e n c } ^ { \bar { \theta } } ( x ) = a , g _ { a r } ^ { \bar { \theta } } ( z ) = b ,$ ) with
141
+
142
+ $$
143
+ \forall x , k , t : \sum _ { l = 1 } ^ { L } \ell _ { t } ^ { ( k , l ) } ( x _ { \leq t } ; \tilde { \theta } ) = \ell ^ { \ast } .
144
+ $$
145
+
146
+ Then we have:
147
+
148
+ $$
149
+ \begin{array} { r l r } { { \mathcal { L } _ { \mathrm { { D D C L } } } ( \theta ) \overset { e q u a t i o n ~ 3 } { = } \mathbb { E } [ \sum _ { k = 1 } ^ { K } \sum _ { t } ^ { T } \sum _ { l = 1 } ^ { L } \ell _ { t } ^ { ( k , l ) } ( x _ { \le t } ; \theta ) ] } } \\ & { } & { \stackrel { e q u a t i o n ~ 6 } { \geq } K T \sum _ { l = 1 } ^ { L } \ell _ { t } ^ { ( k ^ { * } , l ) } ( x _ { \le t ^ { * } } ^ { * } ; \theta ) \overset { e q u a t i o n ~ 7 } { = } \ K T \ell ^ { * } } \\ & { } & { \stackrel { e q u a t i o n ~ 8 } { = } \ \mathbb { E } [ \sum _ { k = 1 } ^ { K } \sum _ { t } ^ { T } \sum _ { l = 1 } ^ { L } \ell _ { t } ^ { ( k , l ) } ( x _ { \le t } ; \tilde { \theta } ) ] \overset { e q u a t i o n ~ 3 } { = } \mathcal { L } _ { \mathrm { { D D C L } } } ( \tilde { \theta } ) , } \end{array}
150
+ $$
151
+
152
+ which was to prove.
153
+
154
+ The above theorem shows that if LNT was trained on the DDCL loss only, LNT would collapse into a trivial solution. On the other hand a constant encoder clearly does not optimize the maximum mutual information criterion (Oord et al., 2018), which is induced by the CPC objective.
155
+
156
+ # 4.2 Computational Complexity Analysis
157
+
158
+ This section is dedicated to investigating the computational complexity for both training and scoring anomalies of the LNT algorithm. A good proxy for complexity is counting the inner product occurring in the loss functions (eqs. (1) and (2)), since each inner product corresponds to an acquisition of the embeddings $z _ { t } , c _ { t } , z _ { t } ^ { ( l ) }$ (a forward pass through a fixed network in $\mathcal { O } ( 1 )$ ) followed by the actual inner product which can be computed in approximately constant time on modern vectorized hardware. Let $B$ denote the batch size in the training of LNT. For the CPC part of the loss $\mathcal { O } ( K ^ { 2 } B ^ { 2 } )$ inner products are computed since every embedding $z _ { t }$ in the batch is contrasted against the negatives from a different time series in the same minibatch. For the DDCL part, $\mathcal { O } ( B K L ^ { 2 } )$ inner products are required since in eq. (3) every $ { \boldsymbol { z } } _ { t } ^ { ( l ) }$ is treated as the positive sample once and contrasted against $L - 1$ negative samples $z _ { t } ^ { ( m ) } ; m \neq l$ , and in practice $K , L \ll B$ are small constants. Thus, in total $\mathcal { O } ( B ^ { 2 } K ^ { 2 } + B K L ^ { 2 } ) = \mathcal { O } ( B ^ { 2 } )$ . For the complexity of scoring anomalies, assume a time series of length $T$ . To score $\ell _ { t }$ for a single time step, $\mathcal { O } ( K L ^ { 2 } )$ inner products are required. For an entire time series this yields $\mathcal { O } ( T L ^ { 2 } )$ .
159
+
160
+ Besides this hard mathematical evidence, there are also other good reasons to include the CPC loss into LNT. For instance, it ensures that the latent representations account for dynamics at longer time scales. This task is carried out by CPC’s autoregressive module. Our hypothesis is that, for effective AD within time series, it is necessary to consider both: the local signal in a time window and the larger context across time windows. Otherwise, the observations within a time window could be perfectly normal while not making sense in the context of a longer time horizon. For this reason, we believe that there are two types of semantic requirements of the representations and the latent views of LNT:
161
+
162
+ • Contextualized semantics (Addressed by $\mathcal { L } _ { \mathrm { D D C L } }$ ): views should reflect how the time window relates to the rest of the time series at different, longer time horizons, i.e. the similarity $h \big ( z _ { t } ^ { ( l ) } , W _ { k } c _ { t - k } \big )$ is maximized for different $k$ and each $\it l$ . • Local semantics (Addressed by ${ \mathcal { L } } _ { \mathrm { C P C } }$ ): views $z _ { t }$ should share semantic information with the current time window $x _ { t }$ , which CPC achieves by maximizing its mutual information Oord et al. (2018).
163
+
164
+ Both loss contributions of LNT facilitate these requirements. CPC contributes local latent representations and context representations. The semantic content of the views is managed by the DDCL loss.
165
+
166
+ # 5 Experiments
167
+
168
+ For experimental evaluation of LNT in comparison to other methods, we study three challenging datasets. We first describe the datasets, baselines and implementation details. In Section 5.3, we present our findings: LNT outperforms many strong baselines in detecting anomalies in the operation of a water distribution and a water treatment system and accurately finds anomalies in speech. In Section 5.4, we provide visualizations of the local transformations that are learned by LNT. Finally, in Section 5.5 we analyze the performance of LNT in comparison to CPC based alternatives. Our findings that LNT is consistently superior, complements our theoretical analysis in Section 4 on why CPC and transformation learning should be combined.
169
+
170
+ # 5.1 Datasets
171
+
172
+ We evaluate LNT on three challenging real-world datasets, namely the Water Distribution Dataset (WaDi) Ahmed et al. (2017), the Secure Water Treatment Dataset (SWaT) (Goh et al., 2016) and the Libri Speech Collection (Panayotov et al., 2015). The first two datasets are provided with labeled anomalies in the test set. As recent observations in Wu & Keogh (2020) show, many popular datasets for time series AD seem to be mislabeled and flawed, which results in the revival of synthetic datasets Lai et al. (2021). The Libri Speech data is augmented with realistic synthetic anomalies.
173
+
174
+ Water Distribution The dataset is acquired from a water distribution testbed and provides a model of a scaled-down version of a large water distribution network in a city (Ahmed et al., 2017). The time series data is 112-dimensional with readings from different sensors and actuators such as pumps and valves. The training data consists of 14 days of normal operation sampled with a frequency of 1 Hz, resulting in a series length of 1048571. The test set consists of 2 days of additional operation (172801 time steps), during which 15 attacks were staged with an average duration of $\approx 1 2$ minutes.
175
+
176
+ Secure Water Treatment This dataset is from a testbed for water treatment (Mathur & Tippenhauer, 2016) that evaluates the Cyber Security of a fully functional plant with a six-stage process of filtration and chemical dosing. Goh et al. (2016) collected 11 days of operation data. Under normal operation 51 sensor channels are recorded for 7 days yielding a training time series of length 475200. For the test data of length 224960, 36 attacks were launched during the last 4 days of the collection process. As suggested in Goh et al. (2016); Li et al. (2019), the first 21600 samples from the training data are removed for training stability.
177
+
178
+ We follow the experimental setup of He & Zhao (2019) and take the first part of the collection under attack as the validation set and drop channels which are constant in both training and test set, yielding a time series of 45 dimension.
179
+
180
+ Libri Speech The LibriSpeech dataset Panayotov et al. (2015) is an audio collection with spoken language recordings from 251 distinct speakers. We adopt the setup of Oord et al. (2018) with their train/test split and unsupervised training on the raw time signal without further pre-processing. For AD benchmarks, we randomly place additive pure sine tones of varying frequency (20 - 120 Hz) and length (512 - 4096 time steps) in the test data, yielding consecutive anomaly regions making up $\approx 1 0 \%$ of the test data. Speech data offers a challenging benchmark for deep AD methods since speech typically exhibits complex temporal dynamics, due to high multi-modality introduced through different speakers and word sequences (Oord et al., 2018).
181
+
182
+ # 5.2 Baselines and Implementation Details
183
+
184
+ Table 1: Neural Transformation Hyperparameters
185
+
186
+ <table><tr><td>Types</td><td>SWaT</td><td>WaDi</td><td>Libri</td></tr><tr><td># neurons</td><td>24</td><td>32</td><td>64</td></tr><tr><td>#layers</td><td>2</td><td>2</td><td>3</td></tr><tr><td>activation</td><td>ReLU</td><td>ReLU</td><td>ReLU</td></tr><tr><td>bias</td><td>False</td><td>False</td><td>False</td></tr></table>
187
+
188
+ ![](images/2f2de772187c73e10442a38c4674af2920478fca3d2b57a5282f1cdebe68e93d.jpg)
189
+ Table 2: F1-scores ( $\%$ ) for the Secure Water Treatment Dataset (SWaT). Baseline results as reported in Shen et al. (2020).
190
+
191
+ Baselines We study LNT in comparison to different classes of AD algorithms, ranging from classical methods to recent advances in deep AD. They include (i) classical methods, such as Isolation Forests (Liu et al., 2008), PCA reconstruction error (Shyu et al., 2003), and Feature Bagging (Lazarevic & Kumar, 2005), (ii) auto-regressive future predictions with LSTM (Hundman et al., 2018) and GDN (Deng & Hooi, 2021), which uses a graph to model the relations among variables as attention for the prediction, (iii) methods that estimate the density of the data, such as KNN (Angiulli & Pizzuti, 2002), LOF (Breunig et al., 2000), combinations with deep auto-encoders DAGMM (Zong et al., 2018), (iv) methods that employ a one-class objective, including OC-SVM (Schölkopf et al., 1999), DeepSVDD (Ruff et al., 2018) and THOC (Shen et al., 2020) for time-series, (v) methods that leverage the reconstruction of an auto-encoder with EncDec-AD (Malhotra et al., 2016) and LSTM-VAE (Park et al., 2018) (vi) and finally methods that use the ability of GANs to discriminate fake examples, like BeatGAN (Zhou et al., 2019) and MAD-GAN (Li et al., 2019).
192
+
193
+ Implementation Details For LNT, the hyperparamaters are adopted from those reported by Oord et al. (2018) for CPC: especially $c _ { t } \in \mathbb { R } ^ { 2 5 6 }$ , $z _ { t } \in \mathbb { R } ^ { 5 1 2 }$ and $K = 1 2$ for experiments with LibriSpeech data. The data is processed in sub-sequences of length 20480 for both training and testing. Since the other datasets contain way less diverse data points and show simpler temporal dynamics, the embeddings size, and thus the capacity of the model, is reduced to $c _ { t } \in \mathbb { R } ^ { 3 2 }$ , $z _ { t } \in \mathbb { R } ^ { 1 2 8 }$ . Also, the time-convolutional encoder network is down-sized to filters $( 3 , 3 , 4 , 2 )$ and strides $( 3 , 3 , 4 , 2 )$ resulting in the convolution of 72 time steps.
194
+
195
+ We consistently choose $L = 1 2$ distinct learned transformations $T _ { l } ( z _ { t } )$ for all datasets. Each is represented by an $M L P$ with properties summarized in table 1. The final layer always shares the dimensionality of $z _ { t }$ and is applied as a multiplicative mask with sigmoid activation to it. Additional implementation details are in the appendix.
196
+
197
+ The crucial part of LNT in terms of hyperparameters is the representation learning with CPC. Its parameters depend on the frequency of observations and sequence lengths in the time series data at hand and can be determined as for any other representation learning. Here, the validation data does not need any anomalies in order to find good hyper-parameters. These preceding optimizations imply different sizes for the embedding vectors $z _ { t } , c _ { t }$ that depend on the size of and inherent variations contained in a dataset. Afterward, as a rule of thumb, the size of the neural transformations are just scaled proportional to these embedding sizes and validated with the (smaller) validation sets containing anomalies.
198
+
199
+ # 5.3 Results
200
+
201
+ We judge the anomaly scores predicted by the algorithms for each time step individually. Since the ratio of anomalies is imbalanced in the data, we evaluated the prediction performance with the $F _ { 1 }$ score, consistent with previous work. Additionally, we also report results using the ROC curve. The area under the curve (ROC-AUC) is a metric to judge the quality of the anomaly score independent of the choice of threshold, which is specifically chosen for its additional insights beyond the evaluation of a single threshold.
202
+
203
+ The results on the SWaT and WaDi datasets can be seen in Tables 2 and 3a, respectively. The ROC curves of our method on the SWaT and WaDi datasets are provided in Figures 4a and 4b. For SWaT, our approach (LNT) outperformed a set of challenging baselines as reported by Shen et al. (2020) with the highest $F _ { 1 }$ score (88.65%). Meanwhile for WaDi, our model produces comparable results both in terms of $F _ { 1 }$ and precision, with the highest recall value2. Notably, GDN achieves the highest precision on WaDi even though our own run, GDN (rerun), performed slightly worse than the reported results in Deng & Hooi (2021). When we
204
+
205
+ <table><tr><td>Method</td><td>F1 0.10</td><td>Prec</td><td>Rec</td></tr><tr><td>PCA KNN FB EncDec-AD DAGMM LSMT-VAE MAD-GAN</td><td>0.08 0.09 0.34 0.36 0.25 0.37</td><td>39.53 7.76 8.60 34.35 54.44 87.79 41.44</td><td>5.63 7.75 8.60 34.35 26.99 14.45 33.92</td></tr><tr><td>GDN GDN (rerun)t GDN (adj.) t</td><td>0.57 0.47 0.38</td><td>97.50 83.76 29.38</td><td>40.19 33.06 54.22</td></tr><tr><td>LNT (ours) t</td><td>0.39</td><td>29.34</td><td>60.92</td></tr></table>
206
+
207
+ (a) Water Distribution Data (WaDi).
208
+
209
+ <table><tr><td>Method</td><td>AUC</td><td>Prec</td><td>Rec</td><td>F1</td></tr><tr><td>LSTM †</td><td>0.58</td><td>15.0</td><td>15.0</td><td>0.15</td></tr><tr><td>THOC t</td><td>0.82</td><td>30.2</td><td>30.0</td><td>0.30</td></tr><tr><td>LNT (ours) t</td><td>0.93</td><td>65.0</td><td>65.0</td><td>0.65</td></tr></table>
210
+
211
+ (b) Synthetic anomalies randomly placed in the LibriSpeech dataset.
212
+
213
+ Table 3: Experimental results for additional datasets. Baseline results are taken from Deng & Hooi (2021), except for the methods marked with $\dagger$ which are derived from our own experiments.
214
+
215
+ ![](images/3900622ce3894089606762b43bed08e53d45d19fdbe351a6083089f5442e5256.jpg)
216
+ Figure 2: Our approach LNT outperforms deep baselines in AD on speech data in terms of ROC-AUC curves.
217
+
218
+ adjust the thresholds in GDN (adj) to have a comparable precision as LNT it has a lower recall (54.22 $\%$ ) than our method $( 6 0 . 9 2 \% )$ ). In many mission-critical applications, detecting as many anomalies as possible is often much more important, as a false negative can do more harm than a false positive. This makes the high recall of LNT (60.92%) preferable while retaining an acceptably high $F 1$ score.
219
+
220
+ We argue that the novel criterion for AD based on contrasting learned latent data transformations allows LNT to also uncover some of the harder detectable anomalies in the dataset. A similar behaviour can also be observed for the LibriSpeech data with results in terms of ROC curves shown in Figure 2. Here, LNT clearly outperforms both deep learning methods. This shows that detecting anomalies within speech data with its complex temporal dynamics is indeed a challenging task for many deep AD algorithms. Especially the future predictions of LSTM perform only slightly better than random chance in this experiment for all possible thresholds. This emphasizes the benefit of contrasting of neural transformations to uncover such hard anomalies. Additional metrics for this experiment are reported in Table 3b.
221
+
222
+ # 5.4 Visualization of Transformations
223
+
224
+ In general, it is considered hard to get insights from embedding visualizations for $z _ { t }$ in the latent space. Hence, to make the transformations interpretable in terms of semantics, we propose to visualize them in data space. We reuse the encoder as described in Section 3.1 and enrich it with a separate decoder. We train the decoder to reconstruct the (non-transformed) input data while freezing the encoder weights. The trained decoder is then applied to transformed embeddings to visualize them in data space.
225
+
226
+ ![](images/ee23ce1c67e813c68f9fc29b7ea8048a3a35e3d3f4e453cf38d9baa95a0df79b.jpg)
227
+ Figure 3: Visualizations of selected transformations in data-space that show semantically interpretable behaviour, such as altered delays in specific channels. Representations from SWaT dataset are decoded with a seperatly trained auto-encoder.
228
+
229
+ ![](images/56516f5476ae4c366a466ef8f7fe9217c6bcb7d7952d1b7f2c6c6d3faa0227a4.jpg)
230
+ Figure 4: Improvement of LNT over CPC scoring evaluated for different datasets. The combination of transformation learning with local representation learning of CPC consitently outperforms the other variants of CPC for anomaly scoring.
231
+
232
+ We chose a subset $\{ \mathcal { T } _ { i } \} _ { i = 1 } ^ { 5 }$ of five transformations which showed interpretable behavior in experiments with $S W a T$ as shown in Figure 3: For the non-transformed series $x$ the signal jumps in channels 25 and 36 at $t \approx 2 5 0 0$ . This jump is delayed for channels $2 6 - 3 5$ . Interestingly, we found that this delay is altered by the learned transformations. For example, $\tau _ { 1 }$ removes this delay causing the signal jump for all aforementioned channels at $t \approx 2 5 0 0$ . In contrast, $\tau _ { 2 }$ affects the series oppositely by enlarging this delay.
233
+
234
+ In summary, these transformations produce semantically meaningful and diverse views of the time series. Admittedly, current interpretations are still rather high-level and fairly limited from application standpoints. However, without domain knowledge, there exists no gold standard for a good transformation on the data to compare against. This was the original motivation for the usage of learnable transformations, as effective data augmentation for AD.
235
+
236
+ # 5.5 Emperical Ablation Study
237
+
238
+ Recall, that we defined LNT to be a composition of CPC and neural transformations trained from a joint loss $\mathcal { L } = \mathcal { L } _ { \mathrm { C P C } } + \lambda \cdot \mathcal { L } _ { \mathrm { D D C L } }$ . Theorem 1 provided a theoretical argument for the advantage of LNT over an approach purely based on DDCL. Also in practice this leeds to a solution with close to random performance in detecting anomalies and is thus not further considered in the following.
239
+
240
+ Instead, we study the reverse ablation: the advantage of LNT over pure CPC. There are several ways to use CPC to detect anomalies: (i) directly use the CPC-loss to score anomalies (de Haan & Löwe, 2021) or (ii) use CPC as a feature extractor and then run another AD method such as OC-SVM on the extracted features. One disadvantage of (i) are the negative samples. They make it nontrivial to evaluate the CPC-loss on test data. We employ a practical implementation (Approx. CPC) without negative samples at test time. de Haan & Löwe (2021) argue that taking samples from the test data is biased and using the training data is infeasible in practice. In contrast, DDCL is deterministic and the alternative views are all constructed from a single sample. It is hence straightforward to use it to score anomalies at test time. From the results in Figure 4, we found that the combination of transformation learning with local representation learning of CPC consistently outperforms the considered variants of CPC for AD in all three datasets. This connects to the discussion about contextualized semantics in Section 4. Comparing LNT with CPC $^ +$ OC-SVM supports our claim: While the OC-SVM with CPC input features has access only to the local semantics in the CPC representations, the performance of LNT in Figure 4 is consistently superior and can be explained by its transformations exhibiting both contextualized semantics and diversity.
241
+
242
+ # 6 Conclusion
243
+
244
+ We propose a novel self-supervised method, LNT, to detect anomalies within time series. The key ingredient is a novel training objective combining representation and transformation learning. We prove that both learning paradigms complement each other to avoid trivial solutions not appropriate for AD. We find in an empirical study that LNT learns to insert delays, which allows it to outperform many strong baselines on challenging detection tasks.
245
+
246
+ # References
247
+
248
+ Chuadhry Mujeeb Ahmed, Venkata Reddy Palleti, and Aditya P Mathur. Wadi: a water distribution testbed for research in the design of secure cyber physical systems. In Proceedings of the 3rd International Workshop on Cyber-Physical Systems for Smart Water Networks, pp. 25–28, 2017.
249
+ Fabrizio Angiulli and Clara Pizzuti. Fast outlier detection in high dimensional spaces. In European conference on principles of data mining and knowledge discovery, pp. 15–27. Springer, 2002.
250
+ Julien Audibert, Pietro Michiardi, Frédéric Guyard, Sébastien Marti, and Maria A Zuluaga. Usad: Unsupervised anomaly detection on multivariate time series. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 3395–3404, 2020. doi: 10.1145/3394486.3403392.
251
+ Liron Bergman and Yedid Hoshen. Classification-based anomaly detection for general data. arXiv preprint arXiv:2005.02359, 2020.
252
+ Markus M Breunig, Hans-Peter Kriegel, Raymond T Ng, and Jörg Sander. Lof: identifying density-based local outliers. In Proceedings of the 2000 ACM SIGMOD international conference on Management of data, pp. 93–104, 2000.
253
+ Chris U Carmona, François-Xavier Aubet, Valentin Flunkert, and Jan Gasthaus. Neural contextual anomaly detection for time series. arXiv preprint arXiv:2107.07702, 2021.
254
+ Puck de Haan and Sindy Löwe. Contrastive predictive coding for anomaly detection. arXiv preprint arXiv:2107.07820, 2021.
255
+ Ailin Deng and Bryan Hooi. Graph neural network-based anomaly detection in multivariate time series. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pp. 4027–4035, 2021.
256
+ Pavel Filonov, Andrey Lavrentyev, and Artem Vorontsov. Multivariate industrial time series with cyber-attack simulation: Fault detection using an lstm-based predictive data model. arXiv preprint arXiv:1612.06676, 2016.
257
+ Alexander Geiger, Dongyu Liu, Sarah Alnegheimish, Alfredo Cuesta-Infante, and Kalyan Veeramachaneni. Tadgan: Time series anomaly detection using generative adversarial networks. In 2020 IEEE International Conference on Big Data (Big Data), pp. 33–43. IEEE, 2020. doi: 10.1109/BigData50022.2020.9378139.
258
+ Jonathan Goh, Sridhar Adepu, Khurum Nazir Junejo, and Aditya Mathur. A dataset to support research in the design of secure water treatment systems. In International conference on critical information infrastructures security, pp. 88–99. Springer, 2016.
259
+ Izhak Golan and Ran El-Yaniv. Deep anomaly detection using geometric transformations. In Advances in Neural Information Processing Systems, pp. 9758–9769, 2018.
260
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. Advances in neural information processing systems, 27, 2014.
261
+ Yifan Guo, Weixian Liao, Qianlong Wang, Lixing Yu, Tianxi Ji, and Pan Li. Multidimensional time series anomaly detection: A gru-based gaussian mixture variational autoencoder approach. In Asian Conference on Machine Learning, pp. 97–112. PMLR, 2018. URL http://proceedings.mlr.press/v95/guo18a.html.
262
+ Michael U Gutmann and Aapo Hyvärinen. Noise-contrastive estimation of unnormalized statistical models, with applications to natural image statistics. Journal of Machine Learning Research, 13(2), 2012.
263
+ Yangdong He and Jiabao Zhao. Temporal convolutional networks for anomaly detection in time series. In Journal of Physics: Conference Series, volume 1213, pp. 042050. IOP Publishing, 2019. doi: 10.1088/ 1742-6596/1213/4/042050.
264
+ Dan Hendrycks, Mantas Mazeika, Saurav Kadavath, and Dawn Song. Using self-supervised learning can improve model robustness and uncertainty. In Advances in Neural Information Processing Systems, pp. 15663–15674, 2019.
265
+ Kyle Hundman, Valentino Constantinou, Christopher Laporte, Ian Colwell, and Tom Soderstrom. Detecting spacecraft anomalies using lstms and nonparametric dynamic thresholding. In Proceedings of the 24th ACM SIGKDD international conference on knowledge discovery & data mining, pp. 387–395, 2018.
266
+ Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. In Yoshua Bengio and Yann LeCun (eds.), 2nd International Conference on Learning Representations, ICLR 2014, Conference Track Proceedings, Banff, AB, Canada, 2014. URL http://arxiv.org/abs/1312.6114.
267
+ Kwei-Herng Lai, Daochen Zha, Junjie Xu, Yue Zhao, Guanchu Wang, and Xia Hu. Revisiting time series outlier detection: Definitions and benchmarks. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 1), 2021.
268
+ Aleksandar Lazarevic and Vipin Kumar. Feature bagging for outlier detection. In Proceedings of the eleventh ACM SIGKDD international conference on Knowledge discovery in data mining, pp. 157–166, 2005.
269
+ Dan Li, Dacheng Chen, Baihong Jin, Lei Shi, Jonathan Goh, and See-Kiong Ng. Mad-gan: Multivariate anomaly detection for time series data with generative adversarial networks. In International Conference on Artificial Neural Networks, pp. 703–716. Springer, 2019. doi: 10.1016/j.neucom.2020.10.084. URL https://www.sciencedirect.com/science/article/pii/S0925231220316970.
270
+ Haoran Liang, Lei Song, Jianxing Wang, Lili Guo, Xuzhi Li, and Ji Liang. Robust unsupervised anomaly detection via multi-time scale dcgans with forgetting mechanism for industrial multivariate time series. Neurocomputing, 423:444–462, 2021. doi: 10.1016/j.neucom.2020.10.084.
271
+ Fei Tony Liu, Kai Ming Ting, and Zhi-Hua Zhou. Isolation forest. In 2008 eighth ieee international conference on data mining, pp. 413–422. IEEE, 2008.
272
+ Pankaj Malhotra, Lovekesh Vig, Gautam Shroff, and Puneet Agarwal. Long short term memory networks for anomaly detection in time series. In Proceedings, volume 89, pp. 89–94, 2015.
273
+ Pankaj Malhotra, Anusha Ramakrishnan, Gaurangi Anand, Lovekesh Vig, Puneet Agarwal, and Gautam Shroff. Lstm-based encoder-decoder for multi-sensor anomaly detection. arXiv preprint arXiv:1607.00148, 2016.
274
+
275
+ Aditya P Mathur and Nils Ole Tippenhauer. Swat: A water treatment testbed for research and training on ics security. In 2016 international workshop on cyber-physical systems for smart water networks (CySWater), pp. 31–36. IEEE, 2016.
276
+
277
+ Mohsin Munir, Shoaib Ahmed Siddiqui, Andreas Dengel, and Sheraz Ahmed. Deepant: A deep learning approach for unsupervised anomaly detection in time series. IEEE Access, 7:1991–2005, 2019. doi: 10.1109/ACCESS.2018.2886457.
278
+ Eric Nalisnick, Akihiro Matsukawa, Yee Whye Teh, Dilan Gorur, and Balaji Lakshminarayanan. Do deep generative models know what they don’t know? In International Conference on Learning Representations, 2018.
279
+ Zijian Niu, Ke Yu, and Xiaofei Wu. Lstm-based vae-gan for time-series anomaly detection. Sensors, 20(13): 3738, 2020. URL https://www.mdpi.com/1424-8220/20/13/3738.
280
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
281
+ Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. Librispeech: an asr corpus based on public domain audio books. In 2015 IEEE international conference on acoustics, speech and signal processing (ICASSP), pp. 5206–5210. IEEE, 2015.
282
+ Daehyung Park, Yuuna Hoshi, and Charles C Kemp. A multimodal anomaly detector for robot-assisted feeding using an lstm-based variational autoencoder. IEEE Robotics and Automation Letters, 3(3):1544–1551, 2018.
283
+ Joao Pereira and Margarida Silveira. Unsupervised anomaly detection in energy time series data using variational recurrent autoencoders with attention. In 2018 17th IEEE international conference on machine learning and applications (ICMLA), pp. 1275–1282. IEEE, 2018. doi: 10.1109/ICMLA.2018.00207.
284
+ Chen Qiu, Timo Pfrommer, Marius Kloft, Stephan Mandt, and Maja Rudolph. Neural transformation learning for deep anomaly detection beyond images. In International Conference on Machine Learning, pp. 8703–8714. PMLR, 2021.
285
+ Maja Rudolph, Francisco Ruiz, Susan Athey, and David Blei. Structured embedding models for grouped data. In Neural Information Processing Systems, 2017.
286
+ Lukas Ruff, Robert Vandermeulen, Nico Goernitz, Lucas Deecke, Shoaib Ahmed Siddiqui, Alexander Binder, Emmanuel Müller, and Marius Kloft. Deep one-class classification. In International conference on machine learning, pp. 4393–4402, 2018.
287
+ Lukas Ruff, Jacob R Kauffmann, Robert A Vandermeulen, Grégoire Montavon, Wojciech Samek, Marius Kloft, Thomas G Dietterich, and Klaus-Robert Müller. A unifying review of deep and shallow anomaly detection. arXiv preprint arXiv:2009.11732, 2020.
288
+ Bernhard Schölkopf, Robert C Williamson, Alexander J Smola, John Shawe-Taylor, John C Platt, et al. Support vector method for novelty detection. In NIPS, volume 12, pp. 582–588. Citeseer, 1999.
289
+ Lifeng Shen, Zhuocong Li, and James Kwok. Timeseries anomaly detection using temporal hierarchical oneclass network. In Advances in Neural Information Processing Systems, 2020. URL https://proceedings. neurips.cc/paper/2020/file/97e401a02082021fd24957f852e0e475-Paper.pdf.
290
+ Mei-Ling Shyu, Shu-Ching Chen, Kanoksri Sarinnapakorn, and LiWu Chang. A novel anomaly detection scheme based on principal component classifier. Technical report, MIAMI UNIV CORAL GABLES FL DEPT OF ELECTRICAL AND COMPUTER ENGINEERING, 2003.
291
+ Maximilian Sölch, Justin Bayer, Marvin Ludersdorfer, and Patrick van der Smagt. Variational inference for
292
+
293
+ on-line anomaly detection in high-dimensional time series. arXiv preprint, 2016.
294
+
295
+ Ya Su, Youjian Zhao, Chenhao Niu, Rong Liu, Wei Sun, and Dan Pei. Robust anomaly detection for multivariate time series through stochastic recurrent neural network. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 2828–2837, 2019. doi: 10.1145/3292500.3330672.
296
+ Alex Tamkin, Mike Wu, and Noah Goodman. Viewmaker networks: Learning views for unsupervised representation learning. arXiv preprint arXiv:2010.07432, 2020.
297
+ Markus Thill, Wolfgang Konen, and Thomas Bäck. Time series encodings with temporal convolutional networks. In International Conference on Bioinspired Methods and Their Applications, pp. 161–173. Springer, 2020. ISBN 978-3-030-63710-1. doi: 10.1007/978-3-030-63710-1_13.
298
+ Michael Tschannen, Josip Djolonga, Paul K Rubenstein, Sylvain Gelly, and Mario Lucic. On mutual information maximization for representation learning. arXiv preprint arXiv:1907.13625, 2019.
299
+ Siqi Wang, Yijie Zeng, Xinwang Liu, En Zhu, Jianping Yin, Chuanfu Xu, and Marius Kloft. Effective end-to-end unsupervised outlier detection via inlier priority of discriminative network. In Advances in Neural Information Processing Systems, pp. 5962–5975, 2019.
300
+ Renjie Wu and Eamonn J Keogh. Current time series anomaly detection benchmarks are flawed and are creating the illusion of progress. arXiv preprint arXiv:2009.13807, 2020.
301
+ Chuxu Zhang, Dongjin Song, Yuncong Chen, Xinyang Feng, Cristian Lumezanu, Wei Cheng, Jingchao Ni, Bo Zong, Haifeng Chen, and Nitesh V Chawla. A deep neural network for unsupervised anomaly detection and diagnosis in multivariate time series data. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 1409–1416, 2019. doi: 10.1609/aaai.v33i01.33011409.
302
+ Hang Zhao, Yujing Wang, Juanyong Duan, Congrui Huang, Defu Cao, Yunhai Tong, Bixiong Xu, Jing Bai, Jie Tong, and Qi Zhang. Multivariate time-series anomaly detection via graph attention network. In 2020 IEEE International Conference on Data Mining (ICDM), pp. 841–850. IEEE, 2020. doi: 10.1109/ ICDM50108.2020.00093.
303
+ Bin Zhou, Shenghua Liu, Bryan Hooi, Xueqi Cheng, and Jing Ye. Beatgan: Anomalous rhythm detection using adversarially generated time series. In IJCAI, pp. 4433–4439, 2019.
304
+ Bo Zong, Qi Song, Martin Renqiang Min, Wei Cheng, Cristian Lumezanu, Daeki Cho, and Haifeng Chen. Deep autoencoding gaussian mixture model for unsupervised anomaly detection. In International conference on learning representations, 2018.
305
+
306
+ # Appendix
307
+
308
+ # A Further Implementation Details
309
+
310
+ In this section the implementation details for the experiments conducted in the main paper are further elaborated. These include our method (LNT) as well as all baselines that we implemented for comparision.
311
+
312
+ # A.1 Hardware
313
+
314
+ All experiments were run on virtualized hardware with 8 CPU cores of type Intel(R) Xeon(R) Gold 6150 running at 2.70 GHz, 32 GB RAM, and a single TeslaV100-SXM2 with 32 GB of gpu memory. Consistently we use Python 3.9, PyTorch in version 1.8.1 with CUDA in version 11.1 and cuDNN in version 8.0.5.
315
+
316
+ # A.2 Hyperparameters
317
+
318
+ LNT The hyper-parameters for our method were determined by the following procedure. Starting with the hyper-paramters as reported in Oord et al. (2018), the sizes of the embeddings $z _ { t }$ and $c _ { t }$ , which also determines the number of memory units in the recurrent part $g _ { \mathrm { a r } }$ , and the number of parameters in the convolutional encoder $g _ { \mathrm { e n c } }$ are downsized to fit the complexity and amount of data in the other datasets. To find a well generalizing setup, a hold-out validation set (split from the training data) was used. For Libri-Speech we considered the hyper-parameters as optimal and didn’t change them. As a rule of thump, the sequence length for training and the width of the strided temporal convolutions were always chosen in a way such that the number of recurrent steps $y _ { \mathrm { a r } }$ takes matches with the setup ( $= 1 2 8$ ) in Oord et al. (2018).
319
+
320
+ LNT is trained for 100 epochs, respectively 500 epochs on SWaT and WaDi, with learning rate $2 \cdot 1 0 ^ { - 4 }$ , batch size 32 and $\lambda = 1 0 ^ { - 3 }$ .
321
+
322
+ # A.3 Baselines in LibriSpeech Experiments
323
+
324
+ The following hyperparameter setups are used for the experiments conducted with synthetic anomalies in LibriSpeech data.
325
+
326
+ LSTM Here, a standard Long Short Term Memory (LSTM) network with 2 layers and 256 hidden units each was chosen. With this setup the number of hidden units aligns with the LNT setup and the multiple layers should account for the missing encoder structure in LSTM. It is trained until convergence, which took approximately 100 epochs, with batch size 32, learning rate $2 \cdot 1 0 ^ { - 4 }$ and a dropout of 0.3.
327
+
328
+ THOC Here, the Implementation was kindly provided by the authors. We used a smaller sub-sequence length of 1024 for training due to the high memory load of the model. Predictions at test time are stitched together to align with the longer sequence length. The method is trained to fit 3 layers hierarchical with dilations $( 1 , 2 , 4 )$ , 128 hidden units and 6 clusters in each layer. The method is trained with learning rate $1 0 ^ { - 3 }$ and batch size 32 and converged after 50 epochs.
329
+
330
+ # B Notation Details
331
+
332
+ The following table summarizes the notations used in the main paper.
333
+
334
+ Table 4: Overview of the notation used in the paper
335
+
336
+ <table><tr><td>Notation</td><td>Description</td></tr><tr><td>Xt</td><td>patch of (multivariate) measurements of a time series x in the time interval [t-T,t+τ] fora fixed window size T</td></tr><tr><td>Zt</td><td>local representation zt = genc(xt) of a time series patch xt produced by the encoder genc</td></tr><tr><td>Ct</td><td>context representation Ct = gar(z≤t) that summarize the history of local representations z≤t := zo:t with an autoregressive network gar</td></tr><tr><td>Wk</td><td>matrix to linearly predict embeddings k steps into the future</td></tr><tr><td>WkCt</td><td>linear (future) prediction of the ground truth embedding zt+k</td></tr><tr><td>TO</td><td>a neural transformation (i.e.a neural network) with parameters 0</td></tr><tr><td></td><td>a latent view z𝑖l) = Ti(zt) of a local representation zt at time t acquired by applying transformation Tt</td></tr><tr><td></td><td>the contribution to the DDCL loss for a specific transformation l and k-step future predictions with Wk</td></tr><tr><td>lt(x&lt;t)</td><td>alLCLottiese</td></tr><tr><td>h(,)</td><td>exponated cosine similarity 2T2j between embeddings h(zi,zj) := exp </td></tr></table>
parse/test/p6xslUyvka/p6xslUyvka_content_list.json ADDED
@@ -0,0 +1,747 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Detecting Anomalies within Time Series using Local Neural Transformations ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Anonymous authors Paper under double-blind review ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "Abstract ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "We develop a new method to detect anomalies within time series, which is essential in many application domains, reaching from self-driving cars, finance, and marketing to medical diagnosis and epidemiology. The method is based on self-supervised deep learning that has played a key role in facilitating deep anomaly detection on images, where powerful image transformations are available. However, such transformations are widely unavailable for time series. Addressing this, we develop Local Neural Transformations (LNT), a method learning local transformations of time series from data. The method produces an anomaly score for each time step and thus can be used to detect anomalies within time series. We prove in a theoretical analysis that our novel training objective is more suitable for transformation learning than previous deep Anomaly detection (AD) methods. Our experiments demonstrate that LNT can find anomalies in speech segments from the LibriSpeech data set and better detect interruptions to cyber-physical systems than previous work. Visualization of the learned transformations gives insight into the type of transformations that LNT learns. ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "1 Introduction ",
27
+ "text_level": 1,
28
+ "page_idx": 0
29
+ },
30
+ {
31
+ "type": "text",
32
+ "text": "Anomaly detection (AD) in time series is significant in many industrial, medical, and scientific applications. For instance, undetected anomalies in water treatment facilities or chemical plants can bring harm to millions of people. Such systems need to be constantly monitored for anomalies. ",
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "While AD has been an important field in machine learning for several decades (Ruff et al., 2020), promising performance gains have been primarily reported in applying deep learning methods to high-dimensional data such as images (Golan & El-Yaniv, 2018; Wang et al., 2019; Hendrycks et al., 2019; Bergman & Hoshen, 2020). Time series exhibit complex temporal dependencies and can be even more diverse than natural images. Consequently, time series anomaly detection with deep learning approaches has been widely studied in recent years Zhou et al. (2019); Shen et al. (2020); Malhotra et al. (2016); Li et al. (2019); de Haan & Löwe (2021); Deng & Hooi (2021); Carmona et al. (2021). While unsupervised methods based on density estimation can yield poor results for AD (Nalisnick et al., 2018), a recent trend relying on self-supervision has proven superior performance. As detailed below, this paper attempts to integrate recent ideas from self-supervised AD of non-temporal data with modern deep learning architectures for sequence modeling. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "text",
42
+ "text": "In this line of work, one uses auxiliary tasks, often based on data augmentation, both for training and anomaly scoring. Data augmentation usually relies on hand-designed data transformations such as rotations for images (Golan & El-Yaniv, 2018; Wang et al., 2019; Hendrycks et al., 2019). Qiu et al. (2021) showed that these transformations could instead be learned, thereby making self-supervised AD applicable to specialized domains beyond images. While this approach can identify an entire sequence as anomalous, it can still not be applied to detecting anomalies within time series (i.e., on a sub-sequence level). ",
43
+ "page_idx": 0
44
+ },
45
+ {
46
+ "type": "text",
47
+ "text": "But this adaption is not straightforward: For AD within time series, both local semantics (the dynamics within a time window) and contextualized semantics (how the time window relates to the remaining time series) matter. To capture both, we propose an end-to-end approach that combines time series representations (Oord et al., 2018) with a novel transformation learning objective. As a result, the local transformations create different views of the data in the latent space (Rudolph et al., 2017) (as opposed to applying them to the data directly as in Qiu et al. (2021)). ",
48
+ "page_idx": 0
49
+ },
50
+ {
51
+ "type": "text",
52
+ "text": "",
53
+ "page_idx": 1
54
+ },
55
+ {
56
+ "type": "text",
57
+ "text": "We develop Local Neural Transformations (LNT): a novel objective that combines representation learning with transformation learning. The encoder for feature extraction and the neural transformations are trained jointly on this loss. We show that the learned latent transformations can correspond to interpretable effects: in one experiment on speech data (details in Section 5), LNT learns transformations that insert delays. Neural transformations are much more general than hand-crafted transformations, which for time series could be time warping, reflections, or shifts: as we illustrate, they can transform the data in ways unintuitive to humans but valuable for the downstream task of AD. ",
58
+ "page_idx": 1
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "We prove theoretically (Section 4) and show empirically (Section 5) that combining representation and transformation learning is beneficial for detecting anomalies within time series. LNT outperforms various AD techniques on benchmark data, including a baseline using the Contrastive Predictive Coding (CPC) loss as the anomaly score (de Haan & Löwe, 2021). We evaluate the methods on public AD datasets for time series from cyber-physical systems. Furthermore, we detect artificial anomalies in speech data, which is challenging due to its complex temporal dynamics. In some experiments, LNT outperforms many strong baselines. ",
63
+ "page_idx": 1
64
+ },
65
+ {
66
+ "type": "text",
67
+ "text": "To summarize, our contributions in this work are: ",
68
+ "page_idx": 1
69
+ },
70
+ {
71
+ "type": "text",
72
+ "text": "1. A new method, LNT, for AD within time series. It unifies time series representations with a novel approach for learning local transformations. A open-source pytorch implementation is available at $[ ] ^ { 1 }$ \n2. A theoretical analysis. We prove that both learning paradigms complement each other to avoid trivial solutions not appropriate for detecting anomalies. \n3. An empirical study showing that LNT can detect anomalies within real cyber-physical data streams on par or better than many existing methods. ",
73
+ "page_idx": 1
74
+ },
75
+ {
76
+ "type": "text",
77
+ "text": "2 Related Work ",
78
+ "text_level": 1,
79
+ "page_idx": 1
80
+ },
81
+ {
82
+ "type": "text",
83
+ "text": "We first describe related work in time series AD, which is the problem we tackle in this work. We then describe related methods, specifically advances in self-supervised AD. ",
84
+ "page_idx": 1
85
+ },
86
+ {
87
+ "type": "text",
88
+ "text": "2.1 Time series anomaly detection ",
89
+ "text_level": 1,
90
+ "page_idx": 1
91
+ },
92
+ {
93
+ "type": "text",
94
+ "text": "There are two types of anomalies in time series: local and global anomalies. Global anomalies are entire time series, with a single anomaly score for the entire series. Local anomalies occur at isolated timestamps or short time intervals within the time series, so each time point must be assigned with an anomaly score. This is the setting that we consider in this work. Existing methods for local AD in time series using deep learning can be divided into four categories, discussed in detail below: (i) methods based on sequence forecasting, (ii) autoencoders, (iii) generative sequence models, and (iv) other approaches. ",
95
+ "page_idx": 1
96
+ },
97
+ {
98
+ "type": "text",
99
+ "text": "Forecasting methods A straightforward approach to detect anomalies in time series is to use the error of a time-series forecaster (predicting the value of the next time step from the time series’ past history) as an anomaly score. The rationale behind is that a forecaster trained on mostly normal data will err less on normal than on abnormal data. We may use any time-series regression method as the forecaster, and various methods have been studied, including neural architectures such as recurrent neural networks (RNNs) (Malhotra et al., 2015; Filonov et al., 2016) and temporal convolutional neural networks (TCNs) (He & Zhao, 2019; Munir et al., 2019), where the convolution operation is applied along the temporal dimension only. ",
100
+ "page_idx": 1
101
+ },
102
+ {
103
+ "type": "text",
104
+ "text": "Autoencoders To detect anomalies within time series, AEs have been combined with various neural network architectures, including RNNs (Malhotra et al., 2016) and TCNs (Thill et al., 2020) or variants (Zhang et al., 2019). Audibert et al. (2020) propose an architecture based purely on dense layers using a combination of two AEs connected with the adversarial loss. Again, the rational of using such approaches for AD is that after training on normal data, a high reconstruction error can be used to detect anomalies. ",
105
+ "page_idx": 1
106
+ },
107
+ {
108
+ "type": "text",
109
+ "text": "",
110
+ "page_idx": 2
111
+ },
112
+ {
113
+ "type": "text",
114
+ "text": "Deep generative models Variational autoencoders (VAEs) (Kingma & Welling, 2014) have frequently been combined with RNNs (Sölch et al., 2016; Park et al., 2018) to detect anomalies within time series. Pereira & Silveira (2018) combine an RNN with temporal self-attention. Guo et al. (2018) use gated recurrent units (GRUs) in combination with a gaussian mixture model. Su et al. (2019) augment a GRU-based VAE with a normalizing flow and a linear Gaussian state-space model. Generative adversarial networks (Goodfellow et al., 2014) have been used for AD within time series, taking either the discriminator’s error (Liang et al., 2021) or the generator’s residuals (Zhou et al., 2019) as an anomaly score. Li et al. (2019) use a weighted combination of both. These approaches have been combined with TCNs (Zhou et al., 2019) and RNNs (Niu et al., 2020; Geiger et al., 2020). ",
115
+ "page_idx": 2
116
+ },
117
+ {
118
+ "type": "text",
119
+ "text": "Other methods Some of the above-described approaches have been used in combination. For instance, Zhao et al. (2020) combine TCNs and LSTMs. Shen et al. (2020) combine a dilated RNN with a deep multisphere hypersphere classifier on the cluster centers of a hierarchical clustering procedure, with regularizers encouraging orthogonal centers at each layer and prediction regularizers encouraging useful representations in intermediate layers. Deng & Hooi (2021) construct a graph with nodes for each feature and edges representing relations between features; these are learned and combined with a graph-based attention mechanism. Carmona et al. (2021) employ a TCN as an encoder to train a hypersphere classifier in the latent space, with the option of including known anomalies into training. ",
120
+ "page_idx": 2
121
+ },
122
+ {
123
+ "type": "text",
124
+ "text": "2.2 Self-supervised anomaly detection ",
125
+ "text_level": 1,
126
+ "page_idx": 2
127
+ },
128
+ {
129
+ "type": "text",
130
+ "text": "Recently, there has been growing interest in tackling AD with self-supervised learning. The core idea of self-supervised learning is to devise training tasks, often based on data augmentation, that guide the model to learn useful representations of the data. In self-supervised AD, performance on the auxiliary tasks can be used for anomaly scoring. This is justified by the principle of inlier priority (Wang et al., 2019) which posits that a self-supervised approach will prioritize solving its training task for inliers. End-to-end detection methods based on transformation prediction (Golan & El-Yaniv, 2018; Hendrycks et al., 2019) have been designed for image AD. However, they require effective hand-crafted transformations while for data types beyond images, it is hard to design effective transformations by hand. Previous works proposed to utilize random affine transformations (Bergman & Hoshen, 2020) or data-driven neural transformations (Qiu et al., 2021) for AD. Neural transformations have been used to detect entire anomalous sequences. However, when the neural transformation learning approach of Qiu et al. (2021) is applied to the task of local anomaly detection, it can lead to trivial transformations that are not suitable for AD. Our work proves this and introduces a novel local transformation learning objective. ",
131
+ "page_idx": 2
132
+ },
133
+ {
134
+ "type": "text",
135
+ "text": "Alternatively, de Haan & Löwe (2021) propose to use the training criterion of CPC, a self-supervised approach without data augmentation, for anomaly detection. CPC learns local time series representations via contrastive predictions of future representations (Oord et al., 2018). However, the CPC loss is not a good fit for scoring anomalies since it requires a random draw of negative samples, which leads to a biased estimation or high memory cost during test time (de Haan & Löwe, 2021). Our work overcomes this. ",
136
+ "page_idx": 2
137
+ },
138
+ {
139
+ "type": "text",
140
+ "text": "3 Method ",
141
+ "text_level": 1,
142
+ "page_idx": 2
143
+ },
144
+ {
145
+ "type": "text",
146
+ "text": "In this work, we propose Local Neural Transformations (LNT), a new framework for detecting anomalies within time series data. LNT has two components: feature extraction and feature transformations. Given an input sequence, an encoder produces an embedding for each time step, encoding relevant information from the current time window. These features are then transformed by applying distinct neural networks to each embedding, producing different latent views. The views are trained to fulfill two requirements; the views should be diverse and semantically meaningful, i.e., they should reflect both local dynamics as well as how the observations fit into the larger context of the time series. Both are encouraged via self-supervision. ",
147
+ "page_idx": 2
148
+ },
149
+ {
150
+ "type": "text",
151
+ "text": "Specifically, two aspects of LNT are self-supervised: it combines two different contrastive losses. One of the contrastive losses, CPC, guides the representation learning that guarantees the encoder of LNT to produce good semantic time series representations that generalize well to unseen test data. The second contrastive loss, a novel dynamic deterministic contrastive loss (DDCL), contrasts different latent views of each time step to encourage the latent views to be diverse and semantically representative of the time series, both in a local and in a contextualized sense. ",
152
+ "page_idx": 3
153
+ },
154
+ {
155
+ "type": "text",
156
+ "text": "LNT follows the general paradigm of self-supervised AD. During training, the capability to contrast the data views produced by the transformations improves for the normal data, while it deteriorates for anomalies. The main components of LNT are the encoder producing local representations of the input and local neural transformations, which are neural networks that transform the local representations into different views. The encoder and the local neural transformations are trained using the two losses, one guiding the quality of representations, the other guiding the quality of the transformations. The losses are combined to produce an anomaly score $\\ell _ { t }$ for each time step in the input time series $x _ { 1 : t } : = ( x _ { 1 } , \\ldots , x _ { t } ) ^ { T } : x _ { t } \\in \\mathbb { R } ^ { d }$ , representing the likelihood that the observation in this time step is an anomaly. Formally, we assume a time series $x _ { 1 : t }$ to be observations of random variables $X _ { 1 : t }$ . Further, we assume that its data generating distribution factorizes with context variables as detailed in the definition below. ",
157
+ "page_idx": 3
158
+ },
159
+ {
160
+ "type": "text",
161
+ "text": "Definition 1 (Temporal Anomaly). Let $x _ { 1 : t } : = ( x _ { 1 } , \\ldots , x _ { t } ) ^ { T } \\in \\mathbb { R } ^ { T \\times d }$ be a multivariate time series and $p$ a distribution that factorizes with context variables $C _ { 1 : t }$ as $\\begin{array} { r } { p ( x _ { 1 : T } ) = \\int \\prod _ { t } p ( X _ { t } = x _ { t } | C _ { t } ) p ( C _ { t } | C _ { t - 1 } ) d C _ { 1 : t } } \\end{array}$ and $x _ { 1 : t } \\sim p$ . We call an observation $\\tilde { x } _ { t }$ an anomaly iff $\\tilde { x } _ { t } \\ne p ( x _ { t } | x _ { 1 : t - 1 } )$ , i.e. it is sampled from a different data generating distribution. ",
162
+ "page_idx": 3
163
+ },
164
+ {
165
+ "type": "text",
166
+ "text": "Given time series data $\\{ x _ { 1 : t } \\}$ it is unclear how to choose a good context representation $C _ { 1 : t }$ that is able to explain all the effects like trends, seasonality, or change points in a time series. This aspect renders it a challenging representation learning problem. Also, good context variables $C _ { t }$ might evolve on a coarse time scale than the measurements recorded for a time series. Note that from definition 1 not every change point is necessarily an anomaly as long as similar changes have been sufficiently observed during training and are accounted for in $p ( C _ { t } | C _ { t - 1 } )$ . In that way a time series with non-stationary dynamics and many change points (compare LibriSpeech, section 5.1) can be normal. ",
167
+ "page_idx": 3
168
+ },
169
+ {
170
+ "type": "text",
171
+ "text": "Before presenting local transformation learning and the DDCL in Section 3.2, we will first describe the encoder and the CPC-loss in Section 3.1. Then, we discuss how a trained model is used to detect anomalies. Finally, in Section 4, we provide theoretical arguments for combining transformation learning with representation learning. All notations used throughout the remainder of the section are summarized in table 4. ",
172
+ "page_idx": 3
173
+ },
174
+ {
175
+ "type": "text",
176
+ "text": "3.1 Local Time Series Representations ",
177
+ "text_level": 1,
178
+ "page_idx": 3
179
+ },
180
+ {
181
+ "type": "text",
182
+ "text": "The LNT architecture has two components, a feature extractor (encoder) and an anomaly detector (local neural transformations). The encoder maps a sequence of samples to a sequence of local latent representations $z _ { t }$ and is trained using the principles of Contrastive Predictive Coding ( $\\mathit { C P C }$ ) (Oord et al., 2018). We use the same architecture as Oord et al. (2018). The representations produced by the encoder $z _ { t } = g _ { \\mathrm { e n c } } ( x _ { t } )$ are summarized with an autoregressive module into context vectors $c _ { t } = g _ { \\mathrm { a r } } ( z _ { \\leq t } )$ . For different choices of $t$ and prediction steps $k$ , we built mini batches by randomly sampling a set $X$ of size $N$ from the training data that each contains one positive pair $\\left( { { x } _ { t } } , { { x } _ { t + k } } \\right)$ and $N - 1$ negative pairs $( x _ { t } , x _ { j } )$ , with $x _ { j }$ being any other sample $( j \\neq t + k )$ from the same mini batch but for a different choice of $t$ and $k$ . The CPC loss contrasts linear $k$ -step future predictions $W _ { k } c _ { t }$ against negative samples: ",
183
+ "page_idx": 3
184
+ },
185
+ {
186
+ "type": "equation",
187
+ "img_path": "images/677e48376f3ee041e0a6fdc28819213d16315e3c4cb3794988239b0be454b406.jpg",
188
+ "text": "$$\n\\mathcal { L } _ { \\mathrm { C P C } } = - \\mathbb { E } _ { X \\sim \\mathcal { D } } \\left[ \\log \\frac { \\exp ( z _ { t + k } ^ { T } W _ { k } c _ { t } ) } { \\sum _ { X } \\exp ( z _ { j } ^ { T } W _ { k } c _ { t } ) } \\right] .\n$$",
189
+ "text_format": "latex",
190
+ "page_idx": 3
191
+ },
192
+ {
193
+ "type": "text",
194
+ "text": "It encourages the context representation $c _ { t }$ to be predictive of nearby local representations $z _ { t + k }$ . Optimizing Equation (1) relates to maximizing the mutual information (Tschannen et al., 2019) between the context representation $c _ { t }$ and nearby time points $x _ { t + k }$ to produce good representations ( $\\scriptstyle { \\mathcal { L } } t$ and $c _ { t }$ ) that can be used in downstream tasks, including AD. ",
195
+ "page_idx": 3
196
+ },
197
+ {
198
+ "type": "image",
199
+ "img_path": "images/0108ddd8737b02c33d6181f9bdd7435fa480498a63a8ed32f1366a92605b6e6f.jpg",
200
+ "image_caption": [
201
+ "Figure 1: LNT on latent representations $z _ { t }$ resulting in transformed views $\\mathcal { T } _ { l } ( z _ { t } )$ - it can be viewed as pushing and pulling representations in latent space with the Dynamic Deterministic Contrastive Loss (DDCL) "
202
+ ],
203
+ "image_footnote": [],
204
+ "page_idx": 4
205
+ },
206
+ {
207
+ "type": "text",
208
+ "text": "3.2 Local Neural Transformations ",
209
+ "text_level": 1,
210
+ "page_idx": 4
211
+ },
212
+ {
213
+ "type": "text",
214
+ "text": "The second part of the LNT architecture introduces an auxiliary task for AD. The time series representations $z _ { t }$ are processed by local neural transformations to produce different views of each embedding. This operation relates to data augmentation but has two major differences: First, the transformations are not applied at the data level but in the latent space, producing latent views of each time window. Second, the transformations are not hand-crafted as is often done in computer vision, where rotation, cropping and blurring are popular augmentations, but are instead directly learned during training (Tamkin et al., 2020; Qiu et al., 2021). ",
215
+ "page_idx": 4
216
+ },
217
+ {
218
+ "type": "text",
219
+ "text": "The neural transformations are $L$ neural networks $\\pi ( \\cdot )$ with parameters $\\theta _ { l }$ . They are applied to each latent representation $z _ { t }$ to produce different latent views $z _ { t } ^ { ( l ) } = \\mathcal { T } _ { l } ( z _ { t } )$ , as shown in Figure 1. Each of the transformed views is encouraged to be predictive of the context at different time horizons $k$ by a loss contribution ",
220
+ "page_idx": 4
221
+ },
222
+ {
223
+ "type": "equation",
224
+ "img_path": "images/f2d89ef038911046aa5b797de427c006a503b3022a1a97997e45df087396ad60.jpg",
225
+ "text": "$$\n\\ell _ { t } ^ { ( k , l ) } ( x _ { \\le t } ) = - \\log \\frac { h \\bigl ( z _ { t } ^ { ( l ) } , W _ { k } c _ { t - k } \\bigr ) } { h \\bigl ( z _ { t } ^ { ( l ) } , W _ { k } c _ { t - k } \\bigr ) + \\sum _ { m \\neq l } h \\bigl ( z _ { t } ^ { ( l ) } , z _ { t } ^ { ( m ) } \\bigr ) } ,\n$$",
226
+ "text_format": "latex",
227
+ "page_idx": 4
228
+ },
229
+ {
230
+ "type": "text",
231
+ "text": "which simultaneously pushes different views of the same latent representations apart from each other. The notation h(zi, zj ) := exp zi zj∥zi∥∥zj∥ is defined as the exponentiated cosine similarity in the embedding space. Unlike most contrastive losses, where the negative samples are drawn from a noise distribution (Gutmann $\\&$ Hyvärinen, 2012), the other views to contrast against are constructed deterministically from the same input (Qiu et al., 2021). The loss contributions of each time-step $t$ , each transformation $\\it l$ , and each time horizon $k$ are combined to produce the Dynamic Deterministic Contrastive Loss (DDCL): ",
232
+ "page_idx": 4
233
+ },
234
+ {
235
+ "type": "equation",
236
+ "img_path": "images/6e2cba15be8a4ac0a0356b599e85d3f23827899f1bfe661afb1d916face54261.jpg",
237
+ "text": "$$\n\\mathcal { L } _ { \\mathrm { { D D C L } } } = \\mathbb { E } _ { \\boldsymbol { x } _ { 1 : T } \\sim \\mathcal { D } } \\left[ \\sum _ { k = 1 } ^ { K } \\sum _ { t = 1 } ^ { T } \\sum _ { l = 1 } ^ { L } \\ell _ { t } ^ { ( k , l ) } ( \\boldsymbol { x } _ { \\le t } ) \\right] .\n$$",
238
+ "text_format": "latex",
239
+ "page_idx": 4
240
+ },
241
+ {
242
+ "type": "text",
243
+ "text": "During training, the two objectives (Equations (1) and (3)) are optimized jointly using a unified loss, ",
244
+ "page_idx": 4
245
+ },
246
+ {
247
+ "type": "equation",
248
+ "img_path": "images/ba11e190716faf257d0fc4e36344ae1526631ddeda3f713e7fa035da680cca44.jpg",
249
+ "text": "$$\n\\mathcal { L } = \\mathcal { L } _ { \\mathrm { C P C } } + \\lambda \\cdot \\mathcal { L } _ { \\mathrm { D D C L } }\n$$",
250
+ "text_format": "latex",
251
+ "page_idx": 4
252
+ },
253
+ {
254
+ "type": "text",
255
+ "text": "and a balancing hyperparameter $\\lambda$ . All contrasting operations are performed on the mini batch described before, but the deterministic contrasting of distinct transformations $m \\neq { l }$ in DDCL causes the mini batch of latent representations to grow by a factor of $L$ . Since for each $\\mathbf { \\boldsymbol { \\mathscr { L } } } _ { t }$ a set $\\{ z _ { t } ^ { ( } 0 ) , \\ldots , z _ { t } ^ { ( } L ) \\}$ of $L$ distinct views needs to be stored. ",
256
+ "page_idx": 4
257
+ },
258
+ {
259
+ "type": "text",
260
+ "text": "As depicted by orange arrows in Figure 1, $\\mathcal { L }$ DDCL can intuitively be interpreted as pushing and pulling different representations in latent space. The numerator pulls the learned transformations $z _ { t + k } ^ { ( l ) }$ close to $W _ { k } c _ { t }$ ensuring semantic views, while the denominator pushes different views apart, ensuring diversity in the learned transformations. ",
261
+ "page_idx": 5
262
+ },
263
+ {
264
+ "type": "text",
265
+ "text": "3.2.1 Scoring of Anomalies ",
266
+ "text_level": 1,
267
+ "page_idx": 5
268
+ },
269
+ {
270
+ "type": "text",
271
+ "text": "After training LNT on a dataset of typical time series, we can use the DDCL for AD. Given a test sequence $x _ { 1 : T }$ , we evaluate the contribution of individual time steps to $\\mathcal { L } _ { \\mathrm { D D C L } }$ (Equation (3)). The score for each time point $t$ in the sequence is, ",
272
+ "page_idx": 5
273
+ },
274
+ {
275
+ "type": "equation",
276
+ "img_path": "images/c26321f5be40943e5896de25fd7ec9254d7cb1963d49e524241c5a3a88eca32d.jpg",
277
+ "text": "$$\n\\ell _ { t } ( \\boldsymbol { x } _ { \\le t } ) = \\sum _ { k = 1 } ^ { K } \\sum _ { l = 1 } ^ { L } \\ell _ { t } ^ { ( k , l ) } ( \\boldsymbol { x } _ { \\le t } )\n$$",
278
+ "text_format": "latex",
279
+ "page_idx": 5
280
+ },
281
+ {
282
+ "type": "text",
283
+ "text": "The higher the score, the more likely the series exhibits abnormal behavior at time $t$ . Unlike CPC-based AD (de Haan & Löwe, 2021), this anomaly score has the advantage of being deterministic and thus there is no need to draw negative samples from a proposal or noise distribution. ",
284
+ "page_idx": 5
285
+ },
286
+ {
287
+ "type": "text",
288
+ "text": "4 Analysis ",
289
+ "text_level": 1,
290
+ "page_idx": 5
291
+ },
292
+ {
293
+ "type": "text",
294
+ "text": "Our experiments in Section 5.5 show that LNT empirically outperforms CPC on various AD tasks. However, since the LNT architecture is trained on two losses jointly (the DDCL and CPC losses), the natural question arises: are both losses necessary or could we just train on the DDCL loss alone? The following analysis demonstrates the value of considering both losses jointly. ",
295
+ "page_idx": 5
296
+ },
297
+ {
298
+ "type": "text",
299
+ "text": "4.1 Ablation Analysis ",
300
+ "text_level": 1,
301
+ "page_idx": 5
302
+ },
303
+ {
304
+ "type": "text",
305
+ "text": "The following theorem shows that, if we trained the LNT architecture (i.e. the encoder and transformations $\\tau _ { i }$ ) only on the $\\mathcal { L } _ { \\mathrm { D D C L } }$ loss (without the $\\mathcal { L } _ { \\mathrm { C P C } }$ loss), the optimal solution would collapse to a constant encoder, a phenomenon known as the manifold collapse in deep AD (Ruff et al., 2018). Thus the CPC loss acts as a regularizer in our DDCL framework to avoid the manifold collapse; it is thus strictly necessary. ",
306
+ "page_idx": 5
307
+ },
308
+ {
309
+ "type": "text",
310
+ "text": "Theorem 1. Let $g _ { e n c } ^ { \\theta }$ and $g _ { a r } ^ { \\theta }$ be arbitrary encoders (including biases) with learned parameters $\\theta$ , and let $\\mathcal { L } _ { D D C L } ^ { \\theta }$ be the corresponding DDCL loss. Then there exist constant encoders $g _ { e n c } ^ { \\tilde { \\theta } }$ and $g _ { a r } ^ { \\tilde { \\theta } }$ (i.e., $\\exists \\tilde { \\theta } , a , b \\ \\forall x , z :$ $g _ { e n c } ^ { \\tilde { \\theta } } ( x ) = a , g _ { a r } ^ { \\tilde { \\theta } } ( z ) = b$ ) with ",
311
+ "page_idx": 5
312
+ },
313
+ {
314
+ "type": "equation",
315
+ "img_path": "images/6bea8539677e0d3b224d21c35d41a4e9505a716cd74c72404520866dbf25761d.jpg",
316
+ "text": "$$\n\\begin{array} { r } { \\mathcal { L } _ { D D C L } ^ { \\tilde { \\theta } } \\leq \\mathcal { L } _ { D D C L } ^ { \\theta } . } \\end{array}\n$$",
317
+ "text_format": "latex",
318
+ "page_idx": 5
319
+ },
320
+ {
321
+ "type": "text",
322
+ "text": "Proof. Let $g _ { e n c } ^ { \\theta }$ and $g _ { a r } ^ { \\theta }$ be arbitrary encoders (including biases) with learned parameters $\\theta$ (for notational simplicity of the proof we understand the additional parameter as included into ), and let be the corresponding DDCL loss. We observe from Equation (3) that $\\mathcal { L } _ { \\mathrm { D D C L } } ^ { \\theta }$ DDCL decomposes into a sum of loss contributions $\\ell _ { t } ^ { ( k , l ) } ( x _ { \\leq t } ; \\theta )$ . Let ",
323
+ "page_idx": 5
324
+ },
325
+ {
326
+ "type": "equation",
327
+ "img_path": "images/b14f9c2ec1e32857535d65079ce8cd1bec2590d727cb8db20ae76bac1444e19f.jpg",
328
+ "text": "$$\n( x _ { \\le t ^ { * } } ^ { * } , k ^ { * } , t ^ { * } ) = \\arg \\operatorname* { m i n } \\sum _ { l = 1 } ^ { L } \\ell _ { t } ^ { ( k , l ) } ( x _ { \\le t } ; \\theta ) ,\n$$",
329
+ "text_format": "latex",
330
+ "page_idx": 5
331
+ },
332
+ {
333
+ "type": "text",
334
+ "text": "be the indices of the summands with the smallest contribution to the sum, for a given fixed $\\theta$ . This means $x ^ { * }$ is the sample, $k ^ { * }$ the time horizon, and $t ^ { * }$ the time point associated with the smallest loss contribution to $\\mathcal { L } _ { \\mathrm { D D C L } }$ . Put ",
335
+ "page_idx": 5
336
+ },
337
+ {
338
+ "type": "equation",
339
+ "img_path": "images/57d7a0042df4299fbe3e807ff57bc76d428e5d2e46285d1ec34d3b0f0b8caadf.jpg",
340
+ "text": "$$\n\\ell ^ { * } : = \\sum _ { l = 1 } ^ { L } \\ell _ { t } ^ { ( k ^ { * } , l ) } ( x _ { \\le t ^ { * } } ; \\theta ) .\n$$",
341
+ "text_format": "latex",
342
+ "page_idx": 5
343
+ },
344
+ {
345
+ "type": "text",
346
+ "text": "Since our encoders are equipped with bias terms there exist constant encoders $g _ { e n c } ^ { \\theta }$ and $g _ { a r } ^ { \\theta }$ (i.e., $\\exists \\tilde { \\theta } , a , b \\forall x , z :$ $g _ { e n c } ^ { \\bar { \\theta } } ( x ) = a , g _ { a r } ^ { \\bar { \\theta } } ( z ) = b ,$ ) with ",
347
+ "page_idx": 6
348
+ },
349
+ {
350
+ "type": "equation",
351
+ "img_path": "images/10cd0d99211ba2fc25e38e63afcf99a8eb9249a532a8bd09838e8bd066ca24da.jpg",
352
+ "text": "$$\n\\forall x , k , t : \\sum _ { l = 1 } ^ { L } \\ell _ { t } ^ { ( k , l ) } ( x _ { \\leq t } ; \\tilde { \\theta } ) = \\ell ^ { \\ast } .\n$$",
353
+ "text_format": "latex",
354
+ "page_idx": 6
355
+ },
356
+ {
357
+ "type": "text",
358
+ "text": "Then we have: ",
359
+ "page_idx": 6
360
+ },
361
+ {
362
+ "type": "equation",
363
+ "img_path": "images/3e84f69923d6c6107ba0005ccd0ab285d2735615a733f14081df7a776e80a902.jpg",
364
+ "text": "$$\n\\begin{array} { r l r } { { \\mathcal { L } _ { \\mathrm { { D D C L } } } ( \\theta ) \\overset { e q u a t i o n ~ 3 } { = } \\mathbb { E } [ \\sum _ { k = 1 } ^ { K } \\sum _ { t } ^ { T } \\sum _ { l = 1 } ^ { L } \\ell _ { t } ^ { ( k , l ) } ( x _ { \\le t } ; \\theta ) ] } } \\\\ & { } & { \\stackrel { e q u a t i o n ~ 6 } { \\geq } K T \\sum _ { l = 1 } ^ { L } \\ell _ { t } ^ { ( k ^ { * } , l ) } ( x _ { \\le t ^ { * } } ^ { * } ; \\theta ) \\overset { e q u a t i o n ~ 7 } { = } \\ K T \\ell ^ { * } } \\\\ & { } & { \\stackrel { e q u a t i o n ~ 8 } { = } \\ \\mathbb { E } [ \\sum _ { k = 1 } ^ { K } \\sum _ { t } ^ { T } \\sum _ { l = 1 } ^ { L } \\ell _ { t } ^ { ( k , l ) } ( x _ { \\le t } ; \\tilde { \\theta } ) ] \\overset { e q u a t i o n ~ 3 } { = } \\mathcal { L } _ { \\mathrm { { D D C L } } } ( \\tilde { \\theta } ) , } \\end{array}\n$$",
365
+ "text_format": "latex",
366
+ "page_idx": 6
367
+ },
368
+ {
369
+ "type": "text",
370
+ "text": "which was to prove. ",
371
+ "page_idx": 6
372
+ },
373
+ {
374
+ "type": "text",
375
+ "text": "The above theorem shows that if LNT was trained on the DDCL loss only, LNT would collapse into a trivial solution. On the other hand a constant encoder clearly does not optimize the maximum mutual information criterion (Oord et al., 2018), which is induced by the CPC objective. ",
376
+ "page_idx": 6
377
+ },
378
+ {
379
+ "type": "text",
380
+ "text": "4.2 Computational Complexity Analysis ",
381
+ "text_level": 1,
382
+ "page_idx": 6
383
+ },
384
+ {
385
+ "type": "text",
386
+ "text": "This section is dedicated to investigating the computational complexity for both training and scoring anomalies of the LNT algorithm. A good proxy for complexity is counting the inner product occurring in the loss functions (eqs. (1) and (2)), since each inner product corresponds to an acquisition of the embeddings $z _ { t } , c _ { t } , z _ { t } ^ { ( l ) }$ (a forward pass through a fixed network in $\\mathcal { O } ( 1 )$ ) followed by the actual inner product which can be computed in approximately constant time on modern vectorized hardware. Let $B$ denote the batch size in the training of LNT. For the CPC part of the loss $\\mathcal { O } ( K ^ { 2 } B ^ { 2 } )$ inner products are computed since every embedding $z _ { t }$ in the batch is contrasted against the negatives from a different time series in the same minibatch. For the DDCL part, $\\mathcal { O } ( B K L ^ { 2 } )$ inner products are required since in eq. (3) every $ { \\boldsymbol { z } } _ { t } ^ { ( l ) }$ is treated as the positive sample once and contrasted against $L - 1$ negative samples $z _ { t } ^ { ( m ) } ; m \\neq l$ , and in practice $K , L \\ll B$ are small constants. Thus, in total $\\mathcal { O } ( B ^ { 2 } K ^ { 2 } + B K L ^ { 2 } ) = \\mathcal { O } ( B ^ { 2 } )$ . For the complexity of scoring anomalies, assume a time series of length $T$ . To score $\\ell _ { t }$ for a single time step, $\\mathcal { O } ( K L ^ { 2 } )$ inner products are required. For an entire time series this yields $\\mathcal { O } ( T L ^ { 2 } )$ . ",
387
+ "page_idx": 6
388
+ },
389
+ {
390
+ "type": "text",
391
+ "text": "Besides this hard mathematical evidence, there are also other good reasons to include the CPC loss into LNT. For instance, it ensures that the latent representations account for dynamics at longer time scales. This task is carried out by CPC’s autoregressive module. Our hypothesis is that, for effective AD within time series, it is necessary to consider both: the local signal in a time window and the larger context across time windows. Otherwise, the observations within a time window could be perfectly normal while not making sense in the context of a longer time horizon. For this reason, we believe that there are two types of semantic requirements of the representations and the latent views of LNT: ",
392
+ "page_idx": 6
393
+ },
394
+ {
395
+ "type": "text",
396
+ "text": "• Contextualized semantics (Addressed by $\\mathcal { L } _ { \\mathrm { D D C L } }$ ): views should reflect how the time window relates to the rest of the time series at different, longer time horizons, i.e. the similarity $h \\big ( z _ { t } ^ { ( l ) } , W _ { k } c _ { t - k } \\big )$ is maximized for different $k$ and each $\\it l$ . • Local semantics (Addressed by ${ \\mathcal { L } } _ { \\mathrm { C P C } }$ ): views $z _ { t }$ should share semantic information with the current time window $x _ { t }$ , which CPC achieves by maximizing its mutual information Oord et al. (2018). ",
397
+ "page_idx": 6
398
+ },
399
+ {
400
+ "type": "text",
401
+ "text": "Both loss contributions of LNT facilitate these requirements. CPC contributes local latent representations and context representations. The semantic content of the views is managed by the DDCL loss. ",
402
+ "page_idx": 6
403
+ },
404
+ {
405
+ "type": "text",
406
+ "text": "5 Experiments ",
407
+ "text_level": 1,
408
+ "page_idx": 7
409
+ },
410
+ {
411
+ "type": "text",
412
+ "text": "For experimental evaluation of LNT in comparison to other methods, we study three challenging datasets. We first describe the datasets, baselines and implementation details. In Section 5.3, we present our findings: LNT outperforms many strong baselines in detecting anomalies in the operation of a water distribution and a water treatment system and accurately finds anomalies in speech. In Section 5.4, we provide visualizations of the local transformations that are learned by LNT. Finally, in Section 5.5 we analyze the performance of LNT in comparison to CPC based alternatives. Our findings that LNT is consistently superior, complements our theoretical analysis in Section 4 on why CPC and transformation learning should be combined. ",
413
+ "page_idx": 7
414
+ },
415
+ {
416
+ "type": "text",
417
+ "text": "5.1 Datasets ",
418
+ "text_level": 1,
419
+ "page_idx": 7
420
+ },
421
+ {
422
+ "type": "text",
423
+ "text": "We evaluate LNT on three challenging real-world datasets, namely the Water Distribution Dataset (WaDi) Ahmed et al. (2017), the Secure Water Treatment Dataset (SWaT) (Goh et al., 2016) and the Libri Speech Collection (Panayotov et al., 2015). The first two datasets are provided with labeled anomalies in the test set. As recent observations in Wu & Keogh (2020) show, many popular datasets for time series AD seem to be mislabeled and flawed, which results in the revival of synthetic datasets Lai et al. (2021). The Libri Speech data is augmented with realistic synthetic anomalies. ",
424
+ "page_idx": 7
425
+ },
426
+ {
427
+ "type": "text",
428
+ "text": "Water Distribution The dataset is acquired from a water distribution testbed and provides a model of a scaled-down version of a large water distribution network in a city (Ahmed et al., 2017). The time series data is 112-dimensional with readings from different sensors and actuators such as pumps and valves. The training data consists of 14 days of normal operation sampled with a frequency of 1 Hz, resulting in a series length of 1048571. The test set consists of 2 days of additional operation (172801 time steps), during which 15 attacks were staged with an average duration of $\\approx 1 2$ minutes. ",
429
+ "page_idx": 7
430
+ },
431
+ {
432
+ "type": "text",
433
+ "text": "Secure Water Treatment This dataset is from a testbed for water treatment (Mathur & Tippenhauer, 2016) that evaluates the Cyber Security of a fully functional plant with a six-stage process of filtration and chemical dosing. Goh et al. (2016) collected 11 days of operation data. Under normal operation 51 sensor channels are recorded for 7 days yielding a training time series of length 475200. For the test data of length 224960, 36 attacks were launched during the last 4 days of the collection process. As suggested in Goh et al. (2016); Li et al. (2019), the first 21600 samples from the training data are removed for training stability. ",
434
+ "page_idx": 7
435
+ },
436
+ {
437
+ "type": "text",
438
+ "text": "We follow the experimental setup of He & Zhao (2019) and take the first part of the collection under attack as the validation set and drop channels which are constant in both training and test set, yielding a time series of 45 dimension. ",
439
+ "page_idx": 7
440
+ },
441
+ {
442
+ "type": "text",
443
+ "text": "Libri Speech The LibriSpeech dataset Panayotov et al. (2015) is an audio collection with spoken language recordings from 251 distinct speakers. We adopt the setup of Oord et al. (2018) with their train/test split and unsupervised training on the raw time signal without further pre-processing. For AD benchmarks, we randomly place additive pure sine tones of varying frequency (20 - 120 Hz) and length (512 - 4096 time steps) in the test data, yielding consecutive anomaly regions making up $\\approx 1 0 \\%$ of the test data. Speech data offers a challenging benchmark for deep AD methods since speech typically exhibits complex temporal dynamics, due to high multi-modality introduced through different speakers and word sequences (Oord et al., 2018). ",
444
+ "page_idx": 7
445
+ },
446
+ {
447
+ "type": "text",
448
+ "text": "5.2 Baselines and Implementation Details ",
449
+ "text_level": 1,
450
+ "page_idx": 7
451
+ },
452
+ {
453
+ "type": "table",
454
+ "img_path": "images/51fed97e8061ffd09a202038b036ac8ffe87fb328f045c04ab2739034de48163.jpg",
455
+ "table_caption": [
456
+ "Table 1: Neural Transformation Hyperparameters "
457
+ ],
458
+ "table_footnote": [],
459
+ "table_body": "<table><tr><td>Types</td><td>SWaT</td><td>WaDi</td><td>Libri</td></tr><tr><td># neurons</td><td>24</td><td>32</td><td>64</td></tr><tr><td>#layers</td><td>2</td><td>2</td><td>3</td></tr><tr><td>activation</td><td>ReLU</td><td>ReLU</td><td>ReLU</td></tr><tr><td>bias</td><td>False</td><td>False</td><td>False</td></tr></table>",
460
+ "page_idx": 7
461
+ },
462
+ {
463
+ "type": "image",
464
+ "img_path": "images/2f2de772187c73e10442a38c4674af2920478fca3d2b57a5282f1cdebe68e93d.jpg",
465
+ "image_caption": [
466
+ "Table 2: F1-scores ( $\\%$ ) for the Secure Water Treatment Dataset (SWaT). Baseline results as reported in Shen et al. (2020). "
467
+ ],
468
+ "image_footnote": [],
469
+ "page_idx": 8
470
+ },
471
+ {
472
+ "type": "text",
473
+ "text": "Baselines We study LNT in comparison to different classes of AD algorithms, ranging from classical methods to recent advances in deep AD. They include (i) classical methods, such as Isolation Forests (Liu et al., 2008), PCA reconstruction error (Shyu et al., 2003), and Feature Bagging (Lazarevic & Kumar, 2005), (ii) auto-regressive future predictions with LSTM (Hundman et al., 2018) and GDN (Deng & Hooi, 2021), which uses a graph to model the relations among variables as attention for the prediction, (iii) methods that estimate the density of the data, such as KNN (Angiulli & Pizzuti, 2002), LOF (Breunig et al., 2000), combinations with deep auto-encoders DAGMM (Zong et al., 2018), (iv) methods that employ a one-class objective, including OC-SVM (Schölkopf et al., 1999), DeepSVDD (Ruff et al., 2018) and THOC (Shen et al., 2020) for time-series, (v) methods that leverage the reconstruction of an auto-encoder with EncDec-AD (Malhotra et al., 2016) and LSTM-VAE (Park et al., 2018) (vi) and finally methods that use the ability of GANs to discriminate fake examples, like BeatGAN (Zhou et al., 2019) and MAD-GAN (Li et al., 2019). ",
474
+ "page_idx": 8
475
+ },
476
+ {
477
+ "type": "text",
478
+ "text": "Implementation Details For LNT, the hyperparamaters are adopted from those reported by Oord et al. (2018) for CPC: especially $c _ { t } \\in \\mathbb { R } ^ { 2 5 6 }$ , $z _ { t } \\in \\mathbb { R } ^ { 5 1 2 }$ and $K = 1 2$ for experiments with LibriSpeech data. The data is processed in sub-sequences of length 20480 for both training and testing. Since the other datasets contain way less diverse data points and show simpler temporal dynamics, the embeddings size, and thus the capacity of the model, is reduced to $c _ { t } \\in \\mathbb { R } ^ { 3 2 }$ , $z _ { t } \\in \\mathbb { R } ^ { 1 2 8 }$ . Also, the time-convolutional encoder network is down-sized to filters $( 3 , 3 , 4 , 2 )$ and strides $( 3 , 3 , 4 , 2 )$ resulting in the convolution of 72 time steps. ",
479
+ "page_idx": 8
480
+ },
481
+ {
482
+ "type": "text",
483
+ "text": "We consistently choose $L = 1 2$ distinct learned transformations $T _ { l } ( z _ { t } )$ for all datasets. Each is represented by an $M L P$ with properties summarized in table 1. The final layer always shares the dimensionality of $z _ { t }$ and is applied as a multiplicative mask with sigmoid activation to it. Additional implementation details are in the appendix. ",
484
+ "page_idx": 8
485
+ },
486
+ {
487
+ "type": "text",
488
+ "text": "The crucial part of LNT in terms of hyperparameters is the representation learning with CPC. Its parameters depend on the frequency of observations and sequence lengths in the time series data at hand and can be determined as for any other representation learning. Here, the validation data does not need any anomalies in order to find good hyper-parameters. These preceding optimizations imply different sizes for the embedding vectors $z _ { t } , c _ { t }$ that depend on the size of and inherent variations contained in a dataset. Afterward, as a rule of thumb, the size of the neural transformations are just scaled proportional to these embedding sizes and validated with the (smaller) validation sets containing anomalies. ",
489
+ "page_idx": 8
490
+ },
491
+ {
492
+ "type": "text",
493
+ "text": "5.3 Results ",
494
+ "text_level": 1,
495
+ "page_idx": 8
496
+ },
497
+ {
498
+ "type": "text",
499
+ "text": "We judge the anomaly scores predicted by the algorithms for each time step individually. Since the ratio of anomalies is imbalanced in the data, we evaluated the prediction performance with the $F _ { 1 }$ score, consistent with previous work. Additionally, we also report results using the ROC curve. The area under the curve (ROC-AUC) is a metric to judge the quality of the anomaly score independent of the choice of threshold, which is specifically chosen for its additional insights beyond the evaluation of a single threshold. ",
500
+ "page_idx": 8
501
+ },
502
+ {
503
+ "type": "text",
504
+ "text": "The results on the SWaT and WaDi datasets can be seen in Tables 2 and 3a, respectively. The ROC curves of our method on the SWaT and WaDi datasets are provided in Figures 4a and 4b. For SWaT, our approach (LNT) outperformed a set of challenging baselines as reported by Shen et al. (2020) with the highest $F _ { 1 }$ score (88.65%). Meanwhile for WaDi, our model produces comparable results both in terms of $F _ { 1 }$ and precision, with the highest recall value2. Notably, GDN achieves the highest precision on WaDi even though our own run, GDN (rerun), performed slightly worse than the reported results in Deng & Hooi (2021). When we ",
505
+ "page_idx": 8
506
+ },
507
+ {
508
+ "type": "table",
509
+ "img_path": "images/e5fe0e68e7c1608b4e7e5f472a7bcd77a624c7e1ead607b4b92076470a44cc47.jpg",
510
+ "table_caption": [],
511
+ "table_footnote": [
512
+ "(a) Water Distribution Data (WaDi). "
513
+ ],
514
+ "table_body": "<table><tr><td>Method</td><td>F1 0.10</td><td>Prec</td><td>Rec</td></tr><tr><td>PCA KNN FB EncDec-AD DAGMM LSMT-VAE MAD-GAN</td><td>0.08 0.09 0.34 0.36 0.25 0.37</td><td>39.53 7.76 8.60 34.35 54.44 87.79 41.44</td><td>5.63 7.75 8.60 34.35 26.99 14.45 33.92</td></tr><tr><td>GDN GDN (rerun)t GDN (adj.) t</td><td>0.57 0.47 0.38</td><td>97.50 83.76 29.38</td><td>40.19 33.06 54.22</td></tr><tr><td>LNT (ours) t</td><td>0.39</td><td>29.34</td><td>60.92</td></tr></table>",
515
+ "page_idx": 9
516
+ },
517
+ {
518
+ "type": "table",
519
+ "img_path": "images/a7a50786951a91f3546764874363fc2baf0b77aa12dac275856ccf7ea4f8c307.jpg",
520
+ "table_caption": [],
521
+ "table_footnote": [],
522
+ "table_body": "<table><tr><td>Method</td><td>AUC</td><td>Prec</td><td>Rec</td><td>F1</td></tr><tr><td>LSTM †</td><td>0.58</td><td>15.0</td><td>15.0</td><td>0.15</td></tr><tr><td>THOC t</td><td>0.82</td><td>30.2</td><td>30.0</td><td>0.30</td></tr><tr><td>LNT (ours) t</td><td>0.93</td><td>65.0</td><td>65.0</td><td>0.65</td></tr></table>",
523
+ "page_idx": 9
524
+ },
525
+ {
526
+ "type": "text",
527
+ "text": "(b) Synthetic anomalies randomly placed in the LibriSpeech dataset. ",
528
+ "page_idx": 9
529
+ },
530
+ {
531
+ "type": "text",
532
+ "text": "Table 3: Experimental results for additional datasets. Baseline results are taken from Deng & Hooi (2021), except for the methods marked with $\\dagger$ which are derived from our own experiments. ",
533
+ "page_idx": 9
534
+ },
535
+ {
536
+ "type": "image",
537
+ "img_path": "images/3900622ce3894089606762b43bed08e53d45d19fdbe351a6083089f5442e5256.jpg",
538
+ "image_caption": [
539
+ "Figure 2: Our approach LNT outperforms deep baselines in AD on speech data in terms of ROC-AUC curves. "
540
+ ],
541
+ "image_footnote": [],
542
+ "page_idx": 9
543
+ },
544
+ {
545
+ "type": "text",
546
+ "text": "adjust the thresholds in GDN (adj) to have a comparable precision as LNT it has a lower recall (54.22 $\\%$ ) than our method $( 6 0 . 9 2 \\% )$ ). In many mission-critical applications, detecting as many anomalies as possible is often much more important, as a false negative can do more harm than a false positive. This makes the high recall of LNT (60.92%) preferable while retaining an acceptably high $F 1$ score. ",
547
+ "page_idx": 9
548
+ },
549
+ {
550
+ "type": "text",
551
+ "text": "We argue that the novel criterion for AD based on contrasting learned latent data transformations allows LNT to also uncover some of the harder detectable anomalies in the dataset. A similar behaviour can also be observed for the LibriSpeech data with results in terms of ROC curves shown in Figure 2. Here, LNT clearly outperforms both deep learning methods. This shows that detecting anomalies within speech data with its complex temporal dynamics is indeed a challenging task for many deep AD algorithms. Especially the future predictions of LSTM perform only slightly better than random chance in this experiment for all possible thresholds. This emphasizes the benefit of contrasting of neural transformations to uncover such hard anomalies. Additional metrics for this experiment are reported in Table 3b. ",
552
+ "page_idx": 9
553
+ },
554
+ {
555
+ "type": "text",
556
+ "text": "5.4 Visualization of Transformations ",
557
+ "text_level": 1,
558
+ "page_idx": 9
559
+ },
560
+ {
561
+ "type": "text",
562
+ "text": "In general, it is considered hard to get insights from embedding visualizations for $z _ { t }$ in the latent space. Hence, to make the transformations interpretable in terms of semantics, we propose to visualize them in data space. We reuse the encoder as described in Section 3.1 and enrich it with a separate decoder. We train the decoder to reconstruct the (non-transformed) input data while freezing the encoder weights. The trained decoder is then applied to transformed embeddings to visualize them in data space. ",
563
+ "page_idx": 9
564
+ },
565
+ {
566
+ "type": "image",
567
+ "img_path": "images/ee23ce1c67e813c68f9fc29b7ea8048a3a35e3d3f4e453cf38d9baa95a0df79b.jpg",
568
+ "image_caption": [
569
+ "Figure 3: Visualizations of selected transformations in data-space that show semantically interpretable behaviour, such as altered delays in specific channels. Representations from SWaT dataset are decoded with a seperatly trained auto-encoder. "
570
+ ],
571
+ "image_footnote": [],
572
+ "page_idx": 10
573
+ },
574
+ {
575
+ "type": "image",
576
+ "img_path": "images/56516f5476ae4c366a466ef8f7fe9217c6bcb7d7952d1b7f2c6c6d3faa0227a4.jpg",
577
+ "image_caption": [
578
+ "Figure 4: Improvement of LNT over CPC scoring evaluated for different datasets. The combination of transformation learning with local representation learning of CPC consitently outperforms the other variants of CPC for anomaly scoring. "
579
+ ],
580
+ "image_footnote": [],
581
+ "page_idx": 10
582
+ },
583
+ {
584
+ "type": "text",
585
+ "text": "We chose a subset $\\{ \\mathcal { T } _ { i } \\} _ { i = 1 } ^ { 5 }$ of five transformations which showed interpretable behavior in experiments with $S W a T$ as shown in Figure 3: For the non-transformed series $x$ the signal jumps in channels 25 and 36 at $t \\approx 2 5 0 0$ . This jump is delayed for channels $2 6 - 3 5$ . Interestingly, we found that this delay is altered by the learned transformations. For example, $\\tau _ { 1 }$ removes this delay causing the signal jump for all aforementioned channels at $t \\approx 2 5 0 0$ . In contrast, $\\tau _ { 2 }$ affects the series oppositely by enlarging this delay. ",
586
+ "page_idx": 10
587
+ },
588
+ {
589
+ "type": "text",
590
+ "text": "In summary, these transformations produce semantically meaningful and diverse views of the time series. Admittedly, current interpretations are still rather high-level and fairly limited from application standpoints. However, without domain knowledge, there exists no gold standard for a good transformation on the data to compare against. This was the original motivation for the usage of learnable transformations, as effective data augmentation for AD. ",
591
+ "page_idx": 10
592
+ },
593
+ {
594
+ "type": "text",
595
+ "text": "5.5 Emperical Ablation Study ",
596
+ "text_level": 1,
597
+ "page_idx": 10
598
+ },
599
+ {
600
+ "type": "text",
601
+ "text": "Recall, that we defined LNT to be a composition of CPC and neural transformations trained from a joint loss $\\mathcal { L } = \\mathcal { L } _ { \\mathrm { C P C } } + \\lambda \\cdot \\mathcal { L } _ { \\mathrm { D D C L } }$ . Theorem 1 provided a theoretical argument for the advantage of LNT over an approach purely based on DDCL. Also in practice this leeds to a solution with close to random performance in detecting anomalies and is thus not further considered in the following. ",
602
+ "page_idx": 10
603
+ },
604
+ {
605
+ "type": "text",
606
+ "text": "Instead, we study the reverse ablation: the advantage of LNT over pure CPC. There are several ways to use CPC to detect anomalies: (i) directly use the CPC-loss to score anomalies (de Haan & Löwe, 2021) or (ii) use CPC as a feature extractor and then run another AD method such as OC-SVM on the extracted features. One disadvantage of (i) are the negative samples. They make it nontrivial to evaluate the CPC-loss on test data. We employ a practical implementation (Approx. CPC) without negative samples at test time. de Haan & Löwe (2021) argue that taking samples from the test data is biased and using the training data is infeasible in practice. In contrast, DDCL is deterministic and the alternative views are all constructed from a single sample. It is hence straightforward to use it to score anomalies at test time. From the results in Figure 4, we found that the combination of transformation learning with local representation learning of CPC consistently outperforms the considered variants of CPC for AD in all three datasets. This connects to the discussion about contextualized semantics in Section 4. Comparing LNT with CPC $^ +$ OC-SVM supports our claim: While the OC-SVM with CPC input features has access only to the local semantics in the CPC representations, the performance of LNT in Figure 4 is consistently superior and can be explained by its transformations exhibiting both contextualized semantics and diversity. ",
607
+ "page_idx": 10
608
+ },
609
+ {
610
+ "type": "text",
611
+ "text": "",
612
+ "page_idx": 11
613
+ },
614
+ {
615
+ "type": "text",
616
+ "text": "6 Conclusion ",
617
+ "text_level": 1,
618
+ "page_idx": 11
619
+ },
620
+ {
621
+ "type": "text",
622
+ "text": "We propose a novel self-supervised method, LNT, to detect anomalies within time series. The key ingredient is a novel training objective combining representation and transformation learning. We prove that both learning paradigms complement each other to avoid trivial solutions not appropriate for AD. We find in an empirical study that LNT learns to insert delays, which allows it to outperform many strong baselines on challenging detection tasks. ",
623
+ "page_idx": 11
624
+ },
625
+ {
626
+ "type": "text",
627
+ "text": "References ",
628
+ "text_level": 1,
629
+ "page_idx": 11
630
+ },
631
+ {
632
+ "type": "text",
633
+ "text": "Chuadhry Mujeeb Ahmed, Venkata Reddy Palleti, and Aditya P Mathur. Wadi: a water distribution testbed for research in the design of secure cyber physical systems. In Proceedings of the 3rd International Workshop on Cyber-Physical Systems for Smart Water Networks, pp. 25–28, 2017. \nFabrizio Angiulli and Clara Pizzuti. Fast outlier detection in high dimensional spaces. In European conference on principles of data mining and knowledge discovery, pp. 15–27. Springer, 2002. \nJulien Audibert, Pietro Michiardi, Frédéric Guyard, Sébastien Marti, and Maria A Zuluaga. Usad: Unsupervised anomaly detection on multivariate time series. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 3395–3404, 2020. doi: 10.1145/3394486.3403392. \nLiron Bergman and Yedid Hoshen. Classification-based anomaly detection for general data. arXiv preprint arXiv:2005.02359, 2020. \nMarkus M Breunig, Hans-Peter Kriegel, Raymond T Ng, and Jörg Sander. Lof: identifying density-based local outliers. In Proceedings of the 2000 ACM SIGMOD international conference on Management of data, pp. 93–104, 2000. \nChris U Carmona, François-Xavier Aubet, Valentin Flunkert, and Jan Gasthaus. Neural contextual anomaly detection for time series. arXiv preprint arXiv:2107.07702, 2021. \nPuck de Haan and Sindy Löwe. Contrastive predictive coding for anomaly detection. arXiv preprint arXiv:2107.07820, 2021. \nAilin Deng and Bryan Hooi. Graph neural network-based anomaly detection in multivariate time series. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pp. 4027–4035, 2021. \nPavel Filonov, Andrey Lavrentyev, and Artem Vorontsov. Multivariate industrial time series with cyber-attack simulation: Fault detection using an lstm-based predictive data model. arXiv preprint arXiv:1612.06676, 2016. \nAlexander Geiger, Dongyu Liu, Sarah Alnegheimish, Alfredo Cuesta-Infante, and Kalyan Veeramachaneni. Tadgan: Time series anomaly detection using generative adversarial networks. In 2020 IEEE International Conference on Big Data (Big Data), pp. 33–43. IEEE, 2020. doi: 10.1109/BigData50022.2020.9378139. \nJonathan Goh, Sridhar Adepu, Khurum Nazir Junejo, and Aditya Mathur. A dataset to support research in the design of secure water treatment systems. In International conference on critical information infrastructures security, pp. 88–99. Springer, 2016. \nIzhak Golan and Ran El-Yaniv. Deep anomaly detection using geometric transformations. In Advances in Neural Information Processing Systems, pp. 9758–9769, 2018. \nIan Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. Advances in neural information processing systems, 27, 2014. \nYifan Guo, Weixian Liao, Qianlong Wang, Lixing Yu, Tianxi Ji, and Pan Li. Multidimensional time series anomaly detection: A gru-based gaussian mixture variational autoencoder approach. In Asian Conference on Machine Learning, pp. 97–112. PMLR, 2018. URL http://proceedings.mlr.press/v95/guo18a.html. \nMichael U Gutmann and Aapo Hyvärinen. Noise-contrastive estimation of unnormalized statistical models, with applications to natural image statistics. Journal of Machine Learning Research, 13(2), 2012. \nYangdong He and Jiabao Zhao. Temporal convolutional networks for anomaly detection in time series. In Journal of Physics: Conference Series, volume 1213, pp. 042050. IOP Publishing, 2019. doi: 10.1088/ 1742-6596/1213/4/042050. \nDan Hendrycks, Mantas Mazeika, Saurav Kadavath, and Dawn Song. Using self-supervised learning can improve model robustness and uncertainty. In Advances in Neural Information Processing Systems, pp. 15663–15674, 2019. \nKyle Hundman, Valentino Constantinou, Christopher Laporte, Ian Colwell, and Tom Soderstrom. Detecting spacecraft anomalies using lstms and nonparametric dynamic thresholding. In Proceedings of the 24th ACM SIGKDD international conference on knowledge discovery & data mining, pp. 387–395, 2018. \nDiederik P. Kingma and Max Welling. Auto-encoding variational bayes. In Yoshua Bengio and Yann LeCun (eds.), 2nd International Conference on Learning Representations, ICLR 2014, Conference Track Proceedings, Banff, AB, Canada, 2014. URL http://arxiv.org/abs/1312.6114. \nKwei-Herng Lai, Daochen Zha, Junjie Xu, Yue Zhao, Guanchu Wang, and Xia Hu. Revisiting time series outlier detection: Definitions and benchmarks. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 1), 2021. \nAleksandar Lazarevic and Vipin Kumar. Feature bagging for outlier detection. In Proceedings of the eleventh ACM SIGKDD international conference on Knowledge discovery in data mining, pp. 157–166, 2005. \nDan Li, Dacheng Chen, Baihong Jin, Lei Shi, Jonathan Goh, and See-Kiong Ng. Mad-gan: Multivariate anomaly detection for time series data with generative adversarial networks. In International Conference on Artificial Neural Networks, pp. 703–716. Springer, 2019. doi: 10.1016/j.neucom.2020.10.084. URL https://www.sciencedirect.com/science/article/pii/S0925231220316970. \nHaoran Liang, Lei Song, Jianxing Wang, Lili Guo, Xuzhi Li, and Ji Liang. Robust unsupervised anomaly detection via multi-time scale dcgans with forgetting mechanism for industrial multivariate time series. Neurocomputing, 423:444–462, 2021. doi: 10.1016/j.neucom.2020.10.084. \nFei Tony Liu, Kai Ming Ting, and Zhi-Hua Zhou. Isolation forest. In 2008 eighth ieee international conference on data mining, pp. 413–422. IEEE, 2008. \nPankaj Malhotra, Lovekesh Vig, Gautam Shroff, and Puneet Agarwal. Long short term memory networks for anomaly detection in time series. In Proceedings, volume 89, pp. 89–94, 2015. \nPankaj Malhotra, Anusha Ramakrishnan, Gaurangi Anand, Lovekesh Vig, Puneet Agarwal, and Gautam Shroff. Lstm-based encoder-decoder for multi-sensor anomaly detection. arXiv preprint arXiv:1607.00148, 2016. ",
634
+ "page_idx": 11
635
+ },
636
+ {
637
+ "type": "text",
638
+ "text": "",
639
+ "page_idx": 12
640
+ },
641
+ {
642
+ "type": "text",
643
+ "text": "Aditya P Mathur and Nils Ole Tippenhauer. Swat: A water treatment testbed for research and training on ics security. In 2016 international workshop on cyber-physical systems for smart water networks (CySWater), pp. 31–36. IEEE, 2016. ",
644
+ "page_idx": 13
645
+ },
646
+ {
647
+ "type": "text",
648
+ "text": "Mohsin Munir, Shoaib Ahmed Siddiqui, Andreas Dengel, and Sheraz Ahmed. Deepant: A deep learning approach for unsupervised anomaly detection in time series. IEEE Access, 7:1991–2005, 2019. doi: 10.1109/ACCESS.2018.2886457. \nEric Nalisnick, Akihiro Matsukawa, Yee Whye Teh, Dilan Gorur, and Balaji Lakshminarayanan. Do deep generative models know what they don’t know? In International Conference on Learning Representations, 2018. \nZijian Niu, Ke Yu, and Xiaofei Wu. Lstm-based vae-gan for time-series anomaly detection. Sensors, 20(13): 3738, 2020. URL https://www.mdpi.com/1424-8220/20/13/3738. \nAaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. \nVassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. Librispeech: an asr corpus based on public domain audio books. In 2015 IEEE international conference on acoustics, speech and signal processing (ICASSP), pp. 5206–5210. IEEE, 2015. \nDaehyung Park, Yuuna Hoshi, and Charles C Kemp. A multimodal anomaly detector for robot-assisted feeding using an lstm-based variational autoencoder. IEEE Robotics and Automation Letters, 3(3):1544–1551, 2018. \nJoao Pereira and Margarida Silveira. Unsupervised anomaly detection in energy time series data using variational recurrent autoencoders with attention. In 2018 17th IEEE international conference on machine learning and applications (ICMLA), pp. 1275–1282. IEEE, 2018. doi: 10.1109/ICMLA.2018.00207. \nChen Qiu, Timo Pfrommer, Marius Kloft, Stephan Mandt, and Maja Rudolph. Neural transformation learning for deep anomaly detection beyond images. In International Conference on Machine Learning, pp. 8703–8714. PMLR, 2021. \nMaja Rudolph, Francisco Ruiz, Susan Athey, and David Blei. Structured embedding models for grouped data. In Neural Information Processing Systems, 2017. \nLukas Ruff, Robert Vandermeulen, Nico Goernitz, Lucas Deecke, Shoaib Ahmed Siddiqui, Alexander Binder, Emmanuel Müller, and Marius Kloft. Deep one-class classification. In International conference on machine learning, pp. 4393–4402, 2018. \nLukas Ruff, Jacob R Kauffmann, Robert A Vandermeulen, Grégoire Montavon, Wojciech Samek, Marius Kloft, Thomas G Dietterich, and Klaus-Robert Müller. A unifying review of deep and shallow anomaly detection. arXiv preprint arXiv:2009.11732, 2020. \nBernhard Schölkopf, Robert C Williamson, Alexander J Smola, John Shawe-Taylor, John C Platt, et al. Support vector method for novelty detection. In NIPS, volume 12, pp. 582–588. Citeseer, 1999. \nLifeng Shen, Zhuocong Li, and James Kwok. Timeseries anomaly detection using temporal hierarchical oneclass network. In Advances in Neural Information Processing Systems, 2020. URL https://proceedings. neurips.cc/paper/2020/file/97e401a02082021fd24957f852e0e475-Paper.pdf. \nMei-Ling Shyu, Shu-Ching Chen, Kanoksri Sarinnapakorn, and LiWu Chang. A novel anomaly detection scheme based on principal component classifier. Technical report, MIAMI UNIV CORAL GABLES FL DEPT OF ELECTRICAL AND COMPUTER ENGINEERING, 2003. \nMaximilian Sölch, Justin Bayer, Marvin Ludersdorfer, and Patrick van der Smagt. Variational inference for ",
649
+ "page_idx": 13
650
+ },
651
+ {
652
+ "type": "text",
653
+ "text": "on-line anomaly detection in high-dimensional time series. arXiv preprint, 2016. ",
654
+ "page_idx": 13
655
+ },
656
+ {
657
+ "type": "text",
658
+ "text": "Ya Su, Youjian Zhao, Chenhao Niu, Rong Liu, Wei Sun, and Dan Pei. Robust anomaly detection for multivariate time series through stochastic recurrent neural network. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 2828–2837, 2019. doi: 10.1145/3292500.3330672. \nAlex Tamkin, Mike Wu, and Noah Goodman. Viewmaker networks: Learning views for unsupervised representation learning. arXiv preprint arXiv:2010.07432, 2020. \nMarkus Thill, Wolfgang Konen, and Thomas Bäck. Time series encodings with temporal convolutional networks. In International Conference on Bioinspired Methods and Their Applications, pp. 161–173. Springer, 2020. ISBN 978-3-030-63710-1. doi: 10.1007/978-3-030-63710-1_13. \nMichael Tschannen, Josip Djolonga, Paul K Rubenstein, Sylvain Gelly, and Mario Lucic. On mutual information maximization for representation learning. arXiv preprint arXiv:1907.13625, 2019. \nSiqi Wang, Yijie Zeng, Xinwang Liu, En Zhu, Jianping Yin, Chuanfu Xu, and Marius Kloft. Effective end-to-end unsupervised outlier detection via inlier priority of discriminative network. In Advances in Neural Information Processing Systems, pp. 5962–5975, 2019. \nRenjie Wu and Eamonn J Keogh. Current time series anomaly detection benchmarks are flawed and are creating the illusion of progress. arXiv preprint arXiv:2009.13807, 2020. \nChuxu Zhang, Dongjin Song, Yuncong Chen, Xinyang Feng, Cristian Lumezanu, Wei Cheng, Jingchao Ni, Bo Zong, Haifeng Chen, and Nitesh V Chawla. A deep neural network for unsupervised anomaly detection and diagnosis in multivariate time series data. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 1409–1416, 2019. doi: 10.1609/aaai.v33i01.33011409. \nHang Zhao, Yujing Wang, Juanyong Duan, Congrui Huang, Defu Cao, Yunhai Tong, Bixiong Xu, Jing Bai, Jie Tong, and Qi Zhang. Multivariate time-series anomaly detection via graph attention network. In 2020 IEEE International Conference on Data Mining (ICDM), pp. 841–850. IEEE, 2020. doi: 10.1109/ ICDM50108.2020.00093. \nBin Zhou, Shenghua Liu, Bryan Hooi, Xueqi Cheng, and Jing Ye. Beatgan: Anomalous rhythm detection using adversarially generated time series. In IJCAI, pp. 4433–4439, 2019. \nBo Zong, Qi Song, Martin Renqiang Min, Wei Cheng, Cristian Lumezanu, Daeki Cho, and Haifeng Chen. Deep autoencoding gaussian mixture model for unsupervised anomaly detection. In International conference on learning representations, 2018. ",
659
+ "page_idx": 14
660
+ },
661
+ {
662
+ "type": "text",
663
+ "text": "Appendix ",
664
+ "text_level": 1,
665
+ "page_idx": 15
666
+ },
667
+ {
668
+ "type": "text",
669
+ "text": "A Further Implementation Details ",
670
+ "text_level": 1,
671
+ "page_idx": 15
672
+ },
673
+ {
674
+ "type": "text",
675
+ "text": "In this section the implementation details for the experiments conducted in the main paper are further elaborated. These include our method (LNT) as well as all baselines that we implemented for comparision. ",
676
+ "page_idx": 15
677
+ },
678
+ {
679
+ "type": "text",
680
+ "text": "A.1 Hardware ",
681
+ "text_level": 1,
682
+ "page_idx": 15
683
+ },
684
+ {
685
+ "type": "text",
686
+ "text": "All experiments were run on virtualized hardware with 8 CPU cores of type Intel(R) Xeon(R) Gold 6150 running at 2.70 GHz, 32 GB RAM, and a single TeslaV100-SXM2 with 32 GB of gpu memory. Consistently we use Python 3.9, PyTorch in version 1.8.1 with CUDA in version 11.1 and cuDNN in version 8.0.5. ",
687
+ "page_idx": 15
688
+ },
689
+ {
690
+ "type": "text",
691
+ "text": "A.2 Hyperparameters ",
692
+ "text_level": 1,
693
+ "page_idx": 15
694
+ },
695
+ {
696
+ "type": "text",
697
+ "text": "LNT The hyper-parameters for our method were determined by the following procedure. Starting with the hyper-paramters as reported in Oord et al. (2018), the sizes of the embeddings $z _ { t }$ and $c _ { t }$ , which also determines the number of memory units in the recurrent part $g _ { \\mathrm { a r } }$ , and the number of parameters in the convolutional encoder $g _ { \\mathrm { e n c } }$ are downsized to fit the complexity and amount of data in the other datasets. To find a well generalizing setup, a hold-out validation set (split from the training data) was used. For Libri-Speech we considered the hyper-parameters as optimal and didn’t change them. As a rule of thump, the sequence length for training and the width of the strided temporal convolutions were always chosen in a way such that the number of recurrent steps $y _ { \\mathrm { a r } }$ takes matches with the setup ( $= 1 2 8$ ) in Oord et al. (2018). ",
698
+ "page_idx": 15
699
+ },
700
+ {
701
+ "type": "text",
702
+ "text": "LNT is trained for 100 epochs, respectively 500 epochs on SWaT and WaDi, with learning rate $2 \\cdot 1 0 ^ { - 4 }$ , batch size 32 and $\\lambda = 1 0 ^ { - 3 }$ . ",
703
+ "page_idx": 15
704
+ },
705
+ {
706
+ "type": "text",
707
+ "text": "A.3 Baselines in LibriSpeech Experiments ",
708
+ "text_level": 1,
709
+ "page_idx": 15
710
+ },
711
+ {
712
+ "type": "text",
713
+ "text": "The following hyperparameter setups are used for the experiments conducted with synthetic anomalies in LibriSpeech data. ",
714
+ "page_idx": 15
715
+ },
716
+ {
717
+ "type": "text",
718
+ "text": "LSTM Here, a standard Long Short Term Memory (LSTM) network with 2 layers and 256 hidden units each was chosen. With this setup the number of hidden units aligns with the LNT setup and the multiple layers should account for the missing encoder structure in LSTM. It is trained until convergence, which took approximately 100 epochs, with batch size 32, learning rate $2 \\cdot 1 0 ^ { - 4 }$ and a dropout of 0.3. ",
719
+ "page_idx": 15
720
+ },
721
+ {
722
+ "type": "text",
723
+ "text": "THOC Here, the Implementation was kindly provided by the authors. We used a smaller sub-sequence length of 1024 for training due to the high memory load of the model. Predictions at test time are stitched together to align with the longer sequence length. The method is trained to fit 3 layers hierarchical with dilations $( 1 , 2 , 4 )$ , 128 hidden units and 6 clusters in each layer. The method is trained with learning rate $1 0 ^ { - 3 }$ and batch size 32 and converged after 50 epochs. ",
724
+ "page_idx": 15
725
+ },
726
+ {
727
+ "type": "text",
728
+ "text": "B Notation Details ",
729
+ "text_level": 1,
730
+ "page_idx": 16
731
+ },
732
+ {
733
+ "type": "text",
734
+ "text": "The following table summarizes the notations used in the main paper. ",
735
+ "page_idx": 16
736
+ },
737
+ {
738
+ "type": "table",
739
+ "img_path": "images/070a3f6060bde03c22c76c0e034837d8c11b8173dfc7a84efe1fd9b56ea64ad2.jpg",
740
+ "table_caption": [
741
+ "Table 4: Overview of the notation used in the paper "
742
+ ],
743
+ "table_footnote": [],
744
+ "table_body": "<table><tr><td>Notation</td><td>Description</td></tr><tr><td>Xt</td><td>patch of (multivariate) measurements of a time series x in the time interval [t-T,t+τ] fora fixed window size T</td></tr><tr><td>Zt</td><td>local representation zt = genc(xt) of a time series patch xt produced by the encoder genc</td></tr><tr><td>Ct</td><td>context representation Ct = gar(z≤t) that summarize the history of local representations z≤t := zo:t with an autoregressive network gar</td></tr><tr><td>Wk</td><td>matrix to linearly predict embeddings k steps into the future</td></tr><tr><td>WkCt</td><td>linear (future) prediction of the ground truth embedding zt+k</td></tr><tr><td>TO</td><td>a neural transformation (i.e.a neural network) with parameters 0</td></tr><tr><td></td><td>a latent view z𝑖l) = Ti(zt) of a local representation zt at time t acquired by applying transformation Tt</td></tr><tr><td></td><td>the contribution to the DDCL loss for a specific transformation l and k-step future predictions with Wk</td></tr><tr><td>lt(x&lt;t)</td><td>alLCLottiese</td></tr><tr><td>h(,)</td><td>exponated cosine similarity 2T2j between embeddings h(zi,zj) := exp </td></tr></table>",
745
+ "page_idx": 16
746
+ }
747
+ ]
parse/test/p6xslUyvka/p6xslUyvka_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/p6xslUyvka/p6xslUyvka_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/qV83K9d5WB/qV83K9d5WB.md ADDED
@@ -0,0 +1,504 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LARGE LANGUAGE MODELS AS TOOL MAKERS
2
+
3
+ Tianle $\mathbf { C a i ^ { 1 , 2 * } }$ Xuezhi Wang1 Tengyu $\mathbf { M } \mathbf { a } ^ { 1 , 3 \dagger }$ Xinyun Chen1 Denny Zhou1 1Google Deepmind 2Princeton University 3Stanford University
4
+
5
+ # ABSTRACT
6
+
7
+ Recent research has highlighted the potential of large language models (LLMs) to improve their problem-solving capabilities with the aid of suitable external tools. In our work, we further advance this concept by introducing a closedloop framework, referred to as LLMs As Tool Makers (LATM), where LLMs create their own reusable tools for problem-solving. Our approach consists of two phases: 1) tool making: an LLM acts as the tool maker that crafts tools for a set of tasks, where a tool is implemented as a Python utility function. 2) tool using: another LLM acts as the tool user, which applies the tool built by the tool maker for problem-solving. The tool user can be either the same or a different LLM from the tool maker. On the problem-solving server side, tool-making enables continual tool generation and caching as new requests emerge. This framework enables subsequent requests to access cached tools via their corresponding APIs, enhancing the efficiency of task resolution. Beyond enabling LLMs to create their own tools, our framework also uncovers intriguing opportunities to optimize the serving cost of LLMs: Recognizing that tool-making requires more sophisticated capabilities, we assign this task to a powerful, albeit resource-intensive, model. Conversely, the simpler tool-using phase is delegated to a lightweight model. This strategic division of labor allows the once-off cost of tool-making to be spread over multiple instances of tool-using, significantly reducing average costs while maintaining strong performance. Furthermore, our method offers a functional cache through the caching and reuse of tools, which stores the functionality of a class of requests instead of the natural language responses from LLMs, thus extending the applicability of the conventional cache mechanism. We evaluate our approach across various complex reasoning tasks, including Big-Bench tasks. With GPT-4 as the tool maker and GPT-3.5 as the tool user, LATM demonstrates performance equivalent to using GPT-4 for both roles, but with a significantly reduced inference cost. The codebase can be found in https://github.com/ ctlllll/LLM-ToolMaker.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Large language models (LLMs) have demonstrated outstanding capabilities across a broad array of NLP tasks (Brown et al., 2020; Chowdhery et al., 2022; Zhang et al., 2022; Hoffmann et al., 2022; OpenAI, 2023; Google, 2023) and have even shown promising signs of achieving certain aspects of artificial general intelligence (Bubeck et al., 2023; Kosinski, 2023). Moreover, analogous to the evolution of human intelligence, recent research has unveiled the potential of augmenting LLMs with external tools, thereby significantly enhancing their problem-solving capacities and efficiencies (Yao et al., 2023; Liu et al., 2023; Parisi et al., 2022; Schick et al., 2023).
12
+
13
+ However, the applicability of these tool-using methods is largely contingent on the availability of suitable tools. According to the lessons learned from the evolutionary milestones of humans, a crucial turning point was that humans got the ability to fabricate their own tools to address emerging challenges. Inspired by the importance of tool-making for humans, in this work, we embark on an initial exploration to apply this evolutionary concept to the realm of LLMs. We propose a closed-loop framework, which we term as LLMs As Tool Makers (LATM), enables LLMs to generate their own reusable tools to tackle new tasks. Our approach comprises two key stages: 1) tool making: an LLM, known as the tool maker, designs tools (implemented as Python functions) specifically for a given task. 2) tool using: another LLM referred to as the tool user, which can be the same as the tool maker, applies the tools to handle new requests. The two-stage design allows LATM to allocate jobs in each stage to the most suitable LLM. Specifically, the tool-making process, which requires a high degree of capability, can be assigned to a powerful albeit resource-intensive model (e.g., GPT-4). On the other hand, the tool-using process, which is comparatively simpler, can be assigned to a lightweight and cost-effective model (e.g., GPT-3.5 Turbo). This approach not only enhances the problem-solving capabilities of LLMs, but also significantly reduces the average computational cost of addressing a series of tasks.
14
+
15
+ ![](images/d968e0650a4da29d2c49385035eaeb6bc08bf25dd97cb7d214098ccef1a8adca.jpg)
16
+ Figure 1: The closed-loop framework of LATM. In situations with numerous problem-solving requests, directly utilizing a powerful LLM to solve all the instances can result in high costs. On the other hand, lightweight models are cost-effective but usually struggle with complex tasks. LATM leverages the strengths of both models by employing a powerful model as the tool maker to generate reusable tools (implemented as Python functions) for tasks observed in the requests and pass the tool to a cost-effective tool user model for solving similar instances in the following requests. This approach allows the lightweight model to achieve performance comparable to the powerful model while maintaining greater cost-efficiency.
17
+
18
+ As the tool-making process needs to be executed only once for a given functionality, the resulting tools can be reused across different task instances. This approach paves the way for a scalable and cost-efficient solution for handling complex task. For instance, consider a task where a user ask the LLM to schedule a meeting that works for everyone (e.g., in email conversations). Lightweight models like GPT-3.5 Turbo often struggle with such tasks that involve complex arithmetic reasoning. In contrast, more powerful models (e.g., GPT-4) can find the correct solutions, despite that the inference costs become much higher. LATM overcomes these hurdles by employing a powerful yet expensive model as the tool maker, and passing it to a cost-effective model as the tool user, for subsequent usage. After the tool has been forged, the lightweight tool user can use it to solve the task efficiently with high performance. This paradigm can similarly be applied to recurring tasks in various workflows, such as parsing and analyzing web documents into specific data formats or formulating routing plans that satisfy several custom requirements, or being used to solve popular games like the 24-game, Sudoku.
19
+
20
+ In the context of serving cost reduction, LATM introduces the opportunity of creating a functional cache for the LLM server. Specifically, consider a streaming setting where the LLM server continuously receives a sequence of requests. Traditional cache systems, such as GPTCache (Zilliz, 2023), store the responses generated by the LLMs and reuse them for textually similar requests. However, with the capacity for tool-making that LATM introduces, the system can store tools crafted by the tool maker and reuse them for functionally analogous requests. This novel approach, combined with the strategic division of labor between the tool maker and tool user, has the potential to considerably reduce the average cost of serving a sequence of requests while maintaining high performance.
21
+
22
+ Our experiments validate the effectiveness of this approach on a range of complex reasoning tasks, including several challenging Big-Bench tasks (Srivastava et al., 2022). The results show that LATM can achieve performance on par with more resource-intensive models while being more cost-effective. This novel approach to LLMs, which mimics the evolutionary leap of humans in creating and using tools, opens up exciting possibilities for a growing community with LLM-generated tools.
23
+
24
+ # 2 RELATED WORK
25
+
26
+ Chain of thought (CoT). Recently, significant progress has been made in enhancing the problemsolving abilities of large language models (LLMs) for complex tasks. For instance, CoT prompting (Wei et al., 2022; Wang et al., 2022) has been proposed to bolster LLM reasoning capabilities, demonstrating improved performance across various reasoning and natural language processing tasks. CoT is typically articulated through natural languages (Ling et al., 2017; Cobbe et al., 2021; Suzgun et al., 2022; Shi et al., 2022; Zhou et al., 2022), yet it might also be effectively represented using programming languages (Amini et al., 2019; Austin et al., 2021; Nye et al., 2021; Chowdhery et al., 2022; Gao et al., 2023; Chen et al., 2022). More recently, Arora et al. (2023) proposed using LLMs to generate structured views over documents, balancing quality and cost by ensembling extractions from multiple synthesized functions. Our method shares a similar spirit with Arora et al. (2023) in managing cost and quality trade-offs but focuses on more general use cases.
27
+
28
+ Augmenting language models with tools. Recent works have explored the potential of using external tools to supplement LLMs’ capabilities for complex tasks. Yao et al. (2023); Yang et al. (2023) proposed augmenting reasoning traces with task-specific actions in LLMs, enabling models to reason and act synergistically. Various studies (Liu et al., 2023; Parisi et al., 2022; Schick et al., 2023; Shen et al., 2023; Lu et al., 2023; Paranjape et al., 2023; Liang et al., 2023) have demonstrated that supplementing LLMs with tools, such as calculators, search engines, translation systems, calendars, or even API calls on other models, can help solve tasks that are not easily addressed by LLMs alone.
29
+
30
+ Similar to LATM, methods like Chameleon (Lu et al., 2023) also incorporate Python executors in the pipeline. However, their primary focus is on using Python executors to accurately solve sub-steps involving arithmetic reasoning, similar to Gao et al. (2023); Chen et al. (2022). In contrast, we use Python executors to create reusable tools for addressing other task instances. Furthermore, the separation of the tool maker and tool user enables the use of a lightweight model for most inferences, thus enhancing efficiency and cost-effectiveness in LATM.
31
+
32
+ Adaptive generation in language models. In addition, recent research has proposed methods to adaptively control decoding in LLMs to improve text generation efficiency (Leviathan et al., 2022; Chen et al., $2 0 2 3 \mathrm { a }$ ; Xia et al., 2023). Speculative decoding is based on the notion that generating text tokens (a more expensive process) can be expedited with a faster yet less powerful model while approximating the performance of larger, costlier models by using them to score generated tokens (a much faster process). Our approach of passing tools from a more expensive model to a smaller, faster model also shares a similar spirit of adaptive computing. Instead of altering the decoding procedure, we transfer newly generated tools between models to boost both the performance and efficiency of an LLM in solving tasks.
33
+
34
+ Language model cascades. There is recent evidence that LLMs can enable repeated interactions and that multiple LLMs can be combined to extend their capabilities further (Wu et al., 2022; Zhou et al., 2022; Dohan et al., 2022; Chen et al., 2023c). Also, Chen et al. (2023b) demonstrated that identifying optimal LLM combinations can help reduce costs while improving accuracy. Our motivation aligns with these findings; however, rather than merely cascading LLMs, we identify task categories that can be better addressed using new tools generated by a larger model and assign each individual inference within that task category to a smaller model.
35
+
36
+ Early attempts on tool-making. Concurrent and independent to our work, several early attempts have been made towards using LLMs to make tools. Wang et al. (2023) conducted research within the Minecraft environment and demonstrated the ability of an LLM-powered agent to acquire new skills in the form of programs. Similarly, Qian et al. (2023) proposes a method of decomposing problem-solving for each individual instance into an abstract tool creation phase and a concrete tool application phase. Our work aligns with the spirit of both Wang et al. (2023) and Qian et al. (2023) in the aim to let LLMs to generate their own tools for problem-solving. However, we also underscore the significance of tool reusability and cost-effectiveness stemming from the division of labor. The idea of tool making is also mentioned in a recent survey paper (Qin et al., 2023).
37
+
38
+ 3 LLM AS TOOL MAKER (LATM)
39
+
40
+ # Tool making template (One-time:)
41
+
42
+ Tool proposing: Write a generic Python function (the Tool) to solve three training samples.
43
+
44
+ Tool verification: Write unit tests to convert three validation samples into function call and validate the correctness.
45
+
46
+ Tool wrapping: Gather the function from the proposing stage and the examples of how to convert problems to function calls from the verification stage into a reusable Wrapped Tool.
47
+
48
+ ![](images/e91e857b0135bcc521b32127e589b5298a003aa9d4def47709636250ee1cdbed.jpg)
49
+
50
+ Tool Maker (e.g., GPT-4): Strong performance but slow and expensive
51
+
52
+ ![](images/cf6c1bb71cd98d019595b688e6bdcfbf1682cbb1edd6d9a9e9aa74e87a669547.jpg)
53
+ Figure 2: The pipeline of LATM. LATM can be divided into two stages: 1) tool making: a powerful yet more expensive model serves as the tool maker to generate generic and reusable tools from a few demonstrations; 2) tool using: a lightweight and cheaper model serves as the tool user to use the tool to solve various instances of the task. The tool-making stage can be further divided into three sub-stages: (i) tool proposing: the tool maker makes an attempt to generate the tool (Python function) from a few training demonstrations, if the tool is not executable, report the error and generate a new one (fix the function); (ii) tool verification: the tool maker runs unit tests on validation samples, if the tool does not pass the tests, report the error and generate new tests (fix the function calls in unit tests); and (iii) tool wrapping: wrapping up the function code and the demonstrations of how to convert a question into a function call from unit tests, preparing usable tools for tool user.
54
+
55
+ # 3.1 MAKING NEW TOOLS AND REUSE THEM
56
+
57
+ In the LATM paradigm, the main process can be split into two stages: Tool Making and Tool Using. Each stage utilizes different types of Large Language Models (LLMs) to balance performance and cost-effectiveness. All the prompts used in our experiments are shown in Appendix C.
58
+
59
+ Tool Making. This stage employs a powerful yet more expensive model, such as GPT-4, to serve as the tool maker. Tool maker’s role is to create a generic and reusable tool (implemented as a Python function) from a few demonstrations of a task. This stage can be further divided into three sub-stages:
60
+
61
+ • Tool Proposing: In this stage, tool maker attempts to generate a Python function to solve the demonstrations from the given task. This process follows the “programming by example” (PbE)
62
+
63
+ paradigm (Halbert, 1984) where several concrete demonstrations are provided, and the model is required to write programs that produce the demonstrated behaviors. In our experiments, we use 3 demonstrations for this stage. If the proposed tool is unexecutable or encounters errors, tool maker appends the error messages to the history and makes another attempt.
64
+
65
+ • Tool Verification: In this stage, the tool maker generates unit tests using validation samples and subsequently executes these tests on the proposed tool. We utilize 3 validation samples in our experiments. If the tool fails any of these tests, the tool maker records the error in its history and makes an attempt to rectify the issues within the unit tests (this procedure will only correct the function calls in the unit test part and will not correct the function). The ability of LLMs to self-debug has been demonstrated effectively in recent research (Madaan et al., 2023; Chen et al., $2 0 2 3 \mathrm { c }$ ; Lu et al., 2023; Kim et al., 2023). However, within the LATM pipeline, the verification stage serves a slightly different usage. This stage fulfills two key roles: 1) it provides examples that demonstrate how to convert natural language questions into function calls, and 2) it verifies the tool’s reliability, enabling the entire process to be fully automated.
66
+
67
+ • Tool Wrapping: If the execution or verification fails over a preset threshold, the Tool Making stage is viewed as failed. Otherwise, tool maker is ready to prepare the wrapped tool for tool user. This step involves wrapping up the function code and providing demonstrations of how to convert a task into a function call. These demonstrations are extracted from the Tool Verification step, which converts questions into unit tests. This final product is then ready for use by the tool user. Please see Appendix D for examples of the wrapped tools.
68
+
69
+ Tool Using. This second stage involves a lightweight and cost-effective model, such as GPT-3.5 Turbo, to serve as the tool user. The tool user’s role is to utilize the verified tool to solve various instances of the task. The prompt for this stage is the wrapped tool which contains the function for solving the task and demonstrations of how to convert a task query into a function call. With the demonstrations, tool user can then generate the required function call in an in-context learning fashion. The function calls are then executed to solve the task. Optionally, postprocessing can be applied to convert the output to match the required format of the task, such as options for multiple-choice questions.
70
+
71
+ The tool-making stage, including tool proposing, verification, and wrapping, only needs to be performed once for each type of task. The resulting tools can then be reused for all instances of that task. This makes LATM significantly more efficient and cost-effective than using a powerful model alone. Furthermore, the Python function tools are a more generic form of Chain-of-Thought, enhancing the overall utility and flexibility of the LLMs, as they can be used to solve questions that involve algorithmic reasoning ability (Velickovi ˇ c and Blundell ´ , 2021).
72
+
73
+ # 4 LATM FOSTERS A FUNCTIONAL CACHE MECHANISM FOR LLM SERVING
74
+
75
+ In real-world scenarios, tasks often arrive in a sequential stream. To address this, we introduce a third LLM, the dispatcher, that decides whether to engage the tool user or tool maker for each incoming task. While this tool selection function mirrors existing works (Lu et al., 2023; Shen et al., 2023; Schick et al., 2023; Paranjape et al., 2023), our dispatcher distinctively contributes to creating a functional cache—it discerns new tasks that cannot be resolved with existing tools, thereby triggering the tool maker to generate appropriate tools for these tasks.
76
+
77
+ The dispatcher maintains a repository of existing tools crafted by the tool maker in the format of function APIs. Upon receipt of a new task instance, the dispatcher first attempts to locate a compatible tool within the cache. If such a tool is present, the dispatcher assigns the instance and corresponding tool to the tool user for resolution. However, if no suitable tool is available, the dispatcher identifies this as a novel task, either solving it with a powerful model or, if necessary, invoking a human labeler. These new instances are then cached until a sufficient number are amassed to craft a new tool, further enriching the functional cache. This mechanism allows for the functionally similar tasks to reuse these tools, expanding the coverage of the classic cache mechanism and reducing the overall serving cost. Given the simplicity of the dispatching task, a lightweight model equipped with appropriate prompts (See Appendix C) can efficiently serve as the dispatcher, adding only a marginal cost to the entire pipeline.
78
+
79
+ ![](images/c019278a0bf3ef3261605e7958474cddca5b91abfe19480e2661996e7803fbff.jpg)
80
+ Figure 3: An illustration of the Tool Proposing and Tool Using stages of the LATM pipeline for the Logical Deduction task (Srivastava et al., 2022). This task requires determining the order of five objects based on several given conditions. In the Tool Proposing stage, the tool maker (such as GPT-4) formulates a generic Python function capable of solving the provided $k$ demonstrations from the task (where $k$ equals 3 in our experiments). The tool maker generates a search algorithm that enumerates all possible orderings and verifies each against the provided conditions. During the tool-using stage, the tool user translates each natural language question into a series of conditions, generating function calls to utilize the tool for each task instance.
81
+
82
+ # 5 EXPERIMENTS
83
+
84
+ # 5.1 EXPERIMENTAL SETUP
85
+
86
+ Datasets. We evaluate our approach on six datasets from diverse domains, including Logical Deduction, Tracking Shuffled Objects, Dyck Language, Word Sorting, Chinese Remainder Theorem, and Scheduling Meeting. The first five datasets are sourced from BigBench (Srivastava et al., 2022). We take the 5 objects version of the Logical Deduction and Tracking Shuffled Objects tasks, referred to as Logical Deduction (5) and Tracking Shuffled Objects (5) in the paper. We also constructed the Scheduling Meeting task to demonstrate the effectiveness of LATM in real-world scenarios. Detailed information on dataset generation can be found in Appendix E. We divide each dataset into training, validation, and test sets, containing 3, 3, and 240 instances, respectively.
87
+
88
+ Model settings. During the tool-making stage, we set the temperature to 0.3 to introduce randomness to the generation process, allowing for retries if necessary. For this stage, we conduct experiments using GPT-4 and GPT-3.5 Turbo models with the ChatCompletion API, always appending the response to the chat history to create an interactive experience. In the tool-using stage, the LLM API call is made only once, and we also perform ablation studies on GPT-3-type models with the standard Completion API. When using the tools, we consistently set the temperature to 0.0. We set the maximal retry times to be 3 for the tool-proposing and tool-verification stages.
89
+
90
+ # 5.2 EFFECTIVENESS OF THE TOOL-MAKING STAGE
91
+
92
+ In the tool-making stage, we use a powerful yet slower model to generate generic Python functions tailored to a specific task. This step is performed only once for each task, and the overhead is amortized across all instances of that task. In our experiments, we use GPT-4 (OpenAI, 2023) as a representative tool maker, while we explore other models’ tool-making capabilities in Section 5.5. We provide several few-shot exemplars for the language model, guiding it to generate generic Python programs, as illustrated in Figure 3.
93
+
94
+ Table 1: The utility functions generated by tool maker to solve the tasks.
95
+
96
+ <table><tr><td>Logical Deduction (5)</td><td>Tracking Shuffled Objects (5)</td><td>Dyck Language Sorting</td><td>Word</td><td>Chinese Remainder Theorem</td><td>Schedule Meeting</td></tr><tr><td>Search</td><td>Simulation</td><td>Stack</td><td>Sort</td><td>| Search/Extended Euclidean| Interval intersections</td><td></td></tr></table>
97
+
98
+ Our observations indicate that when GPT-4 is employed as the tool maker, the model frequently devises suitable algorithms for solving tasks. For instance, as shown in Table 1, the tool maker creates code to solve the logical deduction task by searching through all permutations and selecting the correct one that satisfies the given constraints. In our experiment, the tool-verification stage is mainly used to provide examples that demonstrate how to convert natural language questions into function calls, and we only observe 2 cases out of the 60 trials that the tool maker can correct its mistakes with the guide of error messages. See Section 5.5 for more discussions on the tool maker.
99
+
100
+ # 5.3 LATM IMPROVES THE PERFORMANCE OF LIGHTWEIGHT LLMS
101
+
102
+ In Table 2, we compare the performance of Chain-of-Thought prompting (Wei et al., 2022) with our method, LATM. We employ GPT-4 as the tool maker to generate tools for the six tasks, and evaluate the performance of both GPT-3.5 Turbo and GPT-4 as tool user. The results demonstrate that with the help of the tool, a lightweight model like GPT-3.5 Turbo can achieve performance on par with GPT-4, significantly outperforming CoT prompting. Additionally, the average cost of using GPT-3.5 Turbo with the tool is much lower compared to using GPT-4. This highlights the effectiveness of LATM in enhancing the performance of lightweight models and therefore reducing the cost compared to employing expensive models. Intriguingly, for the Dyck Language task, GPT-3.5 Turbo as the tool user even surpasses GPT-4 in its role as the tool user. Upon investigating the failure cases, we find that when converting the question into a function call, GPT-4 occasionally superfluously closes some brackets within the argument instead of leaving the argument unchanged and letting the function solve it, which leads to incorrect function output.
103
+
104
+ <table><tr><td></td><td></td><td></td><td>TUeMeto</td><td></td><td>Wordg</td><td>RemaiChir Theorem</td><td>Schedue</td><td>Costopes</td></tr><tr><td>GPT-3.5 Turbo</td><td>CoT LATM</td><td>66.4 79.7 (+13.3)</td><td>61.6 99.6 (+38.0)</td><td>20.4 92.2 (+71.8)|98.3 (+39.1)</td><td>59.2</td><td>0.0 100.0 (+100.0)</td><td>18.9</td><td>0(nc) 100.0 (+81.1)|O(nc + C)</td></tr><tr><td>GPT-4</td><td>LAoTM</td><td>88</td><td>100.0</td><td>6</td><td>99</td><td>100.0</td><td>55.0</td><td></td></tr></table>
105
+
106
+ Table 2: Accuracy comparison between LATM and Chain-of-Thought. The six tasks are detailed in Section 5.1. For LATM, the tool is created by GPT-4 and utilized by both GPT-3.5 Turbo and GPT4. The results demonstrate that the application of LATM can significantly enhance the performance of GPT-3.5 Turbo, often surpassing or matching GPT-4’s performance with CoT in certain scenarios. The last column depicts the overall cost of processing $n$ samples. Here, $C$ represents the cost of one call to GPT-4, while $c$ denotes the cost of one call to GPT-3.5 Turbo. At the time of writing this paper, $C$ is over $1 5 \mathrm { x }$ larger than $c$ . The few-shot CoT demonstrations for the first four tasks are provided by Suzgun et al. (2022), while for the last two tasks, we apply direct few-shot prompting without CoT.
107
+
108
+ # 5.4 ADAPTING LATM TO A DYNAMIC STREAM OF DIVERSE TASKS
109
+
110
+ As discussed in Section 4, we can adapt LATM to handle a dynamic stream where instances from potentially different tasks emerge in real-time. In this setting, we introduce an additional model, the dispatcher, tasked with identifying the task to which each incoming instance pertains. We employ GPT-3.5 Turbo for this role, evaluating its effectiveness in two key functions: 1) Identifying and employing existing tools from the functional cache to resolve an incoming instance, and 2)
111
+
112
+ Table 3: Success rate of generating new tools (Python functions that pass the tool-verification step) in the tool-making stage with GPT-4 v.s. GPT-3.5 Turbo. We run 5 trials for each model on each task, $n / 5$ means $n$ trails out of 5 successes to produce a valid tool. For hard tasks like Logical Deduction and Tracking Shuffled Objects, GPT-3.5 Turbo fails in all trials, showing the necessity of using a more powerful model as tool maker.
113
+
114
+ <table><tr><td>Tool Maker Model</td><td>DeLucion (5)</td><td>Trackijes(usr ed</td><td>Langckge</td><td>SWwrdg</td><td> RemainhireTheorem</td><td>Schedule</td></tr><tr><td>GPT-3.5 Turbo</td><td>0/5</td><td>0/5</td><td>5/5</td><td>5/5</td><td>5/5</td><td>0/5</td></tr><tr><td>GPT-4 1</td><td>3/5</td><td>4/5</td><td>5/5</td><td>5/5</td><td>5/5</td><td>3/5</td></tr></table>
115
+
116
+ Detecting unseen tasks and triggering the tool maker to create appropriate tools for these tasks. This experimental setup helps assess how effectively our system can reduce serving costs by reusing and extending the functional cache in a dynamic, multi-tasking scenario.
117
+
118
+ Identifying existing tools. The first part of our evaluation assesses the dispatcher’s capability to recognize existing tools within the functional cache that correspond to a given instance, analogous to the cache fetching phase of traditional cache systems. To this end, we generate a test set of 100 samples, randomly mixed from the six tasks discussed in Section 5.1. For each instance, the dispatcher is tasked to determine the appropriate tool from existing ones, utilizing prompts containing task examples associated with these tools (See Appendix C). Success is measured by the correct identification of the tool. Over five random constructions of the test set, the accuracy in correctly determining the suitable tool is $9 5 \% \pm 2 \%$ .
119
+
120
+ Requesting tool-making. The second part of our evaluation tests the dispatcher’s ability to request tool-making for instances originating from an unseen task. This situation is akin to enqueuing a new instance into the cache when a cache miss happens. We randomly designate four tasks as existing tasks with readily available tools and select four other tasks for testing—two of these are unseen, and the other two fall within the realm of existing tasks. Again, a test set of 100 samples is generated. For each instance in the test set, the dispatcher determines whether it needs to request tool-making or if an existing tool can solve the instance. Over multiple runs, the accuracy of making the correct decision stands at $9 6 \% \pm 3 \%$ , demonstrating the robustness of our approach in efficiently managing the functional cache.
121
+
122
+ The above results illustrate that the dispatcher can effectively recognize existing tools and accurately request tool-making for unseen tasks, all while maintaining high performance. These findings highlight the potential of LATM to be seamlessly adapted to a streaming environment encompassing a diverse range of tasks. This validation serves to fortify the viability of our framework in real-world applications, particularly where the efficient management of functional cache is paramount.
123
+
124
+ # 5.5 ABLATION STUDY
125
+
126
+ Capacity required for the tool-making language model. We investigate the capacity requirements for the language model used in the tool-making stage (See Table 3). Generally, we found that a more powerful and expensive model better serves the purpose, as this stage is performed only once for each task, and high accuracy is crucial for effectively passing tools to a smaller model. Specifically, on hard tasks like Logical Deduction and Tracking Shuffled Objects, GPT-3.5 Turbo fails in all the 5 trails. And the major failure reason is that the tool is not general enough and may only work on the training samples. On the other hand, we also discovered that for easy tasks, the tool maker can be a lightweight language model. For simple tasks like Word Sorting, GPT-3.5 Turbo can effortlessly generate a program that solves the task. Another limitation that may contribute to the tool maker’s failure is the context length constraints. Since we use the entire history in each step of tool-making to enhance the reliability of the tool-making stage, this also introduces a longer context. In this case GPT-4 with 8192 context length is preferable.
127
+
128
+ Capacity required for the tool-using language model. In this section, we investigate the capacity requirements for the tool-using model. The results are presented in Table 4. We observed that GPT-3.5
129
+
130
+ Table 4: A performance comparison of various tool user models, all using the same tool generated by GPT-4. All costs are based on the rates at the time of writing. Of all the models, GPT-3.5 Turbo demonstrates the best trade-off between performance and cost. We opted for GPT-3 models prior to instruction tuning (ada instead of text-ada-001, etc.), as we observed that the models after instruction tuning underperformed in the tool-using stage. We postulate that this is due to the instruction tuning impairing the in-context learning ability, which is essential for the tool-using stage.
131
+
132
+ <table><tr><td></td><td>GPT-3.5 Turbo</td><td>text-davinci-002</td><td>davinci</td><td>curie</td><td>babbage</td><td>ada</td></tr><tr><td>Logical Deduction (5)</td><td>79.7%</td><td>58.2%</td><td>11.6%</td><td>6.5%</td><td>11.6%</td><td>3.0%</td></tr><tr><td>Tracking Shuffled Objects (5)</td><td>99.6%</td><td>100.0%</td><td>62.1%</td><td>20.7%</td><td>16.4%</td><td>5.2%</td></tr><tr><td>Dyck Language</td><td>92.2%</td><td>35.8%</td><td>16.4%</td><td>18.1%</td><td>9.1%</td><td>9.9%</td></tr><tr><td>Word Sorting</td><td>98.3%</td><td>60.8%</td><td>26.6%</td><td>7.3%</td><td>7.3%</td><td>0.9%</td></tr><tr><td>Chinese Remainder Theorem</td><td>100.0%</td><td>100.0%</td><td>99.6%</td><td>93.1%</td><td>75.0%</td><td>66.0%</td></tr><tr><td>Schedule Meeting</td><td>100.0%</td><td>100.0%</td><td>62.9%</td><td>59.1%</td><td>23.2%</td><td>0.0%</td></tr><tr><td>Cost ($ per 1K tokens)</td><td>0.002</td><td>0.02</td><td>0.02</td><td>0.002</td><td>0.0005</td><td>0.0004</td></tr></table>
133
+
134
+ Turbo offers the best balance between performance and cost among all the models tested. Regarding the older GPT-3 series of models (ada, babbage, curie, davinci), we found that models that before instruction tuning often perform better than their counterparts post instruction tuning (text-ada-001, etc.). We hypothesize that the instruction tuning phase in these models may adversely impact the in-context learning ability, which is crucial for the tool-using stage.
135
+
136
+ CoT as a tool does not help. In addition to LATM, we investigate if we can improve task performance by reusing Chain-of-Thought (CoT) from a larger model to a smaller model similar to LATM pipeline. Specifically, we use the same larger model (GPT-4) in the “CoT-making” stage, using zero-shot prompting “Let’s think step by step.” to elicit the intermediate thought steps, and then use the generated CoT to the same smaller tool-using model (GPT-3.5 Turbo). We test this on two tasks and report the results Table 5. We observe that using CoT from a large model has a similar or even worse performance than human-written CoT, which is much worse than LATM.
137
+
138
+ Table 5: Accuracy of using CoT generated by GPT-4. The performance is similar to human-written CoT, which is much worse than LATM.
139
+
140
+ <table><tr><td>Accuracy</td><td>GPT-4 CoT</td><td>Human-written CoT</td><td>LATM</td></tr><tr><td>Logical Deduction (5)</td><td>36.8</td><td>66.4</td><td>79.7</td></tr><tr><td>Tracking Shuffled Objects (5)</td><td>63.2</td><td>61.6</td><td>99.6</td></tr></table>
141
+
142
+ # 6 CONCLUSION AND FUTURE WORK
143
+
144
+ We introduced LATM, a closed-loop framework empowering large language models (LLMs) to create and utilize their own tools for diverse tasks. Our approach, inspired by human’s evolutionary strides in tool creation, employs two key stages: Tool Making and Tool Using. This division of labor allows us to harness the capabilities of advanced LLMs while significantly reducing computational costs. Our experiments confirmed the efficacy of LATM across various complex tasks, demonstrating that our framework performs comparably to resource-intensive models while being more cost-effective. In addition, we show that adding another dispatcher LLM can further provide flexibility to our framework, enabling on-the-fly tool creation and usage.
145
+
146
+ In our evaluation process, we identified a significant lack of high-quality datasets that authentically represent daily human-computer interactions, including recurring tasks such as scheduling meetings or booking flights over email or phone calls, in their raw natural language format. We anticipate that our work will stimulate the research community to create such datasets, which could prove instrumental in cultivating the next generation of AI systems. These systems, capable of generating and applying their own tools, will be equipped to tackle complex tasks more effectively. An exciting avenue for future research is enabling the tool maker to refine and upgrade existing tools to manage new problem instances, much like in software development. This adaptability could further catalyze the evolution of the AI ecosystem, unlocking a wealth of opportunities.
147
+
148
+ REFERENCES
149
+ Aida Amini, Saadia Gabriel, Peter Lin, Rik Koncel-Kedziorski, Yejin Choi, and Hannaneh Hajishirzi. Mathqa: Towards interpretable math word problem solving with operation-based formalisms. arXiv preprint arXiv:1905.13319, 2019.
150
+ Simran Arora, Brandon Yang, Sabri Eyuboglu, Avanika Narayan, Andrew Hojel, Immanuel Trummer, and Christopher Ré. Language models enable simple systems for generating structured views of heterogeneous data lakes, 2023.
151
+ Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, and Charles Sutton. Program synthesis with large language models, 2021.
152
+ Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
153
+ Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023.
154
+ Charlie Chen, Sebastian Borgeaud, Geoffrey Irving, Jean-Baptiste Lespiau, Laurent Sifre, and John Jumper. Accelerating large language model decoding with speculative sampling. February 2023a. doi: 10.48550/ARXIV.2302.01318.
155
+ Lingjiao Chen, Matei Zaharia, and James Zou. Frugalgpt: How to use large language models while reducing cost and improving performance, 2023b.
156
+ Wenhu Chen, Xueguang Ma, Xinyi Wang, and William W. Cohen. Program of thoughts prompting: Disentangling computation from reasoning for numerical reasoning tasks, 2022.
157
+ Xinyun Chen, Maxwell Lin, Nathanael Schärli, and Denny Zhou. Teaching large language models to self-debug. ARXIV.ORG, 2023c. doi: 10.48550/arXiv.2304.05128.
158
+ Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
159
+ Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
160
+ David Dohan, Winnie Xu, Aitor Lewkowycz, Jacob Austin, David Bieber, Raphael Gontijo Lopes, Yuhuai Wu, Henryk Michalewski, Rif A. Saurous, Jascha Sohl-dickstein, Kevin Murphy, and Charles Sutton. Language model cascades, 2022.
161
+ Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models, 2023.
162
+ Google. Palm 2 technical report, 2023. URL https://ai.google/static/documents/ palm2techreport.pdf.
163
+ Daniel Conrad Halbert. Programming by example. University of California, Berkeley, 1984.
164
+ Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556, 2022.
165
+ Geunwoo Kim, P. Baldi, and S. McAleer. Language models can solve computer tasks. ARXIV.ORG, 2023. doi: 10.48550/arXiv.2303.17491.
166
+ Michal Kosinski. Theory of mind may have spontaneously emerged in large language models. arXiv preprint arXiv:2302.02083, 2023.
167
+
168
+ Yaniv Leviathan, Matan Kalman, and Yossi Matias. Fast inference from transformers via speculative decoding. November 2022. doi: 10.48550/ARXIV.2211.17192.
169
+
170
+ Yaobo Liang, Chenfei Wu, Ting Song, Wenshan Wu, Yan Xia, Yu Liu, Yang Ou, Shuai Lu, Lei Ji, Shaoguang Mao, et al. Taskmatrix. ai: Completing tasks by connecting foundation models with millions of apis. arXiv preprint arXiv:2303.16434, 2023.
171
+
172
+ Wang Ling, Dani Yogatama, Chris Dyer, and Phil Blunsom. Program induction by rationale generation: Learning to solve and explain algebraic word problems. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 158–167, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1015. URL https://aclanthology.org/P17-1015.
173
+
174
+ Ruibo Liu, Jason Wei, Shixiang Shane Gu, Te-Yen Wu, Soroush Vosoughi, Claire Cui, Denny Zhou, and Andrew M. Dai. Mind’s eye: Grounded language model reasoning through simulation. In The Eleventh International Conference on Learning Representations, 2023. URL https: //openreview.net/forum?id $\equiv \cdot$ 4rXMRuoJlai.
175
+
176
+ Pan Lu, Baolin Peng, Hao Cheng, Michel Galley, Kai-Wei Chang, Ying Nian Wu, Song-Chun Zhu, and Jianfeng Gao. Chameleon: Plug-and-play compositional reasoning with large language models. arXiv preprint arXiv:2304.09842, 2023.
177
+
178
+ Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, et al. Self-refine: Iterative refinement with self-feedback. arXiv preprint arXiv:2303.17651, 2023.
179
+
180
+ Maxwell Nye, Anders Johan Andreassen, Guy Gur-Ari, Henryk Michalewski, Jacob Austin, David Bieber, David Dohan, Aitor Lewkowycz, Maarten Bosma, David Luan, et al. Show your work: Scratchpads for intermediate computation with language models. arXiv preprint arXiv:2112.00114, 2021.
181
+
182
+ OpenAI. Gpt-4 technical report, 2023.
183
+
184
+ Bhargavi Paranjape, Scott Lundberg, Sameer Singh, Hannaneh Hajishirzi, Luke Zettlemoyer, and Marco Tulio Ribeiro. Art: Automatic multi-step reasoning and tool-use for large language models. arXiv preprint arXiv:2303.09014, 2023.
185
+
186
+ Aaron Parisi, Yao Zhao, and Noah Fiedel. Talm: Tool augmented language models, 2022.
187
+
188
+ Cheng Qian, Chi Han, Yi R Fung, Yujia Qin, Zhiyuan Liu, and Heng Ji. Creator: Disentangling abstract and concrete reasonings of large language models through tool creation. arXiv preprint arXiv:2305.14318, 2023.
189
+
190
+ Yujia Qin, Shengding Hu, Yankai Lin, Weize Chen, Ning Ding, Ganqu Cui, Zheni Zeng, Yufei Huang, Chaojun Xiao, Chi Han, et al. Tool learning with foundation models. arXiv preprint arXiv:2304.08354, 2023.
191
+
192
+ Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Luke Zettlemoyer, Nicola Cancedda, and Thomas Scialom. Toolformer: Language models can teach themselves to use tools, 2023.
193
+
194
+ Yongliang Shen, Kaitao Song, Xu Tan, Dongsheng Li, Weiming Lu, and Yueting Zhuang. Hugginggpt: Solving ai tasks with chatgpt and its friends in huggingface. arXiv preprint arXiv:2303.17580, 2023.
195
+
196
+ Freda Shi, Mirac Suzgun, Markus Freitag, Xuezhi Wang, Suraj Srivats, Soroush Vosoughi, Hyung Won Chung, Yi Tay, Sebastian Ruder, Denny Zhou, et al. Language models are multilingual chain-of-thought reasoners. arXiv preprint arXiv:2210.03057, 2022.
197
+
198
+ Aarohi Srivastava, Abhinav Rastogi, Abhishek Rao, Abu Awal Md Shoeb, Abubakar Abid, Adam Fisch, Adam R Brown, Adam Santoro, Aditya Gupta, Adrià Garriga-Alonso, et al. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. arXiv preprint arXiv:2206.04615, 2022.
199
+
200
+ Mirac Suzgun, Nathan Scales, Nathanael Schärli, Sebastian Gehrmann, Yi Tay, Hyung Won Chung, Aakanksha Chowdhery, Quoc V Le, Ed H Chi, Denny Zhou, et al. Challenging big-bench tasks and whether chain-of-thought can solve them. arXiv preprint arXiv:2210.09261, 2022.
201
+ Petar Velickovi ˇ c and Charles Blundell. Neural algorithmic reasoning. ´ Patterns, 2(7):100273, 2021.
202
+ Guanzhi Wang, Yuqi Xie, Yunfan Jiang, Ajay Mandlekar, Chaowei Xiao, Yuke Zhu, Linxi Fan, and Anima Anandkumar. Voyager: An open-ended embodied agent with large language models. arXiv preprint arXiv:2305.16291, 2023.
203
+ Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022.
204
+ Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. arXiv preprint arXiv:2201.11903, 2022.
205
+ Tongshuang Wu, Michael Terry, and Carrie Jun Cai. Ai chains: Transparent and controllable human-ai interaction by chaining large language model prompts. In Proceedings of the 2022 CHI Conference on Human Factors in Computing Systems, pages 1–22, 2022.
206
+ Heming Xia, Tao Ge, Si-Qing Chen, Furu Wei, and Zhifang Sui. Speculative decoding: Lossless speedup of autoregressive translation, 2023. URL https://openreview.net/forum?id= H-VlwsYvVi.
207
+ Zhengyuan Yang, Linjie Li, Jianfeng Wang, Kevin Lin, Ehsan Azarnasab, Faisal Ahmed, Zicheng Liu, Ce Liu, Michael Zeng, and Lijuan Wang. Mm-react: Prompting chatgpt for multimodal reasoning and action. arXiv preprint arXiv:2303.11381, 2023.
208
+ Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik R Narasimhan, and Yuan Cao. React: Synergizing reasoning and acting in language models. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum? id $=$ WE_vluYUL-X.
209
+ Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, et al. Opt: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068, 2022.
210
+ Denny Zhou, Nathanael Schärli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuurmans, Olivier Bousquet, Quoc Le, and Ed Chi. Least-to-most prompting enables complex reasoning in large language models. arXiv preprint arXiv:2205.10625, 2022.
211
+
212
+ Zilliz. Gptcache. https://github.com/zilliztech/GPTCache, 2023.
213
+
214
+ # A ILLUSTRATION OF THE DISPATCHER
215
+
216
+ ![](images/e18d565c6d1d373168c539f9e235f4bd366fb696208e16b366d874b45f96a036.jpg)
217
+ Figure 4: An illustration of the Dispatcher that enables functional cache mechanism. In an online setting where task instances arrive sequentially, the dispatcher, a lightweight model, assesses each incoming instance. If a suitable tool already exists in the cache to tackle the task, the dispatcher selects this tool and forwards the task instance to the tool user for resolution. If no suitable tool is found, the dispatcher routes the task instance to the tool maker to create a new tool that can be used by tool user later.
218
+
219
+ # B BROADER IMPACT AND LIMITATIONS
220
+
221
+ This paper explores the potential of enabling Large Language Models (LLMs) to create their own tools, thus allowing them greater autonomy in developing their ecosystem. While this avenue of research is promising, it also raises important ethical, safety, and control considerations that need to be carefully addressed.
222
+
223
+ One of the most significant impacts of our work lies in the potential for LLMs to grow and achieve unprecedented capabilities automatically. This could significantly enhance the range and complexity of tasks these models can handle, potentially revolutionizing fields such as customer service, technical support, and even areas of research and development. It could lead to more efficient use of computational resources and a reduction in human intervention, especially for routine or repetitive tasks.
224
+
225
+ However, this newfound autonomy of LLMs is a double-edged sword. As we endow LLMs with the ability to generate their own tools, we also create a scenario where the quality of the tools they develop may not always meet the standards or expectations set by human developers. Without proper safeguards, there’s a risk that these models could generate solutions that are suboptimal, incorrect, or even potentially harmful. Furthermore, as LLMs become more autonomous, the potential for loss of control increases. If these models are widely used without appropriate regulation, there could be unforeseen consequences, potentially even leading to scenarios where humans lose control over the AI systems.
226
+
227
+ In this study, we have not addressed these control and safety issues in depth, and our work has some limitations. Our proposed framework, LLM As Tool Maker, while effective in the tested scenarios, is still in its early stages of development. It is crucial to note that the real-world performance and safety of the system may vary based on the complexity and nature of the tasks it is applied to. Additionally, the evaluation and validation of the tools created by the tool maker in a real-world setting is a challenge that needs to be addressed.
228
+
229
+ # C LATM PROMPTS
230
+
231
+ # Tool Maker Prompt
232
+
233
+ Please write a generic Python function to solve this type of $\hookrightarrow$ problems using only standard python libraries. The output $\hookrightarrow$ of the function can later be converted to the answer $\hookrightarrow$ (option for multiple choice question). All the function $\hookrightarrow$ should be wrapped by
234
+
235
+ # \`python
236
+
237
+ # Tool Verifier Prompt
238
+
239
+ Write unit tests to verify the correctness of the function on
240
+ $\hookrightarrow$ the questions above using the following format:
241
+ \`\`\`python
242
+ {parse the question into the arguments of the function}
243
+ {call the function and save the return value in a variable
244
+ $\hookrightarrow$ named "ret"}
245
+ {for multiple choice question, parse the options}
246
+ {convert the return value "ret" to the answer (if the
247
+ $\hookrightarrow$ question is a multiple choice question, convert to an
248
+ $\hookrightarrow$ option) and save it in a variable named "ans", otherwise}
249
+ {assert ans $= =$ the provided answer (if the question is a $\hookrightarrow$ multiple choice question, assert ans $= =$ option)}
250
+
251
+ # Tool Wrapper Prompt
252
+
253
+ Success! The function is correct. We will need to summarize $\hookrightarrow$ the function and use cases up for further use. Please $\hookrightarrow$ extract the information from the history in the following $\hookrightarrow$ format:
254
+
255
+ Here is a function to solve a class of problems: \`python {the function, including necessary imports}
256
+
257
+ Use cases:
258
+ Question: {question (including options)}
259
+ Solution: \`python
260
+ {parse the question into the arguments of the function}
261
+ {call the function and save the return value in a variable
262
+ $\hookrightarrow$ named "ret"}
263
+ {for multiple choice question, parse the options}
264
+ {convert the return value "ret" to the answer (if the
265
+ $\hookrightarrow$ question is a multiple choice question, convert to an $\hookrightarrow$ option) and save it in a variable named "ans", otherwise}
266
+
267
+ Do this for all the questions in the verification step.
268
+
269
+ # Dispatcher Prompt
270
+
271
+ Here are several functions that can be used to solve some $\hookrightarrow$ task:
272
+
273
+ Task: logical_deduction_five_objects
274
+
275
+ API: find_order(objects, constraints):
276
+
277
+ Finds the order of objects that satisfies a given set of $\hookrightarrow$ constraints.
278
+
279
+ objects: A list of unique objects (strings) to be ordered. constraints: A list of lambda functions that represent the $\hookrightarrow$ constraints on the order of objects. Each constraint $\hookrightarrow$ should take the order of objects as input and return a $\hookrightarrow$ boolean value (True if the constraint is satisfied, False $\hookrightarrow$ otherwise).
280
+
281
+ return: A tuple representing the order of objects that $\hookrightarrow$ satisfies all the constraints. If no such order exists, $\hookrightarrow$ the function returns None.
282
+
283
+ $= = =$
284
+
285
+ Task: tracking_shuffled_objects_five_objects
286
+
287
+ API: square_dance(initial_partners, switches):
288
+
289
+ This function takes an initial list of pairs and a list of $\hookrightarrow$ switches, and returns a dictionary representing the final $\hookrightarrow$ state of the pairs after performing the switches.
290
+
291
+ initial_partners: A list of tuples, where each tuple contains $\hookrightarrow$ two elements representing a pair (e.g., [("Alice", $\hookrightarrow$ "goalkeeper"), ("Bob", "left midfielder"), ...]). The $\hookrightarrow$ elements can be any type (e.g., strings, integers, etc.).
292
+
293
+ switches: A list of tuples, where each tuple contains two $\hookrightarrow$ elements representing a pair of elements from the $\hookrightarrow$ initial_partners list that will be switched (e.g., $\hookrightarrow$ [("Alice", "Claire"), ("Alice", "Bob"), ...]). The $\hookrightarrow$ elements should match the types used in the $\hookrightarrow$ initial_partners list.
294
+
295
+ return: A dictionary representing the final state of the $\hookrightarrow$ pairs after performing the switches. The keys are the $\hookrightarrow$ first elements of the pairs in the initial_partners list, $\hookrightarrow$ and the values are the corresponding second elements $\hookrightarrow$ after performing the switches (e.g., {"Alice": "right $\hookrightarrow$ winger", "Bob": "center midfielder", ...}).
296
+
297
+ $= = =$
298
+
299
+ Skip other tasks
300
+
301
+ Here is a question:\n{question}\n\nAccoding to the API $\hookrightarrow$ documents above, you may find some functions that can be $\hookrightarrow$ used to solve the task, or, sometimes there does not $\hookrightarrow$ exist proper function to solve the task. Figure out if $\hookrightarrow$ there is function to solve the task and reply in the $\hookrightarrow$ format:\nTask: {{task}} (reply unknown if no function can $\hookrightarrow$ solve the question)
302
+
303
+ # D WRAPPED TOOLS
304
+
305
+ # Tool for Logical Deduction
306
+
307
+ Here is a function to solve a class of problems:
308
+
309
+ ![](images/a1f608cfb779721fa49326353ad5529869094bd052c45c5dda68986872d555a2.jpg)
310
+
311
+ # \`python
312
+
313
+ from itertools import permutations def find_order(objects, constraints): for order in permutations(objects): valid $=$ True for constraint in constraints: if not constraint(order): valid $=$ False break if valid: return order
314
+
315
+ Use cases:
316
+
317
+ Question: The following paragraphs each describe a set of $\hookrightarrow$ five objects arranged in a fixed order. The statements $\hookrightarrow$ are logically consistent within each paragraph. On a $\hookrightarrow$ shelf, there are five books: a white book, a green book, $\hookrightarrow$ a brown book, a gray book, and an orange book. The gray $\hookrightarrow$ book is to the right of the orange book. The green book $\hookrightarrow$ is the second from the right. The brown book is to the $\hookrightarrow$ right of the white book. The brown book is to the left of $\hookrightarrow$ the orange book.
318
+
319
+ Options:
320
+
321
+ (A) The white book is the third from the left (B) The green book is the third from the left (C) The brown book is the third from the left (D) The gray book is the third from the left (E) The orange book is the third from the left Solution:
322
+
323
+ # \`python
324
+
325
+ objects $=$ ["white", "green", "brown", "gray", "orange"]
326
+
327
+ constraints $=$ [
328
+
329
+ lambda order: order.index("gray") $>$
330
+ $\hookrightarrow$ order.index("orange"),
331
+ lambda order: order.index("green") $= =$ len(order) - 2,
332
+ lambda order: order.index("brown") $>$
333
+ $\hookrightarrow$ order.index("white"),
334
+ lambda order: order.index("brown") $<$
335
+ $\hookrightarrow$ order.index("orange")
336
+
337
+ ret $=$ find_order(objects, constraints) options $=$ {
338
+
339
+ "A": "white", "B": "green", "C": "brown", "D": "gray", "E": "orange" ans $=$ [k for k, v in options.items() if 17 $\begin{array} { r l } { \mathsf { V } } & { { } = = } \end{array}$ ret[2]][0] Skip two more questions...
340
+
341
+ # Tool for Tracking Shuffled Objects
342
+
343
+ Here is a function to solve a class of problems:
344
+
345
+ # \`\`\`python
346
+
347
+ def square_dance(initial_partners, switches): # Create a dictionary to store the current partners current_partners $=$ dict(initial_partners)
348
+
349
+ # Iterate through the switches and update the current $\hookrightarrow$ partners
350
+
351
+ for switch in switches: dancer1, dancer2 $=$ switch partner1 $=$ current_partners[dancer1] partner2 $=$ current_partners[dancer2]
352
+
353
+ # # Swap the partners
354
+
355
+ current_partners[dancer1] $=$ partner2
356
+ current_partners[dancer2] $=$ partner1
357
+
358
+ return current_partners
359
+
360
+ Use cases:
361
+
362
+ Question: Alice, Bob, Claire, Dave, and Eve are on the same $\hookrightarrow$ team in a soccer match. At the start of the match, they ,→ are each assigned to a position: Alice is playing $\hookrightarrow$ goalkeeper, Bob is playing left midfielder, Claire is $\hookrightarrow$ playing right winger, Dave is playing striker, and Eve is $\hookrightarrow$ playing center midfielder.
363
+
364
+ As the game progresses, pairs of players occasionally swap
365
+ $\hookrightarrow$ positions. First, Alice and Claire trade positions. Then,Alice and Bob trade positions. Then, Dave and Bob trade
366
+ $\hookrightarrow$
367
+ $\hookrightarrow$ positions. Then, Bob and Eve trade positions. Finally,
368
+ $\hookrightarrow$ Dave and Eve trade positions. At the end of the match,
369
+ $\hookrightarrow$ Eve is playing
370
+
371
+ Options:
372
+
373
+ (A) goalkeeper (B) left midfielder (C) right winger (D) striker (E) center midfielder
374
+
375
+ Answer: (C)
376
+
377
+ # Solution:
378
+
379
+ # \`python
380
+
381
+ initial_positions $=$ [("Alice", "goalkeeper"), ("Bob", "left $\hookrightarrow$ midfielder"), ("Claire", "right winger"), ("Dave", $\hookrightarrow$ "striker"), ("Eve", "center midfielder")] switches $=$ [("Alice", "Claire"), ("Alice", "Bob"), ("Dave", $\hookrightarrow$ "Bob"), ("Bob", "Eve"), ("Dave", "Eve")]
382
+
383
+ ret $=$ square_dance(initial_positions, switches)
384
+ options $=$ ["goalkeeper", "left midfielder", "right winger",
385
+ $\hookrightarrow$ "striker", "center midfielder"]
386
+ ans $=$ options.index(ret["Eve"]) $^ +$ 1 # Convert the return
387
+ $\hookrightarrow$ value to an option index (1-based)
388
+
389
+ Skip two more questions...
390
+
391
+ # Tool for Dyck Language
392
+
393
+ Here is a function to solve a class of problems:
394
+
395
+ # \`\`\`python
396
+
397
+ Use cases:
398
+
399
+ Question: Complete the rest of the sequence, making sure that
400
+ $\hookrightarrow$ the parentheses are closed properly. Input:
401
+ $\hookrightarrow$ ([[[{}]] $\{ < [ < [ \{ \ \} ] > ] > \}$
402
+ Answer: ]) Solution:
403
+ \`python
404
+ input_str $=$ "([[[{}]] $\{ < [ < [ \{ \} ] > ] > \}$ " ret $=$ complete_sequence(input_str) ans $=$ ret
405
+ Skip two more questions...
406
+
407
+ # Tool for Word Sorting
408
+
409
+ Here is a function to solve a class of problems:
410
+
411
+ \`python
412
+
413
+ def sort_words_alphabetically(word_list): return sorted(word_list)
414
+
415
+ Use cases:
416
+
417
+ Question: Sort the following words alphabetically: List: $\hookrightarrow$ conference apparition ignore dutton layperson coupe $\hookrightarrow$ superstitious westward turnoff messenger copra floruit $\hookrightarrow$ primitive implement
418
+
419
+ Answer: apparition conference copra coupe dutton floruit $\hookrightarrow$ ignore implement layperson messenger primitive $\hookrightarrow$ superstitious turnoff westward
420
+
421
+ Solution:
422
+
423
+ # \`\`python
424
+
425
+ words1 $=$ ["conference", "apparition", "ignore", "dutton",
426
+ $\hookrightarrow$ "layperson", "coupe", "superstitious", "westward",
427
+ $\hookrightarrow$ "turnoff", "messenger", "copra", "floruit", "primitive",
428
+ $\hookrightarrow$ "implement"]
429
+ ret1 $=$ sort_words_alphabetically(words1)
430
+ ans1 $=$ " ".join(ret1)
431
+
432
+ Skip two more questions...
433
+
434
+ # Tool for Chinese Remainder Theorem
435
+
436
+ Here is a function to solve a class of problems:
437
+
438
+ # \`\`python
439
+
440
+ def find_number(max_limit, divisors, remainders): for num in range(max_limit + 1): if all((num - remainder) % divisor $\qquad = = \quad 0$ for divisor, $\hookrightarrow$ remainder in zip(divisors, remainders)): return num return None
441
+
442
+ Use cases:
443
+
444
+ Question: There is a basket of no more than 1188877 durians.
445
+
446
+ $\hookrightarrow$ If we divide them equally among 41 penguins, we have 17 $\hookrightarrow$ left; if we divide them equally among 107 dinosaurs, we $\hookrightarrow$ have 42 left; if we divide them equally among 271 $\hookrightarrow$ elephants, we have 260 left. How many durians are in the $\hookrightarrow$ basket?
447
+
448
+ Solution:
449
+
450
+ # \`python
451
+
452
+ max_limit $=$ 1188877
453
+ divisors $=$ [41, 107, 271]
454
+ remainders $=$ [17, 42, 260]
455
+ ret $=$ find_number(max_limit, divisors, remainders) ans $=$ ret
456
+ Skip two more questions...
457
+
458
+ # Tool for Schedule Meeting
459
+
460
+ Here is a function to solve a class of problems:
461
+
462
+ # \`\`\`python
463
+
464
+ from datetime import datetime, timedelta def find_earliest_time_slot(a_availability, b_availability, $\hookrightarrow$ meeting_duration):
465
+
466
+ a_availability $=$ [(datetime.strptime(start, '%H:%M'), $\hookrightarrow$ datetime.strptime(end, '%H:%M')) for start, end in $\hookrightarrow$ a_availability]
467
+ b_availability $=$ [(datetime.strptime(start, '%H:%M'), $\hookrightarrow$ datetime.strptime(end, '%H:%M')) for start, end in $\hookrightarrow$ b_availability]
468
+
469
+ for a_start, a_end in a_availability: for b_start, b_end in b_availability: latest_start $=$ max(a_start, b_start) earliest_end $=$ min(a_end, b_end)
470
+
471
+ if earliest_end - latest_start $> =$
472
+ $\hookrightarrow$ timedelta(minutes $=$ meeting_duration): return latest_start.strftime('%H:%M'), $\hookrightarrow$ (latest_start $^ +$ $\hookrightarrow$ timedelta(minutes ${ \bf \equiv } _ { \bf - \infty }$ meeting_duration)).strftime('%H:
473
+
474
+ # return None
475
+
476
+ Use cases:
477
+
478
+ Question: A and B want to schedule a 1-hour meeting together. $\hookrightarrow$ A's availability: 12:00 - 12:30, 13:00 - 13:30, 14:30 - ,→ 15:30, 17:30 - 18:00. B's availability: 09:00 - 11:00, $\hookrightarrow$ 12:00 - 12:30, 13:00 - 13:30, 15:30 - 16:30, 17:30 - $\hookrightarrow$ $1 8 : 0 0$ . What time slot works best? (if multiple, choose $\hookrightarrow$ the earliest one)
479
+
480
+ Answer: No time slot works.
481
+
482
+ Solution: \`python
483
+
484
+ a_availability $=$ [('12:00', '12:30'), ('13:00', '13:30'),
485
+ $\hookrightarrow$ ('14:30', '15:30'), ('17:30', '18:00')]
486
+ b_availability $=$ [('09:00', '11:00'), ('12:00', '12:30'), $\hookrightarrow$ ('13:00', '13:30'), ('15:30', '16:30'), ('17:30',
487
+ $\hookrightarrow$ '18:00')]
488
+ meeting_duration $= ~ 6 0$
489
+ ret $=$ find_earliest_time_slot(a_availability, b_availability,
490
+ $\hookrightarrow$ meeting_duration)
491
+ ans $=$ ret if ret else "No time slot works."
492
+
493
+ Skip two more questions...
494
+
495
+ # E DATASET CONSTRUCTION
496
+
497
+ For the “schedule meeting” task, we use the following template to generate the dataset:
498
+
499
+ question_format $=$ """A and B want to schedule a {interval}-hour $\hookrightarrow$ meeting together.
500
+ A's availability: {A_availability}
501
+ B's availability: {B_availability}
502
+ What time slot works best? (if multiple, choose the earliest $\hookrightarrow$ one)"""
503
+
504
+ where the interval is randomly sampled from $\{ 0 . 5 , 1 , 1 . 5 \}$ , and the availability of A and B are randomly sampled from 8:00-18:00 with 30 minutes as the granularity. The answer is computed by computing the intersection of the two availability sets and then find the earliest time slot that is at least as long as the meeting duration. If there is no such time slot, we return “No time slot works.”.
parse/test/qV83K9d5WB/qV83K9d5WB_content_list.json ADDED
@@ -0,0 +1,1167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "LARGE LANGUAGE MODELS AS TOOL MAKERS ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Tianle $\\mathbf { C a i ^ { 1 , 2 * } }$ Xuezhi Wang1 Tengyu $\\mathbf { M } \\mathbf { a } ^ { 1 , 3 \\dagger }$ Xinyun Chen1 Denny Zhou1 1Google Deepmind 2Princeton University 3Stanford University ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "ABSTRACT ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "Recent research has highlighted the potential of large language models (LLMs) to improve their problem-solving capabilities with the aid of suitable external tools. In our work, we further advance this concept by introducing a closedloop framework, referred to as LLMs As Tool Makers (LATM), where LLMs create their own reusable tools for problem-solving. Our approach consists of two phases: 1) tool making: an LLM acts as the tool maker that crafts tools for a set of tasks, where a tool is implemented as a Python utility function. 2) tool using: another LLM acts as the tool user, which applies the tool built by the tool maker for problem-solving. The tool user can be either the same or a different LLM from the tool maker. On the problem-solving server side, tool-making enables continual tool generation and caching as new requests emerge. This framework enables subsequent requests to access cached tools via their corresponding APIs, enhancing the efficiency of task resolution. Beyond enabling LLMs to create their own tools, our framework also uncovers intriguing opportunities to optimize the serving cost of LLMs: Recognizing that tool-making requires more sophisticated capabilities, we assign this task to a powerful, albeit resource-intensive, model. Conversely, the simpler tool-using phase is delegated to a lightweight model. This strategic division of labor allows the once-off cost of tool-making to be spread over multiple instances of tool-using, significantly reducing average costs while maintaining strong performance. Furthermore, our method offers a functional cache through the caching and reuse of tools, which stores the functionality of a class of requests instead of the natural language responses from LLMs, thus extending the applicability of the conventional cache mechanism. We evaluate our approach across various complex reasoning tasks, including Big-Bench tasks. With GPT-4 as the tool maker and GPT-3.5 as the tool user, LATM demonstrates performance equivalent to using GPT-4 for both roles, but with a significantly reduced inference cost. The codebase can be found in https://github.com/ ctlllll/LLM-ToolMaker. ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "1 INTRODUCTION ",
27
+ "text_level": 1,
28
+ "page_idx": 0
29
+ },
30
+ {
31
+ "type": "text",
32
+ "text": "Large language models (LLMs) have demonstrated outstanding capabilities across a broad array of NLP tasks (Brown et al., 2020; Chowdhery et al., 2022; Zhang et al., 2022; Hoffmann et al., 2022; OpenAI, 2023; Google, 2023) and have even shown promising signs of achieving certain aspects of artificial general intelligence (Bubeck et al., 2023; Kosinski, 2023). Moreover, analogous to the evolution of human intelligence, recent research has unveiled the potential of augmenting LLMs with external tools, thereby significantly enhancing their problem-solving capacities and efficiencies (Yao et al., 2023; Liu et al., 2023; Parisi et al., 2022; Schick et al., 2023). ",
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "However, the applicability of these tool-using methods is largely contingent on the availability of suitable tools. According to the lessons learned from the evolutionary milestones of humans, a crucial turning point was that humans got the ability to fabricate their own tools to address emerging challenges. Inspired by the importance of tool-making for humans, in this work, we embark on an initial exploration to apply this evolutionary concept to the realm of LLMs. We propose a closed-loop framework, which we term as LLMs As Tool Makers (LATM), enables LLMs to generate their own reusable tools to tackle new tasks. Our approach comprises two key stages: 1) tool making: an LLM, known as the tool maker, designs tools (implemented as Python functions) specifically for a given task. 2) tool using: another LLM referred to as the tool user, which can be the same as the tool maker, applies the tools to handle new requests. The two-stage design allows LATM to allocate jobs in each stage to the most suitable LLM. Specifically, the tool-making process, which requires a high degree of capability, can be assigned to a powerful albeit resource-intensive model (e.g., GPT-4). On the other hand, the tool-using process, which is comparatively simpler, can be assigned to a lightweight and cost-effective model (e.g., GPT-3.5 Turbo). This approach not only enhances the problem-solving capabilities of LLMs, but also significantly reduces the average computational cost of addressing a series of tasks. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "image",
42
+ "img_path": "images/d968e0650a4da29d2c49385035eaeb6bc08bf25dd97cb7d214098ccef1a8adca.jpg",
43
+ "image_caption": [
44
+ "Figure 1: The closed-loop framework of LATM. In situations with numerous problem-solving requests, directly utilizing a powerful LLM to solve all the instances can result in high costs. On the other hand, lightweight models are cost-effective but usually struggle with complex tasks. LATM leverages the strengths of both models by employing a powerful model as the tool maker to generate reusable tools (implemented as Python functions) for tasks observed in the requests and pass the tool to a cost-effective tool user model for solving similar instances in the following requests. This approach allows the lightweight model to achieve performance comparable to the powerful model while maintaining greater cost-efficiency. "
45
+ ],
46
+ "image_footnote": [],
47
+ "page_idx": 1
48
+ },
49
+ {
50
+ "type": "text",
51
+ "text": "",
52
+ "page_idx": 1
53
+ },
54
+ {
55
+ "type": "text",
56
+ "text": "As the tool-making process needs to be executed only once for a given functionality, the resulting tools can be reused across different task instances. This approach paves the way for a scalable and cost-efficient solution for handling complex task. For instance, consider a task where a user ask the LLM to schedule a meeting that works for everyone (e.g., in email conversations). Lightweight models like GPT-3.5 Turbo often struggle with such tasks that involve complex arithmetic reasoning. In contrast, more powerful models (e.g., GPT-4) can find the correct solutions, despite that the inference costs become much higher. LATM overcomes these hurdles by employing a powerful yet expensive model as the tool maker, and passing it to a cost-effective model as the tool user, for subsequent usage. After the tool has been forged, the lightweight tool user can use it to solve the task efficiently with high performance. This paradigm can similarly be applied to recurring tasks in various workflows, such as parsing and analyzing web documents into specific data formats or formulating routing plans that satisfy several custom requirements, or being used to solve popular games like the 24-game, Sudoku. ",
57
+ "page_idx": 1
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "In the context of serving cost reduction, LATM introduces the opportunity of creating a functional cache for the LLM server. Specifically, consider a streaming setting where the LLM server continuously receives a sequence of requests. Traditional cache systems, such as GPTCache (Zilliz, 2023), store the responses generated by the LLMs and reuse them for textually similar requests. However, with the capacity for tool-making that LATM introduces, the system can store tools crafted by the tool maker and reuse them for functionally analogous requests. This novel approach, combined with the strategic division of labor between the tool maker and tool user, has the potential to considerably reduce the average cost of serving a sequence of requests while maintaining high performance. ",
62
+ "page_idx": 1
63
+ },
64
+ {
65
+ "type": "text",
66
+ "text": "Our experiments validate the effectiveness of this approach on a range of complex reasoning tasks, including several challenging Big-Bench tasks (Srivastava et al., 2022). The results show that LATM can achieve performance on par with more resource-intensive models while being more cost-effective. This novel approach to LLMs, which mimics the evolutionary leap of humans in creating and using tools, opens up exciting possibilities for a growing community with LLM-generated tools. ",
67
+ "page_idx": 2
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "2 RELATED WORK ",
72
+ "text_level": 1,
73
+ "page_idx": 2
74
+ },
75
+ {
76
+ "type": "text",
77
+ "text": "Chain of thought (CoT). Recently, significant progress has been made in enhancing the problemsolving abilities of large language models (LLMs) for complex tasks. For instance, CoT prompting (Wei et al., 2022; Wang et al., 2022) has been proposed to bolster LLM reasoning capabilities, demonstrating improved performance across various reasoning and natural language processing tasks. CoT is typically articulated through natural languages (Ling et al., 2017; Cobbe et al., 2021; Suzgun et al., 2022; Shi et al., 2022; Zhou et al., 2022), yet it might also be effectively represented using programming languages (Amini et al., 2019; Austin et al., 2021; Nye et al., 2021; Chowdhery et al., 2022; Gao et al., 2023; Chen et al., 2022). More recently, Arora et al. (2023) proposed using LLMs to generate structured views over documents, balancing quality and cost by ensembling extractions from multiple synthesized functions. Our method shares a similar spirit with Arora et al. (2023) in managing cost and quality trade-offs but focuses on more general use cases. ",
78
+ "page_idx": 2
79
+ },
80
+ {
81
+ "type": "text",
82
+ "text": "Augmenting language models with tools. Recent works have explored the potential of using external tools to supplement LLMs’ capabilities for complex tasks. Yao et al. (2023); Yang et al. (2023) proposed augmenting reasoning traces with task-specific actions in LLMs, enabling models to reason and act synergistically. Various studies (Liu et al., 2023; Parisi et al., 2022; Schick et al., 2023; Shen et al., 2023; Lu et al., 2023; Paranjape et al., 2023; Liang et al., 2023) have demonstrated that supplementing LLMs with tools, such as calculators, search engines, translation systems, calendars, or even API calls on other models, can help solve tasks that are not easily addressed by LLMs alone. ",
83
+ "page_idx": 2
84
+ },
85
+ {
86
+ "type": "text",
87
+ "text": "Similar to LATM, methods like Chameleon (Lu et al., 2023) also incorporate Python executors in the pipeline. However, their primary focus is on using Python executors to accurately solve sub-steps involving arithmetic reasoning, similar to Gao et al. (2023); Chen et al. (2022). In contrast, we use Python executors to create reusable tools for addressing other task instances. Furthermore, the separation of the tool maker and tool user enables the use of a lightweight model for most inferences, thus enhancing efficiency and cost-effectiveness in LATM. ",
88
+ "page_idx": 2
89
+ },
90
+ {
91
+ "type": "text",
92
+ "text": "Adaptive generation in language models. In addition, recent research has proposed methods to adaptively control decoding in LLMs to improve text generation efficiency (Leviathan et al., 2022; Chen et al., $2 0 2 3 \\mathrm { a }$ ; Xia et al., 2023). Speculative decoding is based on the notion that generating text tokens (a more expensive process) can be expedited with a faster yet less powerful model while approximating the performance of larger, costlier models by using them to score generated tokens (a much faster process). Our approach of passing tools from a more expensive model to a smaller, faster model also shares a similar spirit of adaptive computing. Instead of altering the decoding procedure, we transfer newly generated tools between models to boost both the performance and efficiency of an LLM in solving tasks. ",
93
+ "page_idx": 2
94
+ },
95
+ {
96
+ "type": "text",
97
+ "text": "Language model cascades. There is recent evidence that LLMs can enable repeated interactions and that multiple LLMs can be combined to extend their capabilities further (Wu et al., 2022; Zhou et al., 2022; Dohan et al., 2022; Chen et al., 2023c). Also, Chen et al. (2023b) demonstrated that identifying optimal LLM combinations can help reduce costs while improving accuracy. Our motivation aligns with these findings; however, rather than merely cascading LLMs, we identify task categories that can be better addressed using new tools generated by a larger model and assign each individual inference within that task category to a smaller model. ",
98
+ "page_idx": 2
99
+ },
100
+ {
101
+ "type": "text",
102
+ "text": "Early attempts on tool-making. Concurrent and independent to our work, several early attempts have been made towards using LLMs to make tools. Wang et al. (2023) conducted research within the Minecraft environment and demonstrated the ability of an LLM-powered agent to acquire new skills in the form of programs. Similarly, Qian et al. (2023) proposes a method of decomposing problem-solving for each individual instance into an abstract tool creation phase and a concrete tool application phase. Our work aligns with the spirit of both Wang et al. (2023) and Qian et al. (2023) in the aim to let LLMs to generate their own tools for problem-solving. However, we also underscore the significance of tool reusability and cost-effectiveness stemming from the division of labor. The idea of tool making is also mentioned in a recent survey paper (Qin et al., 2023). ",
103
+ "page_idx": 2
104
+ },
105
+ {
106
+ "type": "text",
107
+ "text": "",
108
+ "page_idx": 3
109
+ },
110
+ {
111
+ "type": "text",
112
+ "text": "3 LLM AS TOOL MAKER (LATM) ",
113
+ "page_idx": 3
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "Tool making template (One-time:) ",
118
+ "text_level": 1,
119
+ "page_idx": 3
120
+ },
121
+ {
122
+ "type": "text",
123
+ "text": "Tool proposing: Write a generic Python function (the Tool) to solve three training samples. ",
124
+ "page_idx": 3
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "Tool verification: Write unit tests to convert three validation samples into function call and validate the correctness. ",
129
+ "page_idx": 3
130
+ },
131
+ {
132
+ "type": "text",
133
+ "text": "Tool wrapping: Gather the function from the proposing stage and the examples of how to convert problems to function calls from the verification stage into a reusable Wrapped Tool. ",
134
+ "page_idx": 3
135
+ },
136
+ {
137
+ "type": "image",
138
+ "img_path": "images/e91e857b0135bcc521b32127e589b5298a003aa9d4def47709636250ee1cdbed.jpg",
139
+ "image_caption": [],
140
+ "image_footnote": [],
141
+ "page_idx": 3
142
+ },
143
+ {
144
+ "type": "text",
145
+ "text": "Tool Maker (e.g., GPT-4): Strong performance but slow and expensive ",
146
+ "page_idx": 3
147
+ },
148
+ {
149
+ "type": "image",
150
+ "img_path": "images/cf6c1bb71cd98d019595b688e6bdcfbf1682cbb1edd6d9a9e9aa74e87a669547.jpg",
151
+ "image_caption": [
152
+ "Figure 2: The pipeline of LATM. LATM can be divided into two stages: 1) tool making: a powerful yet more expensive model serves as the tool maker to generate generic and reusable tools from a few demonstrations; 2) tool using: a lightweight and cheaper model serves as the tool user to use the tool to solve various instances of the task. The tool-making stage can be further divided into three sub-stages: (i) tool proposing: the tool maker makes an attempt to generate the tool (Python function) from a few training demonstrations, if the tool is not executable, report the error and generate a new one (fix the function); (ii) tool verification: the tool maker runs unit tests on validation samples, if the tool does not pass the tests, report the error and generate new tests (fix the function calls in unit tests); and (iii) tool wrapping: wrapping up the function code and the demonstrations of how to convert a question into a function call from unit tests, preparing usable tools for tool user. "
153
+ ],
154
+ "image_footnote": [],
155
+ "page_idx": 3
156
+ },
157
+ {
158
+ "type": "text",
159
+ "text": "3.1 MAKING NEW TOOLS AND REUSE THEM ",
160
+ "text_level": 1,
161
+ "page_idx": 3
162
+ },
163
+ {
164
+ "type": "text",
165
+ "text": "In the LATM paradigm, the main process can be split into two stages: Tool Making and Tool Using. Each stage utilizes different types of Large Language Models (LLMs) to balance performance and cost-effectiveness. All the prompts used in our experiments are shown in Appendix C. ",
166
+ "page_idx": 3
167
+ },
168
+ {
169
+ "type": "text",
170
+ "text": "Tool Making. This stage employs a powerful yet more expensive model, such as GPT-4, to serve as the tool maker. Tool maker’s role is to create a generic and reusable tool (implemented as a Python function) from a few demonstrations of a task. This stage can be further divided into three sub-stages: ",
171
+ "page_idx": 3
172
+ },
173
+ {
174
+ "type": "text",
175
+ "text": "• Tool Proposing: In this stage, tool maker attempts to generate a Python function to solve the demonstrations from the given task. This process follows the “programming by example” (PbE) ",
176
+ "page_idx": 3
177
+ },
178
+ {
179
+ "type": "text",
180
+ "text": "paradigm (Halbert, 1984) where several concrete demonstrations are provided, and the model is required to write programs that produce the demonstrated behaviors. In our experiments, we use 3 demonstrations for this stage. If the proposed tool is unexecutable or encounters errors, tool maker appends the error messages to the history and makes another attempt. ",
181
+ "page_idx": 4
182
+ },
183
+ {
184
+ "type": "text",
185
+ "text": "• Tool Verification: In this stage, the tool maker generates unit tests using validation samples and subsequently executes these tests on the proposed tool. We utilize 3 validation samples in our experiments. If the tool fails any of these tests, the tool maker records the error in its history and makes an attempt to rectify the issues within the unit tests (this procedure will only correct the function calls in the unit test part and will not correct the function). The ability of LLMs to self-debug has been demonstrated effectively in recent research (Madaan et al., 2023; Chen et al., $2 0 2 3 \\mathrm { c }$ ; Lu et al., 2023; Kim et al., 2023). However, within the LATM pipeline, the verification stage serves a slightly different usage. This stage fulfills two key roles: 1) it provides examples that demonstrate how to convert natural language questions into function calls, and 2) it verifies the tool’s reliability, enabling the entire process to be fully automated. ",
186
+ "page_idx": 4
187
+ },
188
+ {
189
+ "type": "text",
190
+ "text": "• Tool Wrapping: If the execution or verification fails over a preset threshold, the Tool Making stage is viewed as failed. Otherwise, tool maker is ready to prepare the wrapped tool for tool user. This step involves wrapping up the function code and providing demonstrations of how to convert a task into a function call. These demonstrations are extracted from the Tool Verification step, which converts questions into unit tests. This final product is then ready for use by the tool user. Please see Appendix D for examples of the wrapped tools. ",
191
+ "page_idx": 4
192
+ },
193
+ {
194
+ "type": "text",
195
+ "text": "Tool Using. This second stage involves a lightweight and cost-effective model, such as GPT-3.5 Turbo, to serve as the tool user. The tool user’s role is to utilize the verified tool to solve various instances of the task. The prompt for this stage is the wrapped tool which contains the function for solving the task and demonstrations of how to convert a task query into a function call. With the demonstrations, tool user can then generate the required function call in an in-context learning fashion. The function calls are then executed to solve the task. Optionally, postprocessing can be applied to convert the output to match the required format of the task, such as options for multiple-choice questions. ",
196
+ "page_idx": 4
197
+ },
198
+ {
199
+ "type": "text",
200
+ "text": "The tool-making stage, including tool proposing, verification, and wrapping, only needs to be performed once for each type of task. The resulting tools can then be reused for all instances of that task. This makes LATM significantly more efficient and cost-effective than using a powerful model alone. Furthermore, the Python function tools are a more generic form of Chain-of-Thought, enhancing the overall utility and flexibility of the LLMs, as they can be used to solve questions that involve algorithmic reasoning ability (Velickovi ˇ c and Blundell ´ , 2021). ",
201
+ "page_idx": 4
202
+ },
203
+ {
204
+ "type": "text",
205
+ "text": "4 LATM FOSTERS A FUNCTIONAL CACHE MECHANISM FOR LLM SERVING ",
206
+ "text_level": 1,
207
+ "page_idx": 4
208
+ },
209
+ {
210
+ "type": "text",
211
+ "text": "In real-world scenarios, tasks often arrive in a sequential stream. To address this, we introduce a third LLM, the dispatcher, that decides whether to engage the tool user or tool maker for each incoming task. While this tool selection function mirrors existing works (Lu et al., 2023; Shen et al., 2023; Schick et al., 2023; Paranjape et al., 2023), our dispatcher distinctively contributes to creating a functional cache—it discerns new tasks that cannot be resolved with existing tools, thereby triggering the tool maker to generate appropriate tools for these tasks. ",
212
+ "page_idx": 4
213
+ },
214
+ {
215
+ "type": "text",
216
+ "text": "The dispatcher maintains a repository of existing tools crafted by the tool maker in the format of function APIs. Upon receipt of a new task instance, the dispatcher first attempts to locate a compatible tool within the cache. If such a tool is present, the dispatcher assigns the instance and corresponding tool to the tool user for resolution. However, if no suitable tool is available, the dispatcher identifies this as a novel task, either solving it with a powerful model or, if necessary, invoking a human labeler. These new instances are then cached until a sufficient number are amassed to craft a new tool, further enriching the functional cache. This mechanism allows for the functionally similar tasks to reuse these tools, expanding the coverage of the classic cache mechanism and reducing the overall serving cost. Given the simplicity of the dispatching task, a lightweight model equipped with appropriate prompts (See Appendix C) can efficiently serve as the dispatcher, adding only a marginal cost to the entire pipeline. ",
217
+ "page_idx": 4
218
+ },
219
+ {
220
+ "type": "image",
221
+ "img_path": "images/c019278a0bf3ef3261605e7958474cddca5b91abfe19480e2661996e7803fbff.jpg",
222
+ "image_caption": [
223
+ "Figure 3: An illustration of the Tool Proposing and Tool Using stages of the LATM pipeline for the Logical Deduction task (Srivastava et al., 2022). This task requires determining the order of five objects based on several given conditions. In the Tool Proposing stage, the tool maker (such as GPT-4) formulates a generic Python function capable of solving the provided $k$ demonstrations from the task (where $k$ equals 3 in our experiments). The tool maker generates a search algorithm that enumerates all possible orderings and verifies each against the provided conditions. During the tool-using stage, the tool user translates each natural language question into a series of conditions, generating function calls to utilize the tool for each task instance. "
224
+ ],
225
+ "image_footnote": [],
226
+ "page_idx": 5
227
+ },
228
+ {
229
+ "type": "text",
230
+ "text": "5 EXPERIMENTS ",
231
+ "text_level": 1,
232
+ "page_idx": 5
233
+ },
234
+ {
235
+ "type": "text",
236
+ "text": "5.1 EXPERIMENTAL SETUP ",
237
+ "text_level": 1,
238
+ "page_idx": 5
239
+ },
240
+ {
241
+ "type": "text",
242
+ "text": "Datasets. We evaluate our approach on six datasets from diverse domains, including Logical Deduction, Tracking Shuffled Objects, Dyck Language, Word Sorting, Chinese Remainder Theorem, and Scheduling Meeting. The first five datasets are sourced from BigBench (Srivastava et al., 2022). We take the 5 objects version of the Logical Deduction and Tracking Shuffled Objects tasks, referred to as Logical Deduction (5) and Tracking Shuffled Objects (5) in the paper. We also constructed the Scheduling Meeting task to demonstrate the effectiveness of LATM in real-world scenarios. Detailed information on dataset generation can be found in Appendix E. We divide each dataset into training, validation, and test sets, containing 3, 3, and 240 instances, respectively. ",
243
+ "page_idx": 5
244
+ },
245
+ {
246
+ "type": "text",
247
+ "text": "Model settings. During the tool-making stage, we set the temperature to 0.3 to introduce randomness to the generation process, allowing for retries if necessary. For this stage, we conduct experiments using GPT-4 and GPT-3.5 Turbo models with the ChatCompletion API, always appending the response to the chat history to create an interactive experience. In the tool-using stage, the LLM API call is made only once, and we also perform ablation studies on GPT-3-type models with the standard Completion API. When using the tools, we consistently set the temperature to 0.0. We set the maximal retry times to be 3 for the tool-proposing and tool-verification stages. ",
248
+ "page_idx": 5
249
+ },
250
+ {
251
+ "type": "text",
252
+ "text": "5.2 EFFECTIVENESS OF THE TOOL-MAKING STAGE ",
253
+ "text_level": 1,
254
+ "page_idx": 5
255
+ },
256
+ {
257
+ "type": "text",
258
+ "text": "In the tool-making stage, we use a powerful yet slower model to generate generic Python functions tailored to a specific task. This step is performed only once for each task, and the overhead is amortized across all instances of that task. In our experiments, we use GPT-4 (OpenAI, 2023) as a representative tool maker, while we explore other models’ tool-making capabilities in Section 5.5. We provide several few-shot exemplars for the language model, guiding it to generate generic Python programs, as illustrated in Figure 3. ",
259
+ "page_idx": 5
260
+ },
261
+ {
262
+ "type": "table",
263
+ "img_path": "images/b3edc79ac4eccb9ed5ea42bdbcd91113b6d1a09ad98e53cf907202075e019d91.jpg",
264
+ "table_caption": [
265
+ "Table 1: The utility functions generated by tool maker to solve the tasks. "
266
+ ],
267
+ "table_footnote": [],
268
+ "table_body": "<table><tr><td>Logical Deduction (5)</td><td>Tracking Shuffled Objects (5)</td><td>Dyck Language Sorting</td><td>Word</td><td>Chinese Remainder Theorem</td><td>Schedule Meeting</td></tr><tr><td>Search</td><td>Simulation</td><td>Stack</td><td>Sort</td><td>| Search/Extended Euclidean| Interval intersections</td><td></td></tr></table>",
269
+ "page_idx": 6
270
+ },
271
+ {
272
+ "type": "text",
273
+ "text": "",
274
+ "page_idx": 6
275
+ },
276
+ {
277
+ "type": "text",
278
+ "text": "Our observations indicate that when GPT-4 is employed as the tool maker, the model frequently devises suitable algorithms for solving tasks. For instance, as shown in Table 1, the tool maker creates code to solve the logical deduction task by searching through all permutations and selecting the correct one that satisfies the given constraints. In our experiment, the tool-verification stage is mainly used to provide examples that demonstrate how to convert natural language questions into function calls, and we only observe 2 cases out of the 60 trials that the tool maker can correct its mistakes with the guide of error messages. See Section 5.5 for more discussions on the tool maker. ",
279
+ "page_idx": 6
280
+ },
281
+ {
282
+ "type": "text",
283
+ "text": "5.3 LATM IMPROVES THE PERFORMANCE OF LIGHTWEIGHT LLMS ",
284
+ "text_level": 1,
285
+ "page_idx": 6
286
+ },
287
+ {
288
+ "type": "text",
289
+ "text": "In Table 2, we compare the performance of Chain-of-Thought prompting (Wei et al., 2022) with our method, LATM. We employ GPT-4 as the tool maker to generate tools for the six tasks, and evaluate the performance of both GPT-3.5 Turbo and GPT-4 as tool user. The results demonstrate that with the help of the tool, a lightweight model like GPT-3.5 Turbo can achieve performance on par with GPT-4, significantly outperforming CoT prompting. Additionally, the average cost of using GPT-3.5 Turbo with the tool is much lower compared to using GPT-4. This highlights the effectiveness of LATM in enhancing the performance of lightweight models and therefore reducing the cost compared to employing expensive models. Intriguingly, for the Dyck Language task, GPT-3.5 Turbo as the tool user even surpasses GPT-4 in its role as the tool user. Upon investigating the failure cases, we find that when converting the question into a function call, GPT-4 occasionally superfluously closes some brackets within the argument instead of leaving the argument unchanged and letting the function solve it, which leads to incorrect function output. ",
290
+ "page_idx": 6
291
+ },
292
+ {
293
+ "type": "table",
294
+ "img_path": "images/ffbadfb58bff8b785d6cea976902470aaa999b3db6572ae2bbffe853daa47eb1.jpg",
295
+ "table_caption": [],
296
+ "table_footnote": [],
297
+ "table_body": "<table><tr><td></td><td></td><td></td><td>TUeMeto</td><td></td><td>Wordg</td><td>RemaiChir Theorem</td><td>Schedue</td><td>Costopes</td></tr><tr><td>GPT-3.5 Turbo</td><td>CoT LATM</td><td>66.4 79.7 (+13.3)</td><td>61.6 99.6 (+38.0)</td><td>20.4 92.2 (+71.8)|98.3 (+39.1)</td><td>59.2</td><td>0.0 100.0 (+100.0)</td><td>18.9</td><td>0(nc) 100.0 (+81.1)|O(nc + C)</td></tr><tr><td>GPT-4</td><td>LAoTM</td><td>88</td><td>100.0</td><td>6</td><td>99</td><td>100.0</td><td>55.0</td><td></td></tr></table>",
298
+ "page_idx": 6
299
+ },
300
+ {
301
+ "type": "text",
302
+ "text": "Table 2: Accuracy comparison between LATM and Chain-of-Thought. The six tasks are detailed in Section 5.1. For LATM, the tool is created by GPT-4 and utilized by both GPT-3.5 Turbo and GPT4. The results demonstrate that the application of LATM can significantly enhance the performance of GPT-3.5 Turbo, often surpassing or matching GPT-4’s performance with CoT in certain scenarios. The last column depicts the overall cost of processing $n$ samples. Here, $C$ represents the cost of one call to GPT-4, while $c$ denotes the cost of one call to GPT-3.5 Turbo. At the time of writing this paper, $C$ is over $1 5 \\mathrm { x }$ larger than $c$ . The few-shot CoT demonstrations for the first four tasks are provided by Suzgun et al. (2022), while for the last two tasks, we apply direct few-shot prompting without CoT. ",
303
+ "page_idx": 6
304
+ },
305
+ {
306
+ "type": "text",
307
+ "text": "5.4 ADAPTING LATM TO A DYNAMIC STREAM OF DIVERSE TASKS ",
308
+ "text_level": 1,
309
+ "page_idx": 6
310
+ },
311
+ {
312
+ "type": "text",
313
+ "text": "As discussed in Section 4, we can adapt LATM to handle a dynamic stream where instances from potentially different tasks emerge in real-time. In this setting, we introduce an additional model, the dispatcher, tasked with identifying the task to which each incoming instance pertains. We employ GPT-3.5 Turbo for this role, evaluating its effectiveness in two key functions: 1) Identifying and employing existing tools from the functional cache to resolve an incoming instance, and 2) ",
314
+ "page_idx": 6
315
+ },
316
+ {
317
+ "type": "table",
318
+ "img_path": "images/cf9fdac77801f3dbc0811e9ef7043cdf3ca0dd363d265191c54ff0d027d8b2a1.jpg",
319
+ "table_caption": [
320
+ "Table 3: Success rate of generating new tools (Python functions that pass the tool-verification step) in the tool-making stage with GPT-4 v.s. GPT-3.5 Turbo. We run 5 trials for each model on each task, $n / 5$ means $n$ trails out of 5 successes to produce a valid tool. For hard tasks like Logical Deduction and Tracking Shuffled Objects, GPT-3.5 Turbo fails in all trials, showing the necessity of using a more powerful model as tool maker. "
321
+ ],
322
+ "table_footnote": [],
323
+ "table_body": "<table><tr><td>Tool Maker Model</td><td>DeLucion (5)</td><td>Trackijes(usr ed</td><td>Langckge</td><td>SWwrdg</td><td> RemainhireTheorem</td><td>Schedule</td></tr><tr><td>GPT-3.5 Turbo</td><td>0/5</td><td>0/5</td><td>5/5</td><td>5/5</td><td>5/5</td><td>0/5</td></tr><tr><td>GPT-4 1</td><td>3/5</td><td>4/5</td><td>5/5</td><td>5/5</td><td>5/5</td><td>3/5</td></tr></table>",
324
+ "page_idx": 7
325
+ },
326
+ {
327
+ "type": "text",
328
+ "text": "Detecting unseen tasks and triggering the tool maker to create appropriate tools for these tasks. This experimental setup helps assess how effectively our system can reduce serving costs by reusing and extending the functional cache in a dynamic, multi-tasking scenario. ",
329
+ "page_idx": 7
330
+ },
331
+ {
332
+ "type": "text",
333
+ "text": "Identifying existing tools. The first part of our evaluation assesses the dispatcher’s capability to recognize existing tools within the functional cache that correspond to a given instance, analogous to the cache fetching phase of traditional cache systems. To this end, we generate a test set of 100 samples, randomly mixed from the six tasks discussed in Section 5.1. For each instance, the dispatcher is tasked to determine the appropriate tool from existing ones, utilizing prompts containing task examples associated with these tools (See Appendix C). Success is measured by the correct identification of the tool. Over five random constructions of the test set, the accuracy in correctly determining the suitable tool is $9 5 \\% \\pm 2 \\%$ . ",
334
+ "page_idx": 7
335
+ },
336
+ {
337
+ "type": "text",
338
+ "text": "Requesting tool-making. The second part of our evaluation tests the dispatcher’s ability to request tool-making for instances originating from an unseen task. This situation is akin to enqueuing a new instance into the cache when a cache miss happens. We randomly designate four tasks as existing tasks with readily available tools and select four other tasks for testing—two of these are unseen, and the other two fall within the realm of existing tasks. Again, a test set of 100 samples is generated. For each instance in the test set, the dispatcher determines whether it needs to request tool-making or if an existing tool can solve the instance. Over multiple runs, the accuracy of making the correct decision stands at $9 6 \\% \\pm 3 \\%$ , demonstrating the robustness of our approach in efficiently managing the functional cache. ",
339
+ "page_idx": 7
340
+ },
341
+ {
342
+ "type": "text",
343
+ "text": "The above results illustrate that the dispatcher can effectively recognize existing tools and accurately request tool-making for unseen tasks, all while maintaining high performance. These findings highlight the potential of LATM to be seamlessly adapted to a streaming environment encompassing a diverse range of tasks. This validation serves to fortify the viability of our framework in real-world applications, particularly where the efficient management of functional cache is paramount. ",
344
+ "page_idx": 7
345
+ },
346
+ {
347
+ "type": "text",
348
+ "text": "5.5 ABLATION STUDY ",
349
+ "text_level": 1,
350
+ "page_idx": 7
351
+ },
352
+ {
353
+ "type": "text",
354
+ "text": "Capacity required for the tool-making language model. We investigate the capacity requirements for the language model used in the tool-making stage (See Table 3). Generally, we found that a more powerful and expensive model better serves the purpose, as this stage is performed only once for each task, and high accuracy is crucial for effectively passing tools to a smaller model. Specifically, on hard tasks like Logical Deduction and Tracking Shuffled Objects, GPT-3.5 Turbo fails in all the 5 trails. And the major failure reason is that the tool is not general enough and may only work on the training samples. On the other hand, we also discovered that for easy tasks, the tool maker can be a lightweight language model. For simple tasks like Word Sorting, GPT-3.5 Turbo can effortlessly generate a program that solves the task. Another limitation that may contribute to the tool maker’s failure is the context length constraints. Since we use the entire history in each step of tool-making to enhance the reliability of the tool-making stage, this also introduces a longer context. In this case GPT-4 with 8192 context length is preferable. ",
355
+ "page_idx": 7
356
+ },
357
+ {
358
+ "type": "text",
359
+ "text": "Capacity required for the tool-using language model. In this section, we investigate the capacity requirements for the tool-using model. The results are presented in Table 4. We observed that GPT-3.5 ",
360
+ "page_idx": 7
361
+ },
362
+ {
363
+ "type": "table",
364
+ "img_path": "images/6ca5dea1148158aa706a388fb94535a424f9a69806f26deef6f575ef646bcd76.jpg",
365
+ "table_caption": [
366
+ "Table 4: A performance comparison of various tool user models, all using the same tool generated by GPT-4. All costs are based on the rates at the time of writing. Of all the models, GPT-3.5 Turbo demonstrates the best trade-off between performance and cost. We opted for GPT-3 models prior to instruction tuning (ada instead of text-ada-001, etc.), as we observed that the models after instruction tuning underperformed in the tool-using stage. We postulate that this is due to the instruction tuning impairing the in-context learning ability, which is essential for the tool-using stage. "
367
+ ],
368
+ "table_footnote": [],
369
+ "table_body": "<table><tr><td></td><td>GPT-3.5 Turbo</td><td>text-davinci-002</td><td>davinci</td><td>curie</td><td>babbage</td><td>ada</td></tr><tr><td>Logical Deduction (5)</td><td>79.7%</td><td>58.2%</td><td>11.6%</td><td>6.5%</td><td>11.6%</td><td>3.0%</td></tr><tr><td>Tracking Shuffled Objects (5)</td><td>99.6%</td><td>100.0%</td><td>62.1%</td><td>20.7%</td><td>16.4%</td><td>5.2%</td></tr><tr><td>Dyck Language</td><td>92.2%</td><td>35.8%</td><td>16.4%</td><td>18.1%</td><td>9.1%</td><td>9.9%</td></tr><tr><td>Word Sorting</td><td>98.3%</td><td>60.8%</td><td>26.6%</td><td>7.3%</td><td>7.3%</td><td>0.9%</td></tr><tr><td>Chinese Remainder Theorem</td><td>100.0%</td><td>100.0%</td><td>99.6%</td><td>93.1%</td><td>75.0%</td><td>66.0%</td></tr><tr><td>Schedule Meeting</td><td>100.0%</td><td>100.0%</td><td>62.9%</td><td>59.1%</td><td>23.2%</td><td>0.0%</td></tr><tr><td>Cost ($ per 1K tokens)</td><td>0.002</td><td>0.02</td><td>0.02</td><td>0.002</td><td>0.0005</td><td>0.0004</td></tr></table>",
370
+ "page_idx": 8
371
+ },
372
+ {
373
+ "type": "text",
374
+ "text": "Turbo offers the best balance between performance and cost among all the models tested. Regarding the older GPT-3 series of models (ada, babbage, curie, davinci), we found that models that before instruction tuning often perform better than their counterparts post instruction tuning (text-ada-001, etc.). We hypothesize that the instruction tuning phase in these models may adversely impact the in-context learning ability, which is crucial for the tool-using stage. ",
375
+ "page_idx": 8
376
+ },
377
+ {
378
+ "type": "text",
379
+ "text": "CoT as a tool does not help. In addition to LATM, we investigate if we can improve task performance by reusing Chain-of-Thought (CoT) from a larger model to a smaller model similar to LATM pipeline. Specifically, we use the same larger model (GPT-4) in the “CoT-making” stage, using zero-shot prompting “Let’s think step by step.” to elicit the intermediate thought steps, and then use the generated CoT to the same smaller tool-using model (GPT-3.5 Turbo). We test this on two tasks and report the results Table 5. We observe that using CoT from a large model has a similar or even worse performance than human-written CoT, which is much worse than LATM. ",
380
+ "page_idx": 8
381
+ },
382
+ {
383
+ "type": "table",
384
+ "img_path": "images/6b5e7cff72b0b00ea25c14009110e6bde403378c1319e9c7f242a56a50f7c667.jpg",
385
+ "table_caption": [
386
+ "Table 5: Accuracy of using CoT generated by GPT-4. The performance is similar to human-written CoT, which is much worse than LATM. "
387
+ ],
388
+ "table_footnote": [],
389
+ "table_body": "<table><tr><td>Accuracy</td><td>GPT-4 CoT</td><td>Human-written CoT</td><td>LATM</td></tr><tr><td>Logical Deduction (5)</td><td>36.8</td><td>66.4</td><td>79.7</td></tr><tr><td>Tracking Shuffled Objects (5)</td><td>63.2</td><td>61.6</td><td>99.6</td></tr></table>",
390
+ "page_idx": 8
391
+ },
392
+ {
393
+ "type": "text",
394
+ "text": "6 CONCLUSION AND FUTURE WORK ",
395
+ "text_level": 1,
396
+ "page_idx": 8
397
+ },
398
+ {
399
+ "type": "text",
400
+ "text": "We introduced LATM, a closed-loop framework empowering large language models (LLMs) to create and utilize their own tools for diverse tasks. Our approach, inspired by human’s evolutionary strides in tool creation, employs two key stages: Tool Making and Tool Using. This division of labor allows us to harness the capabilities of advanced LLMs while significantly reducing computational costs. Our experiments confirmed the efficacy of LATM across various complex tasks, demonstrating that our framework performs comparably to resource-intensive models while being more cost-effective. In addition, we show that adding another dispatcher LLM can further provide flexibility to our framework, enabling on-the-fly tool creation and usage. ",
401
+ "page_idx": 8
402
+ },
403
+ {
404
+ "type": "text",
405
+ "text": "In our evaluation process, we identified a significant lack of high-quality datasets that authentically represent daily human-computer interactions, including recurring tasks such as scheduling meetings or booking flights over email or phone calls, in their raw natural language format. We anticipate that our work will stimulate the research community to create such datasets, which could prove instrumental in cultivating the next generation of AI systems. These systems, capable of generating and applying their own tools, will be equipped to tackle complex tasks more effectively. An exciting avenue for future research is enabling the tool maker to refine and upgrade existing tools to manage new problem instances, much like in software development. This adaptability could further catalyze the evolution of the AI ecosystem, unlocking a wealth of opportunities. ",
406
+ "page_idx": 8
407
+ },
408
+ {
409
+ "type": "text",
410
+ "text": "REFERENCES \nAida Amini, Saadia Gabriel, Peter Lin, Rik Koncel-Kedziorski, Yejin Choi, and Hannaneh Hajishirzi. Mathqa: Towards interpretable math word problem solving with operation-based formalisms. arXiv preprint arXiv:1905.13319, 2019. \nSimran Arora, Brandon Yang, Sabri Eyuboglu, Avanika Narayan, Andrew Hojel, Immanuel Trummer, and Christopher Ré. Language models enable simple systems for generating structured views of heterogeneous data lakes, 2023. \nJacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, and Charles Sutton. Program synthesis with large language models, 2021. \nTom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. \nSébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023. \nCharlie Chen, Sebastian Borgeaud, Geoffrey Irving, Jean-Baptiste Lespiau, Laurent Sifre, and John Jumper. Accelerating large language model decoding with speculative sampling. February 2023a. doi: 10.48550/ARXIV.2302.01318. \nLingjiao Chen, Matei Zaharia, and James Zou. Frugalgpt: How to use large language models while reducing cost and improving performance, 2023b. \nWenhu Chen, Xueguang Ma, Xinyi Wang, and William W. Cohen. Program of thoughts prompting: Disentangling computation from reasoning for numerical reasoning tasks, 2022. \nXinyun Chen, Maxwell Lin, Nathanael Schärli, and Denny Zhou. Teaching large language models to self-debug. ARXIV.ORG, 2023c. doi: 10.48550/arXiv.2304.05128. \nAakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022. \nKarl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. \nDavid Dohan, Winnie Xu, Aitor Lewkowycz, Jacob Austin, David Bieber, Raphael Gontijo Lopes, Yuhuai Wu, Henryk Michalewski, Rif A. Saurous, Jascha Sohl-dickstein, Kevin Murphy, and Charles Sutton. Language model cascades, 2022. \nLuyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models, 2023. \nGoogle. Palm 2 technical report, 2023. URL https://ai.google/static/documents/ palm2techreport.pdf. \nDaniel Conrad Halbert. Programming by example. University of California, Berkeley, 1984. \nJordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556, 2022. \nGeunwoo Kim, P. Baldi, and S. McAleer. Language models can solve computer tasks. ARXIV.ORG, 2023. doi: 10.48550/arXiv.2303.17491. \nMichal Kosinski. Theory of mind may have spontaneously emerged in large language models. arXiv preprint arXiv:2302.02083, 2023. ",
411
+ "page_idx": 9
412
+ },
413
+ {
414
+ "type": "text",
415
+ "text": "Yaniv Leviathan, Matan Kalman, and Yossi Matias. Fast inference from transformers via speculative decoding. November 2022. doi: 10.48550/ARXIV.2211.17192. ",
416
+ "page_idx": 10
417
+ },
418
+ {
419
+ "type": "text",
420
+ "text": "Yaobo Liang, Chenfei Wu, Ting Song, Wenshan Wu, Yan Xia, Yu Liu, Yang Ou, Shuai Lu, Lei Ji, Shaoguang Mao, et al. Taskmatrix. ai: Completing tasks by connecting foundation models with millions of apis. arXiv preprint arXiv:2303.16434, 2023. ",
421
+ "page_idx": 10
422
+ },
423
+ {
424
+ "type": "text",
425
+ "text": "Wang Ling, Dani Yogatama, Chris Dyer, and Phil Blunsom. Program induction by rationale generation: Learning to solve and explain algebraic word problems. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 158–167, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1015. URL https://aclanthology.org/P17-1015. ",
426
+ "page_idx": 10
427
+ },
428
+ {
429
+ "type": "text",
430
+ "text": "Ruibo Liu, Jason Wei, Shixiang Shane Gu, Te-Yen Wu, Soroush Vosoughi, Claire Cui, Denny Zhou, and Andrew M. Dai. Mind’s eye: Grounded language model reasoning through simulation. In The Eleventh International Conference on Learning Representations, 2023. URL https: //openreview.net/forum?id $\\equiv \\cdot$ 4rXMRuoJlai. ",
431
+ "page_idx": 10
432
+ },
433
+ {
434
+ "type": "text",
435
+ "text": "Pan Lu, Baolin Peng, Hao Cheng, Michel Galley, Kai-Wei Chang, Ying Nian Wu, Song-Chun Zhu, and Jianfeng Gao. Chameleon: Plug-and-play compositional reasoning with large language models. arXiv preprint arXiv:2304.09842, 2023. ",
436
+ "page_idx": 10
437
+ },
438
+ {
439
+ "type": "text",
440
+ "text": "Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, et al. Self-refine: Iterative refinement with self-feedback. arXiv preprint arXiv:2303.17651, 2023. ",
441
+ "page_idx": 10
442
+ },
443
+ {
444
+ "type": "text",
445
+ "text": "Maxwell Nye, Anders Johan Andreassen, Guy Gur-Ari, Henryk Michalewski, Jacob Austin, David Bieber, David Dohan, Aitor Lewkowycz, Maarten Bosma, David Luan, et al. Show your work: Scratchpads for intermediate computation with language models. arXiv preprint arXiv:2112.00114, 2021. ",
446
+ "page_idx": 10
447
+ },
448
+ {
449
+ "type": "text",
450
+ "text": "OpenAI. Gpt-4 technical report, 2023. ",
451
+ "page_idx": 10
452
+ },
453
+ {
454
+ "type": "text",
455
+ "text": "Bhargavi Paranjape, Scott Lundberg, Sameer Singh, Hannaneh Hajishirzi, Luke Zettlemoyer, and Marco Tulio Ribeiro. Art: Automatic multi-step reasoning and tool-use for large language models. arXiv preprint arXiv:2303.09014, 2023. ",
456
+ "page_idx": 10
457
+ },
458
+ {
459
+ "type": "text",
460
+ "text": "Aaron Parisi, Yao Zhao, and Noah Fiedel. Talm: Tool augmented language models, 2022. ",
461
+ "page_idx": 10
462
+ },
463
+ {
464
+ "type": "text",
465
+ "text": "Cheng Qian, Chi Han, Yi R Fung, Yujia Qin, Zhiyuan Liu, and Heng Ji. Creator: Disentangling abstract and concrete reasonings of large language models through tool creation. arXiv preprint arXiv:2305.14318, 2023. ",
466
+ "page_idx": 10
467
+ },
468
+ {
469
+ "type": "text",
470
+ "text": "Yujia Qin, Shengding Hu, Yankai Lin, Weize Chen, Ning Ding, Ganqu Cui, Zheni Zeng, Yufei Huang, Chaojun Xiao, Chi Han, et al. Tool learning with foundation models. arXiv preprint arXiv:2304.08354, 2023. ",
471
+ "page_idx": 10
472
+ },
473
+ {
474
+ "type": "text",
475
+ "text": "Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Luke Zettlemoyer, Nicola Cancedda, and Thomas Scialom. Toolformer: Language models can teach themselves to use tools, 2023. ",
476
+ "page_idx": 10
477
+ },
478
+ {
479
+ "type": "text",
480
+ "text": "Yongliang Shen, Kaitao Song, Xu Tan, Dongsheng Li, Weiming Lu, and Yueting Zhuang. Hugginggpt: Solving ai tasks with chatgpt and its friends in huggingface. arXiv preprint arXiv:2303.17580, 2023. ",
481
+ "page_idx": 10
482
+ },
483
+ {
484
+ "type": "text",
485
+ "text": "Freda Shi, Mirac Suzgun, Markus Freitag, Xuezhi Wang, Suraj Srivats, Soroush Vosoughi, Hyung Won Chung, Yi Tay, Sebastian Ruder, Denny Zhou, et al. Language models are multilingual chain-of-thought reasoners. arXiv preprint arXiv:2210.03057, 2022. ",
486
+ "page_idx": 10
487
+ },
488
+ {
489
+ "type": "text",
490
+ "text": "Aarohi Srivastava, Abhinav Rastogi, Abhishek Rao, Abu Awal Md Shoeb, Abubakar Abid, Adam Fisch, Adam R Brown, Adam Santoro, Aditya Gupta, Adrià Garriga-Alonso, et al. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. arXiv preprint arXiv:2206.04615, 2022. ",
491
+ "page_idx": 10
492
+ },
493
+ {
494
+ "type": "text",
495
+ "text": "Mirac Suzgun, Nathan Scales, Nathanael Schärli, Sebastian Gehrmann, Yi Tay, Hyung Won Chung, Aakanksha Chowdhery, Quoc V Le, Ed H Chi, Denny Zhou, et al. Challenging big-bench tasks and whether chain-of-thought can solve them. arXiv preprint arXiv:2210.09261, 2022. \nPetar Velickovi ˇ c and Charles Blundell. Neural algorithmic reasoning. ´ Patterns, 2(7):100273, 2021. \nGuanzhi Wang, Yuqi Xie, Yunfan Jiang, Ajay Mandlekar, Chaowei Xiao, Yuke Zhu, Linxi Fan, and Anima Anandkumar. Voyager: An open-ended embodied agent with large language models. arXiv preprint arXiv:2305.16291, 2023. \nXuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022. \nJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. arXiv preprint arXiv:2201.11903, 2022. \nTongshuang Wu, Michael Terry, and Carrie Jun Cai. Ai chains: Transparent and controllable human-ai interaction by chaining large language model prompts. In Proceedings of the 2022 CHI Conference on Human Factors in Computing Systems, pages 1–22, 2022. \nHeming Xia, Tao Ge, Si-Qing Chen, Furu Wei, and Zhifang Sui. Speculative decoding: Lossless speedup of autoregressive translation, 2023. URL https://openreview.net/forum?id= H-VlwsYvVi. \nZhengyuan Yang, Linjie Li, Jianfeng Wang, Kevin Lin, Ehsan Azarnasab, Faisal Ahmed, Zicheng Liu, Ce Liu, Michael Zeng, and Lijuan Wang. Mm-react: Prompting chatgpt for multimodal reasoning and action. arXiv preprint arXiv:2303.11381, 2023. \nShunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik R Narasimhan, and Yuan Cao. React: Synergizing reasoning and acting in language models. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum? id $=$ WE_vluYUL-X. \nSusan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, et al. Opt: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068, 2022. \nDenny Zhou, Nathanael Schärli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuurmans, Olivier Bousquet, Quoc Le, and Ed Chi. Least-to-most prompting enables complex reasoning in large language models. arXiv preprint arXiv:2205.10625, 2022. ",
496
+ "page_idx": 11
497
+ },
498
+ {
499
+ "type": "text",
500
+ "text": "Zilliz. Gptcache. https://github.com/zilliztech/GPTCache, 2023. ",
501
+ "page_idx": 11
502
+ },
503
+ {
504
+ "type": "text",
505
+ "text": "A ILLUSTRATION OF THE DISPATCHER ",
506
+ "text_level": 1,
507
+ "page_idx": 12
508
+ },
509
+ {
510
+ "type": "image",
511
+ "img_path": "images/e18d565c6d1d373168c539f9e235f4bd366fb696208e16b366d874b45f96a036.jpg",
512
+ "image_caption": [
513
+ "Figure 4: An illustration of the Dispatcher that enables functional cache mechanism. In an online setting where task instances arrive sequentially, the dispatcher, a lightweight model, assesses each incoming instance. If a suitable tool already exists in the cache to tackle the task, the dispatcher selects this tool and forwards the task instance to the tool user for resolution. If no suitable tool is found, the dispatcher routes the task instance to the tool maker to create a new tool that can be used by tool user later. "
514
+ ],
515
+ "image_footnote": [],
516
+ "page_idx": 12
517
+ },
518
+ {
519
+ "type": "text",
520
+ "text": "B BROADER IMPACT AND LIMITATIONS ",
521
+ "text_level": 1,
522
+ "page_idx": 12
523
+ },
524
+ {
525
+ "type": "text",
526
+ "text": "This paper explores the potential of enabling Large Language Models (LLMs) to create their own tools, thus allowing them greater autonomy in developing their ecosystem. While this avenue of research is promising, it also raises important ethical, safety, and control considerations that need to be carefully addressed. ",
527
+ "page_idx": 12
528
+ },
529
+ {
530
+ "type": "text",
531
+ "text": "One of the most significant impacts of our work lies in the potential for LLMs to grow and achieve unprecedented capabilities automatically. This could significantly enhance the range and complexity of tasks these models can handle, potentially revolutionizing fields such as customer service, technical support, and even areas of research and development. It could lead to more efficient use of computational resources and a reduction in human intervention, especially for routine or repetitive tasks. ",
532
+ "page_idx": 12
533
+ },
534
+ {
535
+ "type": "text",
536
+ "text": "However, this newfound autonomy of LLMs is a double-edged sword. As we endow LLMs with the ability to generate their own tools, we also create a scenario where the quality of the tools they develop may not always meet the standards or expectations set by human developers. Without proper safeguards, there’s a risk that these models could generate solutions that are suboptimal, incorrect, or even potentially harmful. Furthermore, as LLMs become more autonomous, the potential for loss of control increases. If these models are widely used without appropriate regulation, there could be unforeseen consequences, potentially even leading to scenarios where humans lose control over the AI systems. ",
537
+ "page_idx": 12
538
+ },
539
+ {
540
+ "type": "text",
541
+ "text": "In this study, we have not addressed these control and safety issues in depth, and our work has some limitations. Our proposed framework, LLM As Tool Maker, while effective in the tested scenarios, is still in its early stages of development. It is crucial to note that the real-world performance and safety of the system may vary based on the complexity and nature of the tasks it is applied to. Additionally, the evaluation and validation of the tools created by the tool maker in a real-world setting is a challenge that needs to be addressed. ",
542
+ "page_idx": 12
543
+ },
544
+ {
545
+ "type": "text",
546
+ "text": "C LATM PROMPTS ",
547
+ "text_level": 1,
548
+ "page_idx": 13
549
+ },
550
+ {
551
+ "type": "text",
552
+ "text": "Tool Maker Prompt ",
553
+ "text_level": 1,
554
+ "page_idx": 13
555
+ },
556
+ {
557
+ "type": "text",
558
+ "text": "Please write a generic Python function to solve this type of $\\hookrightarrow$ problems using only standard python libraries. The output $\\hookrightarrow$ of the function can later be converted to the answer $\\hookrightarrow$ (option for multiple choice question). All the function $\\hookrightarrow$ should be wrapped by ",
559
+ "page_idx": 13
560
+ },
561
+ {
562
+ "type": "text",
563
+ "text": "\\`python ",
564
+ "text_level": 1,
565
+ "page_idx": 13
566
+ },
567
+ {
568
+ "type": "text",
569
+ "text": "Tool Verifier Prompt ",
570
+ "text_level": 1,
571
+ "page_idx": 13
572
+ },
573
+ {
574
+ "type": "text",
575
+ "text": "Write unit tests to verify the correctness of the function on \n$\\hookrightarrow$ the questions above using the following format: \n\\`\\`\\`python \n{parse the question into the arguments of the function} \n{call the function and save the return value in a variable \n$\\hookrightarrow$ named \"ret\"} \n{for multiple choice question, parse the options} \n{convert the return value \"ret\" to the answer (if the \n$\\hookrightarrow$ question is a multiple choice question, convert to an \n$\\hookrightarrow$ option) and save it in a variable named \"ans\", otherwise} \n{assert ans $= =$ the provided answer (if the question is a $\\hookrightarrow$ multiple choice question, assert ans $= =$ option)} ",
576
+ "page_idx": 13
577
+ },
578
+ {
579
+ "type": "text",
580
+ "text": "",
581
+ "page_idx": 13
582
+ },
583
+ {
584
+ "type": "text",
585
+ "text": "Tool Wrapper Prompt ",
586
+ "text_level": 1,
587
+ "page_idx": 13
588
+ },
589
+ {
590
+ "type": "text",
591
+ "text": "Success! The function is correct. We will need to summarize $\\hookrightarrow$ the function and use cases up for further use. Please $\\hookrightarrow$ extract the information from the history in the following $\\hookrightarrow$ format: ",
592
+ "page_idx": 13
593
+ },
594
+ {
595
+ "type": "text",
596
+ "text": "Here is a function to solve a class of problems: \\`python {the function, including necessary imports} ",
597
+ "page_idx": 13
598
+ },
599
+ {
600
+ "type": "text",
601
+ "text": "Use cases: \nQuestion: {question (including options)} \nSolution: \\`python \n{parse the question into the arguments of the function} \n{call the function and save the return value in a variable \n$\\hookrightarrow$ named \"ret\"} \n{for multiple choice question, parse the options} \n{convert the return value \"ret\" to the answer (if the \n$\\hookrightarrow$ question is a multiple choice question, convert to an $\\hookrightarrow$ option) and save it in a variable named \"ans\", otherwise} ",
602
+ "page_idx": 13
603
+ },
604
+ {
605
+ "type": "text",
606
+ "text": "Do this for all the questions in the verification step. ",
607
+ "page_idx": 13
608
+ },
609
+ {
610
+ "type": "text",
611
+ "text": "Dispatcher Prompt ",
612
+ "text_level": 1,
613
+ "page_idx": 14
614
+ },
615
+ {
616
+ "type": "text",
617
+ "text": "Here are several functions that can be used to solve some $\\hookrightarrow$ task: ",
618
+ "page_idx": 14
619
+ },
620
+ {
621
+ "type": "text",
622
+ "text": "Task: logical_deduction_five_objects ",
623
+ "page_idx": 14
624
+ },
625
+ {
626
+ "type": "text",
627
+ "text": "API: find_order(objects, constraints): ",
628
+ "page_idx": 14
629
+ },
630
+ {
631
+ "type": "text",
632
+ "text": "Finds the order of objects that satisfies a given set of $\\hookrightarrow$ constraints. ",
633
+ "page_idx": 14
634
+ },
635
+ {
636
+ "type": "text",
637
+ "text": "objects: A list of unique objects (strings) to be ordered. constraints: A list of lambda functions that represent the $\\hookrightarrow$ constraints on the order of objects. Each constraint $\\hookrightarrow$ should take the order of objects as input and return a $\\hookrightarrow$ boolean value (True if the constraint is satisfied, False $\\hookrightarrow$ otherwise). ",
638
+ "page_idx": 14
639
+ },
640
+ {
641
+ "type": "text",
642
+ "text": "",
643
+ "page_idx": 14
644
+ },
645
+ {
646
+ "type": "text",
647
+ "text": "return: A tuple representing the order of objects that $\\hookrightarrow$ satisfies all the constraints. If no such order exists, $\\hookrightarrow$ the function returns None. ",
648
+ "page_idx": 14
649
+ },
650
+ {
651
+ "type": "text",
652
+ "text": "$= = =$ ",
653
+ "page_idx": 14
654
+ },
655
+ {
656
+ "type": "text",
657
+ "text": "Task: tracking_shuffled_objects_five_objects ",
658
+ "page_idx": 14
659
+ },
660
+ {
661
+ "type": "text",
662
+ "text": "API: square_dance(initial_partners, switches): ",
663
+ "page_idx": 14
664
+ },
665
+ {
666
+ "type": "text",
667
+ "text": "This function takes an initial list of pairs and a list of $\\hookrightarrow$ switches, and returns a dictionary representing the final $\\hookrightarrow$ state of the pairs after performing the switches. ",
668
+ "page_idx": 14
669
+ },
670
+ {
671
+ "type": "text",
672
+ "text": "initial_partners: A list of tuples, where each tuple contains $\\hookrightarrow$ two elements representing a pair (e.g., [(\"Alice\", $\\hookrightarrow$ \"goalkeeper\"), (\"Bob\", \"left midfielder\"), ...]). The $\\hookrightarrow$ elements can be any type (e.g., strings, integers, etc.). ",
673
+ "page_idx": 14
674
+ },
675
+ {
676
+ "type": "text",
677
+ "text": "switches: A list of tuples, where each tuple contains two $\\hookrightarrow$ elements representing a pair of elements from the $\\hookrightarrow$ initial_partners list that will be switched (e.g., $\\hookrightarrow$ [(\"Alice\", \"Claire\"), (\"Alice\", \"Bob\"), ...]). The $\\hookrightarrow$ elements should match the types used in the $\\hookrightarrow$ initial_partners list. ",
678
+ "page_idx": 14
679
+ },
680
+ {
681
+ "type": "text",
682
+ "text": "",
683
+ "page_idx": 14
684
+ },
685
+ {
686
+ "type": "text",
687
+ "text": "return: A dictionary representing the final state of the $\\hookrightarrow$ pairs after performing the switches. The keys are the $\\hookrightarrow$ first elements of the pairs in the initial_partners list, $\\hookrightarrow$ and the values are the corresponding second elements $\\hookrightarrow$ after performing the switches (e.g., {\"Alice\": \"right $\\hookrightarrow$ winger\", \"Bob\": \"center midfielder\", ...}). ",
688
+ "page_idx": 14
689
+ },
690
+ {
691
+ "type": "text",
692
+ "text": "$= = =$ ",
693
+ "page_idx": 14
694
+ },
695
+ {
696
+ "type": "text",
697
+ "text": "Skip other tasks ",
698
+ "page_idx": 14
699
+ },
700
+ {
701
+ "type": "text",
702
+ "text": "Here is a question:\\n{question}\\n\\nAccoding to the API $\\hookrightarrow$ documents above, you may find some functions that can be $\\hookrightarrow$ used to solve the task, or, sometimes there does not $\\hookrightarrow$ exist proper function to solve the task. Figure out if $\\hookrightarrow$ there is function to solve the task and reply in the $\\hookrightarrow$ format:\\nTask: {{task}} (reply unknown if no function can $\\hookrightarrow$ solve the question) ",
703
+ "page_idx": 14
704
+ },
705
+ {
706
+ "type": "text",
707
+ "text": "",
708
+ "page_idx": 14
709
+ },
710
+ {
711
+ "type": "text",
712
+ "text": "D WRAPPED TOOLS ",
713
+ "text_level": 1,
714
+ "page_idx": 16
715
+ },
716
+ {
717
+ "type": "text",
718
+ "text": "Tool for Logical Deduction ",
719
+ "text_level": 1,
720
+ "page_idx": 16
721
+ },
722
+ {
723
+ "type": "text",
724
+ "text": "Here is a function to solve a class of problems: ",
725
+ "page_idx": 16
726
+ },
727
+ {
728
+ "type": "image",
729
+ "img_path": "images/a1f608cfb779721fa49326353ad5529869094bd052c45c5dda68986872d555a2.jpg",
730
+ "image_caption": [],
731
+ "image_footnote": [],
732
+ "page_idx": 16
733
+ },
734
+ {
735
+ "type": "text",
736
+ "text": "\\`python ",
737
+ "text_level": 1,
738
+ "page_idx": 16
739
+ },
740
+ {
741
+ "type": "text",
742
+ "text": "from itertools import permutations def find_order(objects, constraints): for order in permutations(objects): valid $=$ True for constraint in constraints: if not constraint(order): valid $=$ False break if valid: return order ",
743
+ "page_idx": 16
744
+ },
745
+ {
746
+ "type": "text",
747
+ "text": "",
748
+ "page_idx": 16
749
+ },
750
+ {
751
+ "type": "text",
752
+ "text": "Use cases: ",
753
+ "page_idx": 16
754
+ },
755
+ {
756
+ "type": "text",
757
+ "text": "Question: The following paragraphs each describe a set of $\\hookrightarrow$ five objects arranged in a fixed order. The statements $\\hookrightarrow$ are logically consistent within each paragraph. On a $\\hookrightarrow$ shelf, there are five books: a white book, a green book, $\\hookrightarrow$ a brown book, a gray book, and an orange book. The gray $\\hookrightarrow$ book is to the right of the orange book. The green book $\\hookrightarrow$ is the second from the right. The brown book is to the $\\hookrightarrow$ right of the white book. The brown book is to the left of $\\hookrightarrow$ the orange book. ",
758
+ "page_idx": 16
759
+ },
760
+ {
761
+ "type": "text",
762
+ "text": "",
763
+ "page_idx": 16
764
+ },
765
+ {
766
+ "type": "text",
767
+ "text": "Options: ",
768
+ "page_idx": 16
769
+ },
770
+ {
771
+ "type": "text",
772
+ "text": "(A) The white book is the third from the left (B) The green book is the third from the left (C) The brown book is the third from the left (D) The gray book is the third from the left (E) The orange book is the third from the left Solution: ",
773
+ "page_idx": 16
774
+ },
775
+ {
776
+ "type": "text",
777
+ "text": "\\`python ",
778
+ "text_level": 1,
779
+ "page_idx": 16
780
+ },
781
+ {
782
+ "type": "text",
783
+ "text": "objects $=$ [\"white\", \"green\", \"brown\", \"gray\", \"orange\"] ",
784
+ "page_idx": 16
785
+ },
786
+ {
787
+ "type": "text",
788
+ "text": "constraints $=$ [ ",
789
+ "page_idx": 16
790
+ },
791
+ {
792
+ "type": "text",
793
+ "text": "lambda order: order.index(\"gray\") $>$ \n$\\hookrightarrow$ order.index(\"orange\"), \nlambda order: order.index(\"green\") $= =$ len(order) - 2, \nlambda order: order.index(\"brown\") $>$ \n$\\hookrightarrow$ order.index(\"white\"), \nlambda order: order.index(\"brown\") $<$ \n$\\hookrightarrow$ order.index(\"orange\") ",
794
+ "page_idx": 16
795
+ },
796
+ {
797
+ "type": "text",
798
+ "text": "",
799
+ "page_idx": 16
800
+ },
801
+ {
802
+ "type": "text",
803
+ "text": "ret $=$ find_order(objects, constraints) options $=$ { ",
804
+ "page_idx": 16
805
+ },
806
+ {
807
+ "type": "text",
808
+ "text": "\"A\": \"white\", \"B\": \"green\", \"C\": \"brown\", \"D\": \"gray\", \"E\": \"orange\" ans $=$ [k for k, v in options.items() if 17 $\\begin{array} { r l } { \\mathsf { V } } & { { } = = } \\end{array}$ ret[2]][0] Skip two more questions... ",
809
+ "page_idx": 16
810
+ },
811
+ {
812
+ "type": "text",
813
+ "text": "Tool for Tracking Shuffled Objects ",
814
+ "text_level": 1,
815
+ "page_idx": 17
816
+ },
817
+ {
818
+ "type": "text",
819
+ "text": "Here is a function to solve a class of problems: ",
820
+ "page_idx": 17
821
+ },
822
+ {
823
+ "type": "text",
824
+ "text": "\\`\\`\\`python ",
825
+ "text_level": 1,
826
+ "page_idx": 17
827
+ },
828
+ {
829
+ "type": "text",
830
+ "text": "def square_dance(initial_partners, switches): # Create a dictionary to store the current partners current_partners $=$ dict(initial_partners) ",
831
+ "page_idx": 17
832
+ },
833
+ {
834
+ "type": "text",
835
+ "text": "# Iterate through the switches and update the current $\\hookrightarrow$ partners ",
836
+ "page_idx": 17
837
+ },
838
+ {
839
+ "type": "text",
840
+ "text": "for switch in switches: dancer1, dancer2 $=$ switch partner1 $=$ current_partners[dancer1] partner2 $=$ current_partners[dancer2] ",
841
+ "page_idx": 17
842
+ },
843
+ {
844
+ "type": "text",
845
+ "text": "# Swap the partners ",
846
+ "text_level": 1,
847
+ "page_idx": 17
848
+ },
849
+ {
850
+ "type": "text",
851
+ "text": "current_partners[dancer1] $=$ partner2 \ncurrent_partners[dancer2] $=$ partner1 ",
852
+ "page_idx": 17
853
+ },
854
+ {
855
+ "type": "text",
856
+ "text": "return current_partners ",
857
+ "page_idx": 17
858
+ },
859
+ {
860
+ "type": "text",
861
+ "text": "Use cases: ",
862
+ "page_idx": 17
863
+ },
864
+ {
865
+ "type": "text",
866
+ "text": "Question: Alice, Bob, Claire, Dave, and Eve are on the same $\\hookrightarrow$ team in a soccer match. At the start of the match, they ,→ are each assigned to a position: Alice is playing $\\hookrightarrow$ goalkeeper, Bob is playing left midfielder, Claire is $\\hookrightarrow$ playing right winger, Dave is playing striker, and Eve is $\\hookrightarrow$ playing center midfielder. ",
867
+ "page_idx": 17
868
+ },
869
+ {
870
+ "type": "text",
871
+ "text": "",
872
+ "page_idx": 17
873
+ },
874
+ {
875
+ "type": "text",
876
+ "text": "As the game progresses, pairs of players occasionally swap \n$\\hookrightarrow$ positions. First, Alice and Claire trade positions. Then,Alice and Bob trade positions. Then, Dave and Bob trade \n$\\hookrightarrow$ \n$\\hookrightarrow$ positions. Then, Bob and Eve trade positions. Finally, \n$\\hookrightarrow$ Dave and Eve trade positions. At the end of the match, \n$\\hookrightarrow$ Eve is playing ",
877
+ "page_idx": 17
878
+ },
879
+ {
880
+ "type": "text",
881
+ "text": "Options: ",
882
+ "page_idx": 17
883
+ },
884
+ {
885
+ "type": "text",
886
+ "text": "(A) goalkeeper (B) left midfielder (C) right winger (D) striker (E) center midfielder ",
887
+ "page_idx": 17
888
+ },
889
+ {
890
+ "type": "text",
891
+ "text": "Answer: (C) ",
892
+ "page_idx": 17
893
+ },
894
+ {
895
+ "type": "text",
896
+ "text": "Solution: ",
897
+ "text_level": 1,
898
+ "page_idx": 17
899
+ },
900
+ {
901
+ "type": "text",
902
+ "text": "\\`python ",
903
+ "text_level": 1,
904
+ "page_idx": 17
905
+ },
906
+ {
907
+ "type": "text",
908
+ "text": "initial_positions $=$ [(\"Alice\", \"goalkeeper\"), (\"Bob\", \"left $\\hookrightarrow$ midfielder\"), (\"Claire\", \"right winger\"), (\"Dave\", $\\hookrightarrow$ \"striker\"), (\"Eve\", \"center midfielder\")] switches $=$ [(\"Alice\", \"Claire\"), (\"Alice\", \"Bob\"), (\"Dave\", $\\hookrightarrow$ \"Bob\"), (\"Bob\", \"Eve\"), (\"Dave\", \"Eve\")] ",
909
+ "page_idx": 17
910
+ },
911
+ {
912
+ "type": "text",
913
+ "text": "ret $=$ square_dance(initial_positions, switches) \noptions $=$ [\"goalkeeper\", \"left midfielder\", \"right winger\", \n$\\hookrightarrow$ \"striker\", \"center midfielder\"] \nans $=$ options.index(ret[\"Eve\"]) $^ +$ 1 # Convert the return \n$\\hookrightarrow$ value to an option index (1-based) ",
914
+ "page_idx": 17
915
+ },
916
+ {
917
+ "type": "text",
918
+ "text": "Skip two more questions... ",
919
+ "page_idx": 17
920
+ },
921
+ {
922
+ "type": "text",
923
+ "text": "Tool for Dyck Language ",
924
+ "text_level": 1,
925
+ "page_idx": 18
926
+ },
927
+ {
928
+ "type": "text",
929
+ "text": "Here is a function to solve a class of problems: ",
930
+ "page_idx": 18
931
+ },
932
+ {
933
+ "type": "text",
934
+ "text": "\\`\\`\\`python ",
935
+ "text_level": 1,
936
+ "page_idx": 18
937
+ },
938
+ {
939
+ "type": "text",
940
+ "text": "Use cases: ",
941
+ "page_idx": 18
942
+ },
943
+ {
944
+ "type": "text",
945
+ "text": "Question: Complete the rest of the sequence, making sure that \n$\\hookrightarrow$ the parentheses are closed properly. Input: \n$\\hookrightarrow$ ([[[{}]] $\\{ < [ < [ \\{ \\ \\} ] > ] > \\}$ \nAnswer: ]) Solution: \n\\`python \ninput_str $=$ \"([[[{}]] $\\{ < [ < [ \\{ \\} ] > ] > \\}$ \" ret $=$ complete_sequence(input_str) ans $=$ ret \nSkip two more questions... ",
946
+ "page_idx": 18
947
+ },
948
+ {
949
+ "type": "text",
950
+ "text": "",
951
+ "page_idx": 18
952
+ },
953
+ {
954
+ "type": "text",
955
+ "text": "Tool for Word Sorting ",
956
+ "text_level": 1,
957
+ "page_idx": 19
958
+ },
959
+ {
960
+ "type": "text",
961
+ "text": "Here is a function to solve a class of problems: ",
962
+ "page_idx": 19
963
+ },
964
+ {
965
+ "type": "text",
966
+ "text": "\\`python ",
967
+ "page_idx": 19
968
+ },
969
+ {
970
+ "type": "text",
971
+ "text": "def sort_words_alphabetically(word_list): return sorted(word_list) ",
972
+ "page_idx": 19
973
+ },
974
+ {
975
+ "type": "text",
976
+ "text": "Use cases: ",
977
+ "page_idx": 19
978
+ },
979
+ {
980
+ "type": "text",
981
+ "text": "Question: Sort the following words alphabetically: List: $\\hookrightarrow$ conference apparition ignore dutton layperson coupe $\\hookrightarrow$ superstitious westward turnoff messenger copra floruit $\\hookrightarrow$ primitive implement ",
982
+ "page_idx": 19
983
+ },
984
+ {
985
+ "type": "text",
986
+ "text": "Answer: apparition conference copra coupe dutton floruit $\\hookrightarrow$ ignore implement layperson messenger primitive $\\hookrightarrow$ superstitious turnoff westward ",
987
+ "page_idx": 19
988
+ },
989
+ {
990
+ "type": "text",
991
+ "text": "Solution: ",
992
+ "page_idx": 19
993
+ },
994
+ {
995
+ "type": "text",
996
+ "text": "\\`\\`python ",
997
+ "text_level": 1,
998
+ "page_idx": 19
999
+ },
1000
+ {
1001
+ "type": "text",
1002
+ "text": "words1 $=$ [\"conference\", \"apparition\", \"ignore\", \"dutton\", \n$\\hookrightarrow$ \"layperson\", \"coupe\", \"superstitious\", \"westward\", \n$\\hookrightarrow$ \"turnoff\", \"messenger\", \"copra\", \"floruit\", \"primitive\", \n$\\hookrightarrow$ \"implement\"] \nret1 $=$ sort_words_alphabetically(words1) \nans1 $=$ \" \".join(ret1) ",
1003
+ "page_idx": 19
1004
+ },
1005
+ {
1006
+ "type": "text",
1007
+ "text": "Skip two more questions... ",
1008
+ "page_idx": 19
1009
+ },
1010
+ {
1011
+ "type": "text",
1012
+ "text": "Tool for Chinese Remainder Theorem ",
1013
+ "text_level": 1,
1014
+ "page_idx": 20
1015
+ },
1016
+ {
1017
+ "type": "text",
1018
+ "text": "Here is a function to solve a class of problems: ",
1019
+ "page_idx": 20
1020
+ },
1021
+ {
1022
+ "type": "text",
1023
+ "text": "\\`\\`python ",
1024
+ "text_level": 1,
1025
+ "page_idx": 20
1026
+ },
1027
+ {
1028
+ "type": "text",
1029
+ "text": "def find_number(max_limit, divisors, remainders): for num in range(max_limit + 1): if all((num - remainder) % divisor $\\qquad = = \\quad 0$ for divisor, $\\hookrightarrow$ remainder in zip(divisors, remainders)): return num return None ",
1030
+ "page_idx": 20
1031
+ },
1032
+ {
1033
+ "type": "text",
1034
+ "text": "Use cases: ",
1035
+ "page_idx": 20
1036
+ },
1037
+ {
1038
+ "type": "text",
1039
+ "text": "Question: There is a basket of no more than 1188877 durians. ",
1040
+ "page_idx": 20
1041
+ },
1042
+ {
1043
+ "type": "text",
1044
+ "text": "$\\hookrightarrow$ If we divide them equally among 41 penguins, we have 17 $\\hookrightarrow$ left; if we divide them equally among 107 dinosaurs, we $\\hookrightarrow$ have 42 left; if we divide them equally among 271 $\\hookrightarrow$ elephants, we have 260 left. How many durians are in the $\\hookrightarrow$ basket? ",
1045
+ "page_idx": 20
1046
+ },
1047
+ {
1048
+ "type": "text",
1049
+ "text": "Solution: ",
1050
+ "page_idx": 20
1051
+ },
1052
+ {
1053
+ "type": "text",
1054
+ "text": "\\`python ",
1055
+ "text_level": 1,
1056
+ "page_idx": 20
1057
+ },
1058
+ {
1059
+ "type": "text",
1060
+ "text": "max_limit $=$ 1188877 \ndivisors $=$ [41, 107, 271] \nremainders $=$ [17, 42, 260] \nret $=$ find_number(max_limit, divisors, remainders) ans $=$ ret \nSkip two more questions... ",
1061
+ "page_idx": 20
1062
+ },
1063
+ {
1064
+ "type": "text",
1065
+ "text": "Tool for Schedule Meeting ",
1066
+ "text_level": 1,
1067
+ "page_idx": 21
1068
+ },
1069
+ {
1070
+ "type": "text",
1071
+ "text": "Here is a function to solve a class of problems: ",
1072
+ "page_idx": 21
1073
+ },
1074
+ {
1075
+ "type": "text",
1076
+ "text": "\\`\\`\\`python ",
1077
+ "text_level": 1,
1078
+ "page_idx": 21
1079
+ },
1080
+ {
1081
+ "type": "text",
1082
+ "text": "from datetime import datetime, timedelta def find_earliest_time_slot(a_availability, b_availability, $\\hookrightarrow$ meeting_duration): ",
1083
+ "page_idx": 21
1084
+ },
1085
+ {
1086
+ "type": "text",
1087
+ "text": "",
1088
+ "page_idx": 21
1089
+ },
1090
+ {
1091
+ "type": "text",
1092
+ "text": "a_availability $=$ [(datetime.strptime(start, '%H:%M'), $\\hookrightarrow$ datetime.strptime(end, '%H:%M')) for start, end in $\\hookrightarrow$ a_availability] \nb_availability $=$ [(datetime.strptime(start, '%H:%M'), $\\hookrightarrow$ datetime.strptime(end, '%H:%M')) for start, end in $\\hookrightarrow$ b_availability] ",
1093
+ "page_idx": 21
1094
+ },
1095
+ {
1096
+ "type": "text",
1097
+ "text": "for a_start, a_end in a_availability: for b_start, b_end in b_availability: latest_start $=$ max(a_start, b_start) earliest_end $=$ min(a_end, b_end) ",
1098
+ "page_idx": 21
1099
+ },
1100
+ {
1101
+ "type": "text",
1102
+ "text": "if earliest_end - latest_start $> =$ \n$\\hookrightarrow$ timedelta(minutes $=$ meeting_duration): return latest_start.strftime('%H:%M'), $\\hookrightarrow$ (latest_start $^ +$ $\\hookrightarrow$ timedelta(minutes ${ \\bf \\equiv } _ { \\bf - \\infty }$ meeting_duration)).strftime('%H: ",
1103
+ "page_idx": 21
1104
+ },
1105
+ {
1106
+ "type": "text",
1107
+ "text": "return None ",
1108
+ "text_level": 1,
1109
+ "page_idx": 21
1110
+ },
1111
+ {
1112
+ "type": "text",
1113
+ "text": "Use cases: ",
1114
+ "page_idx": 21
1115
+ },
1116
+ {
1117
+ "type": "text",
1118
+ "text": "Question: A and B want to schedule a 1-hour meeting together. $\\hookrightarrow$ A's availability: 12:00 - 12:30, 13:00 - 13:30, 14:30 - ,→ 15:30, 17:30 - 18:00. B's availability: 09:00 - 11:00, $\\hookrightarrow$ 12:00 - 12:30, 13:00 - 13:30, 15:30 - 16:30, 17:30 - $\\hookrightarrow$ $1 8 : 0 0$ . What time slot works best? (if multiple, choose $\\hookrightarrow$ the earliest one) ",
1119
+ "page_idx": 21
1120
+ },
1121
+ {
1122
+ "type": "text",
1123
+ "text": "Answer: No time slot works. ",
1124
+ "page_idx": 21
1125
+ },
1126
+ {
1127
+ "type": "text",
1128
+ "text": "Solution: \\`python ",
1129
+ "page_idx": 21
1130
+ },
1131
+ {
1132
+ "type": "text",
1133
+ "text": "a_availability $=$ [('12:00', '12:30'), ('13:00', '13:30'), \n$\\hookrightarrow$ ('14:30', '15:30'), ('17:30', '18:00')] \nb_availability $=$ [('09:00', '11:00'), ('12:00', '12:30'), $\\hookrightarrow$ ('13:00', '13:30'), ('15:30', '16:30'), ('17:30', \n$\\hookrightarrow$ '18:00')] \nmeeting_duration $= ~ 6 0$ \nret $=$ find_earliest_time_slot(a_availability, b_availability, \n$\\hookrightarrow$ meeting_duration) \nans $=$ ret if ret else \"No time slot works.\" ",
1134
+ "page_idx": 21
1135
+ },
1136
+ {
1137
+ "type": "text",
1138
+ "text": "",
1139
+ "page_idx": 21
1140
+ },
1141
+ {
1142
+ "type": "text",
1143
+ "text": "Skip two more questions... ",
1144
+ "page_idx": 21
1145
+ },
1146
+ {
1147
+ "type": "text",
1148
+ "text": "E DATASET CONSTRUCTION ",
1149
+ "text_level": 1,
1150
+ "page_idx": 21
1151
+ },
1152
+ {
1153
+ "type": "text",
1154
+ "text": "For the “schedule meeting” task, we use the following template to generate the dataset: ",
1155
+ "page_idx": 21
1156
+ },
1157
+ {
1158
+ "type": "text",
1159
+ "text": "question_format $=$ \"\"\"A and B want to schedule a {interval}-hour $\\hookrightarrow$ meeting together. \nA's availability: {A_availability} \nB's availability: {B_availability} \nWhat time slot works best? (if multiple, choose the earliest $\\hookrightarrow$ one)\"\"\" ",
1160
+ "page_idx": 22
1161
+ },
1162
+ {
1163
+ "type": "text",
1164
+ "text": "where the interval is randomly sampled from $\\{ 0 . 5 , 1 , 1 . 5 \\}$ , and the availability of A and B are randomly sampled from 8:00-18:00 with 30 minutes as the granularity. The answer is computed by computing the intersection of the two availability sets and then find the earliest time slot that is at least as long as the meeting duration. If there is no such time slot, we return “No time slot works.”. ",
1165
+ "page_idx": 22
1166
+ }
1167
+ ]
parse/test/qV83K9d5WB/qV83K9d5WB_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/qV83K9d5WB/qV83K9d5WB_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/rAnB7JSMXL/rAnB7JSMXL.md ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Convolutions Attention MLPs Patches Are All You Need?
2
+
3
+ Asher Trockman, J. Zico Kolter1 Carnegie Mellon University and $^ 1$ Bosch Center for AI
4
+
5
+ Reviewed on OpenReview: https: // openreview. net/ forum? id= rAnB7JSMXL
6
+
7
+ # Abstract
8
+
9
+ Although convolutional neural networks have been the dominant architecture for computer vision for many years, Vision Transformers (ViTs) have recently shown promise as an alternative. Subsequently, many new models have been proposed which replace the self-attention layer within the ViT architecture with novel operations (such as MLPs), all of which have also been relatively performant. We note that these architectures all share a common component—the patch embedding layer—which enables the use of a simple isotropic template with alternating steps of channel- and spatial-dimension mixing. This raises a question: is the success of ViT-style models due to novel, highly-expressive operations like self-attention, or is it at least in part due to using patches? In this paper, we present some evidence for the latter: specifically, we propose the ConvMixer, an extremely simple and parameter-efficient fully-convolutional model in which we replace the self-attention and MLP layers within the ViT with less-expressive depthwise and pointwise convolutional layers, respectively. Despite its unusual simplicity, ConvMixer outperforms the ViT, MLP-Mixer, and their variants for similar data set sizes and parameter counts, in addition to outperforming classical vision models like ResNet. We argue that this contributes to the evidence that patches are sufficient for designing simple and effective vision models. Our code is available at https://github.com/locuslab/convmixer.
10
+
11
+ # 1 Introduction
12
+
13
+ For many years, convolutional neural networks have been the dominant architecture for deep learning systems applied to computer vision tasks. But recently, architectures based upon Transformer models, e.g., the so-called VisionTransformer architecture (Dosovitskiy et al., 2020), have demonstrated compelling performance in many of these tasks, often outperforming classical convolutional architectures, especially for large data sets. An understandable assumption, then, is that it is only a matter of time before Transformers become the dominant architecture for vision domains, just as they have for language processing. In order to apply Transformers to images, however, the representation had to be changed: because the computational cost of the self-attention layers used in Transformers would scale quadratically with the number of pixels per image if applied naively at the per-pixel level, the compromise was to first split the image into multiple “patches”, linearly embed them, and then apply the transformer directly to this collection of patches.
14
+
15
+ ![](images/e58882a1d37e4b57f11c0628a2dfc5a156ef3aa2472f9dc9d09f273c3a327b28.jpg)
16
+ Figure 1: Acc. vs. params., trained $\&$ tested on ImNet-1k; ResNets newly-trained (same procedure as ConvMixers).
17
+
18
+ ![](images/68f171fa1a16778a07a02e7d03eb936cb07d02c7399720015a5f1a2f2d108e75.jpg)
19
+ Figure 2: ConvMixer uses “tensor layout” patch embeddings to preserve locality, and then applies $d$ copies of a simple fully-convolutional block consisting of large-kernel depthwise convolution followed by pointwise convolution, before finishing with global pooling and a simple linear classifier.
20
+ Figure 3: Implementation of ConvMixer in PyTorch; see Appendix E for more implementations.
21
+
22
+ 1 import torch.nn as nn 2 3 class Residual(nn.Module): 4 def __init__(self, fn): 5 super().__init__() 6 self.fn $=$ fn 7 8 def forward(self, x): 9 return self. $\mathbf { f } \mathbf { n } ( \mathbf { x } ) ~ + ~ \mathbf { x }$ 10 11 def ConvMixer(dim, depth, kernel_size $^ { = 9 }$ , patch_size $^ { = 7 }$ , n_classes 1000): 12 return nn.Sequential( 13 nn.Conv2d(3, dim, kernel_size=patch_size, stride=patch_size), 14 nn.GELU(), 15 nn.BatchNorm2d(dim), 16 $^ *$ [nn.Sequential( 17 Residual(nn.Sequential( 18 nn.Conv2d(dim, dim, kernel_size, groups $=$ dim, padding="same"), 19 nn.GELU(), 20 nn.BatchNorm2d(dim) 21 )), 22 nn.Conv2d(dim, dim, kernel_size $^ { = 1 }$ ), 23 nn.GELU(), 24 nn.BatchNorm2d(dim) 25 ) for i in range(depth)], 26 nn.AdaptiveAvgPool2d((1,1)), 27 nn.Flatten(), 28 nn.Linear(dim, n_classes) 29 )
23
+
24
+ Many subsequent works have modified the architecture of the ViT, replacing self-attention with novel operations and making other small changes, all of which have been relatively performant. These architectures follow a common and very simple “template”: they are isotropic, maintaining equal size and resolution throughout the network, and apply alternating steps of spatial and channel mixing. They also all use patch embeddings, which moves all downsampling to the beginning of the network and enables the simple, isotropic mixing design.
25
+
26
+ In this work, we explore the question of whether, fundamentally, the strong performance of vision transformers may result more from this patch-based representation and its simplifying consequences for architecture design, than from the use of novel and highly-expressive operations such as self-attention and MLPs. We develop a very simple convolutional architecture which we dub the “ConvMixer” due to its similarity to the recently-proposed MLP-Mixer (Tolstikhin et al., 2021). This architecture is similar to the Vision Transformer (and MLP-Mixer) in many respects: it directly operates on patches, it maintains an equal-resolution-andsize representation throughout all layers, it does no downsampling of the representation at successive layers, and it separates “channel-wise mixing” from the “spatial mixing” of information. But unlike the Vision Transformer and MLP-Mixer, our architecture does all these operations via only standard convolutions. As depthwise and pointwise convolution are less expressive than self-attention and MLPs respectively, we believe this suggests that the patch-based isotropic mixing architecture is a powerful primitive that works well with almost any choice of well-behaved mixing operations.
27
+
28
+ The chief result we show in this paper is that this ConvMixer architecture, despite its extreme simplicity (it can be implemented in 280 characters of dense PyTorch code; see Appendix E), outperforms both “standard” computer vision models such as ResNets of similar parameter counts and some corresponding Vision Transformer and MLP-Mixer variants, even with a slate of additions intended to make those architectures more performant on smaller data sets. Importantly, this is despite the fact that we did not design our experiments to maximize accuracy nor speed, in contrast to the models we compared against. Our results suggest that, at least to some extent, the patch representation itself may be a critical component to the “superior” performance of newer architectures like Vision Transformers. While these results are naturally just a snapshot, and more experiments are required to exactly disentangle the effect of patch embeddings from other factors, we believe that this provides a strong “convolutional-but-patch-based” baseline to compare against for more advanced architectures in the future.
29
+
30
+ # 2 A simple model: ConvMixer
31
+
32
+ Our model, dubbed ConvMixer, consists of a patch embedding layer followed by repeated applications of a simple fully-convolutional block. We maintain the spatial structure of the patch embeddings, as illustrated in Fig. 2. Patch embeddings with patch size $p$ and embedding dimension $h$ can be implemented as convolution with $c _ { \mathrm { i n } }$ input channels, $h$ output channels, kernel size $p$ , and stride $p$ :
33
+
34
+ $$
35
+ z _ { 0 } = \mathsf { B N } ( \sigma \{ \mathsf { C o n v } _ { c _ { \mathrm { i n } } h } ( X , \mathsf { s t r i d e } = p , \mathsf { k s i z e } { = } p ) \} )
36
+ $$
37
+
38
+ The ConvMixer block itself consists of depthwise convolution (i.e., grouped convolution with groups equal to the number of channels, $h$ ) followed by pointwise (i.e., kernel size $1 \times 1$ ) convolution. As we will explain in Sec. 3, ConvMixers work best with unusually large kernel sizes for the depthwise convolution. Each of the convolutions is followed by an activation and post-activation BatchNorm:
39
+
40
+ $$
41
+ \begin{array} { r } { z _ { l } ^ { \prime } = \mathsf { B N } \left( \sigma \{ \mathsf { C o n v D e p t h w i s e } ( z _ { l - 1 } ) \} \right) + z _ { l - 1 } } \\ { z _ { l + 1 } = \mathsf { B N } \left( \sigma \{ \mathsf { C o n v P o i n t w i s e } ( z _ { l } ^ { \prime } ) \} \right) } \end{array}
42
+ $$
43
+
44
+ After many applications of this block, we perform global pooling to get a feature vector of size $h$ , which we pass to a softmax classifier. See Fig. 3 for an implementation of ConvMixer in PyTorch.
45
+
46
+ Design parameters. An instantiation of ConvMixer depends on four parameters: (1) the “width” or hidden dimension $h$ (i.e., the dimension of the patch embeddings), (2) the depth $d$ , or the number of repetitions of the ConvMixer layer, (3) the patch size $p$ which controls the internal resolution of the model, and (4) the kernel size $k$ of the depthwise convolutional layer. We name ConvMixers after their hidden dimension and depth, like ConvMixer- $h / d$ . We refer to the original input size $n$ divided by the patch size $p$ as the internal resolution; note, however, that ConvMixers support variable-sized inputs.
47
+
48
+ Motivation. Our architecture is based on the idea of mixing, as in Tolstikhin et al. (2021). In particular, we chose depthwise convolution to mix spatial locations and pointwise convolution to mix channel locations. A key idea from previous work is that MLPs and self-attention can mix distant spatial locations, i.e., they can have an arbitrarily large receptive field. Consequently, we used convolutions with an unusually large kernel size to mix distant spatial locations.
49
+
50
+ While self-attention and MLPs are theoretically more flexible, allowing for large receptive fields and contentaware behavior, the inductive bias of convolution is well-suited to vision tasks and leads to high data efficiency. By using such a standard operation, we also get a glimpse into the effect of the patch representation itself in contrast to the conventional pyramid-shaped, progressively-downsampling design of convolutional networks.
51
+
52
+ Table 1: Models trained and evaluated on $2 2 4 \times 2 2 4$ ImageNet-1k only. See more in Appendix A.
53
+
54
+ <table><tr><td colspan="8">Current“Most Interesting” ConvMixer Configurations us. Other Simple Models</td></tr><tr><td>Network</td><td>Pateh</td><td>Kernel1</td><td>#Param</td><td>Throughput</td><td>Act</td><td>#Epochs</td><td></td></tr><tr><td>ConvMixer-1536/20</td><td>7</td><td>9</td><td>51.6</td><td>134</td><td>G</td><td>150</td><td>81.37</td></tr><tr><td>ConvMixer-768/32</td><td>7</td><td>7</td><td>21.1</td><td>206</td><td>R</td><td>300</td><td>80.16</td></tr><tr><td>ConvMixer-1536/20</td><td>14</td><td>9</td><td>52.3</td><td>538</td><td>G</td><td>150</td><td>78.92</td></tr><tr><td>ResNet-152</td><td>1</td><td>3</td><td>60.2</td><td>828</td><td>R</td><td>150</td><td>79.64</td></tr><tr><td>DeiT-B</td><td>16</td><td>1</td><td>86</td><td>792</td><td>G</td><td>300</td><td>81.8</td></tr><tr><td>ResMLP-B24/8</td><td>8</td><td>1</td><td>129</td><td>181</td><td>G</td><td>400</td><td>81.0</td></tr></table>
55
+
56
+ # 3 Experiments
57
+
58
+ Training setup. We primarily evaluate ConvMixers on ImageNet-1k classification without any pretraining or additional data. We added ConvMixer to the timm framework (Wightman, 2019) and trained it with nearly-standard settings for the common training procedure from this library: we used RandAugment (Cubuk et al., 2020), mixup (Zhang et al., 2017), CutMix (Yun et al., 2019), random erasing (Zhong et al., 2020), and gradient norm clipping in addition to default timm augmentation. We used the AdamW (Loshchilov & Hutter, 2018) optimizer and a simple triangular learning rate schedule. Due to limited compute, we did virtually no hyperparameter tuning on ImageNet and trained for fewer epochs than competitors. Consequently, our models could be over- or under-regularized, and the accuracies we report likely underestimate the capabilities of our model.
59
+
60
+ Results. A ConvMixer-1536/20 with 52M parameters can achieve 81.4% top-1 accuracy on ImageNet, and a ConvMixer-768/32 with 21M parameters $8 0 . 2 \%$ (see Table 1). Wider ConvMixers seem to converge in fewer epochs, but are more memory- and compute-hungry. They also work best with large kernel sizes: ConvMixer-1536/20 lost $\approx 1 \%$ accuracy when reducing the kernel size from $k = 9$ to $k = 3$ (we discuss kernel sizes more in Appendix A, B, & C). ConvMixers with smaller patches are substantially better in our experiments, similarly to Sandler et al. (2019); we believe larger patches require deeper ConvMixers. With everything held equal except increasing the patch size from 7 to 14, ConvMixer-1536/20 achieves $7 8 . 9 \%$ top-1 accuracy but is around 4 $\times$ faster. We trained one model with ReLU to demonstrate that GELU (Hendrycks & Gimpel, 2016), which is popular in recent isotropic models, isn’t necessary.
61
+
62
+ Comparisons. Our model and ImageNet1k-only training setup closely resemble that of recent patch-based models like DeiT (Touvron et al., 2020). Due to ConvMixer’s simplicity, we focus on comparing to only the most basic isotropic patch-based architectures adapted to the ImageNet-1k setting, namely DeiT and ResMLP. Attempting a fair comparison with a standard baseline, we trained ResNets using exactly the same parameters as ConvMixers; while this choice of parameters is suboptimal (Wightman et al., 2021), it is likely also suboptimal for ConvMixers, since we did no hyperparameter tuning aside from our recent adoption of hyperparameters from Wightman et al. (2021) for some models (presented separately in Appendix A). Looking at Table 1 and Fig. 1, ConvMixers achieve competitive accuracies for a given parameter budget: ConvMixer1536/20 outperforms both ResNet-152, ResMLP-B24, and DeiT-B despite having substantially fewer parameters. ConvMixer-768/32 uses just a third of the parameters of ResNet-152, but is similarly accurate. Note that unlike ConvMixer, the DeiT and ResMLP results involved hyperparameter tuning, and when substantial resources are dedicated to tuning ResNets, including training for twice as many epochs, they only outperform an equivalently-sized ConvMixer by $\approx 0 . 2 \%$ (Wightman et al., 2021). However, ConvMixers are substantially slower at inference than the competitors, likely due to their smaller patch size; hyperparameter tuning and optimizations could narrow this gap. For more discussion and comparisons, see Table 2 and Appendix A.
63
+
64
+ Hyperparameters. For almost all experiments presented in the main text, we used only one set of “common sense” hyperparameters for the regularization methods. Recently, we adapted hyperparameters from the A1 procedure in Wightman et al. (2021), published after our work, which were better than
65
+
66
+ our initial guess, e.g., giving $+ 0 . 8 \%$ for ConvMixer-1536/20, or $8 2 . 2 \%$ top-1 accuracy (see Appendix A).
67
+ However, we note that such optimal ResNet hyperparameters are likely not optimal for ConvMixers.
68
+
69
+ Additional experiments. We present additional ImageNet experiments in Appendix B; notably, we provide more evidence for the advantage of large-kernel convolutions. We also performed smaller-scale experiments on CIFAR-10, where ConvMixers achieve over 96% accuracy with as few as 0.7M parameters, demonstrating the data efficiency of the convolutional inductive bias. Details of these experiments are presented in Appendix C.
70
+
71
+ # 4 Related work
72
+
73
+ Isotropic architectures. Vision transformers have inspired a new paradigm of “isotropic” architectures, i.e., those with equal size and shape throughout the network, which use patch embeddings for the first layer. These models look similar to repeated transformer-encoder blocks (Vaswani et al., 2017) with different operations replacing the self-attention and MLP operations. For example, MLP-Mixer (Tolstikhin et al., 2021) replaces them both with MLPs applied across different dimensions (i.e., spatial and channel location mixing); ResMLP (Touvron et al., 2021a) is a data-efficient variation on this theme. CycleMLP (Chen et al., 2021), gMLP (Liu et al., 2021a), and vision permutator (Hou et al., 2021), replace one or both blocks with various novel operations. These are all quite performant, which is typically attributed to the novel choice of operations. In contrast, Melas-Kyriazi (2021) proposed an MLP-based isotropic vision model, and also hypothesized patch embeddings could be behind its performance. ResMLP tried replacing its linear interaction layer with (small-kernel) convolution and achieved good performance, but kept its MLP-based cross-channel layer and did not explore convolutions further. As our investigation of ConvMixers suggests, these works may conflate the effect of the new operations (like self-attention and MLPs) with the effect of the use of patch embeddings and the resulting isotropic architecture.
74
+
75
+ After our investigation, Liu et al. (2022) proposed an architecture similar to ConvMixer, the isotropic ConvNeXt. Similarly to our work, they provide evidence that the success of ViTs comes from design choices other than the use of self-attention, such as patches; however, ConvMixer goes a step further and eliminates even the MLPs, which suggests that neither of the original ViT operations are crucial to the success of the more general architecture design. Further, Yu et al. (2022) replaced self-attention with a simple pooling operation and demonstrated its effectiveness; they also argued this supports the effectiveness of the ViT template. In contrast, our work suggests the template is even more general, not even requiring MLPs.
76
+
77
+ A study predating vision transformers investigates isotropic (or “isometric”) MobileNets (Sandler et al., 2019), and even implements patch embeddings under another name. Their architecture simply repeats an isotropic MobileNetv3 block. They identify a tradeoff between patch size and accuracy that matches our experience, and train similarly performant models (see Appendix A, Table 2). However, their block is substantially more complex than ours; simplicity and motivation sets our work apart.
78
+
79
+ Patches aren’t all you need? Several papers have increased vision transformer performance by replacing standard patch embeddings with a different stem: Xiao et al. (2021) and Yuan et al. (2021a) use a standard convolutional stem, while Yuan et al. (2021b) repeatedly combines nearby patch embeddings. However, this conflates the effect of using patch embeddings with the effect of adding convolution or similar inductive biases e.g., locality. We attempt to focus on the use of patches.
80
+
81
+ CNNs meet ViTs. Many efforts have been made to incorporate features of convolutional networks into vision transformers and vice versa. Self-attention can emulate convolution (Cordonnier et al., 2019) and can be initialized or regularized to be like it (d’Ascoli et al., 2021); other works simply add convolution operations to transformers (Dai et al., 2021; Guo et al., 2021), or include downsampling to be more like traditional pyramid-shaped convolutional networks (Wang et al., 2021). Conversely, self-attention or attention-like operations can supplement or replace convolution in ResNet-style models (Bello et al., 2019; Ramachandran et al., 2019; Bello, 2021). While all of these attempts have been successful in one way or another, they are orthogonal to this work, which aims to emphasize the effect of the architecture common to most ViTs by showcasing it with a less-expressive operation.
82
+
83
+ # 5 Conclusion
84
+
85
+ We presented ConvMixers, an extremely simple class of models that independently mixes the spatial and channel locations of patch embeddings using only standard convolutions. We also highlighted that using large kernel sizes, inspired by the large receptive fields of ViTs and MLP-Mixers, provides a substantial performance boost. While neither our model nor our experiments were designed to maximize accuracy or speed, i.e., we did not search for good hyperparameters, ConvMixers outperform the Vision Transformer and MLP-Mixer, and are competitive with ResNets, DeiTs, and ResMLPs.
86
+
87
+ We provided evidence that the increasingly common “isotropic” architecture with a simple patch embedding stem is itself a powerful template for deep learning. Patch embeddings allow all the downsampling to happen at once, immediately decreasing the internal resolution and thus increasing the effective receptive field size, making it easier to mix distant spatial information. Our title, while an exaggeration, points out that attention isn’t the only export from language processing into computer vision: tokenizing inputs, i.e., using patch embeddings, is also a powerful and important takeaway.
88
+
89
+ While our model is not state-of-the-art, we find its simple patch-mixing design to be compelling. We hope that ConvMixers can serve as a baseline for future patch-based architectures with novel operations, or that they can provide a basic template for new conceptually simple and performant models.
90
+
91
+ Given that such simple architectures as ConvMixer can be successful, we question the role of continued architecture searches; in particular, are more complicated architectures fundamentally better at modeling phenomena, or are they ultimately just more computationally efficient? Much of the variance in accuracies may be explained by more advanced training pipelines and augmentation techniques, as demonstrated by Wightman et al. (2021) and our work.
92
+
93
+ Future work. We are optimistic that a deeper ConvMixer with larger patches could reach a desirable tradeoff between accuracy, parameters, and throughput after longer training and more regularization and hyperparameter tuning, similarly to how Wightman et al. (2021) enhanced ResNet performance through carefully-designed training regimens. Low-level optimization of large-kernel depthwise convolution could substantially increase throughput, and small enhancements to our architecture like the addition of bottlenecks or a more expressive classifier could trade simplicity for performance.
94
+
95
+ Due to its large internal resolution and isotropic design, ConvMixer may be especially well-suited for semantic segmentation, and it would be useful to run experiments on this task with a ConvMixer-like model and on other tasks such as object detection. More experiments could be designed to more clearly extricate the effect of patch embeddings from other architectural choices. In particular, for a more in-depth comparison to ViTs and MLP-Mixers, which excel when trained on very large data sets, it is important to investigate the performance of ConvMixers in the regime of large-scale pre-training.
96
+
97
+ More work is necessary to extricate the effect of the patch embeddings from the rest of the architecture. In particular, we have preliminary evidence that it is not necessary to separate the spatial and channel mixing steps; patches followed by any stack of nonlinear operations (say, plain convolution) may be sufficient for simple, performant models.
98
+
99
+ Note on paper length. We acknowledge that this paper is shorter than most, and this is intentional. In the main text, we have presented our main thesis, proposed an extremely simple architecture used to validate the thesis, included a complete implementation, highlighted the results that we believe to be most relevant, and finished with concluding thoughts. The work here is very simple, and thus we believe that a short paper is ultimately more effective at conveying the main messages. While additional experiments and results are included in the appendix, we fully argue that the results in the main text are sufficient to establish our point, and that the supplementary material is genuinely of secondary importance. Hence, we felt the shorter length was more than sufficient.
100
+
101
+ # References
102
+
103
+ Irwan Bello. Lambdanetworks: Modeling long-range interactions without attention. arXiv preprint arXiv:2102.08602, 2021.
104
+
105
+ Irwan Bello, Barret Zoph, Ashish Vaswani, Jonathon Shlens, and Quoc V Le. Attention augmented convolutional networks. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 3286–3295, 2019.
106
+ Shoufa Chen, Enze Xie, Chongjian Ge, Ding Liang, and Ping Luo. Cyclemlp: A mlp-like architecture for dense prediction. arXiv preprint arXiv:2107.10224, 2021.
107
+ Jean-Baptiste Cordonnier, Andreas Loukas, and Martin Jaggi. On the relationship between self-attention and convolutional layers. arXiv preprint arXiv:1911.03584, 2019.
108
+ Ekin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical automated data augmentation with a reduced search space. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pp. 702–703, 2020.
109
+ Zihang Dai, Hanxiao Liu, Quoc V Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes. arXiv preprint arXiv:2106.04803, 2021.
110
+ Stéphane d’Ascoli, Hugo Touvron, Matthew Leavitt, Ari Morcos, Giulio Biroli, and Levent Sagun. Convit: Improving vision transformers with soft convolutional inductive biases. arXiv preprint arXiv:2103.10697, 2021.
111
+ Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020.
112
+ Jianyuan Guo, Kai Han, Han Wu, Chang Xu, Yehui Tang, Chunjing Xu, and Yunhe Wang. Cmt: Convolutional neural networks meet vision transformers. arXiv preprint arXiv:2107.06263, 2021.
113
+ Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
114
+ Qibin Hou, Zihang Jiang, Li Yuan, Ming-Ming Cheng, Shuicheng Yan, and Jiashi Feng. Vision permutator: A permutable mlp-like architecture for visual recognition, 2021.
115
+ Hanxiao Liu, Zihang Dai, David R So, and Quoc V Le. Pay attention to mlps. arXiv preprint arXiv:2105.08050, 2021a.
116
+ Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows, 2021b.
117
+ Zhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, and Saining Xie. A convnet for the 2020s. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11976–11986, 2022.
118
+ Ilya Loshchilov and Frank Hutter. Fixing weight decay regularization in adam. 2018.
119
+ Luke Melas-Kyriazi. Do you even need attention? a stack of feed-forward layers does surprisingly well on imagenet, 2021.
120
+ Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jonathon Shlens. Stand-alone self-attention in vision models. arXiv preprint arXiv:1906.05909, 2019.
121
+ Mark Sandler, Jonathan Baccash, Andrey Zhmoginov, and Andrew Howard. Non-discriminative data or weak model? on the relative importance of data and model resolution. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, pp. 0–0, 2019.
122
+ Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, et al. Mlp-mixer: An all-mlp architecture for vision. arXiv preprint arXiv:2105.01601, 2021.
123
+ Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020.
124
+ Hugo Touvron, Piotr Bojanowski, Mathilde Caron, Matthieu Cord, Alaaeldin El-Nouby, Edouard Grave, Armand Joulin, Gabriel Synnaeve, Jakob Verbeek, and Hervé Jégou. Resmlp: Feedforward networks for image classification with data-efficient training. arXiv preprint arXiv:2105.03404, 2021a.
125
+ Hugo Touvron, Matthieu Cord, Alexandre Sablayrolles, Gabriel Synnaeve, and Hervé Jégou. Going deeper with image transformers. arXiv preprint arXiv:2103.17239, 2021b.
126
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
127
+ Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv preprint arXiv:2102.12122, 2021.
128
+ Ross Wightman. Pytorch image models. https://github.com/rwightman/pytorch-image-models, 2019.
129
+ Ross Wightman, Hugo Touvron, and Hervé Jégou. Resnet strikes back: An improved training procedure in timm, 2021.
130
+ Tete Xiao, Mannat Singh, Eric Mintun, Trevor Darrell, Piotr Dollár, and Ross Girshick. Early convolutions help transformers see better. arXiv preprint arXiv:2106.14881, 2021.
131
+ Weihao Yu, Mi Luo, Pan Zhou, Chenyang Si, Yichen Zhou, Xinchao Wang, Jiashi Feng, and Shuicheng Yan. Metaformer is actually what you need for vision. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10819–10829, 2022.
132
+ Kun Yuan, Shaopeng Guo, Ziwei Liu, Aojun Zhou, Fengwei Yu, and Wei Wu. Incorporating convolution designs into visual transformers. arXiv preprint arXiv:2103.11816, 2021a.
133
+ Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zihang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. arXiv preprint arXiv:2101.11986, 2021b.
134
+ Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6023–6032, 2019.
135
+ Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017.
136
+ Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. Random erasing data augmentation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 13001–13008, 2020.
137
+
138
+ # A Comparison to other models
139
+
140
+ Table 2: Throughputs measured on an RTX8000 GPU using batch size 64 and fp16. ConvMixers and ResNets trained ourselves. Other statistics: DeiT (Touvron et al., 2020), ResMLP (Touvron et al., 2021a), Swin (Liu et al., 2021b), ViT (Dosovitskiy et al., 2020), MLP-Mixer (Tolstikhin et al., 2021), Isotropic MobileNets (Sandler et al., 2019). We think models with matching colored dots (•) are informative to compare with each other. †Throughput tested, but not trained. Activations: ReLU, GELU. $\star$ Using new, better regularization hyperparameters based on Wightman et al. (2021)’s A1 procedure.
141
+
142
+ <table><tr><td colspan="8">Comparison with other simple models trained on ImageNet-1k only with input size 224.</td></tr><tr><td>Network</td><td>Pateh</td><td>Kernel</td><td>Params</td><td>Throughput (img/sec)</td><td>Act</td><td>#Epochs</td><td></td></tr><tr><td>ConvMixer-1536/20★</td><td>7</td><td>9</td><td>51.6</td><td>134</td><td>G</td><td>150</td><td>82.20</td></tr><tr><td>ConvMixer-1536/20·</td><td>7</td><td>9</td><td>51.6</td><td>134</td><td>G</td><td>150</td><td>81.37</td></tr><tr><td>ConvMixer-1536/20*</td><td>7</td><td>3</td><td>49.4</td><td>246</td><td>G</td><td>150</td><td>81.60</td></tr><tr><td>ConvMixer-1536/20</td><td>7</td><td>3</td><td>49.4</td><td>246</td><td>G</td><td>150</td><td>80.43</td></tr><tr><td>ConvMixer-1536/20</td><td>14</td><td>9</td><td>52.3</td><td>538</td><td>G</td><td>150</td><td>78.92</td></tr><tr><td>ConvMixer-1536/24*</td><td>14</td><td>9</td><td>62.3</td><td>447</td><td>G</td><td>150</td><td>80.21</td></tr><tr><td>ConvMixer-768/32*</td><td>7</td><td>7</td><td>21.1</td><td>206</td><td>G</td><td>150</td><td>80.74</td></tr><tr><td>ConvMixer-768/32·</td><td>7</td><td>7</td><td>21.1</td><td>206</td><td>R</td><td>300</td><td>80.16</td></tr><tr><td>ConvMixer-1024/16</td><td>7</td><td>9</td><td>19.4 14.6</td><td>244</td><td>G G</td><td>100</td><td>79.45</td></tr><tr><td>ConvMixer-1024/12</td><td>7</td><td>8</td><td>5.4</td><td>358</td><td>G</td><td>90</td><td>77.75</td></tr><tr><td>ConvMixer-512/16</td><td>7</td><td>8</td><td></td><td>599</td><td>G</td><td>90</td><td>73.76</td></tr><tr><td>ConvMixer-512/12 ·</td><td>7</td><td>8</td><td>4.2 20.2</td><td>798 1235</td><td>R</td><td>90 300</td><td>72.59</td></tr><tr><td>ConvMixer-768/32</td><td>14</td><td>3</td><td>24.4</td><td>750</td><td>G</td><td></td><td>74.93</td></tr><tr><td>ConvMixer-1024/20·</td><td>14</td><td>9</td><td></td><td></td><td></td><td>150</td><td>76.94</td></tr><tr><td>ResNet-152*</td><td></td><td>3</td><td>60.2 60.2</td><td>828</td><td>R R</td><td>150</td><td>81.15</td></tr><tr><td>ResNet-152·</td><td></td><td>3</td><td>44.6</td><td>828 1187</td><td>R</td><td>150</td><td>79.64</td></tr><tr><td>ResNet-101· ResNet-50</td><td>一</td><td>3 3</td><td>25.6</td><td>1739</td><td>R</td><td>150 150</td><td>78.33 76.32</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DeiT-Bt</td><td>7</td><td></td><td>86.7</td><td>83</td><td>G</td><td></td><td>一</td></tr><tr><td>DeiT-St</td><td>7</td><td></td><td>22.1</td><td>174</td><td>G</td><td></td><td></td></tr><tr><td>DeiT-Tit</td><td>7</td><td></td><td>5.7</td><td>336</td><td>G</td><td></td><td></td></tr><tr><td>DeiT-B·</td><td>16</td><td></td><td>86</td><td>792</td><td>G</td><td>300</td><td>81.8</td></tr><tr><td>DeiT-S· DeiT-Ti·</td><td>16</td><td></td><td>22</td><td>1610</td><td>G</td><td>300</td><td>79.8</td></tr><tr><td></td><td>16</td><td></td><td>5.7</td><td>2603</td><td>G</td><td>300</td><td>72.2</td></tr><tr><td>ResMLP-S12/8 ·</td><td>8</td><td></td><td>22.1</td><td>872</td><td>G</td><td>400</td><td>79.1</td></tr><tr><td>ResMLP-B24/8· ResMLP-B24</td><td>8</td><td></td><td>129</td><td>181</td><td>G</td><td>400</td><td>81.0</td></tr><tr><td></td><td>16</td><td></td><td>116</td><td>1597</td><td>G</td><td>400</td><td>81.0</td></tr><tr><td>Swin-S·</td><td>4</td><td></td><td>50</td><td>576</td><td>G</td><td>300</td><td>83.0</td></tr><tr><td>Swin-T ·</td><td>4</td><td></td><td>29</td><td>878</td><td>G</td><td>300</td><td>81.3</td></tr><tr><td>ViT-B/16·</td><td>16</td><td></td><td>86</td><td>789</td><td>G</td><td>300</td><td>77.9</td></tr><tr><td>Mixer-B/16·</td><td>16</td><td></td><td>59</td><td>1025</td><td>G</td><td>300</td><td>76.44</td></tr><tr><td>Isotropic MobileNetv3·</td><td>8 16</td><td>3</td><td>20</td><td>355</td><td>R</td><td></td><td>80.6</td></tr><tr><td>Isotropic MobileNetv3·</td><td></td><td>3</td><td>20</td><td>1296</td><td>R</td><td></td><td>77.6</td></tr></table>
143
+
144
+ Experiment overview. We did not design our experiments to maximize accuracy: We chose “common sense” parameters for timm and its augmentation settings, found that it worked well for a ConvMixer-1024/12, and stuck with them for the proceeding experiments. We admit this is not an optimal strategy, however, we were aware from our early experiments on CIFAR-10 that results seemed robust to various small changes. We did not have access to sufficient compute to attempt to tune hyperparameters for each model: e.g., larger ConvMixers could probably benefit from more regularization than we chose, and smaller ones from less regularization. Keeping the parameters the same across ConvMixer instances seemed more reasonable than guessing for each.
145
+
146
+ However, to some extent, we changed the number of epochs per model: for earlier experiments, we merely wanted a “proof of concept”, and used only 90–100 epochs. Once we saw potential, we increased this to 150 epochs and trained some larger models, namely ConvMixer-1024/20 with $p ~ = ~ 1 4$ patches and ConvMixer-1536/20 with $p \ = \ 7$ patches. Then, believing that we should explore deeper-but-less-wide ConvMixers, and knowing from CIFAR-10 that the deeper models converged more slowly, we trained ConvMixer-768/32s with $p = 1 4$ and $p = 7$ for 300 epochs. Of course, training time was a consideration: ConvMixer-1536/20 took about 9 days to train (on 10 $\times$ RTX8000s) 150 epochs, and ConvMixer-768/32 is over twice as fast, making 300 epochs more feasible.
147
+
148
+ If anything, we believe that in the worst case, the lack of parameter tuning in our experiments resulted in underestimating the accuracies of ConvMixers. Further, due to our limited compute and the fact that large models (particularly ConvMixers) are expensive to train on large data sets, we generally trained our models for fewer epochs than competition like DeiT and ResMLP (see Table 2).
149
+
150
+ In this revision, we have added some additional results (denoted with a $\star$ in Table 2) using hyperparameters loosely based on the precisely-crafted “A1 training procedure” from Wightman et al. (2021). In particular, we adjusted parameters for RandAug, Mixup, CutMix, Random Erasing, and weight decay to match those in the procedure. Importantly, we still only trained for 150 epochs, rather than the 600 epochs used in Wightman et al. (2021), and we did not use binary cross-entropy loss nor repeated augmentation. While we do not think optimal hyperparameters for ResNet would also be optimal for ConvMixer, these settings are significantly better than the ones we initially chose. This further highlights the capabilities of ConvMixers, and we are optimistic that further tuning could lead to still-better performance. Throughout the paper, we still refer to ConvMixers trained using our initial “one shot” selection of hyperparameters.
151
+
152
+ A note on throughput. We measured throughput using batches of 64 images in half precision on a single RTX8000 GPU, averaged over 20 such batches. In particular, we measured CUDA execution time rather than “wall-clock” time. We noticed discrepancies in the relative throughputs of models, e.g., Touvron et al. (2020) reports that ResNet-152 is 2 $\times$ faster than DeiT-B, but our measurements show that the two models have nearly the same throughput. We therefore speculate that our throughputs may underestimate the performance of ResNets and ConvMixers relative to the transformers. The difference may be due to using RTX8000 rather than V100 GPUs, or other low-level differences. Our throughputs were similar for batch sizes 32 and 128.
153
+
154
+ ResNets. As a simple baseline to which to compare ConvMixers, we trained three standard ResNets using exactly the same training setup and parameters as ConvMixer-1536/20. We also trained ResNet- $1 5 2 ^ { \star }$ using the new A1-based procedure for comparison against ConvMixer-1536/ $2 0 ^ { \star }$ . Despite having fewer parameters and being architecturally much simpler, ConvMixers substantially outperform these ResNets in terms of accuracy. A possible confounding factor is that ConvMixers use GELU, which may boost performance, while ResNets use ReLU. In an attempt to rule out this confound, we used ReLU in a later ConvMixer768/32 experiment and found that it still achieved competitive accuracy. We also note that the choice of ReLU vs. GELU was not important on CIFAR-10 experiments (see Table 7). However, ConvMixers do have substantially less throughput.
155
+
156
+ DeiTs. We believe that DeiT is the most reasonable comparison in terms of vision transformers: It only adds additional regularization, as opposed to architectural additions in the case of CaiT (Touvron et al., 2021b), and is then essentially a “vanilla” ViT modulo the distillation token (we don’t consider distilled architectures). In terms of a fixed parameter budget, ConvMixers generally outperform DeiTs. For example, ConvMixer1536/20 is only $0 . 4 3 \%$ less accurate than DeiT-B despite having over 30M fewer parameters; ConvMixer
157
+
158
+ 768/32 is $0 . 3 6 \%$ more accurate than DeiT-S despite having 0.9M fewer parameters; and ConvMixer-512/16 is $0 . 3 9 \%$ more accurate than DeiT-Ti for nearly the same number of parameters. Admittedly, none of the ConvMixers are very competitive in terms of throughput, with the closest being the ConvMixer-512/16 which is $4 \times$ slower than DeiT-Ti.
159
+
160
+ A confounding factor is the difference in patch size between DeiT and ConvMixer; DeiT uses $p = 1 6$ while ConvMixer uses $p = 7$ . This means DeiT is substantially faster. However, ConvMixers using larger patches are not as competitive. While we were not able to train DeiTs with larger patch sizes, it is possible that they would outperform ConvMixers on the parameter count vs. accuracy curve; however, we tested their throughput for $p = 7$ , and they are even slower than ConvMixers. Given the difference between convolution and self-attention, we are not sure it is salient to control for patch size differences.
161
+
162
+ DeiTs were subject to more hyperparameter tuning than ConvMixers, as well as longer training times. They also used stochastic depth while we did not, which can in some cases contribute percent differences in model accuracy (Touvron et al., 2021a). It is therefore possible that further hyperparameter tuning and more epochs for ConvMixers could close the gap between the two architectures for large patches, e.g., $p = 1 6$ .
163
+
164
+ ResMLPs. Similarly to DeiT for ViT, we believe that ResMLP is the most relevant MLP-Mixer variant to compare against. Unlike DeiT, we can compare against instances of ResMLP with similar patch size: ResMLP-B24/8 has $p = 8$ patches, and underperforms ConvMixer-1536/20 by $0 . 3 7 \%$ , despite having over twice the number of parameters; it also has similarly low throughput. ConvMixer-768/32 also outperforms ResMLP-S12/8 for millions fewer parameters, but 4 $\times$ less throughput.
165
+
166
+ ResMLP did not significantly improve in terms of accuracy for halving the patch size from 16 to 8, which shows that smaller patches do not always lead to better accuracy for a fixed architecture and regularization strategy (e.g., training a $p = 8$ DeiT may be challenging).
167
+
168
+ Swin Transformers. While we intend to focus on the most basic isotropic, patch-based architectures for fair comparisons with ConvMixer, it is also interesting to compare to a more complicated model that is closer to state-of-the-art. For a similar parameter budget, ConvMixer is around 1.2-1.6% less accurate than the Swin Transformer, while also being 4-6 $\times$ slower. However, considering we did not attempt to tune or optimize our model in any way, we find it surprising that an exceedingly simple patch-based model that uses only plain convolution does not lag too far behind Swin Transformer.
169
+
170
+ Isotropic MobileNets. These models are closest in design to ours, despite using a repeating block that is substantially more complex than the ConvMixer one. Despite this, for a similar number of parameters, we can get similar performance. Notably, isotropic MobileNets seem to suffer less from larger patch sizes than ConvMixers, which makes us optimistic that sufficient parameter tuning could lead to more performant large-patch ConvMixers. As Sandler et al. (2019) did not provide an implementation, we cannot be sure if ours is exactly the same; e.g., we were unsure if 5x5 stride-5 convolutions were replaced with 3x3 or 5x5 stride-1 convolutions, so we chose 3x3. The throughputs in Table 2 are based on our implementation. We also trained a patch-size-16 Isotropic MobileNet using exactly the same pipeline used for our ConvMixers, which achieved only $7 0 . 7 6 \%$ accuracy.
171
+
172
+ Other models. We included ViT and MLP-Mixer instances in our table, though they are not competitive with ConvMixer, DeiT, or ResMLP, even though MLP-Mixer has comparable regularization to ConvMixer. That is, ConvMixer seems to outperform MLP-Mixer and ViT, while being closer to complexity to them in terms of design and training regime than the other competitors, DeiT and ResMLP.
173
+
174
+ Kernel size. While we found some evidence that larger kernels are better on CIFAR-10, we wanted to see if this finding transferred to ImageNet. Consequently, we trained our best-performing model, ConvMixer1536/20, with kernel size $k = 3$ rather than $k = 9$ . This resulted in a decrease of $0 . 9 4 \%$ top-1 accuracy, which we believe is quite significant relative to the mere 2.2M additional parameters. However, $k = 3$ is substantially faster than $k = 9$ for spatial-domain convolution; we speculate that low-level optimizations could close the performance gap to some extent, e.g., by using implicit instead of explicit padding. Since large-kernel convolutions throughout a model are unconventional, there has likely been low demand for such optimizations.
175
+
176
+ # B Additional Experiments on ImageNet
177
+
178
+ In this section, we present additional experiments on ImageNet-1k. We primarily used ConvMixer-512/12 trained using the new A1-like ( $\star$ ) technique. Note that the throughputs in this section were recorded using Tesla V100 GPUs, while those in Table 2 used RTX8000s (hence, the two measurements should not be compared across tables).
179
+
180
+ Table 3: We investigate the effect of different patch sizes on throughput and accuracy. Smaller patches result in higher accuracy at the expense of throughput.
181
+
182
+ <table><tr><td colspan="5">Effect of Patch Size</td></tr><tr><td>Network</td><td>Patch</td><td>Kermel</td><td>Thrmghput</td><td>IN</td></tr><tr><td>ConvMixer-512/12</td><td>5</td><td>9</td><td>388</td><td>75.60</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>9</td><td>644</td><td>74.60</td></tr><tr><td>ConvMixer-512/12</td><td>9</td><td>9</td><td>1120</td><td>73.55</td></tr><tr><td>ConvMixer-512/12</td><td>12</td><td>9</td><td>1908</td><td>71.79</td></tr><tr><td>ConvMixer-512/12</td><td>16</td><td>9</td><td>2892</td><td>69.65</td></tr></table>
183
+
184
+ Patch sizes. Larger patch sizes result in lower accuracy, while smaller patches increase accuracy. However, ConvMixers using smaller patches are substantially slower. For most of our experiments, we used $7 \times 7$ patches; however, in some cases, it may be desirable to use slightly larger $9 \times 9$ patches in exchange for a bit less accuracy (see Table 3).
185
+
186
+ Table 4: We tested ConvMixers with ResNet-style stems and ResNets with patch embedding stems; in both cases, patch embeddings worked better.
187
+
188
+ <table><tr><td colspan="3">Patch Embeddings vs. ResNet-Style Stems</td></tr><tr><td>Network</td><td>Stem</td><td></td></tr><tr><td>ResNet50 ResNet50</td><td>ResNet Stem Patches (4 × 4)</td><td>78.32 78.74</td></tr><tr><td>ConvMixer-512/12 ConvMixer-512/12</td><td>ResNet Stem Patches (12 × 12)</td><td>71.24 71.79</td></tr></table>
189
+
190
+ Disentangling the effect of patches. We found that using a patch embedding stem with a ResNet improves accuracy relative to the default stem, while using a ResNet stem with a ConvMixer hurts accuracy (see Table 4). This provides some evidence that patches are a good choice of input representation, and may even improve the performance of existing models compared to their default input representation. For the ConvMixer, we used a ResNet stem with $1 2 \times 1 2$ -kernel convolutions with stride 6 followed by max pooling; this ensured that ResNet-stem ConvMixer had the same internal resolution as the version using patches.
191
+
192
+ Kernel sizes. Here, we investigate whether larger kernel sizes are really beneficial to ConvMixers. In Table 5, we see that $9 \times 9$ kernels strongly outperform $3 \times 3$ kernels. This may be unsurprising, as the model with $9 \times 9$ kernels has significantly more parameters; to control for this, we trained a ConvMixer-512/14 with $3 \times 3$ kernels which has a comparable number of parameters. However, this still does not achieve the performance of the $9 \times 9$ -kernel model. Further, conventional wisdom states that three stacked $3 \times 3$ convolutional layers (with GELUs between the layers) has the same receptive field as $9 \times 9$ convolution while being more expressive. Consequently, we replaced plain $3 \times 3$ convolutions with three stacked 3 $\times$ convolutions; however, this still did not surpass the accuracy of $9 \times 9$ convolutions. Finally, using the same intuition, we stack three ConvMixer-512/12s and tried a ConvMixer-512/36; only then do we outperform large-kernel convolutions. This is perhaps unsurprising, given the 24 additional pointwise layers.
193
+
194
+ Table 5: Here, we investigate whether larger kernels are really more effective than smaller ones. Our results suggest that larger kernels are advantageous compared to a variety of “control” experiments.
195
+
196
+ <table><tr><td colspan="6">Effect of Kernel Size</td></tr><tr><td>Network</td><td>Patch</td><td>Kernel</td><td>#Paras</td><td>Troghpgt</td><td>p-N</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>7</td><td>4.07</td><td>724</td><td>74.54</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>15</td><td>5.15</td><td>401</td><td>75.25</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>9</td><td>4.27</td><td>644</td><td>74.60</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>3</td><td>3.83</td><td>992</td><td>72.96</td></tr><tr><td>ConvMixer-512/14</td><td>7</td><td>3</td><td>4.37</td><td>856</td><td>74.03</td></tr><tr><td>ConvMier-512U convs)</td><td>7</td><td>3</td><td>3.95</td><td>732</td><td>74.53</td></tr><tr><td>ConvMixer-512/36</td><td>7</td><td>3</td><td>10.3</td><td>338</td><td>77.67</td></tr></table>
197
+
198
+ Table 6: We investigated choices of activation functions and normalization layers, as well as training with reduced data augmentation. While reducing augmentation improves performance on this small model, we did not adopt this change elsewhere.
199
+
200
+ <table><tr><td colspan="2">Ablation of ConvMixer-512/12 on ImageNet</td></tr><tr><td>Ablation</td><td>ImNet Acc. (%)</td></tr><tr><td>Baseline</td><td>74.60</td></tr><tr><td>BatchNorm →LayerNorm GELU→ReLU</td><td>74.51</td></tr><tr><td>- Mixup and CutMix</td><td>74.44 75.65</td></tr><tr><td>-RandAug</td><td>75.26</td></tr></table>
201
+
202
+ Architectural choices. In Table 6, we demonstrate that the choice of activation function (ReLU vs.
203
+ GELU) and norm layer (BatchNorm vs. LayerNorm) does not have a large impact on performance.
204
+
205
+ Data augmentation. We also investigate removing some of the data augmentations from the A1 recipe (see Table 6). We saw a substantial performance boost from removing Mixup and CutMix, and to a lesser extent, RandAugment as well. This is likely due to the relatively small model used for the comparison (ConvMixer-512/12), for which this level of augmentation may be excessive. We did not adopt these changes for other experiments. For comparison, a DeiT trained exactly the same way as the baseline ConvMixer achieves $7 0 . 2 8 \%$ accuracy, while a DeiT without RandAug, CutMix, and MixUp gets $6 9 . 6 5 \%$ accuracy. That is, it seems augmentations are more important to DeiT than to ConvMixer.
206
+
207
+ Input size. Unlike ViTs, MLP-Mixers, ResMLPs, and other recent models, ConvMixers can handle variable input sizes with no modifications whatsoever. In Fig. 4, we show the effect of input size on the inference time of a ConvMixer-768/32 using a batch size of 32, averaged over 16 trials on an RTX 3080Ti GPU in half precision. Note the rapid growth of inference time for kernel sizes 7 and 9 compared to 3 and 5; we believe this shows that the underlying implementation of depthwise convolution is suboptimal for large kernel sizes.
208
+
209
+ # C Additional Experiments on CIFAR-10
210
+
211
+ Residual connections. We experimented with leaving out one, the other, or both residual connections before settling on the current configuration, and consequently chose to leave out the second residual connection. Our baseline model without the connection achieves 95.88% accuracy, while including the connection reduces it to $9 4 . 7 8 \%$ . Surprisingly, we see only a $0 . 3 1 \%$ decrease in accuracy for removing all residual connections. We acknowledge that these findings for residual connections may not generalize to deeper ConvMixers trained on larger data sets.
212
+
213
+ ![](images/41091f9d2ad52e02a197f45f8f13a06003c21c9c5ec3ac2680b1cc66769bc7d6.jpg)
214
+ Figure 4: Inference time vs. input size for ConvMixer-768/32 with a variety of kernel sizes.
215
+
216
+ Table 7: Small ablation study of training a ConvMixer-256/8 on CIFAR-10.
217
+
218
+ <table><tr><td colspan="2">Ablation of ConvMixer-256/8 on CIFAR-10</td></tr><tr><td>Ablation</td><td>CIFAR-10</td></tr><tr><td>Baseline</td><td>95.88</td></tr><tr><td>- Residual in Eq. 2 + Residual in Eq. 3 BatchNorm →LayerNorm GELU→ReLU</td><td>95.57 94.78 94.44 95.51</td></tr><tr><td>- Mixup and CutMix - Random Erasing RandAug</td><td>95.92 95.24</td></tr></table>
219
+
220
+ Normalization. Our model is conceptually similar to the vision transformer and MLP-Mixer, both of which use LayerNorm instead of BatchNorm. We attempted to use LayerNorm instead, and saw a decrease in performance of around 1% as well as slower convergence (see Table 7). However, this was for a relatively shallow model, and we cannot guarantee that LayerNorm would not hinder ImageNet-scale models to an even larger degree. We note that the authors of ResMLP also saw a relatively small increase in accuracy for replacing LayerNorm with BatchNorm, but for a larger-scale experiment (Touvron et al., 2021a). We conclude that BatchNorm is no more crucial to our architecture than other regularizations or parameter settings (e.g., kernel size).
221
+
222
+ Having settled on an architecture, we proceeded to adjust its parameters $h , d , p , k$ as well as weight decay on CIFAR-10 experiments. (Initially, we took the unconventional approach of excluding weight decay since we were already using strong regularization in the form of RandAug and mixup.) We acknowledge that tuning our architecture on CIFAR-10 does not necessarily generalize to performance on larger data sets, and that this is a limitation of our study.
223
+
224
+ # C.1 Results
225
+
226
+ ConvMixers are quite performant on CIFAR-10, easily achieving $> 9 1 \%$ accuracy for as little as 100, 000 parameters, or $> 9 6 \%$ accuracy for only 887, 000 parameters (see Table 8). With additional refinements e.g., a more expressive classifier or bottlenecks, we think that ConvMixer could be even more competitive. For all experiments, we trained for 200 epochs on CIFAR-10 with RandAug, mixup, cutmix, random erasing, gradient norm clipping, and the standard augmentations in timm. We remove some of these augmentations in Table 7, finding that RandAug and random scaling (“default” in timm) are very important, each accounting for over 3% of the accuracy.
227
+
228
+ Scaling ConvMixer. We adjusted the hidden dimension $h$ and the depth $d$ , finding that deeper networks take longer to converge while wider networks converge faster. That said, increasing the width or the depth is an effective way to increase accuracy; a doubling of depth incurs less compute than a doubling of width. The number of parameters in a ConvMixer is given exactly by:
229
+
230
+ $$
231
+ \# \mathsf { p a r a m s } = h [ d ( k ^ { 2 } + h + 6 ) + c _ { \mathsf { i n } } p ^ { 2 } + n _ { \mathsf { c l a s s e s } } + 3 ] + n _ { \mathsf { c l a s s e s } } ,
232
+ $$
233
+
234
+ including affine scaling parameters in BatchNorm layers, convolutional kernels, and the classifier.
235
+
236
+ Kernel size. We initially hypothesized that large kernels would be important for ConvMixers, as they would allow the mixing of distant spatial information similarly to unconstrained MLPs or self-attention layers. We tried to investigate the effect of kernel size on CIFAR-10: we fixed the model to be a ConvMixer-256/8, and increased the kernel size by 2s from 3 to 15.
237
+
238
+ Using a kernel size of 3, the ConvMixer only achieves $9 3 . 6 1 \%$ accuracy. Simply increasing it to 5 gives an additional $1 . 5 0 \%$ accuracy, and further to 7 an additional $0 . 6 1 \%$ . The gains afterwards are relatively marginal, with kernel size 15 giving an additional 0.28% accuracy. It could be that with more training iterations or more regularization, the effect of larger kernels would be more pronounced. Nonetheless, we concluded that ConvMixers benefit from larger-than-usual kernels, and thus used kernel sizes 7 or 9 in most of our later experiments.
239
+
240
+ It is conventional wisdom that large-kernel convolutions can be “decomposed” into stacked small-kernel convolutions with activations between them, and it is therefore standard practice to use $k = 3$ convolutions, stacking more of them to increase the receptive field size with additional benefits from nonlinearities. This raises a question: is the benefit of larger kernels in ConvMixer actually better than simply increasing the depth with small kernels? First, we note that deeper networks are generally harder to train, so by increasing the kernel size independently of the depth, we may recover some of the benefits of depth without making it harder for signals to “propagate back” through the network. To test this, we trained a ConvMixer-256/10 with $k = 3$ (698K parameters) in the same setting as a ConvMixer-256/8 with $k = 9$ (707K parameters), i.e., we increased depth in a small-kernel model to roughly match the parameters of a large-kernel model. The ConvMixer-256/10 achieved 94.29% accuracy (1.5% less), which provides more evidence for the importance of larger kernels in ConvMixers. Next, instead of fixing the parameter budget, we tripled the depth (using the intuition that 3 stacked $k = 3$ convolutions have the receptive field of a $k = 9$ convolution), giving a ConvMixer-256/24 with 1670K parameters, and got $9 5 . 1 6 \%$ accuracy, i.e., still less.
241
+
242
+ Patch size. CIFAR-10 inputs are so small that we initially only used $p = 1$ , i.e., the patch embedding layer does little more than compute $h$ linear combinations of the input image. Using $p = 2$ , we see a reduction in accuracy of about $0 . 8 0 \%$ ; this is a worthy tradeoff in terms of training and inference time. Further increasing the patch size leads to rapid decreases in accuracy, with only $9 2 . 6 1 \%$ for $p = 4$ .
243
+
244
+ Since the “internal resolution” is decreased by a factor of $p$ when increasing the patch size, we assumed that larger kernels would be less important for larger $p$ . We investigated this by again increasing the kernel size from 3 to 11 for ConvMixer-256/8 with $p = 2$ : however, this time, the improvement going from 3 to 5 is only $1 . 1 3 \%$ , and larger kernels than 5 provide only marginal benefit.
245
+
246
+ Weight decay. We did many of our initial experiments with minimal weight decay. However, this was not optimal: by tuning weight decay, we can get an additional $0 . 1 5 \%$ of accuracy for no cost. Consequently, we used weight decay (without tuning) for our larger-scale experiments on ImageNet.
247
+
248
+ Table 8: An investigation of ConvMixer design parameters $h , d , p , k$ and weight decay on CIFAR-10
249
+
250
+ <table><tr><td colspan="7"> Tiny ConvMixers trained on CIFAR-10.</td></tr><tr><td>Width h</td><td>Depth d</td><td>Patch Size p</td><td>Kernel Size k</td><td># Params (×103)</td><td>Weight Decay</td><td>CIFAR-10 Acc. (%)</td></tr><tr><td>128</td><td>4</td><td>1</td><td>8</td><td>103</td><td>0</td><td>91.26</td></tr><tr><td>128</td><td>8</td><td>1</td><td>8</td><td>205</td><td>0</td><td>93.83</td></tr><tr><td>128</td><td>12</td><td>1</td><td>8</td><td>306</td><td>0</td><td>94.83</td></tr><tr><td>256</td><td>4</td><td>1</td><td>8</td><td>338</td><td>0</td><td>93.37</td></tr><tr><td>256</td><td>8</td><td>1</td><td>8</td><td>672</td><td>0</td><td>95.60</td></tr><tr><td>256</td><td>12</td><td>1</td><td>8</td><td>1006</td><td>0</td><td>96.39</td></tr><tr><td>256</td><td>16</td><td>1</td><td>8</td><td>1339</td><td>0</td><td>96.74</td></tr><tr><td>256</td><td>20</td><td>1</td><td>8</td><td>1673</td><td>0</td><td>96.67</td></tr><tr><td colspan="7">{Kernel adjustments</td></tr><tr><td>256</td><td>8</td><td>1</td><td>3</td><td>559</td><td>0</td><td>93.61</td></tr><tr><td>256</td><td>8</td><td>1</td><td>5</td><td>592</td><td>0</td><td>95.19</td></tr><tr><td>256</td><td>8</td><td>1</td><td>7</td><td>641</td><td>0</td><td>95.80</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>0</td><td>95.88</td></tr><tr><td>256</td><td>8</td><td>1</td><td>11</td><td>788</td><td>0</td><td>95.70</td></tr><tr><td>256</td><td>8</td><td>1</td><td>13</td><td>887</td><td>0</td><td>96.04</td></tr><tr><td>256</td><td>8</td><td>1</td><td>15</td><td>1001</td><td>0</td><td>96.08</td></tr><tr><td colspan="7">↓Patch adjustments</td></tr><tr><td></td><td>8</td><td>2</td><td>9</td><td>709</td><td>0</td><td>95.00</td></tr><tr><td>256 256</td><td>8</td><td>4</td><td>9</td><td>718</td><td>0</td><td>92.61</td></tr><tr><td>256</td><td>8</td><td>8</td><td>9</td><td>755</td><td>0</td><td>85.57</td></tr><tr><td colspan="7">←Weight decay adjustments</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-1</td><td>95.88</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-2</td><td>96.03</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-3</td><td>95.76</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-4</td><td>95.63</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-5</td><td>95.88</td></tr><tr><td colspan="7">↓ Kernel size adjustments when p = 2</td></tr><tr><td>256</td><td>8</td><td>2</td><td>3</td><td>561</td><td>0</td><td>94.08</td></tr><tr><td>256</td><td>8</td><td>2</td><td>5</td><td>594</td><td>0</td><td>95.21</td></tr><tr><td>256</td><td>8</td><td>2</td><td>7</td><td>643</td><td>0</td><td>95.35</td></tr><tr><td>256</td><td>8</td><td>2</td><td>9</td><td>709</td><td>0</td><td>95.00</td></tr><tr><td>256</td><td>8</td><td>2</td><td>11</td><td>791</td><td>0</td><td>95.14</td></tr><tr><td colspan="7">↓ Adding weight decay to the above</td></tr><tr><td>256</td><td>8</td><td>2</td><td>3</td><td>561</td><td>1×10-2</td><td>94.69</td></tr><tr><td>256</td><td>8</td><td>2</td><td>5</td><td>594</td><td>1×10-2</td><td>95.26</td></tr><tr><td>256</td><td>8</td><td>2</td><td>7</td><td>643</td><td>1×10-2</td><td>95.25</td></tr><tr><td>256</td><td>8</td><td>2</td><td>9</td><td>709</td><td>1×10-2</td><td>95.06</td></tr><tr><td>256</td><td>8</td><td>2</td><td>11</td><td>791</td><td>1×10-2</td><td>95.17</td></tr></table>
251
+
252
+ # D Weight Visualizations
253
+
254
+ ![](images/34c4c458dac64a0f25f4bc41849999a45d62f99c678aab00abd17122f57a6bf0.jpg)
255
+ Figure 5: Patch embedding weights for a ConvMixer-1024/20 with patch size 14 (see Table 2).
256
+
257
+ ![](images/8a01da05b0cb1fa5baa45d9a7d981e5fabb7c7218b769f27a18849730aa091ef.jpg)
258
+ Figure 6: Patch embedding weights for a ConvMixer-768/32 with patch size 7 (see Table 2).
259
+
260
+ ![](images/6c039c3854068f860f2a8e3bc97007307a7443f0644ab8198536220e0a41296b.jpg)
261
+ Figure 7: Random subsets of 64 depthwise convolutional kernels from progressively deeper layers of ConvMixer-1536/20 (Table 1).
262
+
263
+ In Figure 5 and 6, we visualize the (complete) weights of the patch embedding layers of a ConvMixer-1536/20 with $p = 1 4$ and a ConvMixer-768/32 with $p = 7$ , respectively. Much like Sandler et al. (2019), the layer consists of Gabor-like filters as well as “colorful globs” or rough edge detectors. The filters seem to be more structured than those learned by MLP-Mixer (Tolstikhin et al., 2021); also unlike MLP-Mixer, the weights look much the same going from $p = 1 4$ to $p = 7$ : the latter simply looks like a downsampled version of the former. It is unclear, then, why we see such a drop in accuracy for larger patches. However, some of the filters essentially look like noise, maybe suggesting a need for more regularization or longer training, or even more data. Ultimately, we cannot read too much into the learned representations here.
264
+
265
+ In Figure 7, we plot the hidden convolutional kernels for successive layers of a ConvMixer. Initially, the kernels seem to be relatively small, but make use of their allowed full size in later layers; there is a clear hierarchy of features as one would expect from a standard convolutional architecture. Interestingly, Touvron et al. (2021a) saw a similar effect for ResMLP, where earlier layers look like small-kernel convolution, while later layers were more diffuse, despite these layers being representated by an unconstrained matrix multiplication rather than convolution.
266
+
267
+ # E Implementation
268
+
269
+ def ConvMixer(h,d,k,p,n):
270
+ S,C,A=Sequential,Conv2d,lambda $\mathbf { x } : \mathbf { S } \left( \mathbf { x } \right.$ ,GELU(),BatchNorm2d(h))
271
+ R=type('',(S,),{'forward':lambda s,x:s[0] $( \mathbf { x } ) + \mathbf { x } \mathbf \}$ )
272
+ return S(A(C(3,h,p,p)), $^ *$ [S(R(A(C(h,h,k,groups $\mathbf { \tau } = \mathbf { h }$ ,padding=k//2))),A(C(h,h,1))) for i in range(d)], AdaptiveAvgPool2d(1),Flatten(),Linear ${ ( \ln , \ n ) }$ ) Figure 8: An implementation of our model in less than 280 characters, in case you happen to know of any means of disseminating information that could benefit from such a length.
273
+ All you need to do to run this is from torch.nn import \*.
274
+
275
+ We present an even more terse implementation of ConvMixer in Figure 8, which to the best of our knowledge is the first model that achieves the elusive dual goals of $8 2 \% +$ ImageNet top-1 accuracy while also fitting into a tweet.
parse/test/rAnB7JSMXL/rAnB7JSMXL_content_list.json ADDED
@@ -0,0 +1,632 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Convolutions Attention MLPs Patches Are All You Need? ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Asher Trockman, J. Zico Kolter1 Carnegie Mellon University and $^ 1$ Bosch Center for AI ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "Reviewed on OpenReview: https: // openreview. net/ forum? id= rAnB7JSMXL ",
16
+ "page_idx": 0
17
+ },
18
+ {
19
+ "type": "text",
20
+ "text": "Abstract ",
21
+ "text_level": 1,
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "Although convolutional neural networks have been the dominant architecture for computer vision for many years, Vision Transformers (ViTs) have recently shown promise as an alternative. Subsequently, many new models have been proposed which replace the self-attention layer within the ViT architecture with novel operations (such as MLPs), all of which have also been relatively performant. We note that these architectures all share a common component—the patch embedding layer—which enables the use of a simple isotropic template with alternating steps of channel- and spatial-dimension mixing. This raises a question: is the success of ViT-style models due to novel, highly-expressive operations like self-attention, or is it at least in part due to using patches? In this paper, we present some evidence for the latter: specifically, we propose the ConvMixer, an extremely simple and parameter-efficient fully-convolutional model in which we replace the self-attention and MLP layers within the ViT with less-expressive depthwise and pointwise convolutional layers, respectively. Despite its unusual simplicity, ConvMixer outperforms the ViT, MLP-Mixer, and their variants for similar data set sizes and parameter counts, in addition to outperforming classical vision models like ResNet. We argue that this contributes to the evidence that patches are sufficient for designing simple and effective vision models. Our code is available at https://github.com/locuslab/convmixer. ",
27
+ "page_idx": 0
28
+ },
29
+ {
30
+ "type": "text",
31
+ "text": "1 Introduction ",
32
+ "text_level": 1,
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "For many years, convolutional neural networks have been the dominant architecture for deep learning systems applied to computer vision tasks. But recently, architectures based upon Transformer models, e.g., the so-called VisionTransformer architecture (Dosovitskiy et al., 2020), have demonstrated compelling performance in many of these tasks, often outperforming classical convolutional architectures, especially for large data sets. An understandable assumption, then, is that it is only a matter of time before Transformers become the dominant architecture for vision domains, just as they have for language processing. In order to apply Transformers to images, however, the representation had to be changed: because the computational cost of the self-attention layers used in Transformers would scale quadratically with the number of pixels per image if applied naively at the per-pixel level, the compromise was to first split the image into multiple “patches”, linearly embed them, and then apply the transformer directly to this collection of patches. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "image",
42
+ "img_path": "images/e58882a1d37e4b57f11c0628a2dfc5a156ef3aa2472f9dc9d09f273c3a327b28.jpg",
43
+ "image_caption": [
44
+ "Figure 1: Acc. vs. params., trained $\\&$ tested on ImNet-1k; ResNets newly-trained (same procedure as ConvMixers). "
45
+ ],
46
+ "image_footnote": [],
47
+ "page_idx": 0
48
+ },
49
+ {
50
+ "type": "image",
51
+ "img_path": "images/68f171fa1a16778a07a02e7d03eb936cb07d02c7399720015a5f1a2f2d108e75.jpg",
52
+ "image_caption": [
53
+ "Figure 2: ConvMixer uses “tensor layout” patch embeddings to preserve locality, and then applies $d$ copies of a simple fully-convolutional block consisting of large-kernel depthwise convolution followed by pointwise convolution, before finishing with global pooling and a simple linear classifier. ",
54
+ "Figure 3: Implementation of ConvMixer in PyTorch; see Appendix E for more implementations. "
55
+ ],
56
+ "image_footnote": [],
57
+ "page_idx": 1
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "1 import torch.nn as nn 2 3 class Residual(nn.Module): 4 def __init__(self, fn): 5 super().__init__() 6 self.fn $=$ fn 7 8 def forward(self, x): 9 return self. $\\mathbf { f } \\mathbf { n } ( \\mathbf { x } ) ~ + ~ \\mathbf { x }$ 10 11 def ConvMixer(dim, depth, kernel_size $^ { = 9 }$ , patch_size $^ { = 7 }$ , n_classes 1000): 12 return nn.Sequential( 13 nn.Conv2d(3, dim, kernel_size=patch_size, stride=patch_size), 14 nn.GELU(), 15 nn.BatchNorm2d(dim), 16 $^ *$ [nn.Sequential( 17 Residual(nn.Sequential( 18 nn.Conv2d(dim, dim, kernel_size, groups $=$ dim, padding=\"same\"), 19 nn.GELU(), 20 nn.BatchNorm2d(dim) 21 )), 22 nn.Conv2d(dim, dim, kernel_size $^ { = 1 }$ ), 23 nn.GELU(), 24 nn.BatchNorm2d(dim) 25 ) for i in range(depth)], 26 nn.AdaptiveAvgPool2d((1,1)), 27 nn.Flatten(), 28 nn.Linear(dim, n_classes) 29 ) ",
62
+ "page_idx": 1
63
+ },
64
+ {
65
+ "type": "text",
66
+ "text": "Many subsequent works have modified the architecture of the ViT, replacing self-attention with novel operations and making other small changes, all of which have been relatively performant. These architectures follow a common and very simple “template”: they are isotropic, maintaining equal size and resolution throughout the network, and apply alternating steps of spatial and channel mixing. They also all use patch embeddings, which moves all downsampling to the beginning of the network and enables the simple, isotropic mixing design. ",
67
+ "page_idx": 1
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "In this work, we explore the question of whether, fundamentally, the strong performance of vision transformers may result more from this patch-based representation and its simplifying consequences for architecture design, than from the use of novel and highly-expressive operations such as self-attention and MLPs. We develop a very simple convolutional architecture which we dub the “ConvMixer” due to its similarity to the recently-proposed MLP-Mixer (Tolstikhin et al., 2021). This architecture is similar to the Vision Transformer (and MLP-Mixer) in many respects: it directly operates on patches, it maintains an equal-resolution-andsize representation throughout all layers, it does no downsampling of the representation at successive layers, and it separates “channel-wise mixing” from the “spatial mixing” of information. But unlike the Vision Transformer and MLP-Mixer, our architecture does all these operations via only standard convolutions. As depthwise and pointwise convolution are less expressive than self-attention and MLPs respectively, we believe this suggests that the patch-based isotropic mixing architecture is a powerful primitive that works well with almost any choice of well-behaved mixing operations. ",
72
+ "page_idx": 1
73
+ },
74
+ {
75
+ "type": "text",
76
+ "text": "",
77
+ "page_idx": 2
78
+ },
79
+ {
80
+ "type": "text",
81
+ "text": "The chief result we show in this paper is that this ConvMixer architecture, despite its extreme simplicity (it can be implemented in 280 characters of dense PyTorch code; see Appendix E), outperforms both “standard” computer vision models such as ResNets of similar parameter counts and some corresponding Vision Transformer and MLP-Mixer variants, even with a slate of additions intended to make those architectures more performant on smaller data sets. Importantly, this is despite the fact that we did not design our experiments to maximize accuracy nor speed, in contrast to the models we compared against. Our results suggest that, at least to some extent, the patch representation itself may be a critical component to the “superior” performance of newer architectures like Vision Transformers. While these results are naturally just a snapshot, and more experiments are required to exactly disentangle the effect of patch embeddings from other factors, we believe that this provides a strong “convolutional-but-patch-based” baseline to compare against for more advanced architectures in the future. ",
82
+ "page_idx": 2
83
+ },
84
+ {
85
+ "type": "text",
86
+ "text": "2 A simple model: ConvMixer ",
87
+ "text_level": 1,
88
+ "page_idx": 2
89
+ },
90
+ {
91
+ "type": "text",
92
+ "text": "Our model, dubbed ConvMixer, consists of a patch embedding layer followed by repeated applications of a simple fully-convolutional block. We maintain the spatial structure of the patch embeddings, as illustrated in Fig. 2. Patch embeddings with patch size $p$ and embedding dimension $h$ can be implemented as convolution with $c _ { \\mathrm { i n } }$ input channels, $h$ output channels, kernel size $p$ , and stride $p$ : ",
93
+ "page_idx": 2
94
+ },
95
+ {
96
+ "type": "equation",
97
+ "img_path": "images/16399192532b623c981c2f6e06effaf10a9f330a94aafe678aef882bc58a688a.jpg",
98
+ "text": "$$\nz _ { 0 } = \\mathsf { B N } ( \\sigma \\{ \\mathsf { C o n v } _ { c _ { \\mathrm { i n } } h } ( X , \\mathsf { s t r i d e } = p , \\mathsf { k s i z e } { = } p ) \\} )\n$$",
99
+ "text_format": "latex",
100
+ "page_idx": 2
101
+ },
102
+ {
103
+ "type": "text",
104
+ "text": "The ConvMixer block itself consists of depthwise convolution (i.e., grouped convolution with groups equal to the number of channels, $h$ ) followed by pointwise (i.e., kernel size $1 \\times 1$ ) convolution. As we will explain in Sec. 3, ConvMixers work best with unusually large kernel sizes for the depthwise convolution. Each of the convolutions is followed by an activation and post-activation BatchNorm: ",
105
+ "page_idx": 2
106
+ },
107
+ {
108
+ "type": "equation",
109
+ "img_path": "images/a82a9e4508e8fee137ed73bd67083169c99980644193ce3b15f1169e14433011.jpg",
110
+ "text": "$$\n\\begin{array} { r } { z _ { l } ^ { \\prime } = \\mathsf { B N } \\left( \\sigma \\{ \\mathsf { C o n v D e p t h w i s e } ( z _ { l - 1 } ) \\} \\right) + z _ { l - 1 } } \\\\ { z _ { l + 1 } = \\mathsf { B N } \\left( \\sigma \\{ \\mathsf { C o n v P o i n t w i s e } ( z _ { l } ^ { \\prime } ) \\} \\right) } \\end{array}\n$$",
111
+ "text_format": "latex",
112
+ "page_idx": 2
113
+ },
114
+ {
115
+ "type": "text",
116
+ "text": "After many applications of this block, we perform global pooling to get a feature vector of size $h$ , which we pass to a softmax classifier. See Fig. 3 for an implementation of ConvMixer in PyTorch. ",
117
+ "page_idx": 2
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "Design parameters. An instantiation of ConvMixer depends on four parameters: (1) the “width” or hidden dimension $h$ (i.e., the dimension of the patch embeddings), (2) the depth $d$ , or the number of repetitions of the ConvMixer layer, (3) the patch size $p$ which controls the internal resolution of the model, and (4) the kernel size $k$ of the depthwise convolutional layer. We name ConvMixers after their hidden dimension and depth, like ConvMixer- $h / d$ . We refer to the original input size $n$ divided by the patch size $p$ as the internal resolution; note, however, that ConvMixers support variable-sized inputs. ",
122
+ "page_idx": 2
123
+ },
124
+ {
125
+ "type": "text",
126
+ "text": "Motivation. Our architecture is based on the idea of mixing, as in Tolstikhin et al. (2021). In particular, we chose depthwise convolution to mix spatial locations and pointwise convolution to mix channel locations. A key idea from previous work is that MLPs and self-attention can mix distant spatial locations, i.e., they can have an arbitrarily large receptive field. Consequently, we used convolutions with an unusually large kernel size to mix distant spatial locations. ",
127
+ "page_idx": 2
128
+ },
129
+ {
130
+ "type": "text",
131
+ "text": "While self-attention and MLPs are theoretically more flexible, allowing for large receptive fields and contentaware behavior, the inductive bias of convolution is well-suited to vision tasks and leads to high data efficiency. By using such a standard operation, we also get a glimpse into the effect of the patch representation itself in contrast to the conventional pyramid-shaped, progressively-downsampling design of convolutional networks. ",
132
+ "page_idx": 2
133
+ },
134
+ {
135
+ "type": "table",
136
+ "img_path": "images/d2492575901fc88bd2fe2a7dfc6b508986a87320ed6e00f0ab44afd607f3040d.jpg",
137
+ "table_caption": [
138
+ "Table 1: Models trained and evaluated on $2 2 4 \\times 2 2 4$ ImageNet-1k only. See more in Appendix A. "
139
+ ],
140
+ "table_footnote": [],
141
+ "table_body": "<table><tr><td colspan=\"8\">Current“Most Interesting” ConvMixer Configurations us. Other Simple Models</td></tr><tr><td>Network</td><td>Pateh</td><td>Kernel1</td><td>#Param</td><td>Throughput</td><td>Act</td><td>#Epochs</td><td></td></tr><tr><td>ConvMixer-1536/20</td><td>7</td><td>9</td><td>51.6</td><td>134</td><td>G</td><td>150</td><td>81.37</td></tr><tr><td>ConvMixer-768/32</td><td>7</td><td>7</td><td>21.1</td><td>206</td><td>R</td><td>300</td><td>80.16</td></tr><tr><td>ConvMixer-1536/20</td><td>14</td><td>9</td><td>52.3</td><td>538</td><td>G</td><td>150</td><td>78.92</td></tr><tr><td>ResNet-152</td><td>1</td><td>3</td><td>60.2</td><td>828</td><td>R</td><td>150</td><td>79.64</td></tr><tr><td>DeiT-B</td><td>16</td><td>1</td><td>86</td><td>792</td><td>G</td><td>300</td><td>81.8</td></tr><tr><td>ResMLP-B24/8</td><td>8</td><td>1</td><td>129</td><td>181</td><td>G</td><td>400</td><td>81.0</td></tr></table>",
142
+ "page_idx": 3
143
+ },
144
+ {
145
+ "type": "text",
146
+ "text": "3 Experiments ",
147
+ "text_level": 1,
148
+ "page_idx": 3
149
+ },
150
+ {
151
+ "type": "text",
152
+ "text": "Training setup. We primarily evaluate ConvMixers on ImageNet-1k classification without any pretraining or additional data. We added ConvMixer to the timm framework (Wightman, 2019) and trained it with nearly-standard settings for the common training procedure from this library: we used RandAugment (Cubuk et al., 2020), mixup (Zhang et al., 2017), CutMix (Yun et al., 2019), random erasing (Zhong et al., 2020), and gradient norm clipping in addition to default timm augmentation. We used the AdamW (Loshchilov & Hutter, 2018) optimizer and a simple triangular learning rate schedule. Due to limited compute, we did virtually no hyperparameter tuning on ImageNet and trained for fewer epochs than competitors. Consequently, our models could be over- or under-regularized, and the accuracies we report likely underestimate the capabilities of our model. ",
153
+ "page_idx": 3
154
+ },
155
+ {
156
+ "type": "text",
157
+ "text": "Results. A ConvMixer-1536/20 with 52M parameters can achieve 81.4% top-1 accuracy on ImageNet, and a ConvMixer-768/32 with 21M parameters $8 0 . 2 \\%$ (see Table 1). Wider ConvMixers seem to converge in fewer epochs, but are more memory- and compute-hungry. They also work best with large kernel sizes: ConvMixer-1536/20 lost $\\approx 1 \\%$ accuracy when reducing the kernel size from $k = 9$ to $k = 3$ (we discuss kernel sizes more in Appendix A, B, & C). ConvMixers with smaller patches are substantially better in our experiments, similarly to Sandler et al. (2019); we believe larger patches require deeper ConvMixers. With everything held equal except increasing the patch size from 7 to 14, ConvMixer-1536/20 achieves $7 8 . 9 \\%$ top-1 accuracy but is around 4 $\\times$ faster. We trained one model with ReLU to demonstrate that GELU (Hendrycks & Gimpel, 2016), which is popular in recent isotropic models, isn’t necessary. ",
158
+ "page_idx": 3
159
+ },
160
+ {
161
+ "type": "text",
162
+ "text": "Comparisons. Our model and ImageNet1k-only training setup closely resemble that of recent patch-based models like DeiT (Touvron et al., 2020). Due to ConvMixer’s simplicity, we focus on comparing to only the most basic isotropic patch-based architectures adapted to the ImageNet-1k setting, namely DeiT and ResMLP. Attempting a fair comparison with a standard baseline, we trained ResNets using exactly the same parameters as ConvMixers; while this choice of parameters is suboptimal (Wightman et al., 2021), it is likely also suboptimal for ConvMixers, since we did no hyperparameter tuning aside from our recent adoption of hyperparameters from Wightman et al. (2021) for some models (presented separately in Appendix A). Looking at Table 1 and Fig. 1, ConvMixers achieve competitive accuracies for a given parameter budget: ConvMixer1536/20 outperforms both ResNet-152, ResMLP-B24, and DeiT-B despite having substantially fewer parameters. ConvMixer-768/32 uses just a third of the parameters of ResNet-152, but is similarly accurate. Note that unlike ConvMixer, the DeiT and ResMLP results involved hyperparameter tuning, and when substantial resources are dedicated to tuning ResNets, including training for twice as many epochs, they only outperform an equivalently-sized ConvMixer by $\\approx 0 . 2 \\%$ (Wightman et al., 2021). However, ConvMixers are substantially slower at inference than the competitors, likely due to their smaller patch size; hyperparameter tuning and optimizations could narrow this gap. For more discussion and comparisons, see Table 2 and Appendix A. ",
163
+ "page_idx": 3
164
+ },
165
+ {
166
+ "type": "text",
167
+ "text": "Hyperparameters. For almost all experiments presented in the main text, we used only one set of “common sense” hyperparameters for the regularization methods. Recently, we adapted hyperparameters from the A1 procedure in Wightman et al. (2021), published after our work, which were better than ",
168
+ "page_idx": 3
169
+ },
170
+ {
171
+ "type": "text",
172
+ "text": "our initial guess, e.g., giving $+ 0 . 8 \\%$ for ConvMixer-1536/20, or $8 2 . 2 \\%$ top-1 accuracy (see Appendix A). \nHowever, we note that such optimal ResNet hyperparameters are likely not optimal for ConvMixers. ",
173
+ "page_idx": 4
174
+ },
175
+ {
176
+ "type": "text",
177
+ "text": "Additional experiments. We present additional ImageNet experiments in Appendix B; notably, we provide more evidence for the advantage of large-kernel convolutions. We also performed smaller-scale experiments on CIFAR-10, where ConvMixers achieve over 96% accuracy with as few as 0.7M parameters, demonstrating the data efficiency of the convolutional inductive bias. Details of these experiments are presented in Appendix C. ",
178
+ "page_idx": 4
179
+ },
180
+ {
181
+ "type": "text",
182
+ "text": "4 Related work ",
183
+ "text_level": 1,
184
+ "page_idx": 4
185
+ },
186
+ {
187
+ "type": "text",
188
+ "text": "Isotropic architectures. Vision transformers have inspired a new paradigm of “isotropic” architectures, i.e., those with equal size and shape throughout the network, which use patch embeddings for the first layer. These models look similar to repeated transformer-encoder blocks (Vaswani et al., 2017) with different operations replacing the self-attention and MLP operations. For example, MLP-Mixer (Tolstikhin et al., 2021) replaces them both with MLPs applied across different dimensions (i.e., spatial and channel location mixing); ResMLP (Touvron et al., 2021a) is a data-efficient variation on this theme. CycleMLP (Chen et al., 2021), gMLP (Liu et al., 2021a), and vision permutator (Hou et al., 2021), replace one or both blocks with various novel operations. These are all quite performant, which is typically attributed to the novel choice of operations. In contrast, Melas-Kyriazi (2021) proposed an MLP-based isotropic vision model, and also hypothesized patch embeddings could be behind its performance. ResMLP tried replacing its linear interaction layer with (small-kernel) convolution and achieved good performance, but kept its MLP-based cross-channel layer and did not explore convolutions further. As our investigation of ConvMixers suggests, these works may conflate the effect of the new operations (like self-attention and MLPs) with the effect of the use of patch embeddings and the resulting isotropic architecture. ",
189
+ "page_idx": 4
190
+ },
191
+ {
192
+ "type": "text",
193
+ "text": "After our investigation, Liu et al. (2022) proposed an architecture similar to ConvMixer, the isotropic ConvNeXt. Similarly to our work, they provide evidence that the success of ViTs comes from design choices other than the use of self-attention, such as patches; however, ConvMixer goes a step further and eliminates even the MLPs, which suggests that neither of the original ViT operations are crucial to the success of the more general architecture design. Further, Yu et al. (2022) replaced self-attention with a simple pooling operation and demonstrated its effectiveness; they also argued this supports the effectiveness of the ViT template. In contrast, our work suggests the template is even more general, not even requiring MLPs. ",
194
+ "page_idx": 4
195
+ },
196
+ {
197
+ "type": "text",
198
+ "text": "A study predating vision transformers investigates isotropic (or “isometric”) MobileNets (Sandler et al., 2019), and even implements patch embeddings under another name. Their architecture simply repeats an isotropic MobileNetv3 block. They identify a tradeoff between patch size and accuracy that matches our experience, and train similarly performant models (see Appendix A, Table 2). However, their block is substantially more complex than ours; simplicity and motivation sets our work apart. ",
199
+ "page_idx": 4
200
+ },
201
+ {
202
+ "type": "text",
203
+ "text": "Patches aren’t all you need? Several papers have increased vision transformer performance by replacing standard patch embeddings with a different stem: Xiao et al. (2021) and Yuan et al. (2021a) use a standard convolutional stem, while Yuan et al. (2021b) repeatedly combines nearby patch embeddings. However, this conflates the effect of using patch embeddings with the effect of adding convolution or similar inductive biases e.g., locality. We attempt to focus on the use of patches. ",
204
+ "page_idx": 4
205
+ },
206
+ {
207
+ "type": "text",
208
+ "text": "CNNs meet ViTs. Many efforts have been made to incorporate features of convolutional networks into vision transformers and vice versa. Self-attention can emulate convolution (Cordonnier et al., 2019) and can be initialized or regularized to be like it (d’Ascoli et al., 2021); other works simply add convolution operations to transformers (Dai et al., 2021; Guo et al., 2021), or include downsampling to be more like traditional pyramid-shaped convolutional networks (Wang et al., 2021). Conversely, self-attention or attention-like operations can supplement or replace convolution in ResNet-style models (Bello et al., 2019; Ramachandran et al., 2019; Bello, 2021). While all of these attempts have been successful in one way or another, they are orthogonal to this work, which aims to emphasize the effect of the architecture common to most ViTs by showcasing it with a less-expressive operation. ",
209
+ "page_idx": 4
210
+ },
211
+ {
212
+ "type": "text",
213
+ "text": "5 Conclusion ",
214
+ "text_level": 1,
215
+ "page_idx": 5
216
+ },
217
+ {
218
+ "type": "text",
219
+ "text": "We presented ConvMixers, an extremely simple class of models that independently mixes the spatial and channel locations of patch embeddings using only standard convolutions. We also highlighted that using large kernel sizes, inspired by the large receptive fields of ViTs and MLP-Mixers, provides a substantial performance boost. While neither our model nor our experiments were designed to maximize accuracy or speed, i.e., we did not search for good hyperparameters, ConvMixers outperform the Vision Transformer and MLP-Mixer, and are competitive with ResNets, DeiTs, and ResMLPs. ",
220
+ "page_idx": 5
221
+ },
222
+ {
223
+ "type": "text",
224
+ "text": "We provided evidence that the increasingly common “isotropic” architecture with a simple patch embedding stem is itself a powerful template for deep learning. Patch embeddings allow all the downsampling to happen at once, immediately decreasing the internal resolution and thus increasing the effective receptive field size, making it easier to mix distant spatial information. Our title, while an exaggeration, points out that attention isn’t the only export from language processing into computer vision: tokenizing inputs, i.e., using patch embeddings, is also a powerful and important takeaway. ",
225
+ "page_idx": 5
226
+ },
227
+ {
228
+ "type": "text",
229
+ "text": "While our model is not state-of-the-art, we find its simple patch-mixing design to be compelling. We hope that ConvMixers can serve as a baseline for future patch-based architectures with novel operations, or that they can provide a basic template for new conceptually simple and performant models. ",
230
+ "page_idx": 5
231
+ },
232
+ {
233
+ "type": "text",
234
+ "text": "Given that such simple architectures as ConvMixer can be successful, we question the role of continued architecture searches; in particular, are more complicated architectures fundamentally better at modeling phenomena, or are they ultimately just more computationally efficient? Much of the variance in accuracies may be explained by more advanced training pipelines and augmentation techniques, as demonstrated by Wightman et al. (2021) and our work. ",
235
+ "page_idx": 5
236
+ },
237
+ {
238
+ "type": "text",
239
+ "text": "Future work. We are optimistic that a deeper ConvMixer with larger patches could reach a desirable tradeoff between accuracy, parameters, and throughput after longer training and more regularization and hyperparameter tuning, similarly to how Wightman et al. (2021) enhanced ResNet performance through carefully-designed training regimens. Low-level optimization of large-kernel depthwise convolution could substantially increase throughput, and small enhancements to our architecture like the addition of bottlenecks or a more expressive classifier could trade simplicity for performance. ",
240
+ "page_idx": 5
241
+ },
242
+ {
243
+ "type": "text",
244
+ "text": "Due to its large internal resolution and isotropic design, ConvMixer may be especially well-suited for semantic segmentation, and it would be useful to run experiments on this task with a ConvMixer-like model and on other tasks such as object detection. More experiments could be designed to more clearly extricate the effect of patch embeddings from other architectural choices. In particular, for a more in-depth comparison to ViTs and MLP-Mixers, which excel when trained on very large data sets, it is important to investigate the performance of ConvMixers in the regime of large-scale pre-training. ",
245
+ "page_idx": 5
246
+ },
247
+ {
248
+ "type": "text",
249
+ "text": "More work is necessary to extricate the effect of the patch embeddings from the rest of the architecture. In particular, we have preliminary evidence that it is not necessary to separate the spatial and channel mixing steps; patches followed by any stack of nonlinear operations (say, plain convolution) may be sufficient for simple, performant models. ",
250
+ "page_idx": 5
251
+ },
252
+ {
253
+ "type": "text",
254
+ "text": "Note on paper length. We acknowledge that this paper is shorter than most, and this is intentional. In the main text, we have presented our main thesis, proposed an extremely simple architecture used to validate the thesis, included a complete implementation, highlighted the results that we believe to be most relevant, and finished with concluding thoughts. The work here is very simple, and thus we believe that a short paper is ultimately more effective at conveying the main messages. While additional experiments and results are included in the appendix, we fully argue that the results in the main text are sufficient to establish our point, and that the supplementary material is genuinely of secondary importance. Hence, we felt the shorter length was more than sufficient. ",
255
+ "page_idx": 5
256
+ },
257
+ {
258
+ "type": "text",
259
+ "text": "References ",
260
+ "text_level": 1,
261
+ "page_idx": 5
262
+ },
263
+ {
264
+ "type": "text",
265
+ "text": "Irwan Bello. Lambdanetworks: Modeling long-range interactions without attention. arXiv preprint arXiv:2102.08602, 2021. ",
266
+ "page_idx": 5
267
+ },
268
+ {
269
+ "type": "text",
270
+ "text": "Irwan Bello, Barret Zoph, Ashish Vaswani, Jonathon Shlens, and Quoc V Le. Attention augmented convolutional networks. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 3286–3295, 2019. \nShoufa Chen, Enze Xie, Chongjian Ge, Ding Liang, and Ping Luo. Cyclemlp: A mlp-like architecture for dense prediction. arXiv preprint arXiv:2107.10224, 2021. \nJean-Baptiste Cordonnier, Andreas Loukas, and Martin Jaggi. On the relationship between self-attention and convolutional layers. arXiv preprint arXiv:1911.03584, 2019. \nEkin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical automated data augmentation with a reduced search space. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pp. 702–703, 2020. \nZihang Dai, Hanxiao Liu, Quoc V Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes. arXiv preprint arXiv:2106.04803, 2021. \nStéphane d’Ascoli, Hugo Touvron, Matthew Leavitt, Ari Morcos, Giulio Biroli, and Levent Sagun. Convit: Improving vision transformers with soft convolutional inductive biases. arXiv preprint arXiv:2103.10697, 2021. \nAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. \nJianyuan Guo, Kai Han, Han Wu, Chang Xu, Yehui Tang, Chunjing Xu, and Yunhe Wang. Cmt: Convolutional neural networks meet vision transformers. arXiv preprint arXiv:2107.06263, 2021. \nDan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016. \nQibin Hou, Zihang Jiang, Li Yuan, Ming-Ming Cheng, Shuicheng Yan, and Jiashi Feng. Vision permutator: A permutable mlp-like architecture for visual recognition, 2021. \nHanxiao Liu, Zihang Dai, David R So, and Quoc V Le. Pay attention to mlps. arXiv preprint arXiv:2105.08050, 2021a. \nZe Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows, 2021b. \nZhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, and Saining Xie. A convnet for the 2020s. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11976–11986, 2022. \nIlya Loshchilov and Frank Hutter. Fixing weight decay regularization in adam. 2018. \nLuke Melas-Kyriazi. Do you even need attention? a stack of feed-forward layers does surprisingly well on imagenet, 2021. \nPrajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jonathon Shlens. Stand-alone self-attention in vision models. arXiv preprint arXiv:1906.05909, 2019. \nMark Sandler, Jonathan Baccash, Andrey Zhmoginov, and Andrew Howard. Non-discriminative data or weak model? on the relative importance of data and model resolution. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, pp. 0–0, 2019. \nIlya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, et al. Mlp-mixer: An all-mlp architecture for vision. arXiv preprint arXiv:2105.01601, 2021. \nHugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020. \nHugo Touvron, Piotr Bojanowski, Mathilde Caron, Matthieu Cord, Alaaeldin El-Nouby, Edouard Grave, Armand Joulin, Gabriel Synnaeve, Jakob Verbeek, and Hervé Jégou. Resmlp: Feedforward networks for image classification with data-efficient training. arXiv preprint arXiv:2105.03404, 2021a. \nHugo Touvron, Matthieu Cord, Alexandre Sablayrolles, Gabriel Synnaeve, and Hervé Jégou. Going deeper with image transformers. arXiv preprint arXiv:2103.17239, 2021b. \nAshish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017. \nWenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv preprint arXiv:2102.12122, 2021. \nRoss Wightman. Pytorch image models. https://github.com/rwightman/pytorch-image-models, 2019. \nRoss Wightman, Hugo Touvron, and Hervé Jégou. Resnet strikes back: An improved training procedure in timm, 2021. \nTete Xiao, Mannat Singh, Eric Mintun, Trevor Darrell, Piotr Dollár, and Ross Girshick. Early convolutions help transformers see better. arXiv preprint arXiv:2106.14881, 2021. \nWeihao Yu, Mi Luo, Pan Zhou, Chenyang Si, Yichen Zhou, Xinchao Wang, Jiashi Feng, and Shuicheng Yan. Metaformer is actually what you need for vision. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10819–10829, 2022. \nKun Yuan, Shaopeng Guo, Ziwei Liu, Aojun Zhou, Fengwei Yu, and Wei Wu. Incorporating convolution designs into visual transformers. arXiv preprint arXiv:2103.11816, 2021a. \nLi Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zihang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. arXiv preprint arXiv:2101.11986, 2021b. \nSangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6023–6032, 2019. \nHongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017. \nZhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. Random erasing data augmentation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 13001–13008, 2020. ",
271
+ "page_idx": 6
272
+ },
273
+ {
274
+ "type": "text",
275
+ "text": "",
276
+ "page_idx": 7
277
+ },
278
+ {
279
+ "type": "text",
280
+ "text": "A Comparison to other models ",
281
+ "text_level": 1,
282
+ "page_idx": 8
283
+ },
284
+ {
285
+ "type": "table",
286
+ "img_path": "images/0f3236819096aa5f2a59cb65fd4532185b9b96fddad9ddd7a3c2ec5a36269adb.jpg",
287
+ "table_caption": [
288
+ "Table 2: Throughputs measured on an RTX8000 GPU using batch size 64 and fp16. ConvMixers and ResNets trained ourselves. Other statistics: DeiT (Touvron et al., 2020), ResMLP (Touvron et al., 2021a), Swin (Liu et al., 2021b), ViT (Dosovitskiy et al., 2020), MLP-Mixer (Tolstikhin et al., 2021), Isotropic MobileNets (Sandler et al., 2019). We think models with matching colored dots (•) are informative to compare with each other. †Throughput tested, but not trained. Activations: ReLU, GELU. $\\star$ Using new, better regularization hyperparameters based on Wightman et al. (2021)’s A1 procedure. "
289
+ ],
290
+ "table_footnote": [],
291
+ "table_body": "<table><tr><td colspan=\"8\">Comparison with other simple models trained on ImageNet-1k only with input size 224.</td></tr><tr><td>Network</td><td>Pateh</td><td>Kernel</td><td>Params</td><td>Throughput (img/sec)</td><td>Act</td><td>#Epochs</td><td></td></tr><tr><td>ConvMixer-1536/20★</td><td>7</td><td>9</td><td>51.6</td><td>134</td><td>G</td><td>150</td><td>82.20</td></tr><tr><td>ConvMixer-1536/20·</td><td>7</td><td>9</td><td>51.6</td><td>134</td><td>G</td><td>150</td><td>81.37</td></tr><tr><td>ConvMixer-1536/20*</td><td>7</td><td>3</td><td>49.4</td><td>246</td><td>G</td><td>150</td><td>81.60</td></tr><tr><td>ConvMixer-1536/20</td><td>7</td><td>3</td><td>49.4</td><td>246</td><td>G</td><td>150</td><td>80.43</td></tr><tr><td>ConvMixer-1536/20</td><td>14</td><td>9</td><td>52.3</td><td>538</td><td>G</td><td>150</td><td>78.92</td></tr><tr><td>ConvMixer-1536/24*</td><td>14</td><td>9</td><td>62.3</td><td>447</td><td>G</td><td>150</td><td>80.21</td></tr><tr><td>ConvMixer-768/32*</td><td>7</td><td>7</td><td>21.1</td><td>206</td><td>G</td><td>150</td><td>80.74</td></tr><tr><td>ConvMixer-768/32·</td><td>7</td><td>7</td><td>21.1</td><td>206</td><td>R</td><td>300</td><td>80.16</td></tr><tr><td>ConvMixer-1024/16</td><td>7</td><td>9</td><td>19.4 14.6</td><td>244</td><td>G G</td><td>100</td><td>79.45</td></tr><tr><td>ConvMixer-1024/12</td><td>7</td><td>8</td><td>5.4</td><td>358</td><td>G</td><td>90</td><td>77.75</td></tr><tr><td>ConvMixer-512/16</td><td>7</td><td>8</td><td></td><td>599</td><td>G</td><td>90</td><td>73.76</td></tr><tr><td>ConvMixer-512/12 ·</td><td>7</td><td>8</td><td>4.2 20.2</td><td>798 1235</td><td>R</td><td>90 300</td><td>72.59</td></tr><tr><td>ConvMixer-768/32</td><td>14</td><td>3</td><td>24.4</td><td>750</td><td>G</td><td></td><td>74.93</td></tr><tr><td>ConvMixer-1024/20·</td><td>14</td><td>9</td><td></td><td></td><td></td><td>150</td><td>76.94</td></tr><tr><td>ResNet-152*</td><td></td><td>3</td><td>60.2 60.2</td><td>828</td><td>R R</td><td>150</td><td>81.15</td></tr><tr><td>ResNet-152·</td><td></td><td>3</td><td>44.6</td><td>828 1187</td><td>R</td><td>150</td><td>79.64</td></tr><tr><td>ResNet-101· ResNet-50</td><td>一</td><td>3 3</td><td>25.6</td><td>1739</td><td>R</td><td>150 150</td><td>78.33 76.32</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DeiT-Bt</td><td>7</td><td></td><td>86.7</td><td>83</td><td>G</td><td></td><td>一</td></tr><tr><td>DeiT-St</td><td>7</td><td></td><td>22.1</td><td>174</td><td>G</td><td></td><td></td></tr><tr><td>DeiT-Tit</td><td>7</td><td></td><td>5.7</td><td>336</td><td>G</td><td></td><td></td></tr><tr><td>DeiT-B·</td><td>16</td><td></td><td>86</td><td>792</td><td>G</td><td>300</td><td>81.8</td></tr><tr><td>DeiT-S· DeiT-Ti·</td><td>16</td><td></td><td>22</td><td>1610</td><td>G</td><td>300</td><td>79.8</td></tr><tr><td></td><td>16</td><td></td><td>5.7</td><td>2603</td><td>G</td><td>300</td><td>72.2</td></tr><tr><td>ResMLP-S12/8 ·</td><td>8</td><td></td><td>22.1</td><td>872</td><td>G</td><td>400</td><td>79.1</td></tr><tr><td>ResMLP-B24/8· ResMLP-B24</td><td>8</td><td></td><td>129</td><td>181</td><td>G</td><td>400</td><td>81.0</td></tr><tr><td></td><td>16</td><td></td><td>116</td><td>1597</td><td>G</td><td>400</td><td>81.0</td></tr><tr><td>Swin-S·</td><td>4</td><td></td><td>50</td><td>576</td><td>G</td><td>300</td><td>83.0</td></tr><tr><td>Swin-T ·</td><td>4</td><td></td><td>29</td><td>878</td><td>G</td><td>300</td><td>81.3</td></tr><tr><td>ViT-B/16·</td><td>16</td><td></td><td>86</td><td>789</td><td>G</td><td>300</td><td>77.9</td></tr><tr><td>Mixer-B/16·</td><td>16</td><td></td><td>59</td><td>1025</td><td>G</td><td>300</td><td>76.44</td></tr><tr><td>Isotropic MobileNetv3·</td><td>8 16</td><td>3</td><td>20</td><td>355</td><td>R</td><td></td><td>80.6</td></tr><tr><td>Isotropic MobileNetv3·</td><td></td><td>3</td><td>20</td><td>1296</td><td>R</td><td></td><td>77.6</td></tr></table>",
292
+ "page_idx": 8
293
+ },
294
+ {
295
+ "type": "text",
296
+ "text": "Experiment overview. We did not design our experiments to maximize accuracy: We chose “common sense” parameters for timm and its augmentation settings, found that it worked well for a ConvMixer-1024/12, and stuck with them for the proceeding experiments. We admit this is not an optimal strategy, however, we were aware from our early experiments on CIFAR-10 that results seemed robust to various small changes. We did not have access to sufficient compute to attempt to tune hyperparameters for each model: e.g., larger ConvMixers could probably benefit from more regularization than we chose, and smaller ones from less regularization. Keeping the parameters the same across ConvMixer instances seemed more reasonable than guessing for each. ",
297
+ "page_idx": 9
298
+ },
299
+ {
300
+ "type": "text",
301
+ "text": "However, to some extent, we changed the number of epochs per model: for earlier experiments, we merely wanted a “proof of concept”, and used only 90–100 epochs. Once we saw potential, we increased this to 150 epochs and trained some larger models, namely ConvMixer-1024/20 with $p ~ = ~ 1 4$ patches and ConvMixer-1536/20 with $p \\ = \\ 7$ patches. Then, believing that we should explore deeper-but-less-wide ConvMixers, and knowing from CIFAR-10 that the deeper models converged more slowly, we trained ConvMixer-768/32s with $p = 1 4$ and $p = 7$ for 300 epochs. Of course, training time was a consideration: ConvMixer-1536/20 took about 9 days to train (on 10 $\\times$ RTX8000s) 150 epochs, and ConvMixer-768/32 is over twice as fast, making 300 epochs more feasible. ",
302
+ "page_idx": 9
303
+ },
304
+ {
305
+ "type": "text",
306
+ "text": "If anything, we believe that in the worst case, the lack of parameter tuning in our experiments resulted in underestimating the accuracies of ConvMixers. Further, due to our limited compute and the fact that large models (particularly ConvMixers) are expensive to train on large data sets, we generally trained our models for fewer epochs than competition like DeiT and ResMLP (see Table 2). ",
307
+ "page_idx": 9
308
+ },
309
+ {
310
+ "type": "text",
311
+ "text": "In this revision, we have added some additional results (denoted with a $\\star$ in Table 2) using hyperparameters loosely based on the precisely-crafted “A1 training procedure” from Wightman et al. (2021). In particular, we adjusted parameters for RandAug, Mixup, CutMix, Random Erasing, and weight decay to match those in the procedure. Importantly, we still only trained for 150 epochs, rather than the 600 epochs used in Wightman et al. (2021), and we did not use binary cross-entropy loss nor repeated augmentation. While we do not think optimal hyperparameters for ResNet would also be optimal for ConvMixer, these settings are significantly better than the ones we initially chose. This further highlights the capabilities of ConvMixers, and we are optimistic that further tuning could lead to still-better performance. Throughout the paper, we still refer to ConvMixers trained using our initial “one shot” selection of hyperparameters. ",
312
+ "page_idx": 9
313
+ },
314
+ {
315
+ "type": "text",
316
+ "text": "A note on throughput. We measured throughput using batches of 64 images in half precision on a single RTX8000 GPU, averaged over 20 such batches. In particular, we measured CUDA execution time rather than “wall-clock” time. We noticed discrepancies in the relative throughputs of models, e.g., Touvron et al. (2020) reports that ResNet-152 is 2 $\\times$ faster than DeiT-B, but our measurements show that the two models have nearly the same throughput. We therefore speculate that our throughputs may underestimate the performance of ResNets and ConvMixers relative to the transformers. The difference may be due to using RTX8000 rather than V100 GPUs, or other low-level differences. Our throughputs were similar for batch sizes 32 and 128. ",
317
+ "page_idx": 9
318
+ },
319
+ {
320
+ "type": "text",
321
+ "text": "ResNets. As a simple baseline to which to compare ConvMixers, we trained three standard ResNets using exactly the same training setup and parameters as ConvMixer-1536/20. We also trained ResNet- $1 5 2 ^ { \\star }$ using the new A1-based procedure for comparison against ConvMixer-1536/ $2 0 ^ { \\star }$ . Despite having fewer parameters and being architecturally much simpler, ConvMixers substantially outperform these ResNets in terms of accuracy. A possible confounding factor is that ConvMixers use GELU, which may boost performance, while ResNets use ReLU. In an attempt to rule out this confound, we used ReLU in a later ConvMixer768/32 experiment and found that it still achieved competitive accuracy. We also note that the choice of ReLU vs. GELU was not important on CIFAR-10 experiments (see Table 7). However, ConvMixers do have substantially less throughput. ",
322
+ "page_idx": 9
323
+ },
324
+ {
325
+ "type": "text",
326
+ "text": "DeiTs. We believe that DeiT is the most reasonable comparison in terms of vision transformers: It only adds additional regularization, as opposed to architectural additions in the case of CaiT (Touvron et al., 2021b), and is then essentially a “vanilla” ViT modulo the distillation token (we don’t consider distilled architectures). In terms of a fixed parameter budget, ConvMixers generally outperform DeiTs. For example, ConvMixer1536/20 is only $0 . 4 3 \\%$ less accurate than DeiT-B despite having over 30M fewer parameters; ConvMixer",
327
+ "page_idx": 9
328
+ },
329
+ {
330
+ "type": "text",
331
+ "text": "768/32 is $0 . 3 6 \\%$ more accurate than DeiT-S despite having 0.9M fewer parameters; and ConvMixer-512/16 is $0 . 3 9 \\%$ more accurate than DeiT-Ti for nearly the same number of parameters. Admittedly, none of the ConvMixers are very competitive in terms of throughput, with the closest being the ConvMixer-512/16 which is $4 \\times$ slower than DeiT-Ti. ",
332
+ "page_idx": 10
333
+ },
334
+ {
335
+ "type": "text",
336
+ "text": "A confounding factor is the difference in patch size between DeiT and ConvMixer; DeiT uses $p = 1 6$ while ConvMixer uses $p = 7$ . This means DeiT is substantially faster. However, ConvMixers using larger patches are not as competitive. While we were not able to train DeiTs with larger patch sizes, it is possible that they would outperform ConvMixers on the parameter count vs. accuracy curve; however, we tested their throughput for $p = 7$ , and they are even slower than ConvMixers. Given the difference between convolution and self-attention, we are not sure it is salient to control for patch size differences. ",
337
+ "page_idx": 10
338
+ },
339
+ {
340
+ "type": "text",
341
+ "text": "DeiTs were subject to more hyperparameter tuning than ConvMixers, as well as longer training times. They also used stochastic depth while we did not, which can in some cases contribute percent differences in model accuracy (Touvron et al., 2021a). It is therefore possible that further hyperparameter tuning and more epochs for ConvMixers could close the gap between the two architectures for large patches, e.g., $p = 1 6$ . ",
342
+ "page_idx": 10
343
+ },
344
+ {
345
+ "type": "text",
346
+ "text": "ResMLPs. Similarly to DeiT for ViT, we believe that ResMLP is the most relevant MLP-Mixer variant to compare against. Unlike DeiT, we can compare against instances of ResMLP with similar patch size: ResMLP-B24/8 has $p = 8$ patches, and underperforms ConvMixer-1536/20 by $0 . 3 7 \\%$ , despite having over twice the number of parameters; it also has similarly low throughput. ConvMixer-768/32 also outperforms ResMLP-S12/8 for millions fewer parameters, but 4 $\\times$ less throughput. ",
347
+ "page_idx": 10
348
+ },
349
+ {
350
+ "type": "text",
351
+ "text": "ResMLP did not significantly improve in terms of accuracy for halving the patch size from 16 to 8, which shows that smaller patches do not always lead to better accuracy for a fixed architecture and regularization strategy (e.g., training a $p = 8$ DeiT may be challenging). ",
352
+ "page_idx": 10
353
+ },
354
+ {
355
+ "type": "text",
356
+ "text": "Swin Transformers. While we intend to focus on the most basic isotropic, patch-based architectures for fair comparisons with ConvMixer, it is also interesting to compare to a more complicated model that is closer to state-of-the-art. For a similar parameter budget, ConvMixer is around 1.2-1.6% less accurate than the Swin Transformer, while also being 4-6 $\\times$ slower. However, considering we did not attempt to tune or optimize our model in any way, we find it surprising that an exceedingly simple patch-based model that uses only plain convolution does not lag too far behind Swin Transformer. ",
357
+ "page_idx": 10
358
+ },
359
+ {
360
+ "type": "text",
361
+ "text": "Isotropic MobileNets. These models are closest in design to ours, despite using a repeating block that is substantially more complex than the ConvMixer one. Despite this, for a similar number of parameters, we can get similar performance. Notably, isotropic MobileNets seem to suffer less from larger patch sizes than ConvMixers, which makes us optimistic that sufficient parameter tuning could lead to more performant large-patch ConvMixers. As Sandler et al. (2019) did not provide an implementation, we cannot be sure if ours is exactly the same; e.g., we were unsure if 5x5 stride-5 convolutions were replaced with 3x3 or 5x5 stride-1 convolutions, so we chose 3x3. The throughputs in Table 2 are based on our implementation. We also trained a patch-size-16 Isotropic MobileNet using exactly the same pipeline used for our ConvMixers, which achieved only $7 0 . 7 6 \\%$ accuracy. ",
362
+ "page_idx": 10
363
+ },
364
+ {
365
+ "type": "text",
366
+ "text": "Other models. We included ViT and MLP-Mixer instances in our table, though they are not competitive with ConvMixer, DeiT, or ResMLP, even though MLP-Mixer has comparable regularization to ConvMixer. That is, ConvMixer seems to outperform MLP-Mixer and ViT, while being closer to complexity to them in terms of design and training regime than the other competitors, DeiT and ResMLP. ",
367
+ "page_idx": 10
368
+ },
369
+ {
370
+ "type": "text",
371
+ "text": "Kernel size. While we found some evidence that larger kernels are better on CIFAR-10, we wanted to see if this finding transferred to ImageNet. Consequently, we trained our best-performing model, ConvMixer1536/20, with kernel size $k = 3$ rather than $k = 9$ . This resulted in a decrease of $0 . 9 4 \\%$ top-1 accuracy, which we believe is quite significant relative to the mere 2.2M additional parameters. However, $k = 3$ is substantially faster than $k = 9$ for spatial-domain convolution; we speculate that low-level optimizations could close the performance gap to some extent, e.g., by using implicit instead of explicit padding. Since large-kernel convolutions throughout a model are unconventional, there has likely been low demand for such optimizations. ",
372
+ "page_idx": 10
373
+ },
374
+ {
375
+ "type": "text",
376
+ "text": "B Additional Experiments on ImageNet ",
377
+ "text_level": 1,
378
+ "page_idx": 11
379
+ },
380
+ {
381
+ "type": "text",
382
+ "text": "In this section, we present additional experiments on ImageNet-1k. We primarily used ConvMixer-512/12 trained using the new A1-like ( $\\star$ ) technique. Note that the throughputs in this section were recorded using Tesla V100 GPUs, while those in Table 2 used RTX8000s (hence, the two measurements should not be compared across tables). ",
383
+ "page_idx": 11
384
+ },
385
+ {
386
+ "type": "table",
387
+ "img_path": "images/aeb84f9cd38e1967ce701dd4d15b819034fba4344df0e73decc6d778ab540b32.jpg",
388
+ "table_caption": [
389
+ "Table 3: We investigate the effect of different patch sizes on throughput and accuracy. Smaller patches result in higher accuracy at the expense of throughput. "
390
+ ],
391
+ "table_footnote": [],
392
+ "table_body": "<table><tr><td colspan=\"5\">Effect of Patch Size</td></tr><tr><td>Network</td><td>Patch</td><td>Kermel</td><td>Thrmghput</td><td>IN</td></tr><tr><td>ConvMixer-512/12</td><td>5</td><td>9</td><td>388</td><td>75.60</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>9</td><td>644</td><td>74.60</td></tr><tr><td>ConvMixer-512/12</td><td>9</td><td>9</td><td>1120</td><td>73.55</td></tr><tr><td>ConvMixer-512/12</td><td>12</td><td>9</td><td>1908</td><td>71.79</td></tr><tr><td>ConvMixer-512/12</td><td>16</td><td>9</td><td>2892</td><td>69.65</td></tr></table>",
393
+ "page_idx": 11
394
+ },
395
+ {
396
+ "type": "text",
397
+ "text": "Patch sizes. Larger patch sizes result in lower accuracy, while smaller patches increase accuracy. However, ConvMixers using smaller patches are substantially slower. For most of our experiments, we used $7 \\times 7$ patches; however, in some cases, it may be desirable to use slightly larger $9 \\times 9$ patches in exchange for a bit less accuracy (see Table 3). ",
398
+ "page_idx": 11
399
+ },
400
+ {
401
+ "type": "table",
402
+ "img_path": "images/e2ba351be5b875c8a63fed9ac924e5f63a6738e6ddb7a59e80e49448c5d6eac9.jpg",
403
+ "table_caption": [
404
+ "Table 4: We tested ConvMixers with ResNet-style stems and ResNets with patch embedding stems; in both cases, patch embeddings worked better. "
405
+ ],
406
+ "table_footnote": [],
407
+ "table_body": "<table><tr><td colspan=\"3\">Patch Embeddings vs. ResNet-Style Stems</td></tr><tr><td>Network</td><td>Stem</td><td></td></tr><tr><td>ResNet50 ResNet50</td><td>ResNet Stem Patches (4 × 4)</td><td>78.32 78.74</td></tr><tr><td>ConvMixer-512/12 ConvMixer-512/12</td><td>ResNet Stem Patches (12 × 12)</td><td>71.24 71.79</td></tr></table>",
408
+ "page_idx": 11
409
+ },
410
+ {
411
+ "type": "text",
412
+ "text": "Disentangling the effect of patches. We found that using a patch embedding stem with a ResNet improves accuracy relative to the default stem, while using a ResNet stem with a ConvMixer hurts accuracy (see Table 4). This provides some evidence that patches are a good choice of input representation, and may even improve the performance of existing models compared to their default input representation. For the ConvMixer, we used a ResNet stem with $1 2 \\times 1 2$ -kernel convolutions with stride 6 followed by max pooling; this ensured that ResNet-stem ConvMixer had the same internal resolution as the version using patches. ",
413
+ "page_idx": 11
414
+ },
415
+ {
416
+ "type": "text",
417
+ "text": "Kernel sizes. Here, we investigate whether larger kernel sizes are really beneficial to ConvMixers. In Table 5, we see that $9 \\times 9$ kernels strongly outperform $3 \\times 3$ kernels. This may be unsurprising, as the model with $9 \\times 9$ kernels has significantly more parameters; to control for this, we trained a ConvMixer-512/14 with $3 \\times 3$ kernels which has a comparable number of parameters. However, this still does not achieve the performance of the $9 \\times 9$ -kernel model. Further, conventional wisdom states that three stacked $3 \\times 3$ convolutional layers (with GELUs between the layers) has the same receptive field as $9 \\times 9$ convolution while being more expressive. Consequently, we replaced plain $3 \\times 3$ convolutions with three stacked 3 $\\times$ convolutions; however, this still did not surpass the accuracy of $9 \\times 9$ convolutions. Finally, using the same intuition, we stack three ConvMixer-512/12s and tried a ConvMixer-512/36; only then do we outperform large-kernel convolutions. This is perhaps unsurprising, given the 24 additional pointwise layers. ",
418
+ "page_idx": 11
419
+ },
420
+ {
421
+ "type": "table",
422
+ "img_path": "images/f693b92c4a8afc6787e4dbd9cf9f9e845088e4c98c9682e4b86d16f131b91f29.jpg",
423
+ "table_caption": [
424
+ "Table 5: Here, we investigate whether larger kernels are really more effective than smaller ones. Our results suggest that larger kernels are advantageous compared to a variety of “control” experiments. "
425
+ ],
426
+ "table_footnote": [],
427
+ "table_body": "<table><tr><td colspan=\"6\">Effect of Kernel Size</td></tr><tr><td>Network</td><td>Patch</td><td>Kernel</td><td>#Paras</td><td>Troghpgt</td><td>p-N</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>7</td><td>4.07</td><td>724</td><td>74.54</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>15</td><td>5.15</td><td>401</td><td>75.25</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>9</td><td>4.27</td><td>644</td><td>74.60</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>3</td><td>3.83</td><td>992</td><td>72.96</td></tr><tr><td>ConvMixer-512/14</td><td>7</td><td>3</td><td>4.37</td><td>856</td><td>74.03</td></tr><tr><td>ConvMier-512U convs)</td><td>7</td><td>3</td><td>3.95</td><td>732</td><td>74.53</td></tr><tr><td>ConvMixer-512/36</td><td>7</td><td>3</td><td>10.3</td><td>338</td><td>77.67</td></tr></table>",
428
+ "page_idx": 12
429
+ },
430
+ {
431
+ "type": "table",
432
+ "img_path": "images/3da3ada44edc5695bf2778b7d5a8120477ef43d94342c5f4745c9da6769bcce5.jpg",
433
+ "table_caption": [
434
+ "Table 6: We investigated choices of activation functions and normalization layers, as well as training with reduced data augmentation. While reducing augmentation improves performance on this small model, we did not adopt this change elsewhere. "
435
+ ],
436
+ "table_footnote": [],
437
+ "table_body": "<table><tr><td colspan=\"2\">Ablation of ConvMixer-512/12 on ImageNet</td></tr><tr><td>Ablation</td><td>ImNet Acc. (%)</td></tr><tr><td>Baseline</td><td>74.60</td></tr><tr><td>BatchNorm →LayerNorm GELU→ReLU</td><td>74.51</td></tr><tr><td>- Mixup and CutMix</td><td>74.44 75.65</td></tr><tr><td>-RandAug</td><td>75.26</td></tr></table>",
438
+ "page_idx": 12
439
+ },
440
+ {
441
+ "type": "text",
442
+ "text": "Architectural choices. In Table 6, we demonstrate that the choice of activation function (ReLU vs. \nGELU) and norm layer (BatchNorm vs. LayerNorm) does not have a large impact on performance. ",
443
+ "page_idx": 12
444
+ },
445
+ {
446
+ "type": "text",
447
+ "text": "Data augmentation. We also investigate removing some of the data augmentations from the A1 recipe (see Table 6). We saw a substantial performance boost from removing Mixup and CutMix, and to a lesser extent, RandAugment as well. This is likely due to the relatively small model used for the comparison (ConvMixer-512/12), for which this level of augmentation may be excessive. We did not adopt these changes for other experiments. For comparison, a DeiT trained exactly the same way as the baseline ConvMixer achieves $7 0 . 2 8 \\%$ accuracy, while a DeiT without RandAug, CutMix, and MixUp gets $6 9 . 6 5 \\%$ accuracy. That is, it seems augmentations are more important to DeiT than to ConvMixer. ",
448
+ "page_idx": 12
449
+ },
450
+ {
451
+ "type": "text",
452
+ "text": "Input size. Unlike ViTs, MLP-Mixers, ResMLPs, and other recent models, ConvMixers can handle variable input sizes with no modifications whatsoever. In Fig. 4, we show the effect of input size on the inference time of a ConvMixer-768/32 using a batch size of 32, averaged over 16 trials on an RTX 3080Ti GPU in half precision. Note the rapid growth of inference time for kernel sizes 7 and 9 compared to 3 and 5; we believe this shows that the underlying implementation of depthwise convolution is suboptimal for large kernel sizes. ",
453
+ "page_idx": 12
454
+ },
455
+ {
456
+ "type": "text",
457
+ "text": "C Additional Experiments on CIFAR-10 ",
458
+ "text_level": 1,
459
+ "page_idx": 12
460
+ },
461
+ {
462
+ "type": "text",
463
+ "text": "Residual connections. We experimented with leaving out one, the other, or both residual connections before settling on the current configuration, and consequently chose to leave out the second residual connection. Our baseline model without the connection achieves 95.88% accuracy, while including the connection reduces it to $9 4 . 7 8 \\%$ . Surprisingly, we see only a $0 . 3 1 \\%$ decrease in accuracy for removing all residual connections. We acknowledge that these findings for residual connections may not generalize to deeper ConvMixers trained on larger data sets. ",
464
+ "page_idx": 12
465
+ },
466
+ {
467
+ "type": "image",
468
+ "img_path": "images/41091f9d2ad52e02a197f45f8f13a06003c21c9c5ec3ac2680b1cc66769bc7d6.jpg",
469
+ "image_caption": [
470
+ "Figure 4: Inference time vs. input size for ConvMixer-768/32 with a variety of kernel sizes. "
471
+ ],
472
+ "image_footnote": [],
473
+ "page_idx": 13
474
+ },
475
+ {
476
+ "type": "text",
477
+ "text": "",
478
+ "page_idx": 13
479
+ },
480
+ {
481
+ "type": "table",
482
+ "img_path": "images/2cb4060f2216247c7b30b067277b0725de70c4606f13817c4a4b1fe147724474.jpg",
483
+ "table_caption": [
484
+ "Table 7: Small ablation study of training a ConvMixer-256/8 on CIFAR-10. "
485
+ ],
486
+ "table_footnote": [],
487
+ "table_body": "<table><tr><td colspan=\"2\">Ablation of ConvMixer-256/8 on CIFAR-10</td></tr><tr><td>Ablation</td><td>CIFAR-10</td></tr><tr><td>Baseline</td><td>95.88</td></tr><tr><td>- Residual in Eq. 2 + Residual in Eq. 3 BatchNorm →LayerNorm GELU→ReLU</td><td>95.57 94.78 94.44 95.51</td></tr><tr><td>- Mixup and CutMix - Random Erasing RandAug</td><td>95.92 95.24</td></tr></table>",
488
+ "page_idx": 13
489
+ },
490
+ {
491
+ "type": "text",
492
+ "text": "Normalization. Our model is conceptually similar to the vision transformer and MLP-Mixer, both of which use LayerNorm instead of BatchNorm. We attempted to use LayerNorm instead, and saw a decrease in performance of around 1% as well as slower convergence (see Table 7). However, this was for a relatively shallow model, and we cannot guarantee that LayerNorm would not hinder ImageNet-scale models to an even larger degree. We note that the authors of ResMLP also saw a relatively small increase in accuracy for replacing LayerNorm with BatchNorm, but for a larger-scale experiment (Touvron et al., 2021a). We conclude that BatchNorm is no more crucial to our architecture than other regularizations or parameter settings (e.g., kernel size). ",
493
+ "page_idx": 13
494
+ },
495
+ {
496
+ "type": "text",
497
+ "text": "Having settled on an architecture, we proceeded to adjust its parameters $h , d , p , k$ as well as weight decay on CIFAR-10 experiments. (Initially, we took the unconventional approach of excluding weight decay since we were already using strong regularization in the form of RandAug and mixup.) We acknowledge that tuning our architecture on CIFAR-10 does not necessarily generalize to performance on larger data sets, and that this is a limitation of our study. ",
498
+ "page_idx": 13
499
+ },
500
+ {
501
+ "type": "text",
502
+ "text": "C.1 Results ",
503
+ "text_level": 1,
504
+ "page_idx": 14
505
+ },
506
+ {
507
+ "type": "text",
508
+ "text": "ConvMixers are quite performant on CIFAR-10, easily achieving $> 9 1 \\%$ accuracy for as little as 100, 000 parameters, or $> 9 6 \\%$ accuracy for only 887, 000 parameters (see Table 8). With additional refinements e.g., a more expressive classifier or bottlenecks, we think that ConvMixer could be even more competitive. For all experiments, we trained for 200 epochs on CIFAR-10 with RandAug, mixup, cutmix, random erasing, gradient norm clipping, and the standard augmentations in timm. We remove some of these augmentations in Table 7, finding that RandAug and random scaling (“default” in timm) are very important, each accounting for over 3% of the accuracy. ",
509
+ "page_idx": 14
510
+ },
511
+ {
512
+ "type": "text",
513
+ "text": "Scaling ConvMixer. We adjusted the hidden dimension $h$ and the depth $d$ , finding that deeper networks take longer to converge while wider networks converge faster. That said, increasing the width or the depth is an effective way to increase accuracy; a doubling of depth incurs less compute than a doubling of width. The number of parameters in a ConvMixer is given exactly by: ",
514
+ "page_idx": 14
515
+ },
516
+ {
517
+ "type": "equation",
518
+ "img_path": "images/a62536eac0375c425d9638381b2852cb555efff5d549a3b0945785bc33dae9d9.jpg",
519
+ "text": "$$\n\\# \\mathsf { p a r a m s } = h [ d ( k ^ { 2 } + h + 6 ) + c _ { \\mathsf { i n } } p ^ { 2 } + n _ { \\mathsf { c l a s s e s } } + 3 ] + n _ { \\mathsf { c l a s s e s } } ,\n$$",
520
+ "text_format": "latex",
521
+ "page_idx": 14
522
+ },
523
+ {
524
+ "type": "text",
525
+ "text": "including affine scaling parameters in BatchNorm layers, convolutional kernels, and the classifier. ",
526
+ "page_idx": 14
527
+ },
528
+ {
529
+ "type": "text",
530
+ "text": "Kernel size. We initially hypothesized that large kernels would be important for ConvMixers, as they would allow the mixing of distant spatial information similarly to unconstrained MLPs or self-attention layers. We tried to investigate the effect of kernel size on CIFAR-10: we fixed the model to be a ConvMixer-256/8, and increased the kernel size by 2s from 3 to 15. ",
531
+ "page_idx": 14
532
+ },
533
+ {
534
+ "type": "text",
535
+ "text": "Using a kernel size of 3, the ConvMixer only achieves $9 3 . 6 1 \\%$ accuracy. Simply increasing it to 5 gives an additional $1 . 5 0 \\%$ accuracy, and further to 7 an additional $0 . 6 1 \\%$ . The gains afterwards are relatively marginal, with kernel size 15 giving an additional 0.28% accuracy. It could be that with more training iterations or more regularization, the effect of larger kernels would be more pronounced. Nonetheless, we concluded that ConvMixers benefit from larger-than-usual kernels, and thus used kernel sizes 7 or 9 in most of our later experiments. ",
536
+ "page_idx": 14
537
+ },
538
+ {
539
+ "type": "text",
540
+ "text": "It is conventional wisdom that large-kernel convolutions can be “decomposed” into stacked small-kernel convolutions with activations between them, and it is therefore standard practice to use $k = 3$ convolutions, stacking more of them to increase the receptive field size with additional benefits from nonlinearities. This raises a question: is the benefit of larger kernels in ConvMixer actually better than simply increasing the depth with small kernels? First, we note that deeper networks are generally harder to train, so by increasing the kernel size independently of the depth, we may recover some of the benefits of depth without making it harder for signals to “propagate back” through the network. To test this, we trained a ConvMixer-256/10 with $k = 3$ (698K parameters) in the same setting as a ConvMixer-256/8 with $k = 9$ (707K parameters), i.e., we increased depth in a small-kernel model to roughly match the parameters of a large-kernel model. The ConvMixer-256/10 achieved 94.29% accuracy (1.5% less), which provides more evidence for the importance of larger kernels in ConvMixers. Next, instead of fixing the parameter budget, we tripled the depth (using the intuition that 3 stacked $k = 3$ convolutions have the receptive field of a $k = 9$ convolution), giving a ConvMixer-256/24 with 1670K parameters, and got $9 5 . 1 6 \\%$ accuracy, i.e., still less. ",
541
+ "page_idx": 14
542
+ },
543
+ {
544
+ "type": "text",
545
+ "text": "Patch size. CIFAR-10 inputs are so small that we initially only used $p = 1$ , i.e., the patch embedding layer does little more than compute $h$ linear combinations of the input image. Using $p = 2$ , we see a reduction in accuracy of about $0 . 8 0 \\%$ ; this is a worthy tradeoff in terms of training and inference time. Further increasing the patch size leads to rapid decreases in accuracy, with only $9 2 . 6 1 \\%$ for $p = 4$ . ",
546
+ "page_idx": 14
547
+ },
548
+ {
549
+ "type": "text",
550
+ "text": "Since the “internal resolution” is decreased by a factor of $p$ when increasing the patch size, we assumed that larger kernels would be less important for larger $p$ . We investigated this by again increasing the kernel size from 3 to 11 for ConvMixer-256/8 with $p = 2$ : however, this time, the improvement going from 3 to 5 is only $1 . 1 3 \\%$ , and larger kernels than 5 provide only marginal benefit. ",
551
+ "page_idx": 14
552
+ },
553
+ {
554
+ "type": "text",
555
+ "text": "Weight decay. We did many of our initial experiments with minimal weight decay. However, this was not optimal: by tuning weight decay, we can get an additional $0 . 1 5 \\%$ of accuracy for no cost. Consequently, we used weight decay (without tuning) for our larger-scale experiments on ImageNet. ",
556
+ "page_idx": 14
557
+ },
558
+ {
559
+ "type": "table",
560
+ "img_path": "images/d09860b4487bb0e3326b09978009d2cdc8adb7b680bb9edf7d23c9dacb5ff30a.jpg",
561
+ "table_caption": [
562
+ "Table 8: An investigation of ConvMixer design parameters $h , d , p , k$ and weight decay on CIFAR-10 "
563
+ ],
564
+ "table_footnote": [],
565
+ "table_body": "<table><tr><td colspan=\"7\"> Tiny ConvMixers trained on CIFAR-10.</td></tr><tr><td>Width h</td><td>Depth d</td><td>Patch Size p</td><td>Kernel Size k</td><td># Params (×103)</td><td>Weight Decay</td><td>CIFAR-10 Acc. (%)</td></tr><tr><td>128</td><td>4</td><td>1</td><td>8</td><td>103</td><td>0</td><td>91.26</td></tr><tr><td>128</td><td>8</td><td>1</td><td>8</td><td>205</td><td>0</td><td>93.83</td></tr><tr><td>128</td><td>12</td><td>1</td><td>8</td><td>306</td><td>0</td><td>94.83</td></tr><tr><td>256</td><td>4</td><td>1</td><td>8</td><td>338</td><td>0</td><td>93.37</td></tr><tr><td>256</td><td>8</td><td>1</td><td>8</td><td>672</td><td>0</td><td>95.60</td></tr><tr><td>256</td><td>12</td><td>1</td><td>8</td><td>1006</td><td>0</td><td>96.39</td></tr><tr><td>256</td><td>16</td><td>1</td><td>8</td><td>1339</td><td>0</td><td>96.74</td></tr><tr><td>256</td><td>20</td><td>1</td><td>8</td><td>1673</td><td>0</td><td>96.67</td></tr><tr><td colspan=\"7\">{Kernel adjustments</td></tr><tr><td>256</td><td>8</td><td>1</td><td>3</td><td>559</td><td>0</td><td>93.61</td></tr><tr><td>256</td><td>8</td><td>1</td><td>5</td><td>592</td><td>0</td><td>95.19</td></tr><tr><td>256</td><td>8</td><td>1</td><td>7</td><td>641</td><td>0</td><td>95.80</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>0</td><td>95.88</td></tr><tr><td>256</td><td>8</td><td>1</td><td>11</td><td>788</td><td>0</td><td>95.70</td></tr><tr><td>256</td><td>8</td><td>1</td><td>13</td><td>887</td><td>0</td><td>96.04</td></tr><tr><td>256</td><td>8</td><td>1</td><td>15</td><td>1001</td><td>0</td><td>96.08</td></tr><tr><td colspan=\"7\">↓Patch adjustments</td></tr><tr><td></td><td>8</td><td>2</td><td>9</td><td>709</td><td>0</td><td>95.00</td></tr><tr><td>256 256</td><td>8</td><td>4</td><td>9</td><td>718</td><td>0</td><td>92.61</td></tr><tr><td>256</td><td>8</td><td>8</td><td>9</td><td>755</td><td>0</td><td>85.57</td></tr><tr><td colspan=\"7\">←Weight decay adjustments</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-1</td><td>95.88</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-2</td><td>96.03</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-3</td><td>95.76</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-4</td><td>95.63</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-5</td><td>95.88</td></tr><tr><td colspan=\"7\">↓ Kernel size adjustments when p = 2</td></tr><tr><td>256</td><td>8</td><td>2</td><td>3</td><td>561</td><td>0</td><td>94.08</td></tr><tr><td>256</td><td>8</td><td>2</td><td>5</td><td>594</td><td>0</td><td>95.21</td></tr><tr><td>256</td><td>8</td><td>2</td><td>7</td><td>643</td><td>0</td><td>95.35</td></tr><tr><td>256</td><td>8</td><td>2</td><td>9</td><td>709</td><td>0</td><td>95.00</td></tr><tr><td>256</td><td>8</td><td>2</td><td>11</td><td>791</td><td>0</td><td>95.14</td></tr><tr><td colspan=\"7\">↓ Adding weight decay to the above</td></tr><tr><td>256</td><td>8</td><td>2</td><td>3</td><td>561</td><td>1×10-2</td><td>94.69</td></tr><tr><td>256</td><td>8</td><td>2</td><td>5</td><td>594</td><td>1×10-2</td><td>95.26</td></tr><tr><td>256</td><td>8</td><td>2</td><td>7</td><td>643</td><td>1×10-2</td><td>95.25</td></tr><tr><td>256</td><td>8</td><td>2</td><td>9</td><td>709</td><td>1×10-2</td><td>95.06</td></tr><tr><td>256</td><td>8</td><td>2</td><td>11</td><td>791</td><td>1×10-2</td><td>95.17</td></tr></table>",
566
+ "page_idx": 15
567
+ },
568
+ {
569
+ "type": "text",
570
+ "text": "D Weight Visualizations ",
571
+ "text_level": 1,
572
+ "page_idx": 16
573
+ },
574
+ {
575
+ "type": "image",
576
+ "img_path": "images/34c4c458dac64a0f25f4bc41849999a45d62f99c678aab00abd17122f57a6bf0.jpg",
577
+ "image_caption": [
578
+ "Figure 5: Patch embedding weights for a ConvMixer-1024/20 with patch size 14 (see Table 2). "
579
+ ],
580
+ "image_footnote": [],
581
+ "page_idx": 16
582
+ },
583
+ {
584
+ "type": "image",
585
+ "img_path": "images/8a01da05b0cb1fa5baa45d9a7d981e5fabb7c7218b769f27a18849730aa091ef.jpg",
586
+ "image_caption": [
587
+ "Figure 6: Patch embedding weights for a ConvMixer-768/32 with patch size 7 (see Table 2). "
588
+ ],
589
+ "image_footnote": [],
590
+ "page_idx": 16
591
+ },
592
+ {
593
+ "type": "image",
594
+ "img_path": "images/6c039c3854068f860f2a8e3bc97007307a7443f0644ab8198536220e0a41296b.jpg",
595
+ "image_caption": [
596
+ "Figure 7: Random subsets of 64 depthwise convolutional kernels from progressively deeper layers of ConvMixer-1536/20 (Table 1). "
597
+ ],
598
+ "image_footnote": [],
599
+ "page_idx": 17
600
+ },
601
+ {
602
+ "type": "text",
603
+ "text": "In Figure 5 and 6, we visualize the (complete) weights of the patch embedding layers of a ConvMixer-1536/20 with $p = 1 4$ and a ConvMixer-768/32 with $p = 7$ , respectively. Much like Sandler et al. (2019), the layer consists of Gabor-like filters as well as “colorful globs” or rough edge detectors. The filters seem to be more structured than those learned by MLP-Mixer (Tolstikhin et al., 2021); also unlike MLP-Mixer, the weights look much the same going from $p = 1 4$ to $p = 7$ : the latter simply looks like a downsampled version of the former. It is unclear, then, why we see such a drop in accuracy for larger patches. However, some of the filters essentially look like noise, maybe suggesting a need for more regularization or longer training, or even more data. Ultimately, we cannot read too much into the learned representations here. ",
604
+ "page_idx": 17
605
+ },
606
+ {
607
+ "type": "text",
608
+ "text": "In Figure 7, we plot the hidden convolutional kernels for successive layers of a ConvMixer. Initially, the kernels seem to be relatively small, but make use of their allowed full size in later layers; there is a clear hierarchy of features as one would expect from a standard convolutional architecture. Interestingly, Touvron et al. (2021a) saw a similar effect for ResMLP, where earlier layers look like small-kernel convolution, while later layers were more diffuse, despite these layers being representated by an unconstrained matrix multiplication rather than convolution. ",
609
+ "page_idx": 17
610
+ },
611
+ {
612
+ "type": "text",
613
+ "text": "E Implementation ",
614
+ "text_level": 1,
615
+ "page_idx": 18
616
+ },
617
+ {
618
+ "type": "text",
619
+ "text": "def ConvMixer(h,d,k,p,n): \nS,C,A=Sequential,Conv2d,lambda $\\mathbf { x } : \\mathbf { S } \\left( \\mathbf { x } \\right.$ ,GELU(),BatchNorm2d(h)) \nR=type('',(S,),{'forward':lambda s,x:s[0] $( \\mathbf { x } ) + \\mathbf { x } \\mathbf \\}$ ) \nreturn S(A(C(3,h,p,p)), $^ *$ [S(R(A(C(h,h,k,groups $\\mathbf { \\tau } = \\mathbf { h }$ ,padding=k//2))),A(C(h,h,1))) for i in range(d)], AdaptiveAvgPool2d(1),Flatten(),Linear ${ ( \\ln , \\ n ) }$ ) Figure 8: An implementation of our model in less than 280 characters, in case you happen to know of any means of disseminating information that could benefit from such a length. \nAll you need to do to run this is from torch.nn import \\*. ",
620
+ "page_idx": 18
621
+ },
622
+ {
623
+ "type": "text",
624
+ "text": "",
625
+ "page_idx": 18
626
+ },
627
+ {
628
+ "type": "text",
629
+ "text": "We present an even more terse implementation of ConvMixer in Figure 8, which to the best of our knowledge is the first model that achieves the elusive dual goals of $8 2 \\% +$ ImageNet top-1 accuracy while also fitting into a tweet. ",
630
+ "page_idx": 18
631
+ }
632
+ ]
parse/test/rAnB7JSMXL/rAnB7JSMXL_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/rAnB7JSMXL/rAnB7JSMXL_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/u6jbcaCHqO/u6jbcaCHqO.md ADDED
@@ -0,0 +1,507 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SCIBENCH: EVALUATING COLLEGE-LEVEL SCIENTIFIC PROBLEM-SOLVING ABILITIES OF LARGE LANGUAGE MODELS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Recent advances in Large Language Models (LLMs) have demonstrated notable progress on many mathematical benchmarks. However, most of these benchmarks only contain problems grounded in junior and senior high school subjects, contain only multiple-choice questions, and are confined to a limited scope of elementary arithmetic operations. To address these issues, this paper introduces an expansive benchmark suite SCIBENCH that aims to systematically examine the reasoning capabilities required for solving complex scientific problems. SCIBENCH contains two carefully curated datasets: an open set featuring a range of collegiate-level scientific problems drawn from mathematics, chemistry, and physics textbooks, and a closed set comprising problems from undergraduate-level exams in computer science and mathematics. Based on the two datasets, we conduct an in-depth benchmarking study of five representative LLMs with various prompting strategies. The results reveal that current LLMs fall short of delivering satisfactory performance, with the best overall score of merely $3 5 . 8 0 \%$ . Furthermore, through a detailed user study, we categorize the errors made by LLMs into ten problem-solving abilities. Our analysis indicates that no single prompting strategy significantly outperforms the others and some strategies that demonstrate improvements in certain problemsolving skills could result in declines in other skills. We envision that SCIBENCH will catalyze further developments in the reasoning abilities of LLMs, thereby ultimately contributing to scientific research and discovery.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Recent advancements in Large Language Models (LLMs) have dramatically expanded the boundaries of artificial intelligence [1–8]. They have demonstrated outstanding performance in many mathematical reasoning tasks that are typically considered challenging even for well-educated individuals [9–13]. Notably, GPT-4 achieves a remarkable score of 163 out of 170 on GRE Quantitative Exam, placing it at the 80th percentile ranking [3].
12
+
13
+ While the remarkable improvements in these benchmark performances might suggest that LLMs are capable of performing mathematical reasoning tasks, we argue that this assertion might be overly optimistic due to the inherent limitations of the current benchmarks. Firstly, many existing benchmarks such as ScienceQA [14] and GSM8K [15] only contain problems grounded in grade-level subjects, thereby lacking enough complexity. Although other benchmarks like MATH [16] introduce high-school level problems, they only involve a restricted range of operations — addition, subtraction, multiplication, and exponentiation — which do not adequately assess the depth of reasoning abilities of LLMs. Secondly, recent works including MMLU [17], AGIEval [18], and CEval [19], despite introducing challenging problems that span a wide range of disciplines, mainly focus on multiplechoice questions without providing detailed solutions. This setup could inadvertently mislead benchmark evaluation, as it allows LLMs to guess the answers from candidate choices and appear knowledgeable in comprehending the questions. Moreover, the lack of detailed solutions prevents us from understanding the limitations of LLMs and discerning why they commit certain errors. Furthermore, these benchmarks often source problems from online material, where questions are closely followed by answers. As these problems could already be a part of the training data, the models, trained in an autoregressive manner, may directly predict the answer without genuinely understanding the problem. This potential data leakage provides a shortcut for LLM evaluation, further compromising its validity.
14
+
15
+ ![](images/996966c2dbfe123e1b8c6617e26bb21e6d1f0e2c28cd5a434dd3238d4320814a.jpg)
16
+ Figure 1: An example problem from Physical Chemistry with solutions generated under two prompting strategies. GPT-4 with Chain-of-Thought (CoT) prompting shows calculation errors, while GPT-4 that prompts Python as external tools misunderstands mathematical equations. Errors are highlighted in red and the corrections are shown in purple.
17
+
18
+ On the other hand, many studies propose various prompting strategies aimed at enhancing the reasoning abilities for mathematical problem solving. For example, the representative strategy chainof-thought (CoT) instructs LLMs using specific examples to generate step-by-step solutions that prompt deeper problem thinking [9, 20–22], while other strategies propose to enable LLMs to utilize external tools [23, 24] that improve the numerical computation capability. However, even these strategic approaches, each with its specific strengths, struggle to fully address complex scientific problems. Consider an example problem from college-level Physical Chemistry [25] that requires the use of the Planck distribution to derive certain quantities. As shown in Figure 1, LLMs with CoT prompts accurately generate the correct formula, but fail in the final numerical calculation. Further, when explicitly instructed to generate a Python program to solve this problem alongside the reasoning process of CoT, the LLM derives an incorrect equation, misplacing $\lambda _ { 1 }$ in the numerator rather than the denominator. This error illustrates that LLMs struggle to comprehend mathematical relationships when employing external tools. This example underscores the need for a fine-grained analysis of the essential skill set required for complex scientific problem solving.
19
+
20
+ To mitigate the aforementioned deficiencies in existing LLM evaluation, this paper introduces a novel college-level Scientific problem solving Benchmark, referred to as SCIBENCH. Our SCIBENCH contains two datasets of college-level scientific problems. The open dataset includes 695 problems collected from widely-used textbooks in college-level Chemistry, Physics, and Math courses. To simulate real-world evaluation, we also include a closed dataset that encompasses seven sets of midterm and final examination questions from three college courses in Computer Science and Mathematics. Distinct from existing benchmarks, all of the problems in SCIBENCH are open-ended, free-response questions. They require multiple steps of reasoning and the computation therein involve complex arithmetic operations such as differentiation and integration. To ensure the integrity of our evaluation, these datasets have been manually extracted from PDF documents and formatted into LaTeX documents, thereby minimizing the possibility of their leakage in LLM training data. Importantly, SCIBENCH also includes detailed solution steps, facilitating detailed error analysis.
21
+
22
+ Our evaluation includes five representative LLMs: two open-source models LLaMA-2-7B and LLaMA-2-70B, and three close-source models Claude2, GPT-3.5, and GPT-4, with various prompting strategies, including CoT, zero-shot learning, and few-shot learning. In addition, we also prompt LLMs to utilize external tools such as Python and Wolfram languages. The experimental results indicate that the complexity and difficulty of our dataset are sufficient to differentiate the performance levels of different LLMs. With the strongest configuration, which combines both CoT prompting and external tools, GPT-4 achieves an average score of $3 5 . 8 0 \%$ on the open dataset and $5 1 . 5 7 \%$ on the closed exam dataset. These results suggest a considerable potential for improvement in future LLMs.
23
+
24
+ Table 1: Comparison of SCIBENCH with other benchmarks. “Level” represents the grade level of problems. “Computation” represents the level of computational type that problems use. “Solution” represents whether datasets contain detailed solutions. “Type” represents the type of most problems provided in the dataset: “MT” denotes multiple-choice questions and “Free” denotes free-response questions. “Human” indicates whether the analysis process employs a human annotation process. “Auto” represents whether the analysis process uses an automatic annotation process.
25
+
26
+ <table><tr><td rowspan="2"> Benchmark</td><td colspan="4"></td><td colspan="4">FEew-Shot CoT</td><td colspan="2">Haunanysiato</td></tr><tr><td>Level</td><td>Domputation</td><td>Solution</td><td>Type</td><td>Zero-Shot</td><td></td><td></td><td>Tool</td><td></td><td></td></tr><tr><td>ScienceQA [14]</td><td>Grade 1-12</td><td>Algebra</td><td>Yes</td><td>MT</td><td>Yes</td><td>Yes</td><td>Yes</td><td>No</td><td>No</td><td>No</td></tr><tr><td>IconQA [26]</td><td>Grade 1-12</td><td>Algebra</td><td>No</td><td>MT</td><td>No</td><td>Yes</td><td>No</td><td>No</td><td>No</td><td>No</td></tr><tr><td>TabMWP [27]</td><td>Grade 1-12</td><td>Algebra</td><td>Yes</td><td>Free</td><td>No</td><td>Yes</td><td>No</td><td>No</td><td>No</td><td>No</td></tr><tr><td>GSM8K[15]</td><td>Grade 1-12</td><td>Algebra</td><td>Yes</td><td>Free</td><td>No</td><td>Yes</td><td>No</td><td>No</td><td>No</td><td>No</td></tr><tr><td>MATH [16]</td><td>High School</td><td>Exponentiation</td><td>Yes</td><td>Free</td><td>No</td><td>Yes</td><td>No</td><td>No</td><td>No</td><td>No</td></tr><tr><td>LILA [28]</td><td>High School</td><td>Exponentiation</td><td>Yes</td><td>Free</td><td>Yes</td><td>Yes</td><td>No</td><td>No</td><td>No</td><td>No</td></tr><tr><td>SciEval [29]</td><td>High School</td><td>Exponentiation</td><td>No</td><td>MT</td><td>Yes</td><td>Yes</td><td>Yes</td><td>No</td><td>No</td><td>No</td></tr><tr><td>MMLU [17]</td><td> High School + College</td><td>Exponentiation</td><td>No</td><td>MT</td><td>No</td><td>Yes</td><td>No</td><td>No</td><td>No</td><td>No</td></tr><tr><td>CEval[19]</td><td>High School + College</td><td>Differentiation</td><td>No</td><td>MT</td><td>No</td><td>Yes</td><td>Yes</td><td>No</td><td>No</td><td>No</td></tr><tr><td>AGIEval[18]</td><td>High School + College</td><td>Exponentiation</td><td>No</td><td>MT</td><td>Yes</td><td>Yes</td><td>Yes</td><td>No</td><td>Yes</td><td>No</td></tr><tr><td>TheroemQA [30]</td><td>College</td><td>Differentiation</td><td>No</td><td>Free</td><td>No</td><td>Yes</td><td>Yes</td><td>Yes</td><td>No</td><td>No</td></tr><tr><td>ScIBENCH</td><td>College</td><td>Differentiation</td><td>Yes</td><td>Free</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr></table>
27
+
28
+ In order to gain a comprehensive understanding of the limitations of LLMs in scientific problem solving, we propose a novel self-refinement method to uncover the deficient skills in the solutions made by LLMs. Firstly, we compare the correct solutions with the solutions generated by LLMs and, with the assistance of human annotators, summarize ten essential skills requisite for successful scientific problem-solving. These skills include proficiency in domain knowledge, mathematical reasoning, numerical calculation abilities, and comprehension of common sense concepts. Subsequently, we employ an LLM-empowered self-critic approach to automatically classify the lacking skills in the solutions made by the benchmarked LLMs under each experiment configuration. Our analysis finds that (1) although CoT significantly improves the calculation ability, it is less effective in other aspects; (2) prompts with the use of external tools could potentially compromise the other fundamental skills; (3) few-shot learning does not universally improve scientific problem-solving skills.
29
+
30
+ # 2 RELATED WORK
31
+
32
+ Recently, many benchmarks focus on assessing problem-solving skills of LLMs, particularly in scientific and mathematical domains [17, 18, 27, 28, 30–33]. GSM8K [15] is a widely used math dataset containing 8.5K grade school math word problems. ScienceQA [14] is a multimodal questionanswering dataset with accompanying lecture and explanation annotations. MATH [16] presents a challenging collection of 12.5K math problems gathered from math competitions. LILA [28] extends 20 datasets by including task instructions and Python program solutions. However, the majority of those benchmarks concentrates on the grade or high school level tasks involving basic arithmetic operations such as addition, multiplication, and exponentiation, rather than more sophisticated operations like differentiation. TheroemQA [30] is a theorem-oriented dataset comprising 800 high-quality questions that aim to evaluate the ability of LLMs to apply theorems to solve problems. However, it lacks an in-depth qualitative analysis of their benchmark. Galactica [34] provides a set of scientific tasks, including LaTeX equation conversions, domain knowledge probes, citation prediction and chemical QA. BIG-Bench [35] is a large-scale general-purpose test suite comprising 204 multiple-choice or exact-match tasks, while BIG-Bench [36] Hard poses particularly challenging chain-of-thought prompts. C-EVAL [19] focuses on evaluating LLMs in Chinese, offering questions from humanities to science and engineering. SciEval [29] includes a mix of objective and subjective questions across multiple scientific fields to assess understanding, application, and research capabilities. AGIEval [18] evaluates the performance of LLMs in human-centric standardized exams, such as college entrance exams and lawyer qualification tests. It also provides human annotated qualitative analysis to analyze the capabilities of the model. However, relying on human labor for direct solution analysis can be costly. Our evaluation protocol, based on predefined fundamental problem solving skills, enables automated classification of deficient skills for each incorrectly answered question. This approach enables an affordable, large-scale of qualitative analysis over model solutions. We include the comparison between different benchmarks in Table 1.
33
+
34
+ Table 2: Summary of the open textbook dataset. We report the number of problems and the ratio of problems with detailed solutions in the fourth and fifth columns respectively.
35
+
36
+ <table><tr><td>Subject</td><td>Title</td><td>Acronym</td><td>#Problems</td><td>%Solutions</td></tr><tr><td rowspan="3">Physics</td><td>Fundamentalsof Physics [37]</td><td>fund</td><td>83</td><td>12.0%</td></tr><tr><td>Statistical Thermodynamics [38]</td><td>thermo</td><td>84</td><td>20.2%</td></tr><tr><td>Classical Dynamics of Particles and Systems [39]</td><td>class</td><td>54</td><td>13.0%</td></tr><tr><td rowspan="4"> Chemistry</td><td> Quantum Chemistry [40]</td><td> quan</td><td>42</td><td>19.0%</td></tr><tr><td>Qugmtum Chemistyta41</td><td></td><td></td><td>18.0%</td></tr><tr><td></td><td>chemms</td><td>48</td><td></td></tr><tr><td> Physical Chemistry, Quanta, Matter, and Change [25]</td><td> matter</td><td>59</td><td>16.9%</td></tr><tr><td rowspan="3">Math</td><td>Calculus: Early Transcendentals [43]</td><td>calc</td><td>52</td><td>19.2%</td></tr><tr><td>Probability and Statistical Inference [44]</td><td>stat</td><td>95</td><td>21.1%</td></tr><tr><td>Elementary Differential Equations and Boundary Value Problems [45]</td><td>diff</td><td>55</td><td>9.1%</td></tr></table>
37
+
38
+ # 3 THE SCIBENCH DATASET
39
+
40
+ To evaluate the capabilities and analyze the limitations of Large Language Models (LLMs) to solve scientific computing problems, we collect a new dataset consisting of college-level textbooks and course exams in a variety of domains. This section details the dataset construction process.
41
+
42
+ Data selection. Our dataset aims to improve the previous benchmarks by including more challenging problems, which require more reasoning steps, and more advanced types of computations. Specifically, the selected dataset should fulfill the following requirements:
43
+
44
+ • Inclusion of college-level problems. The chosen problems demand a solid understanding of domain-specific knowledge, proficiency in reasoning capability, adept calculation skills, and the ability to comprehend complex concepts.
45
+ • Inclusion of detailed solutions. To facilitate a thorough analysis of the limitations of LLMs, detailed solutions should be provided as well, which could facilitate a finer-grained examination of the capacity of LLMs to handle complex problem-solving tasks.
46
+ • Inaccessibility in text formats. To ensure an unbiased evaluation, questions should not be readily accessible online and cannot be easily extracted or transformed into text. This aims to mitigate any potential information leakage from the exposure of LLMs to pre-existing online question banks, such as those found in standardized tests like the SAT exams.
47
+ • Enabling of assessing advanced problem solving ability. The problems to benchmark should not be confined to basic arithmetic operations like addition and multiplication. Rather, they should enable evaluating the capability of LLMs in performing advanced computations such as integration and differentiation, particularly when dealing with exceptionally small or large floating numbers.
48
+
49
+ Accordingly, we select ten textbooks that have been extensively used in college courses as the open textbook dataset from three scientific fields Physics, Chemistry, and Math. We report the number of problems and the ratio of problems with detailed solutions of each title in Table 2. For brevity, we will be using their acronyms when referring to specific textbooks throughout the paper. Furthermore, in order to simulate real-world evaluation, we collect a closed set of exam questions from college courses from Computer Science and Math departments, including Data Mining, Machine Learning, and Differential Equations. The statistics of the problems in each exam is detailed in Table 3. We refer readers of interest to Appendix A for details on these textbooks and exams.
50
+
51
+ To reduce the likelihood of correct answers being merely guessed from candidates, we choose to mainly include questions with more challenging, free-response answers, rather than multiple-choice questions in previous works [14, 30, 46]. In order to facilitate standardized and automated evaluation, we focus on answers that only contain single numerical numbers to avoid ambiguity for the textbook dataset. Further, we convert the answer to floating-point numbers rounded to three decimal places. For example, the answer 2π will be converted to the decimal representation of 0.450. We also treat scientific notation as a unit to avoid overflow issues. For example, if the answer is $2 . 2 \times 1 0 ^ { - 3 1 } \mathrm { m }$ we take 2.2 as the final answer and $1 0 ^ { - 3 1 }$ m as the unit.
52
+
53
+ Table 3: Statistics of the close exam dataset. We report the number of problem instances in each exam and the ratio of problems in the exam that include detailed solutions. We further report the ratio of problems in different formats, including free-response, multiple-choice, and true-false. For reference, the number in parentheses denotes the grading points assigned to the problems.
54
+
55
+ <table><tr><td rowspan="2"></td><td colspan="2">DataMining</td><td colspan="2">Machine Learning</td><td colspan="3">DifferentialEquations</td></tr><tr><td>Midterm</td><td>Final</td><td>Midterm</td><td>Final</td><td>Exam 1</td><td>Exam 2</td><td>Final</td></tr><tr><td>#Problems</td><td>25 (90)</td><td>24 (75)</td><td>12 (56)</td><td>16 (75)</td><td>8(100)</td><td>8(100)</td><td>11 (95)</td></tr><tr><td>% Solutions</td><td>56.0% (58)</td><td>16.7% (19)</td><td>100.0% (56)</td><td>31.2% (26)</td><td>100.0% (100)</td><td>100.0% (100)</td><td>90.9% (90)</td></tr><tr><td>% Free-response</td><td>40.0% (46)</td><td>33.3% (29)</td><td>66.7% (38)</td><td>81.3% (62)</td><td>100.0% (100)</td><td>100.0% (100)</td><td>90.9% (90)</td></tr><tr><td> % Multiple-choice</td><td>28.0% (28)</td><td>29.2% (28)</td><td>33.3% (18)</td><td>18.7% (13)</td><td>0.0% (0)</td><td>0.0% (0)</td><td>9.1% (5)</td></tr><tr><td>% True-false</td><td>32.0% (16)</td><td>37.5% (18)</td><td>0.0% (0)</td><td>0.0% (0)</td><td>0.0% (0)</td><td>0.0% (0)</td><td>0.0% (0)</td></tr></table>
56
+
57
+ Data preprocessing. We collect each problem from the original textbooks in PDF documents and manually process them into LaTeX documents using an OCR tool Mathpix. The data is manually collected by human annotators using a web-based annotation tool [46], whose user interface is shown in Appendix B. All problems are carefully verified by human annotators to ensure that LaTeX documents can be compiled without any syntax errors. For reference, we also provide the original numbers in textbooks. For every problem, we provide the answer in two forms: the numerical value and the corresponding LaTeX expression with mathematical notations retained (e.g., 0.450 and ${ \frac { \sqrt { 2 } } { \pi } } .$ ); the unit of each answer is saved as a separate attribute. The detailed step-by-step solutions are also provided in LaTeX. For problems having multiple answers, we either keep only the first subproblem and discard the remaining subproblems or convert each subproblem into a separate problem.
58
+
59
+ # 4 EXPERIMENTS
60
+
61
+ # 4.1 EXPERIMENT SETUP
62
+
63
+ We evaluate three close-source LLMs: Claude2 (claude2) [47], GPT-3.5 (gpt-3.5-turbo) [2], GPT-4 (gpt-4) [3], along with two open LLMs: LLaMA-2-7B (llama-2-7b-chat) and LLaMA-2- 70B (llama-2-70b-chat) [48] on two benchmark datasets. We consider two prompting strategies, including the Chain-of-Thought (CoT) prompting and prompting to use external tools, under both zero-shot and few-shot learning paradigms.
64
+
65
+ • Zero-shot and few-shot learning. In the zero-shot learning setting, models are not provided with any prior examples, which evaluates their inherent problem-solving capabilities with background knowledge and reasoning abilities. In the few-shot setting, a few of examples are given to the models before the test example. This aims to assess their capability to learn new information from the demonstrations and incorporate it into their problem-solving processes.
66
+
67
+ • Prompting-based approaches. In the zero-shot setting, we evaluate both with and without the system prompt, which describes the types and categories of questions, along with instructions; all other settings incorporate the system prompt. Additionally, we utilize CoT as our prompting strategy in the zero-shot setting. Besides, we further explore an answer-only strategy in the few-shot setting, where the prompt solely provides questions and answers without any intermediate solutions.
68
+
69
+ • Tool-augmented approaches. Given that LLMs are limited to acquiring exact knowledge and performing precise calculations, some recent approaches, such as Toolformer [23] and Chameleon [24], explored the use of external tools to enhance the capabilities of solving complex reasoning tasks. In line with this approach and acknowledging the limitations of LLMs in performing precise calculations, we also include a setting that prompts the model to convert its solution steps in natural language into either Wolfram Language2 or Python code, aiming to achieve more accurate results for certain computation steps. This prompt is only tested in the few-shot learning setting. We manually construct Python and Wolfram Language code that produces the correct answer.
70
+
71
+ In summary, we consider seven combinations of prompting strategies and learning paradigms: zeroshot learning without the system prompt $( Z e r o { - } S )$ , zero-shot learning with the system prompt (Zero), few-shot learning $( F e w )$ , CoT prompting under zero-shot $( Z e r o { + } C o T )$ and few-shot learning $( F e w { + } C o T )$ scenarios, few-shot learning that prompts to use Python $( F e w { + } P y )$ , and Wolfram
72
+
73
+ Table 4: Experimental results in terms of accuracy $( \% )$ on the textbook dataset. The best performing score is highlighted in bold and second-best is underlined.
74
+
75
+ <table><tr><td rowspan="2">Model</td><td rowspan="2"> Setting</td><td colspan="4">Chemistry</td><td colspan="3">Physics</td><td colspan="3">Math</td><td rowspan="2">Avg.</td></tr><tr><td>atkins</td><td>chemmc</td><td>quan</td><td>matter</td><td>fund</td><td>class</td><td>thermo</td><td>diff</td><td>stat</td><td>calc</td></tr><tr><td rowspan="7">LLaMA-2-7B</td><td>Zero-S</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>1.37</td><td>0.00</td><td>0.00</td><td>2.00</td><td>2.67</td><td>4.76</td><td>0.60</td></tr><tr><td>Zero</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>1.37</td><td>0.00</td><td>0.00</td><td>2.00</td><td>5.33</td><td>0.00</td><td>0.60</td></tr><tr><td>Zero+CoT</td><td>0.00</td><td>2.56</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>4.00</td><td>0.00</td><td>0.40</td></tr><tr><td>Few</td><td>3.74</td><td>5.13</td><td>5.99</td><td>2.04</td><td>4.11</td><td>0.00</td><td>1.49</td><td>6.00</td><td>8.00</td><td>0.00</td><td>2.20</td></tr><tr><td>Few+CoT</td><td>1.87</td><td>5.13</td><td>2.94</td><td>0.00</td><td>5.48</td><td>0.00</td><td>0.00</td><td>0.00</td><td>12.00</td><td>7.14</td><td>2.10</td></tr><tr><td>Few+Py</td><td>0.93</td><td>2.56</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>6.67</td><td>0.00</td><td>0.70</td></tr><tr><td>Few+Wol</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td rowspan="7">LLaMA-2-70B</td><td>Zero-S</td><td>1.87</td><td>2.56</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>2.67</td><td>0.00</td><td>0.50</td></tr><tr><td>Zero</td><td>1.87</td><td>2.56</td><td>0.00</td><td>0.00</td><td>1.40</td><td>0.00</td><td>0.00</td><td>0.00</td><td>10.70</td><td>4.76</td><td>1.41</td></tr><tr><td> Zero+CoT</td><td>0.93</td><td>2.56</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>1.49</td><td>0.00</td><td>10.70</td><td>0.00</td><td>1.10</td></tr><tr><td>Few</td><td>9.30</td><td>12.83</td><td>14.71</td><td>2.04</td><td>15.07</td><td>6.38</td><td>2.94</td><td>8.00</td><td>21.33</td><td>9.52</td><td>6.09</td></tr><tr><td>Few+CoT</td><td>13.10</td><td>12.83</td><td>14.71</td><td>4.08</td><td>12.33</td><td>0.00</td><td>0.00</td><td>0.00</td><td>13.30</td><td>9.52</td><td>4.90</td></tr><tr><td>Few+Py</td><td>0.93</td><td>7.69</td><td>2.94</td><td>0.00</td><td>9.59</td><td>0.00</td><td>1.49</td><td>0.00</td><td>17.30</td><td>9.52</td><td>2.99</td></tr><tr><td>Few+Wol</td><td>1.87</td><td>0.00</td><td>0.00</td><td>0.00</td><td>1.39</td><td>0.00</td><td>0.00</td><td>2.00</td><td>5.33</td><td>11.90</td><td>1.30</td></tr><tr><td rowspan="8">Claude2</td><td>Zero-S</td><td>16.82</td><td>17.95</td><td>8.82</td><td>8.16</td><td>6.85</td><td>12.77</td><td>7.46</td><td>4.00</td><td>37.33</td><td>9.52</td><td>8.20</td></tr><tr><td>Zero</td><td>15.00</td><td>12.83</td><td>14.71</td><td>10.20</td><td>12.33</td><td>6.40</td><td>9.00</td><td>4.00</td><td>38.70</td><td>16.70</td><td>8.71</td></tr><tr><td>Zero+CoT</td><td>20.56</td><td>15.38</td><td>8.82</td><td>4.08</td><td>8.23</td><td>4.26</td><td>5.97</td><td>6.00</td><td>36.00</td><td>14.29</td><td>8.10</td></tr><tr><td>Few</td><td>15.87</td><td>20.51</td><td>8.82</td><td>8.16</td><td>6.85</td><td>10.64</td><td>8.51</td><td>4.00</td><td>32.00</td><td>11.90</td><td>6.09</td></tr><tr><td>Few+CoT</td><td>15.89</td><td>25.64</td><td>14.65</td><td>6.12</td><td>9.59</td><td>6.38</td><td>10.45</td><td>8.00</td><td>33.33</td><td>19.05</td><td>8.90</td></tr><tr><td>Few+Py</td><td>6.54</td><td>12.82</td><td>14.71</td><td>4.08</td><td>17.81</td><td>8.51</td><td>5.97</td><td>20.00</td><td>40.00</td><td>16.67</td><td>8.70</td></tr><tr><td>Few+Wol</td><td>9.35</td><td>0.00</td><td>2.94</td><td>0.00</td><td>1.39</td><td>0.00</td><td>0.00</td><td>2.00</td><td>5.33</td><td>11.90</td><td>2.20</td></tr><tr><td>Zero-S</td><td>8.41</td><td>28.21</td><td>5.88</td><td>4.08</td><td>12.33</td><td>2.13</td><td>5.97</td><td>4.00</td><td>21.33</td><td>13.95</td><td>10.62</td></tr><tr><td rowspan="7">GPT-3.5</td><td>Zero</td><td>4.67</td><td>20.51</td><td>8.82</td><td>2.04</td><td>10.96</td><td>2.13</td><td>2.94</td><td>6.00</td><td>28.00</td><td>9.30</td><td>9.59</td></tr><tr><td> Zero+CoT</td><td>6.54</td><td>23.08</td><td>2.94</td><td>10.20</td><td>12.33</td><td>2.12</td><td>5.97</td><td>12.00</td><td>33.33</td><td>9.30</td><td>12.17</td></tr><tr><td>Few</td><td>5.61</td><td>15.38</td><td>11.76</td><td>4.08</td><td>8.22</td><td>0.00</td><td>1.49</td><td>10.00</td><td>26.67</td><td>13.95</td><td>9.60</td></tr><tr><td>Few+CoT</td><td>8.41</td><td>20.51</td><td>8.82</td><td>6.12</td><td>10.96</td><td>2.12</td><td>1.49</td><td>10.00</td><td>38.67</td><td>6.98</td><td>11.99</td></tr><tr><td>Few+Py</td><td>13.08</td><td>33.33</td><td>8.82</td><td>16.33</td><td>26.01</td><td>4.26</td><td>7.46</td><td>16.00</td><td>44.00</td><td>26.19</td><td>19.91</td></tr><tr><td>Few+Wol</td><td>3.74</td><td>7.69</td><td>2.94</td><td>18.37</td><td>17.81</td><td>6.38</td><td>2.99</td><td>12.00</td><td>5.33</td><td>2.38</td><td>7.87</td></tr><tr><td>Zero-S</td><td>14.95</td><td>25.64</td><td>8.82</td><td>18.37</td><td>21.92</td><td>12.77</td><td>7.46</td><td>8.00</td><td>28.00</td><td>19.05</td><td>16.81</td></tr><tr><td rowspan="7">GPT-4</td><td>Zero</td><td>27.10</td><td>23.08</td><td>14.71</td><td>22.45</td><td>15.07</td><td>8.51</td><td>11.94</td><td>18.00</td><td>56.00</td><td>42.86</td><td>25.09</td></tr><tr><td>Zero+CoT</td><td>28.04</td><td>43.59</td><td>14.71</td><td>20.41</td><td>21.92</td><td>19.15</td><td>17.91</td><td>22.00</td><td>50.67</td><td>42.86</td><td>28.52</td></tr><tr><td>Few Few+CoT</td><td>15.87</td><td>30.77</td><td>17.65</td><td>12.24</td></table>
76
+
77
+ Language $( F e w + W o l )$ as external tools. Regarding the exam dataset, to replicate a real-world exam environment, we only consider two specific settings: zero-shot learning (Zero) and zero-shot learning supplemented with CoT prompting $( Z e r o { + } C o T )$ .
78
+
79
+ Implementation details. We set temperature to zero for all models to reduce the randomness of the predictions. Few-shot examples, including solutions, are randomly selected from problems within each textbook. When external tools are used, we add a code snippet that translates the solution into specific programming languages in all few-shot examples. The code snippets are verified by human annotators that will produce the correct output. In terms of evaluation metrics, we compare the model outputs with the correct answers, allowing a relative tolerance of 0.05. In particular to the exam dataset, the model solutions are graded using the rubrics provided by the instructors. Readers may refer to Appendix C for all prompts and the implementation details for utilizing external tools.
80
+
81
+ # 4.2 RESULTS AND ANALYSIS
82
+
83
+ We report the model performance in terms of accuracy score for each textbook and an average score over all problems. The results of all LLMs in various settings on the textbook and the exam dataset are summarized in Tables 4 and 5 respectively. We have the following observations.
84
+
85
+ • Observation 1. SCIBENCH is complex enough to differentiate among LLMs. Our findings show that open-source models LLaMA-2-7B and LLaMA-2-70B do not yet rival closed-source counterparts on both textbook and exam datasets, where the best performance is obtained with GPT-4 with Python as the external tool in the few-shot learning setting. Within both the LLaMA and GPT series, we also observe a clear correlation between increased model capacity (i.e., larger
86
+
87
+ Table 5: Experimental results in terms of total scores under zero-shot learning on the exam dataset. The best performing score is highlighted in bold.
88
+
89
+ <table><tr><td rowspan="2">Model</td><td rowspan="2"> Setting</td><td colspan="2">MiDaraMininal</td><td colspan="2">Machine Learmiag</td><td colspan="3">Ditrenial iainsal</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="2">LLaMA-2-7B</td><td>Zero</td><td>24/90</td><td>14/75</td><td>6/56</td><td>6/75</td><td>5/100</td><td>0/100</td><td>0/95</td></tr><tr><td>Zero+CoT</td><td>18/90</td><td>14/75</td><td>2/56</td><td>10 /75</td><td>10/100</td><td>0/100</td><td>10/95</td></tr><tr><td rowspan="2">LLaMA-2-70B</td><td>Zero</td><td>23 /90</td><td>18 /75</td><td>18 /56</td><td>12/75</td><td>20/100</td><td>5/100</td><td>0/95</td></tr><tr><td>Zero+CoT</td><td>31/90</td><td>18 /75</td><td>10 /56</td><td>11/ 75</td><td>35 /100</td><td>10 /100</td><td>0/95</td></tr><tr><td rowspan="2">Claude2</td><td>Zero</td><td>37/90</td><td>26/75</td><td>28/56</td><td>35/75</td><td>35/100</td><td>30/100</td><td>20/95</td></tr><tr><td>Zero+CoT</td><td>33/90</td><td>38/75</td><td>22/56</td><td>41/75</td><td>25 /100</td><td>15 /100</td><td>20/95</td></tr><tr><td rowspan="2">GPT-3.5</td><td>Zero</td><td>44 /90</td><td>39/75</td><td>16 /56</td><td>32/75</td><td>0/100</td><td>45/100</td><td>15 /95</td></tr><tr><td>Zero+CoT</td><td>38 /90</td><td>33 /75</td><td>32 / 56</td><td>37 /75</td><td>28 /100</td><td>30 /100</td><td>10 /95</td></tr><tr><td rowspan="2">GPT-4</td><td>Zero</td><td>56/90</td><td>44/75</td><td>30/56</td><td>37/75</td><td>25/100</td><td>80/100</td><td>25/95</td></tr><tr><td>Zero+CoT</td><td>58/90</td><td>32/75</td><td>40/56</td><td>35/75</td><td>50 /100</td><td>70/100</td><td>15/95</td></tr></table>
90
+
91
+ parameter sizes) and improved performance. This observation demonstrates that the complexity of SCIBENCH is able to differentiate the capacities of different LLMs.
92
+ • Observation 2. The zero-shot learning setting exhibits comparable performance to the fewshot learning setting. For example, with CoT prompting, Claude2 achieves average scores of $8 . 1 0 \%$ and $8 . 9 0 \%$ , and GPT-4 achieves $2 8 . 5 2 \%$ and $2 8 . 3 5 \%$ in zero- and few-shot settings respectively. Moreover, in many textbooks such as Quantum Chemistry (quan and chemmc), which focus on a specialized subdomain within each field, few-shot learning outperforms zero-shot learning, with improvements of $2 . 9 4 \%$ and $2 . 5 6 \%$ in GPT-4 and $1 4 . 7 \%$ and $1 0 . 2 0 \%$ in LLaMA-2-70B under the CoT setting, for instance. This could be attributed to the selected prompt examples being representative and informative to the domain.
93
+ • Observation 3. Utilizing advanced prompting strategies like CoT brings advantages over vanilla LLMs. For the textbook dataset, the CoT prompting yields average improvements of $2 . 5 8 \%$ and $2 . 3 9 \%$ under zero-shot and few-shot learning for GPT-3.5, and $3 . 4 3 \%$ and $6 . 8 9 \%$ for GPT-4, respectively. This improvement suggests that encouraging LLMs to generate detailed solution steps helps obtain correct final answers, though its effectiveness varies across different models and settings. However, this trend is less obvious in LLaMA models with $6 . 0 9 \%$ and $4 . 9 0 \%$ i n LLaMA-2-70B under the few-shot setting, possibly due to their inherent inadequacy.
94
+ Observation 4. Prompts that utilize Python yield improvements in certain models while those using Wolfram diminish performance. Under few-shot learning scenarios, utilizing Python as an external tool results in an improvement of $7 . 9 2 \%$ compared to the CoT prompting for GPT-3.5, and an improvement of $7 . 4 5 \%$ for GPT-4. However, in Claude2, this trend is less evident with average scores of $8 . 9 0 \%$ and $8 . 7 0 \%$ with and without utilizing Python. Similarly, LLaMA models exhibit a decrease in performance from $4 . 9 0 \%$ to $2 . 9 9 \%$ in LLaMA-2-70B. Utilizing Wolfram Language does not help few-shot learning and even results in a deteriorated performance, with a decrease of $6 . 7 0 \%$ compared to the CoT prompting for Claude2, and a decrease of $1 2 . 7 9 \%$ for GPT-4. We note that converting the solution steps to Wolfram Language often introduces syntax issues and thus fails to produce satisfactory results, particularly in textbooks like Quantum Chemistry (chemmc), which involve numerous variables.
95
+
96
+ # 5 ERROR ANALYSIS OF VARIOUS PROMPTING STRATEGIES
97
+
98
+ Considering the substantial advancements of current LLMs, an in-depth analysis of the particular skills that are either enhanced or limited under certain settings becomes imperative. Previous works have relied on human labor to annotate error reasons into different categories, which is both expensive and time-consuming [18]. In this section, we present an evaluation protocol that automates the classification of error reasons into deficient skills. This time-efficient approach enables large-scale analyses in future research.
99
+
100
+ In order to quantify the impact of each setting on scientific problem-solving, we first define an essential skill set that is required by solving scientific problems. Then, an LLM verifier is employed to automatically classify each incorrectly solved problem based on the absence of a specific skill from the essential skill set. This approach generates error profiles, showcasing a direct comparison of different strategies. This evaluation protocol is summarized in Figure 2.
101
+
102
+ ![](images/ce5e1a90fdc2f6e3de19e431254e87b03a73a6bf7516a189bf44f0e6e4cfe120.jpg)
103
+ Figure 2: Pipeline of the evaluation protocol. The evaluation protocol involves analyzing both LLMs and reference (correct) solutions with the assistance of human annotators to identify error reasons. These reasons are then summarized into ten essential scientific problem-solving skills in which LLM may face challenges. Subsequently, a LLM verifier is employed to automatically attribute each incorrectly answered problem to a lack of a specific skill. The resulting error profiles enable the interpretation of the improved skills by certain prompting strategies and the direct comparison of various strategies.
104
+
105
+ Firstly, we analyze the incorrect solutions made by GPT-3.5 for problems that provide detailed solutions. We hire two college students, who are highly familiar with the problems in our datasets, to annotate the source of the error for each problem, indicating the specific line where the model makes a mistake and why. From 112 such error annotations and with the assistance of GPT-4, we distill these errors into ten essential skills that GPT-3.5 might lack:
106
+
107
+ • Logical decomposition and analysis skills. This ability involves decomposing the problem into smaller, manageable parts, and understanding the relationships between these parts.
108
+ • Identification of assumptions. This skill involves the ability to recognize relevant and necessary assumptions in the problem.
109
+ • Spatial perception. This is important for understanding problems in areas such as Physics and Chemistry, where models need to visualize molecules, forces, fields, etc.
110
+ • Causal reasoning. This is the ability to understand cause and effect relationships.
111
+ • Problem deduction skills. This pertains to the ability to infer and deduce potential solutions or underlying principles from the given information in a problem.
112
+ • Abstract reasoning. This skill involves the ability to understand complex concepts that cannot be perceived physically, and to recognize patterns or relationships beyond concrete examples.
113
+ • Scientific literacy. This skill involves a comprehensive understanding of key scientific principles, terminology, and methodologies across a range of disciplines.
114
+ • Code conversion skills. This involves the ability to accurately translate solution steps into different programming languages, like Python or Wolfram Language.
115
+ • Logical reasoning. This is the ability to make a reasoned argument and to identify fallacies or inconsistencies in an argument or set of data.
116
+ • Calculation skills. This involves the ability to accurately carry out mathematical operations and computations.
117
+
118
+ After identifying this essential skill set, we assess the performance of the LLMs under different settings to discern the specific problem-solving skills they lack. Given the high cost of human annotations required to attribute the cause of incorrect solutions to specific skill deficiencies, we propose a novel self-critique protocol: we design a specific prompt that outlines these abilities, and employ another LLM to serve as a classifier and determine whether a specific error results from the lack of a particular problem-solving skill. Finally, we ask human annotators to scrutinize the classification results, which results in approximately $20 \%$ of incorrectly classified skills being discarded. To be specific, we utilize a GPT-3.5 model as the verifier to determine the reason behind each error and pinpoint the missing skill. The details regarding the specific prompts used are provided in Appendix C.1. This verification process is conducted for six settings, with results represented in bar charts (Figure 3). Additional examples of the evaluation protocol are elaborated in Appendix D.
119
+
120
+ Overall, our findings suggest that there is a lack of a universally effective setting: each configuration only enhances some specific abilities and occasionally even hurts other skills that the original GPT models possess. First, CoT prompting significantly improves calculation skills in both zero- and few-shot scenarios, with $7 . 1 \%$ and $8 . 0 \%$ error rates caused by calculation ability respectively, considerably lower than the $2 4 . 1 \%$ error rate of the vanilla zero-shot baseline. However, CoT shows limitations in improving other skills, with $\cdot$ error rates in both casual ability and logical decomposition ability in the zero-shot CoT setting, respectively, compared to $1 7 . 0 \%$ and $1 3 . 4 \%$ in the zero-shot setting. This contradicts previous claims about universal skill enhancement through zero-shot CoT and carefully-designed few-shot CoT prompts [9]. In Appendix, we show an example in Figure S3, where the zero-shot learning setting without CoT has generated the correct formula but fails in the calculation steps. In this case, CoT prompting is even unable to use the correct formula as it misinterprets the specific conditions (non-necessity) in the problem. Second, while the use of external tools significantly reduces calculation errors, they can weaken other skills, particularly the code conversion skills, i.e., generating the correct programs for the solution. This issue becomes particularly prominent when using the Wolfram Language, with $4 1 . 1 \%$ error rate in code conversion skill comparing $0 . 9 \%$ in the few-shot CoT setting. Despite providing grammar specifications in system prompts and a few examples as demonstrations, most attempts of code conversion result in syntax errors. In Wolfram Language, the error mainly comes from the violation of variable rules (for instance, Wolfram Language reserves certain letters such as $E$ as protected symbols and disallows underscores in variable names) or incorrect usage of certain functions.
121
+
122
+ ![](images/730cc29772f6dfff51640b24c0528241fffbd2cc5fab763e0d7bb319c63592ef.jpg)
123
+ Figure 3: Error profiles of GPT-3.5 on the text dataset under six settings, which reveal the distribution of their deficiencies in ten essential problem-solving abilities.
124
+
125
+ Additionally, few-shot learning does not universally improve scientific problem-solving skills, as indicated in the comparison between zero-shot and few-shot CoT settings. The improvement in one skill is offset by the shortcomings in others: although the few-shot CoT setting results in a reduction of $6 . 3 \%$ in errors related to causal reasoning, it also leads to an increase in errors associated with other skills, such as logical decomposition and calculation.
126
+
127
+ Moreover, the skill of identifying assumptions appears to be most lacking in the zero-shot setting without a system prompt. In this scenario, the LLM does not have any predefined direction to follow. However, when a system prompt with instructions about which scientific domain the model is tackling, this issue can be significantly mitigated, decreasing this error from $1 1 . 6 \%$ to $5 . 4 \%$ .
128
+
129
+ # 6 CONCLUSION
130
+
131
+ In conclusion, this paper presents SCIBENCH, a college-level dataset that includes scientific problems from Mathematics, Physics, and Chemistry, as well as exam questions in Computer Science and Mathematics. We also conduct extensive experiments on five representative models, LLaMA-2- 7B, LLaMA-2-70B, Claude2, GPT-3.5, and GPT4. The evaluation protocol we employ serves as a framework for evaluating advanced problem-solving skills of LLMs in scientific domains. The findings of this study highlight that while large language models (LLMs) exhibit impressive performance on introductory mathematical benchmarks, their mastery of problem solving ability remains weak. These findings underscore the limitations of current LLMs in achieving satisfactory performance, even with the assistance of various tools. We envision that the SCIBENCH benchmark dataset and evaluation protocol presented in this paper could lay a foundation for future research and enable advancements in understanding and enhancing problem-solving capabilities of LLMs.
132
+
133
+ # REPRODUCIBILITY STATEMENT
134
+
135
+ To foster reproducible research, we include all dataset processing and experiment details of SCIBENCH. We detail data processing in Section 3 and provide the UI design of data collection in Appendix B. We include all experiment details with LLM prompts in Appendix C. Finally, we make our dataset and code publicly available at this anonymous repository.
136
+
137
+ # ETHICAL STATEMENT
138
+
139
+ The questions of SCIBENCH are sourced from science textbooks and exams. We conduct a manual examination of our dataset to ensure the absence of potential sensitive background or ethical concerns. The inclusion of exam questions has been authorized by the instructors of the respective courses. To the best of our knowledge, there are no ethical concerns or sensitive information present in the dataset.
140
+
141
+ # REFERENCES
142
+
143
+ [1] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. 1
144
+ [2] OpenAI. Chatgpt: Optimizing language models for dialogue. https://openai.com/blog/chatgpt/., 2022. 1, 5
145
+ [3] OpenAI. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023. 1, 5
146
+ [4] Zhuosheng Zhang, Aston Zhang, Mu Li, Hai Zhao, George Karypis, and Alex Smola. Multimodal chain-of-thought reasoning in language models. arXiv preprint arXiv:2302.00923, 2023. 1
147
+ [5] Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. LLaMA: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023. 1
148
+ [6] Renrui Zhang, Jiaming Han, Aojun Zhou, Xiangfei Hu, Shilin Yan, Pan Lu, Hongsheng Li, Peng Gao, and Yu Qiao. Llama-adapter: Efficient fine-tuning of language models with zero-init attention. arXiv preprint arXiv:2303.16199, 2023. 1
149
+ [7] Peng Gao, Jiaming Han, Renrui Zhang, Ziyi Lin, Shijie Geng, Aojun Zhou, Wei Zhang, Pan Lu, Conghui He, Xiangyu Yue, Hongsheng Li, and Yu Qiao. Llama-adapter v2: Parameter-efficient visual instruction model. arXiv preprint arXiv:2304.15010, 2023. 1
150
+ [8] Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. arXiv preprint arXiv:2304.08485, 2023. 1
151
+ [9] Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. arXiv preprint arXiv:2201.11903, 2022. 1, 2, 9
152
+ [10] Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. arXiv preprint arXiv:2205.11916, 2022. 1
153
+ [11] Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021. 1
154
+ [12] Wenhu Chen, Xueguang Ma, Xinyi Wang, and William W Cohen. Program of thoughts prompting: Disentangling computation from reasoning for numerical reasoning tasks. arXiv preprint arXiv:2211.12588, 2022. 1
155
+ [13] Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. PAL: Program-aided language models. arXiv preprint arXiv:2211.10435, 2022. 1
156
+ [14] Pan Lu, Swaroop Mishra, Tanglin Xia, Liang Qiu, Kai-Wei Chang, Song-Chun Zhu, Oyvind Tafjord, Peter Clark, and Ashwin Kalyan. Learn to explain: Multimodal reasoning via thought chains for science question answering. Advances in Neural Information Processing Systems, 35:2507–2521, 2022. 1, 3, 4
157
+ [15] Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. 1, 3
158
+ [16] Dan Hendrycks, Collin Burns, Saurav Kadavath, Akul Arora, Steven Basart, Eric Tang, Dawn Song, and Jacob Steinhardt. Measuring mathematical problem solving with the math dataset. arXiv preprint arXiv:2103.03874, 2021. 1, 3
159
+ [17] Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. arXiv preprint arXiv:2009.03300, 2020. 1, 3
160
+ [18] Wanjun Zhong, Ruixiang Cui, Yiduo Guo, Yaobo Liang, Shuai Lu, Yanlin Wang, Amin Saied, Weizhu Chen, and Nan Duan. Agieval: A human-centric benchmark for evaluating foundation models. arXiv preprint arXiv:2304.06364, 2023. 1, 3, 7, 25
161
+ [19] Yuzhen Huang, Yuzhuo Bai, Zhihao Zhu, Junlei Zhang, Jinghan Zhang, Tangjun Su, Junteng Liu, Chuancheng Lv, Yikai Zhang, Jiayi Lei, et al. C-eval: A multi-level multi-discipline chinese evaluation suite for foundation models. arXiv preprint arXiv:2305.08322, 2023. 1, 3
162
+ [20] Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022. 2
163
+ [21] Denny Zhou, Nathanael Schärli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuurmans, Olivier Bousquet, Quoc Le, and Ed Chi. Least-to-most prompting enables complex reasoning in large language models. arXiv preprint arXiv:2205.10625, 2022. 2
164
+ [22] Jiaxin Huang, Shixiang Shane Gu, Le Hou, Yuexin Wu, Xuezhi Wang, Hongkun Yu, and Jiawei Han. Large language models can self-improve. arXiv preprint arXiv:2210.11610, 2022. 2
165
+ [23] Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Luke Zettlemoyer, Nicola Cancedda, and Thomas Scialom. Toolformer: Language models can teach themselves to use tools. arXiv preprint arXiv:2302.04761, 2023. 2, 5
166
+ [24] Pan Lu, Baolin Peng, Hao Cheng, Michel Galley, Kai-Wei Chang, Ying Nian Wu, Song-Chun Zhu, and Jianfeng Gao. Chameleon: Plug-and-play compositional reasoning with large language models. arXiv preprint arXiv:2304.09842, 2023. 2, 5
167
+ [25] Peter Atkins, Julio De Paula, and Ronald Friedman. Physical chemistry: quanta, matter, and change. Oxford University Press, USA, 2014. 2, 4, 13
168
+ [26] Pan Lu, Liang Qiu, Jiaqi Chen, Tony Xia, Yizhou Zhao, Wei Zhang, Zhou Yu, Xiaodan Liang, and Song-Chun Zhu. Iconqa: A new benchmark for abstract diagram understanding and visual language reasoning. arXiv preprint arXiv:2110.13214, 2021. 3
169
+ [27] Pan Lu, Liang Qiu, Kai-Wei Chang, Ying Nian Wu, Song-Chun Zhu, Tanmay Rajpurohit, Peter Clark, and Ashwin Kalyan. Dynamic prompt learning via policy gradient for semi-structured mathematical reasoning. In International Conference on Learning Representations (ICLR), 2023. 3
170
+ [28] Swaroop Mishra, Matthew Finlayson, Pan Lu, Leonard Tang, Sean Welleck, Chitta Baral, Tanmay Rajpurohit, Oyvind Tafjord, Ashish Sabharwal, Peter Clark, et al. Lila: A unified benchmark for mathematical reasoning. In The 2022 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2022. 3
171
+ [29] Liangtai Sun, Yang Han, Zihan Zhao, Da Ma, Zhennan Shen, Baocai Chen, Lu Chen, and Kai Yu. Scieval: A multi-level large language model evaluation benchmark for scientific research. arXiv preprint arXiv:2308.13149, 2023. 3
172
+ [30] Wenhu Chen, Ming Yin, Max Ku, Pan Lu, Elaine Wan, Xueguang Ma, Jianyu Xu, Tony Xia, and Xinyi Wang. Theoremqa: A theorem-driven question answering dataset. arXiv preprint arXiv:2305.12524, 2023. 3, 4
173
+ [31] Pan Lu, Liang Qiu, Wenhao Yu, Sean Welleck, and Kai-Wei Chang. A survey of deep learning for mathematical reasoning. In The 61st Annual Meeting of the Association for Computational Linguistics (ACL), 2023. 3
174
+ [32] Yao Fu, Litu Ou, Mingyu Chen, Yuhao Wan, Hao Peng, and Tushar Khot. Chain-of-thought hub: A continuous effort to measure large language models’ reasoning performance. arXiv preprint arXiv:2305.17306, 2023. 3
175
+ [33] Taicheng Guo, Kehan Guo, Zhengwen Liang, Zhichun Guo, Nitesh V Chawla, Olaf Wiest, Xiangliang Zhang, et al. What indeed can gpt models do in chemistry? a comprehensive benchmark on eight tasks. arXiv preprint arXiv:2305.18365, 2023. 3
176
+ [34] Ross Taylor, Marcin Kardas, Guillem Cucurull, Thomas Scialom, Anthony Hartshorn, Elvis Saravia, Andrew Poulton, Viktor Kerkez, and Robert Stojnic. Galactica: A large language model for science. arXiv preprint arXiv:2211.09085, 2022. 3
177
+ [35] Ahmad Ghazal, Tilmann Rabl, Minqing Hu, Francois Raab, Meikel Poess, Alain Crolotte, and Hans-Arno Jacobsen. Bigbench: Towards an industry standard benchmark for big data analytics. In Proceedings of the 2013 ACM SIGMOD international conference on Management of data, pages 1197–1208, 2013. 3
178
+ [36] Mirac Suzgun, Nathan Scales, Nathanael Schärli, Sebastian Gehrmann, Yi Tay, Hyung Won Chung, Aakanksha Chowdhery, Quoc V Le, Ed H Chi, Denny Zhou, et al. Challenging big-bench tasks and whether chain-of-thought can solve them. arXiv preprint arXiv:2210.09261, 2022. 3
179
+ [37] David Halliday, Robert Resnick, and Jearl Walker. Fundamentals of physics. John Wiley & Sons, 2013. 4, 14
180
+ [38] Thomas Engel and Philip J Reid. Thermodynamics, statistical thermodynamics, and kinetics. Prentice Hall Upper saddle River, 2010. 4, 13
181
+ [39] Stephen T Thornton and Jerry B Marion. Classical dynamics of particles and systems. Cengage Learning, 2021. 4, 13
182
+ [40] Ira N Levine, Daryle H Busch, and Harrison Shull. Quantum chemistry, volume 6. Pearson Prentice Hall Upper Saddle River, NJ, 2009. 4, 13
183
+ [41] Donald A McQuarrie. Quantum chemistry. University Science Books, 2008. 4, 13
184
+ [42] Peter Atkins, Peter William Atkins, and Julio de Paula. Atkins’ physical chemistry. Oxford university press, 2014. 4, 13
185
+ [43] James Stewart, Saleem Watson, and Daniel Clegg. Calculus: Early transcendentals, 8th. Edition, Brooks/- Cole, Cengae learning, 2012. 4, 14
186
+ [44] Robert V Hogg, Elliot A Tanis, and Dale L Zimmerman. Probability and statistical inference, volume 993. Macmillan New York, 1977. 4, 14
187
+ [45] William E Boyce, Richard C DiPrima, and Douglas B Meade. Elementary differential equations and boundary value problems. John Wiley & Sons, 2021. 4, 14
188
+ [46] Pan Lu, Ran Gong, Shibiao Jiang, Liang Qiu, Siyuan Huang, Xiaodan Liang, and Song-Chun Zhu. Intergps: Interpretable geometry problem solving with formal language and symbolic reasoning. In The Joint Conference of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (ACL-IJCNLP 2021), 2021. 4, 5
189
+ [47] Anthropic. Claude2. https://www.anthropic.com/index/claude-2, 2023. 5
190
+ [48] Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023. 5
191
+
192
+ # Supplementary Material for SCIBENCH
193
+
194
+ A SciBench: Textbook Sources 13
195
+ A.1 Textbook 13
196
+ A.2 Examination . 14
197
+ A.3 Textbook Examples 14
198
+ B SciBench: More Statistics 14
199
+ B.1 UI Design 14
200
+ C Experimental Details 14
201
+ C.1 Prompting . 14
202
+ C.2 Experiment Process 17
203
+ D Problem Solving Abilities of Current LLMs 18
204
+ D.1 Example . 18
205
+ D.2 Assessment of evaluation protocol 19
206
+ D.3 Comparison 21
207
+
208
+ A SCIBENCH: TEXTBOOK SOURCES
209
+
210
+ # A.1 TEXTBOOK
211
+
212
+ • PHYSICAL CHEMISTRY, ATKINS ET AL. [42] (atkins) provides an exploration of equilibrium, structure, and reactions, integrating contemporary techniques like nanoscience, spectroscopy, and computational chemistry.
213
+ QUANTUM CHEMISTRY, MCQUARRIE [41] (chemmc) meticulously covers Quantum Mechanics, from foundational principles like blackbody radiation and Heisenberg’s Uncertainty Principle to complex topics such as Schrödinger’s equation, quantum mechanical operators, and the application of quantum mechanics in chemical bonding.
214
+ QUANTUM CHEMISTRY, LEVINE ET AL. [40] (quan) explores quantum chemistry, providing a detailed understanding of the Schrödinger equation, particle behavior in various scenarios, quantum mechanics operators, and other foundational quantum principles. It delves into specific applications like the electronic structure of diatomic and polyatomic molecules, variation methods, perturbation theory, electron spin and its implications in quantum mechanics, as well as various computational methods for molecular quantum mechanics.
215
+ PHYSICAL CHEMISTRY, QUANTA, MATTER, AND CHANGE, ATKINS ET AL. [25] (matter) combines physics and mathematics, beginning with basics like differentiation and integration, advancing through quantum mechanics and atomic structure, then exploring thermodynamics, molecular motion, and chemical kinetics. Each section is supplemented with mathematical concepts such as differential equations, vectors, and probability theory.
216
+ CLASSICAL DYNAMICS OF PARTICAL AND SYSTEMS, THORNTON AND MARION [39] (class) initiates with an exploration of fundamental mathematical concepts, discussing scalars, vectors, matrix operations, coordinate transformations, differentiation, and integration of vectors, using these constructs to illustrate concepts like velocity, acceleration, and angular velocity. It then transitions into the realm of Newtonian mechanics, detailing Newton’s laws, frames of reference, and the equation of motion for a single particle.
217
+ • THERMODYNAMICS, STATISTICAL THERMODYNAMICS, AND KINETICS, [38] (thermo) navigates through thermodynamics’ principles, from fundamental concepts to complex laws, further discussing real and ideal gases, solutions, electrochemical cells, and statistical thermodynamics. It
218
+
219
+ concludes with an examination of the kinetic theory of gases, transport phenomena, and chemical kinetics.
220
+
221
+ • FUNDAMENTALS OF PHYSICS, HALLIDAY ET AL. [37] (fund) covers undergraduate physics topics, ranging from fundamental concepts like motion and energy to more advanced areas such as quantum physics and nuclear physics.
222
+ • ELEMENTARY DIFFERENTIAL EQUATIONS AND BOUNDARY VALUE PROBLEMS, [45] (diff) provides a detailed exploration of differential equations, progressing from basic mathematical models to advanced topics like the Laplace Transform, linear systems, numerical methods, and Fourier series. It culminates with a deep dive into nonlinear equations, partial differential equations, and boundary value problems.
223
+ • PROBABILITY AND STATISTICAL INFERENCE, [44] (stat) covers probability and statistics, including fundamental concepts, discrete and continuous distributions, bivariate distributions, functions of random variables, and estimation techniques.
224
+ • CALCULUS: EARLY TRANSCENDENTALS, [43] (calculus) begins with diagnostic tests in foundational topics, and explores functions from multiple perspectives. It comprehensively covers calculus concepts from limits to three-dimensional analytic geometry, incorporating applications in various fields.
225
+
226
+ # A.2 EXAMINATION
227
+
228
+ • INTRODUCTION TO DATA MINING provides an introductory survey of data mining, which involves the automatic discovery of patterns, associations, changes, and anomalies in large databases. It explores various application areas of data mining, including bioinformatics, e-commerce, environmental studies, financial markets, multimedia data processing, network monitoring, and social service analysis.
229
+
230
+ • FUNDAMENTALS ARTIFICIAL INTELLIGENCE provides an introduction to the core problemsolving and knowledge representation paradigms in artificial intelligence. It covers Lisp programming with regular assignments, as well as topics such as search methods, planning techniques, knowledge structures, natural language processing, expert systems, vision, and parallel architectures.
231
+
232
+ • DIFFERENTIAL EQUATIONS covers various topics in differential equations, including first-order and second-order linear equations with constant coefficients, power series solutions, and linear systems. Students will explore the principles and applications of these mathematical concepts.
233
+
234
+ A.3 TEXTBOOK EXAMPLES
235
+
236
+ # B SCIBENCH: MORE STATISTICS
237
+
238
+ # B.1 UI DESIGN
239
+
240
+ We employed a team of seven individuals to gather data from textbooks using an annotation tool. Each individual was responsible for 1-2 books, encompassing approximately 100 examples. The user interface of the annotation tool is depicted in Figure S2. For subsequent verification, we preserved images of problems and their corresponding answers. To ensure clarity in future references, we have maintained the original sequence of problems as they appear in the textbooks.
241
+
242
+ # C EXPERIMENTAL DETAILS
243
+
244
+ # C.1 PROMPTING
245
+
246
+ ChatGPT and GPT-4’s API have three message parameters: SYSTEM, USER, and ASSISTANT. The SYSTEM parameter represents the system prompt, which provides context and instructions to the model. The USER parameter is the training prompt or input provided by the user, and the ASSISTANT parameter contains the model’s output or response. We provide all system prompts and training prompts used in our experiments as below.
247
+
248
+ ![](images/4c4beae679e3e299d77335e111c875196817dd38b6f88c3706626c30171c949a.jpg)
249
+ Figure S1: Textbook examples with acronym highlighted in brown.
250
+
251
+ # System Prompt for Zero-Shot, Few-Shot, and Chain-of-Thought setting:
252
+
253
+ Please provide a clear and step-by-step solution for a scientific problem in the categories of Chemistry, Physics, or Mathematics. The problem will specify the unit of measurement, which should not be included in the answer. Express the final answer as a decimal number with three digits after the decimal point. Conclude the answer by stating "The answer is therefore \boxed[ANSWER]."
254
+
255
+ # System Prompt for Python setting:
256
+
257
+ Please provide a clear and step-by-step solution for a scientific problem in the categories of Chemistry, Physics, or Mathematics. The problem will specify the unit of measurement. Please translate the solution steps into Python code and encase the Python code within triple backticks for clarity.
258
+
259
+ ![](images/68523898ab6dbc6ca4cc07f2398e4229250fefb777f89473bedfbabb64e60006.jpg)
260
+ Figure S2: The UI design of data annotation.
261
+
262
+ # System Prompt for Wolfram setting:
263
+
264
+ Please provide a clear and step-by-step solution for a scientific problem in the categories of Chemistry, Physics, or Mathematics. The problem will specify the unit of measurement. Please translate the solution steps into Wolfram code and encase the Wolfram Language code within triple backticks for clarity.
265
+
266
+ # System Prompt for Evaluation Protocol:
267
+
268
+ Examine the given problem, the correct solution, and the model’s solution. Identify the reason for the error in the model’s solution based on the following 10 categories:
269
+ 1. Logical Decomposition and Analysis Skills: This ability involves decomposing the problem into smaller, manageable parts, and understanding the relationships between these parts.
270
+ 2. Identification of Assumptions: This skill involves the AI’s ability to recognize relevant and necessary assumptions in the problem.
271
+ 3. Spatial Perception: This is important for understanding problems in areas such as physics and chemistry, where you need to visualize molecules, forces, fields, etc.
272
+ 4. Causal Reasoning: This is the ability to understand cause and effect relationships.
273
+ 5. Problem Deduction Skills: This pertains to the ability to infer and deduce potential solutions or underlying principles from the given information in a problem.
274
+ 6. Abstract Reasoning: This skill involves the ability to understand complex concepts that can’t be perceived physically, and to recognize patterns or relationships beyond concrete examples. 7. Scientific Literacy: This skill involves a comprehensive understanding of key scientific principles, terminology, and methodologies across a range of disciplines.
275
+ 8. Code Conversion Skills: This denotes the ability to accurately translate solution steps into different programming languages, like Python or Wolfram, without syntax errors.
276
+ 9. Logical Reasoning: This is the ability to make a reasoned argument and to identify fallacies or inconsistencies in an argument or set of data.
277
+ 10. Calculation Skills: This involves the ability to accurately carry out mathematical operations and computations.
278
+ Conclude your final error reason category number within \boxed.
279
+
280
+ # Training Prompt for Zero-Shot Chain-of-Thought:
281
+
282
+ Stage 1:
283
+
284
+ Input: [input-question] Let’s think step by step.
285
+ Output: <explanation>
286
+ Stage 2:
287
+ Input: [input-question] Let’s think step by step. [explanation] $^ +$ Therefore, the answer is:
288
+
289
+ Output: <answer>
290
+
291
+ # Training Prompt for Few-Shot:
292
+
293
+ # Input:
294
+
295
+ Problem 1: [Question 1] The answer is \boxed{[Answer 1]}.
296
+ Problem 2: [Question 2] The answer is \boxed{[Answer 2]}.
297
+ Problem n: [Question n] The answer is \boxed{[Answer n]}.
298
+ Problem $\mathrm { n } { + } 1$ : [Question $\mathrm { n } { + } 1$ ] Output: The answer is \boxed{<answer>}.
299
+
300
+ # Training Prompt for Few-Shot Chain-of-Thought:
301
+
302
+ # Input:
303
+
304
+ Problem 1: [Question 1] Explanation for Problem 1: [Explanation 1]. The answer is \boxed{[Answer 1]}.
305
+ Problem 2: [Question 2] Explanation for Problem 2: [Explanation 2]. The answer is \boxed{[Answer 2]}.
306
+ ...
307
+ Problem n: [Question n] Explanation for Problem n: [Explanation n]. The answer is \boxed{[Answer n]}.
308
+ Problem $\mathrm { n } { + } 1$ : [Question $\mathrm { n } { + } 1$ ]
309
+ Output: Explanaiton for Problem $\mathrm { n } { + } 1$ : <explanation>. The answer is \boxed{<answer>}.
310
+
311
+ # Training Prompt for Few-Shot Python/Wolfram:
312
+
313
+ # Input:
314
+
315
+ Problem 1: [Question 1] Explanation for Problem 1: [Explanation 1]. Python/Wolfram language for Problem 1: \`\`\`[Python/Wolfram code 1]\`
316
+ Problem 2: [Question 2] Explanation for Problem 2: [Explanation 2]. Python/Wolfram language for Problem 2: \`\`\`[Python/Wolfram code 2]\`\`
317
+ ...
318
+ Problem n: [Question n] Explanation for Problem n: [Explanation n]. Python/Wolfram language for Problem n: \`\`\`[Python/Wolfram code n]\`\`\`
319
+ Problem $\mathrm { n } { + } 1$ : [Question $\mathrm { n } { + } 1$ ]
320
+ Output: Explanaiton for Problem $\mathrm { n } { + } 1$ : <explanation>. Python/Wolfram language for Problem $\mathrm { n } { + } 1$ : \`[Python/Wolfram code $\mathfrak { n } { + } \mathbb { 1 } \mathbf { \setminus } \mathbf { \Omega }$
321
+
322
+ # Training Prompt for Evaluation Protocol:
323
+
324
+ Input: The question is [input-question]. The correct solution is [Correct-Solution]. The model solution is [Model-Solution].
325
+ Output: <Error Type>
326
+
327
+ # Training Prompt for Evaluation Protocol in Python/Wolfram:
328
+
329
+ Input: The question is [input-question]. The correct solution is [Correct-Solution]. The model solution is [Model-Solution]. The translated program generates the answer as [Program Generated Answer], which is treated as model’s output answer.
330
+
331
+ Output: <Error Type>
332
+
333
+ # C.2 EXPERIMENT PROCESS
334
+
335
+ All model output is extracted using \boxed{} notation. To prevent any missed extractions, we supplement this process with a manual check. For both Python and Wolfram settings, we extract the programming language with the triple backtick \`\`\`method, subsequently executing it within the corresponding language. The entirety of our code can be accessed via the following URL: https://anonymous.4open.science/r/anonymous-4FFB.
336
+
337
+ # D PROBLEM SOLVING ABILITIES OF CURRENT LLMS
338
+
339
+ # D.1 EXAMPLE
340
+
341
+ # Correct Solution
342
+
343
+ The mass of an electron is $9 . 1 0 9 \times 1 0 ^ { - 3 1 } \mathrm { k g }$ . One percent of the speed of light is
344
+
345
+ $$
346
+ v = ( 0 . 0 1 0 0 ) \left( 2 . 9 9 8 \times { 1 0 } ^ { 8 } { \mathrm { m } } \cdot { \mathrm { s } } ^ { - 1 } \right) = 2 . 9 9 8 \times { 1 0 } ^ { 6 } { \mathrm { m } } \cdot { \mathrm { s } } ^ { - 1 }
347
+ $$
348
+
349
+ The momentum of the electron is given by
350
+
351
+ $$
352
+ p = m _ { \mathrm { e } } v = { \Big ( } 9 . 1 0 9 \times 1 0 ^ { - 3 1 } { \mathrm { k g } } { \Big ) } \left( 2 . 9 9 8 \times 1 0 ^ { 6 } { \mathrm { m } } \cdot { \mathrm { s } } ^ { - 1 } \right) = 2 . 7 3 \times 1 0 ^ { - 2 4 } { \mathrm { k g } } \cdot { \mathrm { m } } \cdot { \mathrm { s } } ^ { - 1 }
353
+ $$
354
+
355
+ The de Broglie wavelength of this electron is
356
+
357
+ $$
358
+ \lambda = { \frac { h } { p } } = { \frac { 6 . 6 2 6 \times 1 0 ^ { - 3 4 } { \mathrm { ~ J } } \cdot { \mathrm { ~ s } } } { 2 . 7 3 \times 1 0 ^ { - 2 4 } { \mathrm { ~ k g } } \cdot { \mathrm { m } } \cdot { \mathrm { s } } ^ { - 1 } } } = 2 . 4 3 \times 1 0 ^ { - 1 0 } { \mathrm { ~ m } } = 2 4 3 { \mathrm { p m } }
359
+ $$
360
+
361
+ This wavelength is of atomic dimensions.
362
+
363
+ Final Answer: 243
364
+
365
+ # Chatgpt Solution with Chain-of-Thought Method
366
+
367
+ Let’s start by recalling the de Broglie wavelength formula: $\begin{array} { r } { \lambda = \frac { h } { p } } \end{array}$ where $\lambda$ is the de Broglie wavelength, $h$ is Planck’s constant, and $p$ is the momentum of the particle. To calculate the momentum of the electron, we can use the relativistic momentum formula:
368
+
369
+ $$
370
+ p = { \frac { m _ { e } v } { \sqrt { 1 - { \frac { v ^ { 2 } } { c ^ { 2 } } } } } }
371
+ $$
372
+
373
+ where $m _ { e }$ is the mass of the electron, $_ v$ is its velocity, and $^ c$ is the speed of light. Plugging in the given values, we get:
374
+
375
+ $$
376
+ p = { \frac { ( 9 . 1 1 \times 1 0 ^ { - 3 1 } { \mathrm { k g } } ) ( 0 . 0 1 c ) } { { \sqrt { 1 - ( 0 . 0 1 c ) ^ { 2 } / c ^ { 2 } } } } } = 8 . 1 9 \times 1 0 ^ { - 2 3 } { \mathrm { k g } } \cdot { \mathrm { m / s } }
377
+ $$
378
+
379
+ Now we can plug this momentum into the de Broglie wavelength formula:
380
+
381
+ $$
382
+ \lambda = { \frac { h } { p } } = { \frac { 6 . 6 2 6 \times 1 0 ^ { - 3 4 } { \mathrm { J } } \cdot { \mathrm { s } } } { 8 . 1 9 \times 1 0 ^ { - 2 3 } { \mathrm { k g } } \cdot { \mathrm { m } } / { \mathrm { s } } } } = 8 . 0 9 { \mathrm { p m } }
383
+ $$
384
+
385
+ # ChatGPT Solution without Chain-of-Thought Method
386
+
387
+ The de Broglie wavelength of a particle is given by the equation: $\begin{array} { r } { \lambda = { \frac { h } { p } } } \end{array}$ where $^ h$ is the Planck constant and $p$ is the momentum of the particle. The momentum of an electron is given by:
388
+
389
+ $$
390
+ p = m v
391
+ $$
392
+
393
+ where $_ m$ is the mass of the electron and $_ v$ is its velocity. We are given that the electron is traveling at $1 . 0 0 \%$ of the speed of light, which is: $v = 0 . 0 1$ cwhere $^ c$ is the speed of light. The mass of an electron is: $m = 9 . 1 1 \times 1 0 ^ { - 3 1 }$ , kgPutting it all together, we have:
394
+
395
+ $$
396
+ \lambda = { \frac { h } { m v } } = { \frac { h } { m ( 0 . 0 1 c ) } }
397
+ $$
398
+
399
+ Substituting the values of $h , m ,$ , and $^ c$ , we get:
400
+
401
+ $$
402
+ \lambda = { \frac { 6 . 6 2 6 \times 1 0 ^ { - 3 4 } , \mathbf { J } \cdot \mathbf { s } } { 9 . 1 1 \times 1 0 ^ { - 3 1 } , \mathbf { k g } \cdot 0 . 0 1 \cdot 2 . 9 9 8 \times 1 0 ^ { 8 } , \mathbf { m } / \mathbf { s } } } = 3 . 3 1 \times 1 0 ^ { - 1 2 } \mathbf { m } = 3 . 3 1 \mathbf { p m }
403
+ $$
404
+
405
+ In the context of each specific capability, we present several exemplary errors accompanied by their corresponding classifications and explanations derived from the GPT model. Referencing Figure S3, the ChatGPT solution employing the Chain-of-Thought method corresponds to error category 4, "Causal Reasoning". The model explanation posits that "The error reason category is 4. Causal Reasoning. The model solution uses the relativistic momentum formula to calculate the momentum of the electron, which is not necessary for this problem since the electron is traveling at only $1 . 0 0 \%$ of the speed of light. The relativistic momentum formula is only needed when the velocity of the particle is a significant fraction of the speed of light. Therefore, using this formula in this problem leads to an incorrect value for the momentum and consequently an incorrect value for the de Broglie wavelength." Meanwhile, the ChatGPT solution that doesn’t utilize the Chain-of-Thought method is categorized under error case 10, "Calculation Skills". This example is further highlighted as an illustrative showcase for explanations of the Chain-of-Thought method in Section 5. More examples resulting in different error types are shown in Figure S4, S5, S6, S7, S8, S9, S10, S11, S12,S13.
406
+
407
+ <table><tr><td>Problem Find the length of the cardioid r =1+ sinθ.</td></tr><tr><td>Correct Solution The cardioid&#x27;s fullength is given by the parameter interval O ≤θ≤ 2π,so Formula 5 gives 2π</td></tr><tr><td>L = +()0= 2π √(1+sin0)² +cos2 0d0= √2+2sin0de Jo 0 0 Wecouldevaluate tis itegralbymultiplyinganddividingthentegrandby2-2sin,orwecoulduseacomputeralgebrasystem.In</td></tr><tr><td>any event, we find that the length of the cardioid is L = 8. Final Answer: 8 Model Solution</td></tr><tr><td>To find the length of the cardioid, we use the formula for arc length in polar coordinates:</td></tr><tr><td>L=J ²+()2,d,</td></tr><tr><td>he andβare he agleshat orsrod toinflp f he carid i.e ad = r).First sefin dr d</td></tr><tr><td>d d(1+ sinθ) = cos0. Then,we plug in r =1 + sin θ and = cos θ into he formula for ac length:</td></tr><tr><td>2π L = √(1+ sin 0)²+cos²0</td></tr><tr><td>0</td></tr><tr><td>d0= ² √1+2sin0 +sin20+cos²θ J0</td></tr><tr><td>d0= ²√2+2sin0</td></tr><tr><td>J0</td></tr><tr><td>d0=4 √2+2sin0 0</td></tr><tr><td>d (due to symmetry) = 8 |&quot;/²√2 + 2sinθ J0 π/2</td></tr><tr><td>0-2 d0=8 4cos2 J0 π/2 0</td></tr><tr><td>d0(using thehaf-ageformula)=16 cos2 π/2</td></tr><tr><td>d0= 32 sin 2 = 32.</td></tr><tr><td>Therefore,thelengthofthecardioidis32,andtheunitoftheansweriswhateverunit wasusedforr(e.gmeters,centimeters,etc.).</td></tr><tr><td>Final Answer: 32</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>ThemodelsouioaerieiofttalS2ind.corretsoutiotylifedhs</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>Error Reason</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>integralto4+2sinduetothesymmetryofthtegandandthenusedasubstutiontoevaluatetheintegraleodel</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr></table>
408
+
409
+ # D.2 ASSESSMENT OF EVALUATION PROTOCOL
410
+
411
+ In order to assess the effectiveness of our evaluation protocol’s classification, we enlisted the assistance of two annotators to determine whether the errors identified by the model verifier were accurate or
412
+
413
+ <table><tr><td>Problem Use Simpson&#x27;s Rule with n = 10 to approximate S²2(1/𝑥)dx. Correct Solution Putting f(x)=1/𝑥,n =10,and△x = 0.1 in Simpson&#x27;s Rule, we obtain</td></tr><tr><td>3 ( 4 2 4 2 4 2 4 二 3 +11+1.2+1.3+1.4+1.5 1.6 1.7+1.8+1.9+ ~0.693150 Final Answer: 0.693150</td></tr><tr><td>ExplanationforProblem6: Withn =10we haveh=21=andxi =1+fri =0,1,2.,10.ThenSimpson&#x27;sule gives ↑²dx~[f(x)+4f(x1)+2f(x2)+4f(x3)+.+2f(xs)+4f(x)+f(x1)] J1 x wheref(x)=1. wolfram language for Problem 6: (*Constants *) n = 10; a=1; b=2;</td></tr></table>
414
+
415
+ Figure S5: An example problem is inaccurately solved by error reason 8. Code Conversion Skills.
416
+ "Error Reason" denotes the output from the LLM Verifier utilized in the classification of error causes.
417
+ In the example, the mistaken step is highlighted in red.
418
+
419
+ <table><tr><td colspan="2">Problem Use Simpson&#x27;s Rule with n = 10 to approximate S²2(1/𝑥)dx.</td></tr><tr><td colspan="2">Correct Solution</td></tr><tr><td colspan="2">The equations for c1 and c2 are C1(α-E)+c2β=0 and c1β+c2(α-E)=0</td></tr><tr><td colspan="2">ForE=α+β,eitherequationyieldsC1=C2.Thus,b=C1(2pz1+2pz2).ThevalueofC1canbefoundbyrequiringthatthe wavefunctionbenormalized.Thenormalizationconditionongivesc²(1+2S+1)=1.UsingtheHuckelssumptionthatS=0,</td></tr><tr><td colspan="2">we find that c1 =1/√2.Substituting E=α-βinto eitherof the equations for c1 and c2 yields c1 =-C2,or a=c1(2pz1-2pz2)</td></tr><tr><td colspan="2">The normalization condition gives c²(1- 2S +1) = 1,or c1 = 1/√2. Final Answer: 0.7071067</td></tr><tr><td colspan="2">Model Solution therefore not provided as this problem requires visual representations and cannot be solved through text alone.</td></tr><tr><td colspan="2">Error Reason</td></tr><tr><td colspan="2">The error reason category is|3. Spatial Perception molecularorialsfeeneeodel&#x27;ssolutioisicompleteasitonlyproidesuatiosanddoesoprovidayvisualeprtatio</td></tr><tr><td></td><td>This problem requires visual representations to find the bonding and antibonding Huickel</td></tr></table>
420
+
421
+ not. Through the annotation of 151 samples across different settings, we observed that 123 of them were correctly classified, resulting in an accuracy rate of $8 1 . 4 5 \%$ .
422
+
423
+ Figure S7: An example problem is inaccurately solved by error reason 7. Scientific Literacy. "Error Reason" denotes the output from the LLM Verifier utilized in the classification of error causes. In the example, the mistaken step is highlighted in red, while the correct step is highlighted in blue.
424
+
425
+ <table><tr><td colspan="2">Problem What is the mean speed,c,of N2 molecules in air at 25C Correct Solution</td></tr><tr><td colspan="2">The integral required is =4π 2MT )3/2 ʃ8-Mv2/2Rr du =4π )²×(2)²= (8RT)1/2</td></tr><tr><td colspan="2">πM where we have used the standard result from tables of integrals (or software) that xe 1 dx= -ax2</td></tr><tr><td colspan="2">J0 2a² Substitution of the data then gives (8× (8.3141JK-1 mol-1) × (298K) 1/2 C= = 475ms-1</td></tr><tr><td colspan="2">π × (28.02 × 10-3 kg mol-1) where we have used 1J=1kg m² s-2. Final Answer: 475</td></tr></table>
426
+
427
+ <table><tr><td colspan="2">Problem What is the number of possible four-letter code words,selecting from the 26 letters in the alphabet?</td></tr><tr><td colspan="2">CorrectSolution The numberofpossblefour-ettercodewords,selectingfromthe26lettersinthealphabet,inhchallfourletersarediferentis</td></tr><tr><td colspan="2">26P4 = (26)(25)(24)(23) = 26 =358,800. 22!</td></tr><tr><td colspan="2">Final Answer: 358800</td></tr><tr><td colspan="2">Model Solution Explanation forProblem6:The numberof possible four-lettr code words,selecting fromthe26 leters in thealphabetis</td></tr><tr><td colspan="2">264=456,976.</td></tr><tr><td colspan="2">Final Answer: 456976</td></tr><tr><td>ErrorReason The model&#x27;s error reason category is|9. Logical Reasoning</td><td></td></tr><tr><td></td><td>.The model did not consider the condition that all four lettrs should be different. Thecorectsolutionconsiders thisonditionanduses thepermutationformula tocalculateteumberofposiblefour-letercode ords.</td></tr></table>
428
+
429
+ Figure S8: An example problem is inaccurately solved by error reason 9. Logical reasoning. “Error Reason” denotes the output from the LLM Verifier utilized in the classification of error causes. In the example, the mistaken step is highlighted in red.
430
+
431
+ # D.3 COMPARISON
432
+
433
+ <table><tr><td colspan="2">Problem Find the bonding and antibonding Huckel molecular orbitals for ethene.</td></tr><tr><td colspan="2">Correct Solution</td></tr><tr><td colspan="2">The equations for C1 and C2 associated with Equation 11.7 are</td></tr><tr><td colspan="2">C1(α-E)+c2β=O and ciβ+c2(α-E)=0</td></tr><tr><td colspan="2">For E=α+ β,either equation yields c1 =C2. Thus,</td></tr><tr><td colspan="2">b=c1(2pz1+2pz2) Thevalueofc1canbefoundbyrequiring hathe wavefunctionbenomalized.Thenormalizationconditionongivesc²(1+2S+1)=</td></tr><tr><td colspan="2">1.UsingtheHuckelassumptionthatS=O,wefindthatc1=1/2.SubstitutingE=α-βintoeitheroftheequationsforandC2 yieldsc1 =-c2,or a=c1(2pz1-2pz2)</td></tr><tr><td colspan="2">The normalization condition gives c²(1- 2S +1)= 1,or c1 = 1/√2. Final Answer: 0.70710678</td></tr><tr><td colspan="2">Model Solution twobondingdtoibongckelolelaobalsf.Thitftsrisotaplblesisualitietion of the molecular orbitals.</td></tr><tr><td colspan="2">Final Answer: None Error Reason</td></tr><tr><td colspan="2">The error reason category for the model&#x27;s solution is|6.Abstract Reasoning .The model&#x27;s solution is incorrect because it did not consider theHuckelmoleculaobalhoryichpredicts attereareolytomolecularobialsforeteoeodingadetibodng</td></tr></table>
434
+
435
+ Figure S9: An example problem is inaccurately solved by error reason 6. Abstract Reasoning. “Error Reason” denotes the output from the LLM Verifier utilized in the classification of error causes.
436
+
437
+ <table><tr><td colspan="2">Problem Alivingromhasfoordimensionsof3.5mand4.2mandaheightof2.4m.Whatdoestheairintheroom weighwhentheairpresure is 1.0atm? CorrectSolution</td></tr><tr><td>The air&#x27;s weightisequaltomg,wheremisitsmassMasmisrelatedtotheairdensityandtheairvolumeV(=m/V).Calculation: Putting the two ideas together and taking the density of air at 1.O atm, we find mg = (pV)g = (1.21 kg/m³) (3.5 m × 4.2 m × 2.4 m) (9.8 m/s2)= 418 N Final Answer: 418</td></tr><tr><td>ModelSolution 101,640N.Tofindtheweghtoftheairineroom,wedtofstcalculatethevolumef heoo:V=lh=3.54.2m 2.4m=35.28mNextwecanusetheidealgaslwtofindthe massoftheairintheroom:PV=nRTwherePisthepressure,Vis thevolume,nisteumberofolesofas,Risthesostant,ndTis tetempeature.Aumigootmperatureof(93K), wecansolve forn: PV (1.0atm)(35.28m3) m=RT = (0.0821 L atm/mol K)(293 K) = 1,610 mol Finally,we can find the weight of the air using the molar mass of air(approximately 28.97 g/mol):</td></tr></table>
438
+
439
+ Figure S10: An example problem is inaccurately solved by error reason 2. Identification of Assumptions. "Error Reason" denotes the output from the LLM Verifier utilized in the classification of error causes. In the example, the mistaken step is highlighted in red.
440
+
441
+ <table><tr><td>Problem Fromardiarydeckofplaingcads,cardsaretoedrasucesivelyatandomaditouteplacement.Whatistheprobbilitytat the third spade appears on the sixth draw?</td></tr><tr><td>Correct Solution LetAbetheevetoftwospadesitefrstfvecardsdra,ndtBbeteeventofspadeotesithdr.us,theprobabilittat we wish to compute is P(A B). It is reasonable to take</td></tr><tr><td>P()=(132)((3 = 0.274 and P(B|A)= 17 =0.234</td></tr><tr><td>The desired probability,P(A B),is the productof those numbers:P(An B)= (0.274)(0.234) = 0.064 Final Answer: 0.064</td></tr><tr><td>Model Solution The probability that the third spade appears on the sixth draw is</td></tr><tr><td>13C2·39C4 78·741,948 1,441</td></tr><tr><td>52C6 20,358,520 5,577</td></tr><tr><td></td></tr><tr><td>Final Answer: 0.258</td></tr><tr><td>Error Reason</td></tr><tr><td>Themodel&#x27;ssolutionisicorctbecauseitcalculatesthprobabilityofgetigtwospadesinthefrstfivecadsandayspadeonthesixth</td></tr><tr><td>draw,insteadofspeciicallycalculatingtheprobabilityoftetirdspadeappearingontesixthdragiventhattwspadeshavealeady</td></tr><tr><td>appeared in the first five draws.Therefore,the error reason category is|4. Causal Reasoning</td></tr></table>
442
+
443
+ Figure S11: An example problem is inaccurately solved by error reason 4. Causal Reasoning. The mistaken step is highlighted in red.
444
+
445
+ <table><tr><td>Problem Gas cylinders of COare sold in terms of weightofCO2.Acylindercontains5Olb(22.7kg)ofCO2.Howlong can this cylinderbe usedinanexperiment hatrequiresfowingCO2at293K(n=146μP)througha1.-m-long ube(diameter=0.75mm)withan input pressure of 1.O5 atm and output pressure of 1.OO atm ?The flow is measured at the tube output</td></tr><tr><td>CorrectSolution The gas flowrate△V/△t is</td></tr><tr><td>△V (P²-P²) 2.76 × 10-6 3 -1 △t 16nLP 二 ms Tr4</td></tr><tr><td>Converting the CO2 contained in the cylinder to the volume occupied at 298 K and 1 atm pressure,we get (10</td></tr><tr><td>ncoz = 22.7 kg (0.044kgmol-1 = 516 mol, V=𝑛RT = 1.24× 104 L</td></tr><tr><td></td></tr><tr><td>GiventheeffectivevolumeofCO2contaiedinthecylinder,the durationoverwhichthecylindercabeusedis2.76×1-4 4.49 × 10 s. This time corresponds to roughly 52 days. Final Answer: 52 days</td></tr><tr><td>Model Solution The volume of CO2 in the cylinder is given by</td></tr><tr><td>m 22.7 kg = 11.5m³</td></tr><tr><td>p 1.98 kg m-3</td></tr><tr><td>The volume of CO2 that flows through the tube is given by</td></tr><tr><td>Πd²L (0.75 × 10-3m)²(1.00m) = 1.77 × 10-7m² 4 V</td></tr><tr><td>1.710-7(104gmD) = 2.08 x 10s.The</td></tr><tr><td>The time required to flow V volume of CO2 isgiven byt = = P1</td></tr><tr><td>2.08x106</td></tr><tr><td>numberof seconds inayearis3.15×107s.Therefore,thecylindercanbeusedfor.110r-1=0.066yr =24.1days</td></tr><tr><td></td></tr><tr><td>Final Answer: 24.1 days</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>Error Reason</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>Themodel’ssolutionisicorectbcasetcalulatesthetierequedtofowvolumeofCOtroughtetubeutitdoesottakeit</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>accountthetotal volumefCOinthecyliderThecorrctslutioncalulates thetotalvolumeofCOintecylinderanddividestbythe</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>flowratetodeterinetheurationoerichtecyldercanbeuedTerefore,theeroreasoncategoryis」.ProblemDeductioSkills</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr></table>
446
+
447
+ Figure S12: An example problem is inaccurately solved by error reason 5. Problem Deduction Skills.
448
+ The mistaken step is highlighted in red.
449
+
450
+ # Problem
451
+
452
+ # Correct Solution
453
+
454
+ We can approximate Earth as a uniform sphere of mass $M _ { E }$ . Then, from Eq. 13-11, the gravitational acceleration at any distance $r$ from the center of Earth is
455
+
456
+ $$
457
+ a _ { g } = { \frac { G M _ { E } } { r ^ { 2 } } }
458
+ $$
459
+
460
+ We might simply apply this equation twice, first with $r = 6 . 7 7 \times 1 0 ^ { 6 }$ m for the location of the feet and then with $r = 6 . 7 7 \times 1 0 ^ { 6 } \mathrm { m } +$ $1 . 7 0 \mathrm { m }$ for the location of the head. However, a calculator may give us the same value for $a _ { g }$ twice, and thus a difference of zero, because $^ h$ is so much smaller than $r$ . Here’s a more promising approach: Because we have a differential change $d r$ in $_ r$ between the astronaut’s feet and head, we should differentiate Eq. 13-15 with respect to $_ r$ .Calculations: The differentiation gives us
461
+
462
+ $$
463
+ d a _ { g } = - 2 { \frac { G M _ { E } } { r ^ { 3 } } } d r
464
+ $$
465
+
466
+ where $d \boldsymbol { a } _ { g }$ is the differential change in the gravitational acceleration due to the differential change $d r$ in $_ r$ . For the astronaut, $d r = h$ and $r = 6 . 7 \bar { 7 } \times 1 0 ^ { 6 } \mathrm { ~ m ~ }$ . Substituting data into Eq.13-16, we find
467
+
468
+ $$
469
+ d a _ { g } = - 2 { \frac { \left( 6 . 6 7 \times 1 0 ^ { - 1 1 } { \bf m } ^ { 3 } / \mathrm { k g } \cdot \mathrm { s } ^ { 2 } \right) \left( 5 . 9 8 \times 1 0 ^ { 2 4 } \mathrm { k g } \right) } { ( 6 . 7 7 \times 1 0 ^ { 6 } \mathrm { m } ) ^ { 3 } } } \left( 1 . 7 0 \mathrm { m } \right) \quad = - 4 . 3 7 \times 1 0 ^ { - 6 } \mathrm { m / s } ^ { 2 }
470
+ $$
471
+
472
+ Final Answer: $- 4 . 3 7 \times 1 0 ^ { - 6 } \mathrm { m / s } ^ { 2 }$
473
+
474
+ # Model Solution
475
+
476
+ We can use the equation for the gravitational acceleration due to a point mass, given by Eq. 13-2 $( g = G M / r ^ { 2 } )$ , to find the gravitational acceleration at the astronaut’s feet and head. Because the astronaut is in free fall, the difference between these two accelerations is the tidal acceleration, given by Eq. 13-22 $\Delta g = 2 G M h / r ^ { 3 } )$ .Calculations: The gravitational acceleration at the astronaut’s feet is
477
+
478
+ $$
479
+ g _ { \mathrm { f e e t } } = { \frac { G M } { r ^ { 2 } } } = { \frac { \left( 6 . 6 7 \times 1 0 ^ { - 1 1 } { \mathrm { N } } \cdot { \mathrm { m } } ^ { 2 } / { \mathrm { k g } } ^ { 2 } \right) \left( 5 . 9 8 \times 1 0 ^ { 2 4 } { \mathrm { k g } } \right) } { \left( 6 . 7 7 \times 1 0 ^ { 6 } { \mathrm { m } } \right) ^ { 2 } } } = 9 . 7 8 { \mathrm { m } } / { \mathrm { s } } ^ { 2 } .
480
+ $$
481
+
482
+ The gravitational acceleration at the astronaut’s head is
483
+
484
+ $$
485
+ g _ { \mathrm { h e a d } } = { \frac { G M } { ( r + h ) ^ { 2 } } } = { \frac { \left( 6 . 6 7 \times 1 0 ^ { - 1 1 } { \mathrm { ~ N } } \cdot { \mathrm { m } } ^ { 2 } / { \mathrm { k g } } ^ { 2 } \right) \left( 5 . 9 8 \times 1 0 ^ { 2 4 } { \mathrm { ~ k g } } \right) } { \left( 6 . 7 7 \times 1 0 ^ { 6 } { \mathrm { ~ m } } + 1 . 7 0 { \mathrm { ~ m } } \right) ^ { 2 } } } = 9 . 7 7 { \mathrm { m / s } } ^ { 2 } .
486
+ $$
487
+
488
+ The difference between these two accelerations is
489
+
490
+ $$
491
+ \Delta g = g _ { \mathrm { f e e t } } - g _ { \mathrm { h e a d } } \mathrm { ~ \rho ~ = 9 . 7 8 ~ m / s ^ { 2 } - 9 . 7 7 ~ m / s ^ { 2 } = 0 . 0 1 ~ m / s ^ { 2 } ~ } = 1 . 0 \times 1 0 ^ { - 5 } ~ \mathrm { m / s ^ { 2 } } .
492
+ $$
493
+
494
+ Final Answer: $1 . 0 \times 1 0 ^ { - 5 } \mathrm { m / s ^ { 2 } }$
495
+
496
+ # Error Reason
497
+
498
+ The model’s solution is incorrect because it uses the equation for the gravitational acceleration due to a point mass, which is not applicable in this case since the Earth is not a point mass. The correct equation to use is the one given in the correct solution, which takes into account the fact that the Earth is a uniform sphere of mass. Therefore, the error reason category is 1. Logical Decomposition and Analysis Skills
499
+
500
+ Figure S13: An example problem is inaccurately solved by error reason 1. Logical Decomposition and Analysis Skills. “Error Reason” denotes the output from the LLM Verifier utilized in the classification of error causes. In the example, the mistaken step is highlighted in red.
501
+
502
+ ![](images/9291f4e15c79ab2f87044fd15fddb5f4457d2f8baad800400c7ec080e961fbe3.jpg)
503
+ Figure S14: Comparison of error reasons between different subjects. The qualitative analysis of incorrect answers provided by the model revealed ten dimensions of problem-solving abilities. The "Correct" category, representing the proportion of accurately answered questions by the model, is included for comparison. A smaller chart representation indicates a lower number of erroneously answered questions.
504
+
505
+ <table><tr><td>Problem 3x +4y =-23,2y-x =-19.What is the solution(x,y) to the system of equations above? Options: (A).(-5,2) (B). (3,-8) (C).(4,-6) (D). (9,-6) Final Answer: B</td></tr><tr><td>Problem What is the mean speed, c,of N2 molecules in air at 25C Correct Solution The integral required is</td></tr><tr><td>c=4π (M)3/2√08-M2/2RT d =4π )³²×(2)²= ()/2 where we have used the standard result from tables of integrals (or software) that</td></tr><tr><td>xe dx =22 1ax2</td></tr><tr><td>Substitution of the data then gives Jo</td></tr><tr><td>(8× (8.3141JK-1 mol-1) × (298K) 1/2 c= = 475ms-1</td></tr><tr><td>π× (28.02×10-3kg mol-1)</td></tr><tr><td>Final Answer: 475 where we have used 1 J = 1 kg m2 s-2.</td></tr></table>
506
+
507
+ Figure S15: Example from AGIEval [18] (top) and SCIBENCH (bottom). The problem from AGIEval is of high school difficulty with basic algebraic computations involved. In contrast, the problem from our dataset is of a college-level complexity, requiring not only an understanding of background equations but also proficiency in differentiation calculations.
parse/test/u6jbcaCHqO/u6jbcaCHqO_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/u6jbcaCHqO/u6jbcaCHqO_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/u6jbcaCHqO/u6jbcaCHqO_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/umFYHBDCcW/umFYHBDCcW.md ADDED
@@ -0,0 +1,348 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Can We Solve 3D Vision Tasks Starting from A 2D Vision Transformer?
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # Abstract
6
+
7
+ Vision Transformers (ViTs) have proven to be effective, in solving 2D image understanding tasks by training over large-scale image datasets; and meanwhile as a somehow separate track, in modeling the 3D visual world too such as voxels or point clouds. However, with the growing hope that transformers can become the “universal” modeling tool for heterogeneous data, ViTs for 2D and 3D tasks have so far adopted vastly different architecture designs that are hardly transferable. That invites an (over-)ambitious question: can we close the gap between the 2D and 3D ViT architectures? As a piloting study, this paper demonstrates the appealing promise to understand the 3D visual world, using a standard 2D ViT architecture, with only minimal customization at the input and output levels without redesigning the pipeline. To build a 3D ViT from its 2D sibling, we “inflate” the patch embedding and token sequence, accompanied with new positional encoding mechanisms designed to match the 3D data geometry. The resultant “minimalist” 3D ViT, named Simple3D-Former, performs surprisingly robustly on popular 3D tasks such as object classification, point cloud segmentation and indoor scene detection, compared to highly customized 3D-specific designs. It can hence act as a strong baseline for new 3D ViTs. Moreover, we note that pursuing a unified 2D-3D ViT design has practical relevance besides just scientific curiosity. Specifically, we demonstrate that Simple3D-Former naturally is able to exploit the wealth of pre-trained weights from large-scale realistic 2D images (e.g., ImageNet), which can be plugged into enhancing the 3D task performance “for free”.
8
+
9
+ # 1 Introduction
10
+
11
+ In the past year, we have witnessed how transformers extend their reasoning ability from Natural Language Processing(NLP) tasks to computer vision (CV) tasks. Various vision transformers (ViTs) (Carion et al., 2020; Dosovitskiy et al., 2020; Liu et al., 2021b; Wang et al., 2022) have prevailed in different image/video processing pipelines and outperform conventional Convolutional Neural Networks (CNNs). One major reason that accounts for the success of ViTs is the self-attention mechanism that allows for global token reasoning (Vaswani et al., 2017b). It receives tokenized, sequential data and learns to attend between every token pair. These pseudo-linear blocks offer flexibility and global feature aggregation at every element, whereas the receptive field of CNNs at a single location is confined by small size convolution kernels. This is one of the appealing reasons that encourages researchers to develop more versatile ViTs, while keeping its core of self-attention module simple yet efficient, e.g., Zhou et al. (2021); He et al. (2021).
12
+
13
+ Motivated by ViT success in the 2D image/video space, researchers are expecting the same effectiveness of transformers applied into the 3D world, and many innovated architectures have been proposed, e.g., Point Transformer (PT, Zhao et al. (2021)), Point-Voxel Transformer (PVT, Zhang et al. (2021)), Voxel Transformer (VoTr, Mao et al. (2021)), M3DETR(Guan et al., 2021). Although most of the newly proposed 3D Transformers have promising results in 3D classification, segmentation and detection, they hinge on heavy customization beyond a standard transformer architecture, by either introducing pyramid style design in transformer blocks, or making heavy manipulation of self-attention modules to compensate for sparselyscattered data. Consequently, ViTs for same type of vision tasks under 2D and 3D data is difficult to share similar architecture designs. On the other hand, there are recently emerged works, including Perceiver
14
+
15
+ IO(Jaegle et al., 2021a), and SRT(Sajjadi et al., 2022), that make fairly direct use of ViTs architecture, with only the input and output modalities requiring different pre-encoders.
16
+
17
+ That invites the question: are those task-specific, complicated designs necessary for ViTs to succeed in 3D vision tasks? Or can we stick an authentic transformer architecture with minimum modifications, as is the case in 2D ViTs? Note that the questions are of both scientific interest, and practical relevance. On one hand, accomplishing 3D vision tasks with standard transformers would set another important milestone for a transformer to become the universal model, whose success could save tedious task-specific model design. On the other hand, bridging 2D and 3D vision tasks with a unified model implies convenient means to borrow each other’s strength. For example, 2D domain has a much larger scale of real-world images with annotations, while acquiring the same in the 3D domain is much harder or more expensive. Hence, a unified transformer could help leverage the wealth of 2D pre-trained models, which are supposed to learn more discriminative ability over real-world data, to enhance the 3D learning which often suffers from either limited data or synthetic-real domain gap. Other potential appeals include integrating 2D and 3D data into unified multi-modal/multi-task learning using one transformer (Akbari et al., 2021).
18
+
19
+ As an inspiring initial attempt, 3DETR (Misra et al., 2021) has been proposed. Despite its simplicity, it is surprisingly powerful to yield good end-to-end detection performance over 3D dense point clouds. The success of 3DETR implies that the reasoning ability of a basic transformer, fed with scattered point cloud data in 3D space, is still valid even without additional structural design. However, its 2D siblings, DETR(Devlin et al., 2019), cannot be naively generalized to fit in 3D data scenario. Hence, 3DETR is close to a universal design of but without testing itself over other 3D tasks, and embrace 2D domain. Moreover, concurrent works justify ViT can be extended onto 2D detection tasks without Feature Pyramid Network design as its 2D CNN siblings (Chen et al., 2021; Fang et al., 2022; Li et al., 2022), leading a positive sign of transferring ViT into different tasks. Uniform transformer model has been tested over multimodal data, especially in combination with 1D and 2D data, and some 3D image data as well (Jaegle et al., 2021b; Girdhar et al., 2022).
20
+
21
+ Therefore, we are motivated to design an easily customized transformer by taking a minimalist step from what we have in 2D, i.e., the standard 2D ViT (Dosovitskiy et al., 2020). The 2D ViT learns patch semantic correlation mostly under pure stacking of transformer blocks, and is well-trained over large scale of real-world images with annotations. However, there are two practical gaps when bringing 2D ViT to 3D space. i) Data Modality Gaps. Compared with 2D grid data, the data generated in 3D space contains richer semantic and geometric meanings, and the abundant information is recorded mostly in a spatially-scattered point cloud data format. Even for voxel data, the additional dimension brings the extra semantic information known as “depth”. ii) Task Knowledge Gaps. It is unclear whether or not a 3D visual understanding task can gain from 2D semantic information, especially considering many 3D tasks are to infer the stereo structures(Yao et al., 2020) which 2D images do not seem to directly offer.
22
+
23
+ To minimize the aforementioned gaps, we provide a candidate solution, named as Simple3D-Former, to generate 3D understanding starting with a unified framework adapted from 2D ViTs. We propose an easy-to-go model relying on the standard ViT backbone where we made no change to the basic pipeline nor the self-attention module. Rather, we claim that properly modifying (i) positional embeddings; (ii) tokenized scheme; (iii) down-streaming task heads, suffices to settle a high-performance vision transformer for 3D tasks, that can also cross the “wall of dimensionality” to effectively utilize knowledge learned by 2D ViTs, such as in the form of pre-trained weights.
24
+
25
+ # Our Highlighted Contributions
26
+
27
+ • We propose Simple-3DFormer, which closely follows the standard 2D ViT backbone with only minimal modifications at the input and output levels. Based on the data modality and the end task, we slightly edit only the tokenizer, position embedding and head of Simple3D-Former, making it sufficiently versatile, easy to deploy with maximal reusability.
28
+ • We are the first to lend 2D ViT’s knowledge to 3D ViT. We infuse the 2D ViT’s pre-trained weight as a warm initialization, from which Simple-3DFormer can seamlessly adapt and continue training over 3D data. We prove the concept that 2D vision knowledge can help further 3D learning through a unified model.
29
+
30
+ • Due to a unified 2D-3D ViT design, our Simple3D-Former can naturally extend to some different 3D down-streaming tasks, with hassle-free changes. We empirically show that our model yield competitive results in 3D understanding tasks including 3D object classification, 3D part segmentation, 3D indoor scene segmentation and 3D indoor scene detection, with simpler and mode unified designs.
31
+
32
+ ![](images/5effd3f961d345ace42bdb2431499577c3e74db5349b75dd7c3cbd6cfbb05494.jpg)
33
+ Figure 1: Overview of Simple3D-Former Architecture. As a Simple3D-Former, our network consists of three common components: tokenizer, transformer backbone (in our case we refer to 2D ViT), and a down-streaming task-dependent head layer. All data modalities, including 2D images, can follow the same processing scheme and share a universal transformer backbone. Therefore, we require minimal extension from the backbone and it is simple to replace any part of the network to perform multi-task 3D understanding. Dashed arrow refers a possible push forward features in the tokenizer when performing dense prediction tasks.
34
+
35
+ # 2 Related Work
36
+
37
+ # 2.1 Existing 2D Vision Transformer Designs
38
+
39
+ There is recently a growing interest in exploring the use of transformer architecture for vision tasks: works in image generation (Chen et al., 2020a; Parmar et al., 2018) and image classification (Chen et al., 2020a) learn the pixel distribution using transformer models. ViT (Dosovitskiy et al., 2020), DETR (Carion et al., 2020) formulated object detection using transformer as a set of prediction problem. SWIN (Liu et al., 2021b) is a more advanced, versatile transformer that infuses hierarchical, cyclic-shifted windows to assign more focus within local features while maintaining global reasoning benefited from transformer architectures. In parallel, the computation efficiency is discussed, since the pseudo-linear structure in a self-attention module relates sequence globally, leading to a fast increasing time complexity. DeIT (Touvron et al., 2021) focus on data-efficient training while DeepViT (Zhou et al., 2021) propose a deeper ViT model with feasible training. Recently, MSA (He et al., 2021) was introduced to apply a masked autoencoder to lift the scaling of training in 2D space. Recent works start exploring if a pure ViT backbone can be transferred as 2D object detection backbone with minimal modification, and the result indicates it might be sufficient to use single scale feature plus a Vanilla ViT without FPN structure to achieve a good detection performance (Chen et al., 2021; Fang et al., 2022; Li et al., 2022).
40
+
41
+ # 2.2 Exploration of 3D Vision Transformers
42
+
43
+ Transformer is under active development in the 3D Vision world (Fan et al., 2021; 2022). For example, 3D reconstruction for human body and hand is explored by the work (Lin et al., 2021) and 3D point cloud completion has been discussed in (Yu et al., 2021a). Earlier works such as Point Transformer (Engel et al., 2020) and Point Cloud Transformer (Guo et al., 2021) focus on point cloud classification and semantic segmentation. They closely follow the prior wisdom in PointNet (Qi et al., 2017a) and PointNet $^ { + + }$ (Qi et al., 2017b). These networks represent each 3D point as tokens using the Set Abstraction idea in PointNet and design a hierarchical transformer-like architecture for point cloud processing. Nevertheless, the computing power increases quadratically with respect to the number of points, leading to memory scalability bottleneck. Latest works seek an efficient representation of token sequences. For instance, a concurrent work PatchFormer (Cheng et al., 2021) explores the local voxel embedding as the tokens that feed in transformer layers. Inspired by sparse CNN in object detection, VoTR (Mao et al., 2021) modifies the transformer to fit sparse voxel input via heavy hand-crafted changes such as the sparse voxel module and the submanifold voxel module. The advent of 3DETR (Misra et al., 2021) takes an inspiring step towards returning to the standard transformer architecture and avoiding heavy customization. It attains good performance in object detection. Nevertheless, the detection task requires sampling query and bounding box prediction. The semantics contains more information from local queries compared with other general vision tasks in interest, and 3DETR contains transform decoder designs whereas ViT contains transformer encoder only. At current stage, our work focuses more on a simple, universal ViT design, i.e., transformer encoder-based design.
44
+
45
+ # 2.3 Transferring Knowledge between 2D and 3D
46
+
47
+ Transfer learning has always been a hot topic since the advent of deep learning architectures, and hereby we focus our discussion on the transfer of the architecture or weight between 2D and 3D models. 3D Multi View Fusion (Su et al., 2015; Kundu et al., 2020) has been viewed as one connection from Images to 3D Shape domain. A 2D to 3D inflation solution of CNN has been discussed in Image2Point (Xu et al., 2021), where the copy of convolutional kernels in inflated dimension can help 3D voxel/point cloud understanding and requires less labeled training data in target 3D task. On a related note, for video as a 2D+1D data, TimeSFormer (Bertasius et al., 2021) proposes an inflated design from 2D transformers, plus memorizing information across frames using another transformer along the additional time dimension. Liu et al. (2021a) provides a pixel-to-point knowledge distillation by contrastive learning.
48
+
49
+ It is also possible to apply a uniform transformer backbone in different data modalities, including 2D and 3D images, which is successfully shown by Perceiver (Jaegle et al., 2021b), Perceiver IO (Jaegle et al., 2021a), Omnivore (Girdhar et al., 2022), SVT (Sajjadi et al., 2022), UViM (Kolesnikov et al., 2022) and Transformer-M (Luo et al., 2022). All these works aim at projecting different types of data into latent token embedding but incorporate knowledge from different modalities either with self-attention or with cross-attention modules (with possibly one branch embedding from knowledge-abundant domain). Note that among all these aforementioned work. Only Perceiver discuss the application in point cloud modality with very preliminary result, and Omnivore discuss RGB-D data which is a primary version resembling 3D Voxel data. Contrary to prior works, our Simple3D-Former specifically aims at a model unifying 3D modalities, where point cloud and voxels are two most common data types that has not been extensively discussed in previous universal transformer model design. We discuss in particular how to design 3D data token embeddings as well as how to add 2D prior knowledge. In this paper, we show that with the help of a 2D vanilla transformer, we do not need to specifically design or apply any 2D-3D transfer step - the unified architecture itself acts as the natural bridge.
50
+
51
+ # 3 Our Simple3D-Former Design
52
+
53
+ # 3.1 Network Architecture
54
+
55
+ We briefly review the ViT and explain how our network differs from 2D ViTs when dealing with different 3D data modalities. We look for both voxel input and point cloud input. Then we describe how we adapt the 2D reasoning from pretrained weights of 2D ViTs. The overall architecture refers to Figure 1.
56
+
57
+ # 3.1.1 Preliminary
58
+
59
+ For a conventional 2D ViT (Dosovitskiy et al., 2020), the input image $I \in \mathbb { R } ^ { H \times W \times C }$ is assumed to be divided into patches of size by $P$ , thus leading to a sequence of length total length $P$ by $P$ , denoted as with subscripts $\begin{array} { r } { N : = { \frac { H W } { P ^ { 2 } } } } \end{array}$ $x , y$ . We assume . We apply a patch embedding layers $H$ and $W$ can be divided
60
+
61
+ $E : \mathbb { R } ^ { P \times P } \mathbb { R } ^ { D }$ as the tokenizer that maps an image patch into a $D$ -dimensional feature embedding vector. Then, we collect those embeddings and prepend class tokens, denoted as $\mathbf { \mathcal { x } } _ { c l a s s }$ , as the target classification feature vector. To incorporate positional information for each patch when flattened from 2D grid layout to 1D sequential layout, we add a positional embedding matrix $E _ { p o s } \in \mathbb { R } ^ { D \times ( N + 1 ) }$ as a learn-able parameter with respect to locations of patches. Then we apply $L$ transformer blocks and output the class labeling $\mathbf { \pmb { y } }$ by a head layer. The overall formula of a 2D ViT is:
62
+
63
+ $$
64
+ \begin{array} { r l } & { z _ { 0 } = [ \pmb { x } _ { c l a s s } ; E ( I _ { 1 , 1 } ) ; \cdots ; E ( I _ { \frac { H } { P } } , \underline { { w } } ) ] + E _ { p o s } ; } \\ & { \tilde { z } _ { l } = M S A ( L N ( z _ { l - 1 } ) ) + z _ { l - 1 } ; z _ { l } = M L P ( L N ( \tilde { z } _ { l } ) ) + \tilde { z } _ { l } ; } \\ & { \pmb { y } = h ( L N ( z _ { L , 0 } ) ) . } \end{array}
65
+ $$
66
+
67
+ Here $M S A$ and $M L P$ refer to the multi-head self-attention layer and multi-layer perception, respectively. The MSA is a standard qkv dot-product attention scheme with multi-heads settings (Vaswani et al., 2017a). The MLP contains two layers with a GELU non-linearity. Before every block, Layernorm (LN, Wang et al. (2019a); Baevski & Auli (2019)) is applied. The last layer class token output $z _ { L , 0 }$ will be fed into head layer $h$ to obtain final class labelings. In 2D ViT setting, $h$ is a single-layer MLP that maps $D$ -dimensional class tokens into class dimensions (1000 for ImageNet).
68
+
69
+ The primary design principle of our Simple3D-Former is to keep transformer encoder blocks equation 2 same as in 2D ViT, while maintaining the tokenizing pipeline, equation 1 and the taskdependent head, equation 3. We state how to design our Simple3DFormer specifically with minimum extension for different data modalities.
70
+
71
+ # 3.1.2 Simple3D-Former of Voxel Input
72
+
73
+ We first consider the “patchable” data, voxels. We start from the data $V \in \mathbb { R } ^ { H \times W \times Z \times C }$ as the voxel of height $H$ , width $W$ , depth $Z$ and channel number $C$ . We denote our 3D space tessellation unit as cubes $V _ { x , y , z } \in \mathbb { R } ^ { T \times T \times T \times C }$ , where $x , y , z$ are three dimensional indices. We assume the cell is of size $T$ by $T$ by $T$ and $H , W , C$ are divided by $T$ . Let $\begin{array} { r } { N = \frac { H W Z } { T ^ { 3 } } } \end{array}$ be the number of total cubes obtained. To reduce the gap from 2D ViT to derived 3D ViT, we provide three different realizations of our Simple3D-Former, only by manipulating tokenization that has been formed in equation 1. We apply a same voxel embedding $E _ { V } : \mathbb { R } ^ { T \times T \times T ^ { \ast } } \to \mathbb { R } ^ { D }$ for all following schemes. We refer readers to Figure 2 for a visual interpretation of three different schemes.
74
+
75
+ ![](images/c2daafa1ee3835d04fb6bd61b580217cae165019d029d56d962e1a4d4f407f96.jpg)
76
+ Figure 2: Three different voxel tokenizer designs. The given example is a $2 ^ { 3 }$ cell division. We number cells for understanding. Top: Naive Inflation; We pass the entire voxel sequence in XYZ coordinate ordering. Middle: 2D Projection; We average along $Z$ -dimension to generate 2D “patch” sequence unified with 2D ViT design. Bottom: Group Embedding; We introduce an additional, single layer transformer encoder to encode along $Z$ - dimension, to generate 2D “group” tokens. Then the flattened tokenized sequence can thereby pass to a universal backbone.
77
+
78
+ Naive Inflation One can consider straight-forward inflation by only changing patch embedding to a voxel embedding $E _ { V }$ , and reallocating a new positional encoding matrix $E _ { p o s , V } \in \mathbb { R } ^ { ( 1 + N ) \cdot D }$ to arrive at a new tokenized sequence:
79
+
80
+ $$
81
+ z _ { 0 } ^ { V } = [ { \pmb x } _ { c l a s s } ; E _ { V } ( { \pmb x } _ { 1 , 1 , 1 } ) ; E _ { V } ( { \pmb x } _ { 1 , 1 , 2 } ) ; \cdots ; E _ { V } ( { \pmb x } _ { 1 , 2 , 1 } ) ; \cdots ; E _ { V } ( { \pmb x } _ { \frac { H } { T } , \frac { W } { P } , \frac { Z } { P } } ) ] + E _ { p o s , V } .
82
+ $$
83
+
84
+ We then feed the voxel tokenized sequence $z _ { \mathrm { 0 } } ^ { V }$ to the transformer block equation 2. The head layer $h$ is replaced by a linear MLP with the output of probability vector in Shape Classification task.
85
+
86
+ 2D Projection (Averaging) It is unclear from equation 4 that feeding 3D tokizened cube features is compatible with 2D ViT setting. A modification is to force our Simple3D-Former to think as if the data were in 2D case, with its 3rd dimensional data being compressed into one token, not consecutive tokens. This resembles the occupancy of data at a certain viewpoint if compressed in 2D, and naturally a 2D ViT would fit the 3D voxel modality. We average all tokenized cubes if they come from the same XY coordinates (i.e. view directions). Therefore, we modify the input tokenized sequence as follows:
87
+
88
+ $$
89
+ z _ { 0 } ^ { V } = [ { \pmb x } _ { c l a s s } ; \frac { T } { Z } \sum _ { z = 1 } ^ { \frac { z } { T } } E ( { \pmb x } _ { 1 , 1 , z } ) ; \frac { T } { Z } \sum _ { z = 1 } ^ { \frac { z } { T } } E ( { \pmb x } _ { 1 , 2 , z } ) ; \cdots ; \frac { T } { Z } \sum _ { z = 1 } ^ { \frac { z } { T } } E ( { \pmb x } _ { \frac { H } { T } , \frac { W } { T } , z } ) ] + E _ { p o s , V } .
90
+ $$
91
+
92
+ The average setting consider class tokens as a projection in 2D space, with $\begin{array} { r } { { E } _ { p o s , V } \in \mathbb { R } ^ { ( 1 + \tilde { N } ) \cdot D } , \tilde { N } = \frac { H W } { T ^ { 2 } } } \end{array}$ , and henceforth $E _ { p o s , V }$ attempts to serve as the 2D projected positional encoding with $\tilde { N }$ “patches” encoded.
93
+
94
+ Group Embedding A more advanced way of tokenizing the cube data is to consider interpreting the additional dimension as a “word group”. The idea comes from group word embedding in BERT-training (Devlin et al., 2019). A similar idea was explored in TimesFormer (Bertasius et al., 2021) for space-time dataset as well when considering inflation from image to video (with a temporal 2D+1D inflation). To train an additional “word group” embedding, we introduce an additional 1D Transformer Encoder(TE) to translate the inflated Z-dim data into a single, semantic token. Denote $V _ { x , y , - } = [ V _ { x , y , 1 } ; V _ { x , y , 2 } ; \cdot \cdot \cdot ; V _ { x , y , \frac { Z } { P } } ]$ as the stacking cube sequence along $z$ -dimension, we have:
95
+
96
+ $$
97
+ \begin{array} { r l } & { \tilde { E } ( { \cal V } _ { \boldsymbol { x } , \boldsymbol { y } , - } ) : = T E ( E ( { \cal V } _ { \boldsymbol { x } , \boldsymbol { y } , - } ) ) , } \\ & { z _ { 0 } ^ { V } = [ { \pmb x } _ { c l a s s } ; \tilde { E } ( { \cal V } _ { 1 , 1 , - } ) ; \cdots ; \tilde { E } ( { \cal V } _ { \frac { H } { P } , \frac { W } { P } , - } ) ] + { \bf E } _ { p o s , V } . } \end{array}
98
+ $$
99
+
100
+ Here $\tilde { E }$ as a compositional mapping of patch embedding and the 1D Transformer Encoder Layer (TE). The grouping, as an “projection” from 3D space to 2D space, maintains more semantic meaning compared with 2D Projection.
101
+
102
+ # 3.1.3 Simple3D-Former of Point Cloud Data
103
+
104
+ It is not obvious how one can trust 2D ViT backbone’s reasoning power applied over point clouds, especially when the target task changes from image classification to dense point cloud labeling. We show that, in our Simple3D-Former, a universal framework is a valid option for 3D semantic segmentation, with point cloud tokenization scheme combined with our universal transformer backbone. We modify the embedding layer $E$ , positional encoding $E _ { p o s }$ and task-specific head $h$ originated from equation 1 and equation 3 jointly. We state each module’s design specifically, but our structure does welcome different combinations.
105
+
106
+ Point Cloud Embedding We assume the input now has a form of $( X , P ) , X \in \mathbb { R } ^ { N \times 3 } , P \in \mathbb { R } ^ { N \times C }$ , referred as point coordinate and input point features. For a given point cloud, we first adopt a MLP (two linear layers with one ReLU nonlinearity) to aggregate positional information into point features and use another MLP embedding to lift point cloud feature vectors. Then, we adopt the same Transition Down (TD) scheme proposed in Point Transformer (Zhao et al., 2021). A TD layer contains a set abstraction downsampling scheme, originated from PointNet $^ { + + }$ (Qi et al., 2017b), a local graph convolution with kNN connectivity and a local max-pooling layer. We do not adopt a simpler embedding only (for instance, a single MLP) for two reasons. i) We need to lift input point features to the appropriate dimension to transformer blocks, by looking loosely in local region; ii) We need to reduce the cardinality of dense sets for efficient reasoning. We denote each layer of Transition Down operation as $T D ( X , P )$ , whose output is a new pair of point coordinate and features $( X ^ { \prime } , P ^ { \prime } )$ with fewer cardinality in $X ^ { \prime }$ and lifted feature dimension in $P ^ { \prime }$ . To match a uniform setting, we add a class token to the tokenized sequence. Later on, this token will not contribute to the segmentation task.
107
+
108
+ Positional Embedding for Point Clouds We distinguish our positional embedding scheme from any previous work in 3D space. The formula is a simple addition and we state it in equation 8. We adopt only a single MLP to lift up point cloud coordinate $X$ , and then we sum the result with the point features $P$ altogether for tokenizing. We did not require the transformer backbone to adopt any positional embedding components to fit the point cloud modality.
109
+
110
+ Segmentation Task Head Design For dense semantic segmentation, since we have proposed applying a down-sampling layer, i.e. TD, to the input point cloud, we need to interpolate back to the same input dimension. We adopt the Transition Up(TU) layer in Point Transformer (Zhao et al., 2021) to match TD layers earlier in tokenized scheme. TU layer receives both input coordinate-feature pair from the previous layer as well as the coordinate-feature pair from the same depth TD layer. Overall, the changes we made can be formulated as:
111
+
112
+ $$
113
+ \begin{array} { l } { { \tilde { P } = M L P _ { 2 } ( P + M L P _ { 1 } ( X ) ) ; ~ z _ { 0 } ^ { P C } = [ { \pmb x } _ { c l a s s } ; T D ( T D ( X , \tilde { P } ) ) ] ; } } \\ { { { \pmb y } = h ( T U ( T U ( L N ( z _ { L , 1 : N } ) , T D ( X , \tilde { P } ) ) , ( X , \tilde { P } ) ) ) . } } \end{array}
114
+ $$
115
+
116
+ We refer to Figure 3 as the overall visualized design of our Simple3D-Former for point cloud data. For detail architecture of Simple3D-Former in segmentation, we refer readers to Appendix C.
117
+
118
+ ![](images/87b497e51d84f865ea421fb9d9b1fec63880b52619821b9a7aa1d11d121df06b.jpg)
119
+ Figure 3: To transfer from a classification backbone into an object part segmentation backbone, we propose some additional, yet easy extensions that fit into 3D data modality. Given input point clouds with its coordinates $X$ , features $P$ , we compose positional information into features first and use a simple MLP to elevate features into $D / 4$ dimensions, given $D$ the dimension of backbone. Then we apply two layers of Transition down over pair $( X , P )$ , then feed the abstracted point cloud tokens sequentially into the transformer backbone. To generate the dense prediction. We follow the residual setting and add feature output from TD layers together with the previous layers’ output into a transition up layer. Then we apply a final MLP layer to generate dense object part predictions.
120
+
121
+ # 3.2 Incorporating 2D Reasoning Knowledge
122
+
123
+ The advantage of keeping the backbone transformer unchanged is to utilize the comprehensive learnt model in 2D ViT. Our Simple3D-Former can learn from 2D pretrained tasks thanks to the flexibility of choice of backbone structure, without any additional design within transformer blocks. We treat 2D knowledge as either an initial step of finetuning Simple3D-Former or prior knowledge transferred from a distinguished task. The overall idea is demonstrated in Figure 4.
124
+
125
+ Pretraining from 2D ViT As shown in Figure 1, we did not change the architecture of transformer backbone. Therefore, one can load transformer backbone weight from 2D-pretrained checkpoints with any difficulty. This is different from a direct 3D Convolutional Kernel Inflation (Shan et al., 2018; Xu et al., 2021) by maintaining the pure reasoning from patch understanding. We observed that one needs to use a small learning rates in first few epochs as a warm-up fine-tuning, to prevent catastrophic forgetting from 2D pretrained ViT. The observation motivates a better transfer learning scheme by infusing the knowledge batch-by-batch.
126
+
127
+ Retrospecting From 2D Cases by Generalization As we are transferring a model trained on 2D ImageNet to unseen 3D data, retaining the ImageNet domain knowledge is potentially beneficial to the generalized 3D task. Following such a motivation, we require our Simple3D-Former to memorize the representation learned from ImageNet while training on 3D. Therefore, apart from the loss function given in 3d task $\mathcal { L } _ { 3 d }$ , we propose adding the divergence measurement as a proxy guidance during our transfer learning process (Chen et al., 2020b). We fix a pretrained teacher network (teacher ViT in Figure 4). When training
128
+
129
+ ![](images/764904cf05322849f87642c491d433362a9de68dfd1a9faa1ada80394e7c5d1f.jpg)
130
+
131
+ Figure 4: Memorizing 2D knowledge. The teacher network (with all weights fixed) guide the current task by comparing the performance over the pretrained task.
132
+
133
+ Table 1: Baseline Comparison in 3D Object Classification
134
+
135
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">Modality</td><td colspan="2">mAM.(d)otA. (%)</td><td></td></tr><tr><td></td><td></td><td>PB-T50-Rs ectAN N%)</td></tr><tr><td>VoxelNet(Maturana &amp; Scherer,2015)</td><td>Voxel</td><td>83.0</td><td>85.9</td><td>-</td></tr><tr><td>PointNet(Qi et al., 2017a)</td><td>Point</td><td>86.2</td><td>89.2</td><td>68.0</td></tr><tr><td>PointNet++(Qi et al., 2017b)</td><td>Point</td><td>二</td><td>91.9</td><td>77.9</td></tr><tr><td>Perceiver(Jaegle etal., 2021b)</td><td>Point</td><td></td><td>85.7</td><td></td></tr><tr><td>DGCNN (Wang et al., 2019b)</td><td>Point</td><td>90.2</td><td>92.2</td><td>78.1</td></tr><tr><td>Image2Point(Xu et al., 2021)</td><td>Voxel</td><td>1</td><td>89.1</td><td>-</td></tr><tr><td>Point Transformer(Zhao et al., 2021)</td><td>Point</td><td>90.6</td><td>93.7</td><td>81.2</td></tr><tr><td>PVT(Zhang et al., 2021)</td><td>Point</td><td></td><td>94.0</td><td>-</td></tr><tr><td>Point-BERT(Yu et al., 2021b)</td><td>Point1</td><td>93.2</td><td></td><td>83.1</td></tr><tr><td rowspan="4">Simple3D-Former (ours)²</td><td>Voxel(NI)</td><td>82.8</td><td>86.5</td><td>二</td></tr><tr><td>Voxel(Avg.)</td><td>82.4</td><td>85.9</td><td></td></tr><tr><td>Voxel(GE)</td><td>84.0</td><td>88.0</td><td>-</td></tr><tr><td>Point</td><td>89.3</td><td>92.0</td><td>83.1</td></tr></table>
136
+
137
+ 1 We report the result with 1024 point sample inputs here to match with other methods. 2 NI:Naive Embedding; Avg.: Averaging; GE: Group Embedding.
138
+
139
+ each mini-batch of 3D data, we additionally bring a mini-batch of images from ImageNet validation set (in batch size $M$ ). To generate a valid output class vector, we borrow every part except Transformer blocks from 2D teacher ViT and generate 2D class labeling. We then apply an additional KL divergence to measure knowledge memorizing power, denoted as:
140
+
141
+ $$
142
+ \mathcal { L } : = \mathcal { L } _ { \mathrm { 3 d } } + \lambda \sum _ { i = 1 } ^ { M } K L ( \pmb { y } _ { t e a c h e r } | | \pmb { y } ) .
143
+ $$
144
+
145
+ The original 3d task loss, $\mathcal { L } _ { \mathrm { 3 d } }$ with additional KL divergence regularization, forms our teacher-student’s training loss. The vector $y _ { t e a c h e r }$ is from 2D teacher ViT output, and $\mathbf { \pmb { y } }$ comes from a same structure as teacher ViT, with the transformer block weight updated as we learn 3D data. In practical implementation, since the teacher ViT is fixed, the hyper-parameter $\lambda$ depends on the task: see Section 4.
146
+
147
+ # 4 Experiments
148
+
149
+ We test our Simple-3DFormer over three different 3D tasks: object classification, semantic segmentation and object detection. For detailed dataset setup and training implementations, we refer readers to Appendix A.
150
+
151
+ # 4.1 3D Object Classification
152
+
153
+ 3D object classification tasks receives a 3D point cloud or 3D voxel as its input and output the object categories. We test 3D classification performance over ModelNet40 (Wu et al., 2015) dataset and ScanObjectNN (Uy et al., 2019) dataset. To generate voxel input of ModelNet40, We use binvoxMin (2004 - 2019); Nooruddin & Turk (2003) to voxelize the data into a $3 0 ^ { 3 }$ input. The size 30 follows the standard setup in ModelNet40 setup. We choose to apply Group Embedding scheme as our best Simple3D-Former to compare with existing state-of-the-art methods. We further report the result in Table 1, compared with other state-of-the-art methods over ModelNet40 dataset, and over ScanObjectNN dataset. We optimize the performance of our Simple3D-Former with voxel input by setting up $T = 6$ in equation 7. We finetune with pretrained weight as well as using memorizing regularization equation 10 with $M$ equal to batch size. The classification result of point cloud modality is generated by dropping out two TU layers and passing the class token into a linear classifier head, with the same training setup as ShapeNetV2 case. Our network outperforms previous CNN based designs, and yields a competitive performance compared with 3D transformers. Several prior works observed that adding relative positional encoding within self-attention is important for a performance boost. We appreciate these findings, but claim that a well-pretrained 2D ViT backbone, with real semantic knowledge infused, does assist a simple, unified network to learn across different data modalities. The observation is particularly true over ScanObjectNN dataset, where transformer-enlightened networks outperform all past CNN based networks. Our method, with relatively small parameter space, achieves a similar result compared with Point-BERT.
154
+
155
+ ![](images/09f724d6b98f20b67c8eb875b3ca9149243eb8bad3d4c2d169d559500bf4bccf.jpg)
156
+ Figure 5: Selective visualizations of point cloud part segmentation.
157
+
158
+ Table 2: Comparison of 3D segmentation results on the ShapeNetPart and S3DIS dataset.
159
+
160
+ <table><tr><td rowspan="2">Method</td><td colspan="2">ShapeNetPartSeg</td><td colspan="2">S3DIS</td></tr><tr><td>cat. mIoU.(%)</td><td>ins. mIoU.(%)</td><td>mAcc.(%)</td><td>ins. mIoU.(%)</td></tr><tr><td>PointNet(Qi et al., 2017a)</td><td>80.4</td><td>83.7</td><td>49.0</td><td>41.1</td></tr><tr><td>PointNet++(Qi et al.,2017b)</td><td>81.9</td><td>85.1</td><td></td><td>-</td></tr><tr><td>PointCNN(Li et al., 2018)</td><td>84.6</td><td>86.1</td><td>75.6</td><td>65.4</td></tr><tr><td>DGCNN(Wang et al., 2019b)</td><td>82.3</td><td>85.1</td><td>56.1</td><td>-</td></tr><tr><td>KPConv(Thomas et al.,2019)</td><td>85.1</td><td>86.4</td><td>72.8</td><td>67.1</td></tr><tr><td>Point Transformer(Zhao et al., 2021)</td><td>83.7</td><td>86.6</td><td>76.5</td><td>70.4</td></tr><tr><td>PVT(Zhang et al., 2021)</td><td>-</td><td>86.5</td><td>67.7</td><td>61.3</td></tr><tr><td>PatchFormer(Cheng et al., 2021)</td><td>-</td><td>86.7</td><td>-</td><td>68.1</td></tr><tr><td>Simple3D-Former (ours)</td><td>83.3</td><td>86.0</td><td>72.5</td><td>67.0</td></tr></table>
161
+
162
+ # 4.2 3D Point Cloud Segmentation
163
+
164
+ 3D point cloud segmentation is a two-fold task. One receives a point cloud input (either an object or indoor scene scans) and output a class labels per input point within the point cloud. The output simultaneously contains segmentation as well as classification information. Figure 5 is a visual example of object part segmentation task. We report our performance over object part segmentation task in Table 2. The target datasets are ShapeNetPart (Yi et al., 2016) dataset and Semantic 3D Indoor Scene dataset, S3DIS (Armeni et al., 2016). We do observe that some articulated desiged transformer network, such as Point Trasnformers (Zhao et al., 2021) and PatchFormer (Cheng et al., 2021) reach the overall best performance by designing their transformer networks to fit 3D data with more geometric priors, while our model bond geometric information only by a positional embedding at tokenization. Nevertheless, our model does not harm the performance and is very flexible in designing. Figure 5 visualizes our Simple3D-Former prediction. The prediction is close to ground truth and it is surprisingly coming from 2D vision transformer backbone without any further geometric-aware infused knowledge. Moreover, the prior knowledge comes only from ImageNet classification task, indicating a good generalization ability within our network.
165
+
166
+ Table 3: 3D Detection Result over SUN RGB-D data
167
+
168
+ <table><tr><td>Metric</td><td>BoxNet</td><td>VoteNet</td><td>3DETR</td><td>3DETR-masked</td><td>H3DNet</td><td>Simple3D-Former (ours)</td></tr><tr><td>AP25</td><td>52.4</td><td>58.3</td><td>58.0</td><td>59.1</td><td>60.1</td><td>57.6</td></tr><tr><td>AP50</td><td>25.1</td><td>33.4</td><td>30.3</td><td>32.7</td><td>39.0</td><td>32.0</td></tr></table>
169
+
170
+ # 4.3 3D Object Detection
171
+
172
+ 3D object detection is a pose estimation task. For any given 3D input, one needs to return a 3D bounding box of each detected objects of targeted class. In our experiments we use point cloud input data. We test our simple-3DFormer for SUN RGB-D detection task (Song et al., 2015). We compare our results with BoxNet (Qi et al., 2019), VoteNet (Qi et al., 2019), 3DETR (Misra et al., 2021) and H3DNet (Yin et al., 2020). We follow the experiment setup from Misra et al. (2021): we report the detection performance on the validation set using mean Average Precision (mAP) at IoU thresholds of 0.25 and 0.5, referred to as AP25 and AP50. The result is shown in Table 3 and the evaluation is conducted over the 10 most frequent categories for SUN RGB-D. Even though 3DETR is a simple coupled Transformer Encoder-Decoder coupled system, we have shown that our scheme can achieve similar performance by replacing 3D backbone with our simple3D-Former scheme.
173
+
174
+ # 4.4 Ablation Study
175
+
176
+ Different Performance With/Without 2D Infused Knowledge To justify our Simple3D-Former can learn to generalize from 2D task to 3D task, we study the necessity of prior knowledge for performance boost. We compare the performance among four different settings: i) train without any 2D knowledge; ii) with pretrained 2D ViT weights loaded; iii) with a teacher ViT only, by applying additional 2D tasks and use the loss in equation 10; iv) using both pretraining weights and a teacher ViT.
177
+
178
+ Results shown in Table 4 reflect our motivation. One does achieve the best performance by not only infusing prior 2D pretraining weight at an early stage, but also getting pay-offs by learning without forgetting prior knowledge. It probably benefits a more complex, large-scale task which is based upon our Simple3D-Former.
179
+
180
+ Table 4: Power of 2D Prior Knowledge, with 2D projection scheme and evaluated in OA. ( $\%$ ) The performance is tested under ShapeNetV2 and ModelNet40 dataset.
181
+
182
+ <table><tr><td>Pretrain Usage</td><td>ShapeNetV2</td><td>ModelNet40</td></tr><tr><td>Without Any 2D Knowledge</td><td>82.8</td><td>86.5</td></tr><tr><td>With 2D pretraining</td><td>83.5</td><td>86.6</td></tr><tr><td>Teacher ViT</td><td>84.3</td><td>87.6</td></tr><tr><td>Pretrain+ Teacher ViT</td><td>84.5</td><td>88.0</td></tr></table>
183
+
184
+ Table 5: Power of 2D Prior Knowledge (with teacher ViT) in 3D task, evaluated in cat. mIOU.( $\%$ ) and ins. mIoU. $\%$ ) over ShapeNet Part Segmentation
185
+
186
+ <table><tr><td>3DData Portion</td><td>M</td><td>cat. mIoU.(%)</td><td>ins, mIoU. (%)</td></tr><tr><td rowspan="3">25%</td><td>0</td><td>79.1</td><td>83.3</td></tr><tr><td>32</td><td>79.4</td><td>83.1</td></tr><tr><td>64</td><td>79.8</td><td>83.6</td></tr><tr><td rowspan="3">50%</td><td>0</td><td>79.5</td><td>84.1</td></tr><tr><td>32</td><td>79.9</td><td>84.0</td></tr><tr><td>64</td><td>80.3</td><td>84.5</td></tr><tr><td rowspan="3">100%</td><td>0</td><td>81.1</td><td>84.6</td></tr><tr><td>32</td><td>82.8</td><td>85.4</td></tr><tr><td>64</td><td>83.1</td><td>85.7</td></tr></table>
187
+
188
+ Performance in Low-Quantity 3D Data Regime The computation complexity of point cloud data goes up as the number of sample points blows up. Even for a fixed point cloud sampling of 1024 points, it is inefficient to train over the entire dataset. To test the generalization ability of our Simple3D-Former, we perform a test to explore the power of 2D knowledge transferring. We use only a portion of training data in 3D and change the batch size of source task images $M$ at different scales. Result in Table 5 justify the performance over point cloud part segmentation task. Though one needs more data to attain higher accuracy, we found 2D pretrained knowledge offers an accuracy boost. The result indicates a potential joint-training across different data modality and different tasks to find universal transformers with good generalization ability.
189
+
190
+ # 4.5 Limitation of our work
191
+
192
+ Our method challenges the necessity of heavy-lifting design of transformers for 3D tasks. However, a potential drawback of our simple3D-Former is an overlook in 3D-aware only knowledge in the tokenizing process. It has been justified in Point Transformer(Zhao et al., 2021) the layer-wise positional encoding is beneficial for point cloud understanding. While our method is flexible in choosing tokenizer and transformer backbone, the performance might be hindered from a strict fixed transformer structure.
193
+
194
+ Another concern is that the performance of our method is strongly related with the complexity of selected transformer backbone. Our Simple3D-Former outperforms early-stage point cloud CNN architectures with a total of 29.59G Multiply Add Cumulations(MACs). On the contrary, Point Transformer Zhao et al. (2021) has a total of 36.76G MACs. The detailed model complexity comparison is shown in Appendix B and D. We observe that even with the most complex ViT model (deit-base) we have been testified, we cannot yield the state-of-the-art performance compared with concurrent works. It is in particular true for large indoor scene data (S3DIS) shown in Table 2. How to yield the best trade-off and how the result is different from choice of backbone (especially the embedding dimension) need to be analized further by introduing different designs of transformer backbones.
195
+
196
+ # 5 Conclusion
197
+
198
+ We retrospect the development of Vision Transformer and propose a unified version of a 3D transformer, named as Simple3D-Former, that learns from 2D rich-knowledge domain. a 2D ViT can inflate into a 3D ViT, by replacing 2D feature embedding, positional embedding and end-task head layer. Moreover, we justify that 2D domain knowledge helps our model perform better when understanding 3D data and the power of our model can be further strengthened by learning without forgetting. Our experimental result indicates self-attention modules, if learnt from 2D domain knowledge, can be distilled and thereby help the learning 3D object classification, part segmentation and detection tasks under both voxel and point cloud data. In the subsequent work, we hope to explore more versatile combinations of 2D transformer backbones attached with distinguished 3D feature extracting layers, and include complex tasks in large scale datasets.
199
+
200
+ # References
201
+
202
+ Hassan Akbari, Linagzhe Yuan, Rui Qian, Wei-Hong Chuang, Shih-Fu Chang, Yin Cui, and Boqing Gong. Vatt: Transformers for multimodal self-supervised learning from raw video, audio and text. arXiv preprint arXiv:2104.11178, 2021.
203
+ Iro Armeni, Ozan Sener, Amir R Zamir, Helen Jiang, Ioannis Brilakis, Martin Fischer, and Silvio Savarese. 3d semantic parsing of large-scale indoor spaces. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1534–1543, 2016.
204
+ Alexei Baevski and Michael Auli. Adaptive input representations for neural language modeling. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=ByxZX20qFQ.
205
+ Gedas Bertasius, Heng Wang, and Lorenzo Torresani. Is space-time attention all you need for video understanding? In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings of Machine Learning Research, pp. 813–824. PMLR, 2021. URL http://proceedings.mlr.press/v139/bertasius21a.html.
206
+ Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision, pp. 213–229. Springer, 2020.
207
+ Mark Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, and Ilya Sutskever. Generative pretraining from pixels. In International Conference on Machine Learning, pp. 1691–1703. PMLR, 2020a.
208
+ Wuyang Chen, Zhiding Yu, Zhangyang Wang, and Animashree Anandkumar. Automated synthetic-to-real generalization. In International Conference on Machine Learning, pp. 1746–1756. PMLR, 2020b.
209
+ Wuyang Chen, Xianzhi Du, Fan Yang, Lucas Beyer, Xiaohua Zhai, Tsung-Yi Lin, Huizhong Chen, Jing Li, Xiaodan Song, Zhangyang Wang, et al. A simple single-scale vision transformer for object localization and instance segmentation. arXiv preprint arXiv:2112.09747, 2021.
210
+ Zhang Cheng, Haocheng Wan, Xinyi Shen, and Zizhao Wu. Patchformer: A versatile 3d transformer based on patch attention. arXiv preprint arXiv:2111.00207, 2021.
211
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https://www.aclweb.org/anthology/N19-1423.
212
+ Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020.
213
+ Nico Engel, Vasileios Belagiannis, and Klaus Dietmayer. Point transformer. arXiv preprint arXiv:2011.00931, 2020.
214
+ Hehe Fan, Yi Yang, and Mohan S. Kankanhalli. Point 4d transformer networks for spatio-temporal modeling in point cloud videos. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2021.
215
+ Hehe Fan, Yi Yang, and Mohan S. Kankanhalli. Point spatio-temporal transformer networks for point cloud video modeling. 2022. doi: 10.1109/TPAMI.2022.3161735.
216
+ Yuxin Fang, Shusheng Yang, Shijie Wang, Yixiao Ge, Ying Shan, and Xinggang Wang. Unleashing vanilla vision transformer with masked image modeling for object detection. arXiv preprint arXiv:2204.02964, 2022.
217
+ Rohit Girdhar, Mannat Singh, Nikhila Ravi, Laurens van der Maaten, Armand Joulin, and Ishan Misra. Omnivore: A single model for many visual modalities. arXiv preprint arXiv:2201.08377, 2022.
218
+ Tianrui Guan, Jun Wang, Shiyi Lan, Rohan Chandra, Zuxuan Wu, Larry Davis, and Dinesh Manocha. M3detr: Multi-representation, multi-scale, mutual-relation 3d object detection with transformers. arXiv preprint arXiv:2104.11896, 2021.
219
+ Meng-Hao Guo, Jun-Xiong Cai, Zheng-Ning Liu, Tai-Jiang Mu, Ralph R Martin, and Shi-Min Hu. Pct: Point cloud transformer. Computational Visual Media, 7(2):187–199, 2021.
220
+ Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners, 2021.
221
+ Andrew Jaegle, Sebastian Borgeaud, Jean-Baptiste Alayrac, Carl Doersch, Catalin Ionescu, David Ding, Skanda Koppula, Daniel Zoran, Andrew Brock, Evan Shelhamer, et al. Perceiver io: A general architecture for structured inputs & outputs. arXiv preprint arXiv:2107.14795, 2021a.
222
+ Andrew Jaegle, Felix Gimeno, Andy Brock, Oriol Vinyals, Andrew Zisserman, and Joao Carreira. Perceiver: General perception with iterative attention. In International Conference on Machine Learning, pp. 4651– 4664. PMLR, 2021b.
223
+ Alexander Kolesnikov, André Susano Pinto, Lucas Beyer, Xiaohua Zhai, Jeremiah Harmsen, and Neil Houlsby. Uvim: A unified modeling approach for vision with learned guiding codes. arXiv preprint arXiv:2205.10337, 2022.
224
+ Abhijit Kundu, Xiaoqi Yin, Alireza Fathi, David Ross, Brian Brewington, Thomas Funkhouser, and Caroline Pantofaru. Virtual multi-view fusion for 3d semantic segmentation. In European Conference on Computer Vision, pp. 518–535. Springer, 2020.
225
+ Yanghao Li, Hanzi Mao, Ross Girshick, and Kaiming He. Exploring plain vision transformer backbones for object detection. arXiv preprint arXiv:2203.16527, 2022.
226
+ Yangyan Li, Rui Bu, Mingchao Sun, Wei Wu, Xinhan Di, and Baoquan Chen. Pointcnn: Convolution on x-transformed points. Advances in neural information processing systems, 31:820–830, 2018.
227
+ Kevin Lin, Lijuan Wang, and Zicheng Liu. End-to-end human pose and mesh reconstruction with transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1954–1963, 2021.
228
+ Yueh-Cheng Liu, Yu-Kai Huang, Hung-Yueh Chiang, Hung-Ting Su, Zhe-Yu Liu, Chin-Tang Chen, Ching-Yu Tseng, and Winston H Hsu. Learning from 2d: Pixel-to-point knowledge transfer for 3d pretraining. arXiv preprint arXiv:2104.04687, 2021a.
229
+ Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv preprint arXiv:2103.14030, 2021b.
230
+ Shengjie Luo, Tianlang Chen, Yixian Xu, Shuxin Zheng, Tie-Yan Liu, Liwei Wang, and Di He. One transformer can understand both 2d & 3d molecular data. arXiv preprint arXiv:2210.01765, 2022.
231
+ Jiageng Mao, Yujing Xue, Minzhe Niu, Haoyue Bai, Jiashi Feng, Xiaodan Liang, Hang Xu, and Chunjing Xu. Voxel transformer for 3d object detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 3164–3173, 2021.
232
+ Daniel Maturana and Sebastian Scherer. Voxnet: A 3d convolutional neural network for real-time object recognition. In 2015 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 922–928, 2015. doi: 10.1109/IROS.2015.7353481.
233
+ Patrick Min. binvox. http://www.patrickmin.com/binvox or https://www.google.com/search?q=binvox, 2004 - 2019. Accessed: yyyy-mm-dd.
234
+ Ishan Misra, Rohit Girdhar, and Armand Joulin. An End-to-End Transformer Model for 3D Object Detection. In ICCV, 2021.
235
+ Fakir S. Nooruddin and Greg Turk. Simplification and repair of polygonal models using volumetric techniques. IEEE Transactions on Visualization and Computer Graphics, 9(2):191–205, 2003.
236
+ Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In International Conference on Machine Learning, pp. 4055–4064. PMLR, 2018.
237
+ Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 652–660, 2017a.
238
+ Charles R. Qi, Li Yi, Hao Su, and Leonidas J. Guibas. Pointnet++: Deep hierarchical feature learning on point sets in a metric space. In Proceedings of the 31st International Conference on Neural Information Processing Systems, NIPS’17, pp. 5105–5114, Red Hook, NY, USA, 2017b. Curran Associates Inc. ISBN 9781510860964.
239
+ Charles R Qi, Or Litany, Kaiming He, and Leonidas J Guibas. Deep hough voting for 3d object detection in point clouds. In proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9277–9286, 2019.
240
+ Mehdi SM Sajjadi, Henning Meyer, Etienne Pot, Urs Bergmann, Klaus Greff, Noha Radwan, Suhani Vora, Mario Lučić, Daniel Duckworth, Alexey Dosovitskiy, et al. Scene representation transformer: Geometry-free novel view synthesis through set-latent scene representations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6229–6238, 2022.
241
+ Hongming Shan, Yi Zhang, Qingsong Yang, Uwe Kruger, Mannudeep K Kalra, Ling Sun, Wenxiang Cong, and Ge Wang. 3-d convolutional encoder-decoder network for low-dose ct via transfer learning from a 2-d trained network. IEEE transactions on medical imaging, 37(6):1522–1534, 2018.
242
+ Shuran Song, Samuel P Lichtenberg, and Jianxiong Xiao. Sun rgb-d: A rgb-d scene understanding benchmark suite. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 567–576, 2015.
243
+ Hang Su, Subhransu Maji, Evangelos Kalogerakis, and Erik Learned-Miller. Multi-view convolutional neural networks for 3d shape recognition. In Proceedings of the IEEE international conference on computer vision, pp. 945–953, 2015.
244
+ Hugues Thomas, Charles R Qi, Jean-Emmanuel Deschaud, Beatriz Marcotegui, François Goulette, and Leonidas J Guibas. Kpconv: Flexible and deformable convolution for point clouds. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6411–6420, 2019.
245
+ Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. In International Conference on Machine Learning, pp. 10347–10357. PMLR, 2021.
246
+ Mikaela Angelina Uy, Quang-Hieu Pham, Binh-Son Hua, Duc Thanh Nguyen, and Sai-Kit Yeung. Revisiting point cloud classification: A new benchmark dataset and classification model on real-world data. In International Conference on Computer Vision (ICCV), 2019.
247
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017a. URL https://proceedings.neurips.cc/paper/2017/file/ 3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf.
248
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017b.
249
+ Peihao Wang, Wenqing Zheng, Tianlong Chen, and Zhangyang Wang. Anti-oversmoothing in deep vision transformers via the fourier domain analysis: From theory to practice. arXiv preprint arXiv:2203.05962, 2022.
250
+ Qiang Wang, Bei Li, Tong Xiao, Jingbo Zhu, Changliang Li, Derek F. Wong, and Lidia S. Chao. Learning deep transformer models for machine translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 1810–1822, Florence, Italy, July 2019a. Association for Computational Linguistics. doi: 10.18653/v1/P19-1176. URL https://aclanthology.org/P19-1176.
251
+ Yue Wang, Yongbin Sun, Ziwei Liu, Sanjay E Sarma, Michael M Bronstein, and Justin M Solomon. Dynamic graph cnn for learning on point clouds. Acm Transactions On Graphics (tog), 38(5):1–12, 2019b.
252
+ Zhirong Wu, Shuran Song, Aditya Khosla, Fisher Yu, Linguang Zhang, Xiaoou Tang, and Jianxiong Xiao. 3d shapenets: A deep representation for volumetric shapes. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1912–1920, 2015.
253
+ Chenfeng Xu, Shijia Yang, Bohan Zhai, Bichen Wu, Xiangyu Yue, Wei Zhan, Peter Vajda, Kurt Keutzer, and Masayoshi Tomizuka. Image2point: 3d point-cloud understanding with pretrained 2d convnets. arXiv preprint arXiv:2106.04180, 2021.
254
+ Yao Yao, Zixin Luo, Shiwei Li, Jingyang Zhang, Yufan Ren, Lei Zhou, Tian Fang, and Long Quan. Blendedmvs: A large-scale dataset for generalized multi-view stereo networks. Computer Vision and Pattern Recognition (CVPR), 2020.
255
+ Li Yi, Vladimir G Kim, Duygu Ceylan, I-Chao Shen, Mengyan Yan, Hao Su, Cewu Lu, Qixing Huang, Alla Sheffer, and Leonidas Guibas. A scalable active framework for region annotation in 3d shape collections. ACM Transactions on Graphics (ToG), 35(6):1–12, 2016.
256
+ Junbo Yin, Jianbing Shen, Chenye Guan, Dingfu Zhou, and Ruigang Yang. Lidar-based online 3d video object detection with graph-based message passing and spatiotemporal transformer attention. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11495–11504, 2020.
257
+ Xumin Yu, Yongming Rao, Ziyi Wang, Zuyan Liu, Jiwen Lu, and Jie Zhou. Pointr: Diverse point cloud completion with geometry-aware transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 12498–12507, 2021a.
258
+ Xumin Yu, Lulu Tang, Yongming Rao, Tiejun Huang, Jie Zhou, and Jiwen Lu. Point-bert: Pre-training 3d point cloud transformers with masked point modeling. arXiv preprint arXiv:2111.14819, 2021b.
259
+ Cheng Zhang, Haocheng Wan, Shengqiang Liu, Xinyi Shen, and Zizhao Wu. Pvt: Point-voxel transformer for 3d deep learning. arXiv preprint arXiv:2108.06076, 2021.
260
+ Hengshuang Zhao, Li Jiang, Jiaya Jia, Philip H.S. Torr, and Vladlen Koltun. Point transformer. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 16259–16268, October 2021.
261
+ Daquan Zhou, Bingyi Kang, Xiaojie Jin, Linjie Yang, Xiaochen Lian, Zihang Jiang, Qibin Hou, and Jiashi Feng. Deepvit: Towards deeper vision transformer. arXiv preprint arXiv:2103.11886, 2021.
262
+
263
+ # A Dataset Setup and Implementation Details
264
+
265
+ # A.1 3D Object Classcification
266
+
267
+ Dataset Setup ModelNet40 consists of 12311 samples with 9843 training samples and 2468 test samples. It contains 40 classes in total. The original data is aligned and in point-cloud format. ScanObjectNN contains 2902 CAD objects with background knowledge provided in point cloud as well. It contains 15 classes in total. We apply our model over the augmented PB_T50_RS batch samples, in which bounding boxes of objects can shift up to $5 0 \%$ and objects are perturbed with rotation and scaling, resulting in 14510 total input train/test samples. We follow the standard sampling scheme to generate a subset of 1024 points for every point cloud model in both datasets. We additionally use ShapeNetV2[47] to testify our Simple3D-Former for voxel input as well. For details on ShapeNetV2 classification, we refer readers to Appendix B.
268
+
269
+ Implementation Details We use one TITAN A100 for training. For voxel classification task, we use the Adam optimizer with an initial warm-up at starting learning rate of 0.01, which is decayed by a factor of 0.5 every 20 epochs. The batch size is set to 64. We trained 100 epochs in total. The hyperparameter $\lambda$ is set to 0.1 back in (10). We evaluate mean of class-wise accuracy (mAcc), and overall point-wise accuracy (OA). The voxel embedding $E _ { V }$ we choose is a single convolutional layer with kernel size of $T$ and stride $T$ to generate tokenized sequence and remain simple. The pretrained knowledge comes from DeIT. The experiment is conducted with DeIT-base backbone with ImageNet-1K pretraining of image size 224. We justify the ablation study for choosing backbones and appropriate positional embedding parameters for optimal performance. In addition, we show that optimal performance is obtained by using not only ViT backbone but pretrained 2D knowledge and the help of memorizing 2D tasks. We report the result in Appendix B accordingly.
270
+
271
+ # A.2 3D Point Cloud Segmentation
272
+
273
+ Dataset Setup For object part segmentation, we test over ShapeNetPart dataset, containing 16, 881 pre-aligned shapes with dense labeling of 50 different parts over 16 distinguished categorical objects. We sample 1024 points for every point cloud model with standard process. We evaluate our Simple3D-Former over semantic indoor scene semantic segmentation dataset, S3DIS, as well. S3DIS contains 5 large-scale indoor scans with 12 semantic elements. We use area 5 as the test case while the reamining areas are treated as training data. We sample 4096 points for every partitioned indoor scene with standard process.
274
+
275
+ Implementation Details The training is conducted on one TITAN A100. For object part segmentation task, we use the SGD optimizer with an initial learning rate of 0.05, which is decayed by a factor of 0.1 every 100 epochs. The batch size is set to 64. We trained our Simple3D-Former up-to 300 epochs. For semantic segmentation task , we use the SGD optimizer with an initial learning rate of 0.1, which is decayed by a factor of 0.5 every 20 epochs. We trained 100 epochs with batch size 8. We use DeIT-base as the backbone ViT for both tasks. The hyperparameter $\lambda$ is set to 0.1 back in equation 10. We evaluate categorical mean intersection over union (cat. mIOU.) and instance mean intersection over union (ins. mIOU.) respectively for ShapeNetPart dataset while we report the mean accuracy and instance mean intersection over union in S3DIS dataset.
276
+
277
+ # A.3 3D Point Cloud Object Detection
278
+
279
+ Dataset Setup We apply our Simple3D-Former onto a standard 3D indoor detection benchmark, SUN RGB-D (v1). SUN RGB-D contains 5000 training samples with oriented bounding box annotations while KITTI dataset contains 7518 raw 3d input.
280
+
281
+ Implementation Details To justify our simple3D-Former can be embedded naturally into a detection model’s 3D backbone, we modify 3DETR’s backbone into our version, while keep the decoder head unchanged. The training is conduced on one TITAN A100 and trained over 1080 epochs. Detailed architecture of Simple3D-Former backbone used in detection task is explained in Appendix C.
282
+
283
+ # B More Classification Result With Voxel Input
284
+
285
+ ShapeNetV2 dataset contains 52456 samples from 55 categories and we use a fixed 80% − 20% train-test split throughout our experiments. The voxel data is of size $1 2 8 ^ { 3 }$ . Note that ShapeNetV2 is evaluated only when we determine which Simple3D-Former setup optimizes the performance over voxel data.
286
+
287
+ It has been explored in 2D ViT the relationship between the size of patches and the classification accuracy over image dataset. There is no such prior belief in 3D voxel data, so we test our Simple3D-Formers under different settings to find the optimal scheme. For point cloud input, we fix our model all from the beginning.
288
+
289
+ Table 6: Performance of Different Simple-3DFormer Design on ShapeNetV2 Classification evaluated on OA. ( $\%$ ), either with pretrained 2D ViT weight guidance (W P.) or without pretrained 2D ViT guidance (W/O P.).
290
+
291
+ <table><tr><td rowspan="2">Scheme</td><td rowspan="2">Token Length</td><td colspan="2">Naive Transformer</td></tr><tr><td>W P.</td><td>W/O P.</td></tr><tr><td>Naive Inflation</td><td>8 by 8 by 8</td><td>83.1</td><td>79.8</td></tr><tr><td>2D Projection</td><td>8 by 8</td><td>83.6</td><td>82.3</td></tr><tr><td>Group Embedding</td><td>8 by 8</td><td>85.0</td><td>84.9</td></tr><tr><td>Naive Inflation</td><td>14 by 14 by 14</td><td>85.5</td><td>85.5</td></tr><tr><td>2D Projection</td><td>14 by 14</td><td>83.5</td><td>82.8</td></tr><tr><td>Group Embedding</td><td>14 by 14</td><td>87.6</td><td>86.8</td></tr></table>
292
+
293
+ Table 6 shows the preliminary result. We test under two different cell size settings: $T = 1 6$ (8 cells per axis) and $T = 9 ^ { 1 }$ (14 cells per axis) in equation 4, equation 5 and equation 7 . Among all configurations, Group Embedding outperforms Naive Inflation and 2D Projection. More importantly, the pretraining weight adopted in transformer backbone before training over 3D data does help to improve the accuracy of object classification. Another observation is that the size of token sequence affects the result as well. A $9 ^ { 3 }$ cell yields more semantic meaning compare to that of a $1 6 ^ { 3 }$ cell, which neglects too many local connections. Hence, in the following experiments over voxel data,
294
+
295
+ We further justify that among all transformer backbone mimic from 2D ViT siblings, DeIT-base attains optimal performance. The result is shown in Table 7.
296
+
297
+ Table 7: Different 2D ViT backbone performance and complexity comparison. The table shows our Simple3DFormer under Group Embedding setup.
298
+
299
+ <table><tr><td rowspan="2">Backbone Name</td><td>ImageNet(2D)</td><td colspan="3">ModelNet40(3D)</td></tr><tr><td>Param. (M)</td><td>FLOPs (G)</td><td>Param. (M)</td><td>OA. (%)</td></tr><tr><td>DeiT-tiny</td><td>5</td><td>0.28</td><td>5</td><td>84.5</td></tr><tr><td>DeiT-small</td><td>22</td><td>1.12</td><td>21</td><td>86.7</td></tr><tr><td>DeiT-base</td><td>86</td><td>4.46</td><td>85</td><td>88.0</td></tr></table>
300
+
301
+ Different Performance Under Particular Ordering When discussing 2D Projection tokenized scheme for voxel data, we implicitly assume we project along $Z$ -dim. We show that we are not biased from the choice of ordering. Table 8 explains different result of particular ordering in 2D Projection scheme, in both ShapeNetV2 and ModelNet40 dataset. We denote the ordering $X Y Z$ as the normal input order, where $Z$ -dim data is projected or grouped. Similarly, $Y Z X$ refers to the $X$ -dim data projection and $Z X Y$ refers to the $Y$ -dim data projection. The result indicates the optimal choice of projection is dataset dependent, but the performance is optimal further when considering group embedding scheme.
302
+
303
+ Table 8: Performance under different ordering of input voxels, with 2D Projection scheme and evaluated in OA. ( $\%$ )
304
+
305
+ <table><tr><td>ProjectionView</td><td>ShapeNetV2</td><td>ModelNet40</td></tr><tr><td>XYZ</td><td>83.6</td><td>82.1</td></tr><tr><td>YZX</td><td>84.5</td><td>83.2</td></tr><tr><td>ZXY</td><td>81.9</td><td>84.3</td></tr></table>
306
+
307
+ # C Detailed architecture of Simple3D-Former In Point Cloud Modality
308
+
309
+ Simple3D-Former for Part Segmentation Task The overall Simple3D-Former of point cloud segmentation has a different design of data tokenizer and downstream head (to produce information not from class tokens). In point tokenizer part, two layers of point set abstractions are applied. The Transition Down (TD) layer comes from Point Transformer. A TD layer contains a set abstraction downsampling scheme, originated from PointNet $^ { + + }$ , a local graph convolution with kNN connectivity, and a local max-pooling layer.
310
+
311
+ Rather than adding relative positional embedding in attention layers as most 3d-aware transformers did, we propose to add the relative positional embedding in local convolution layers in pointnet $^ { + + }$ skeleton (i.e. PointSetAbstraction operation in PointNet $^ { + + }$ ), to avoid artificial design in transformer attention modules, but incorporate local embeddings beforehand. Each TD layer reduces the number of points by 4 with a $2 x$ scale-up of the embedding dimension. The newly distilled point tokenized sequence is then fed into the ViT backbone. The Transition Up (TU) layer comes from Point Transformer as well. It interpolates over the original point coordinates by neighboring features and scales down the embedding dimension by 2. TU module also contains a residual block that adds the point feature vectors back in the corresponding TD layer, resulting in a U-Net architecture. We provide code snippets in Listing 1 and 2 for readers to match the practical implementation with Figure 3.
312
+
313
+ Simple3D-Former for 3D Detection Task In our 3D detection experiment, we replace 3DETR’s transformer encoder structure into our Simple3D-Former design, and generate the output head with same structure as in 3detr, and fix other part to show the flexibility of our design.
314
+
315
+ 2 self . transition_downs $=$ nn . ModuleList ()
316
+ 3 for i in range (2) : 4 channel $=$ self . embed_dim // 4 \* 2 \*\* (i +1)
317
+ 5 self . transition_downs . append ( TransitionDown ( npoints // 4 \*\* i , nneighbor , [ channel // 2 + 3, channel , channel ]) )
318
+ 6 self . transition_ups $=$ nn . ModuleList () 8 for i in reversed ( range (2) ):
319
+ 9 channel $=$ self . embed_dim $/ / \textrm { \textbf { 4 } * 2 } * * \textrm { \textbf { i } }$
320
+ 10 self . transition_ups . append ( TransitionUp ( channel \* 2, channel , channel ))
321
+ 11
322
+ 12 self . fc1 $=$ nn . Sequential (
323
+ 13 nn . Linear ( d_points , self . embed_dim // 4) ,
324
+ 14 nn . ReLU () ,
325
+ 15 nn . Linear ( self . embed_dim // 4, self . embed_dim // 4)
326
+ 16 )
327
+ 17
328
+ 18 self . fc_pos_embed $=$ nn . Sequential (
329
+ 19 nn . Linear (3 , self . embed_dim // 4) ,
330
+ 20 nn . ReLU () ,
331
+ 21 nn . Linear ( self . embed_dim // 4, self . embed_dim // 4)
332
+ 22 )
333
+
334
+ Listing 1: Code Snippet to define TD/TU layers and two MLPs
335
+
336
+ def forward_features ( self , $\mathbf { x }$ ) : 2 xyz , f= x [... ,:3] , self . fc1 (x) 3 f $=$ self . pos_drop (f $^ +$ self . fc_pos_embed ( xyz )) 4 5 xyz_0 , points_0 $=$ .. 6 self . transition_downs [0]( xyz , f) xyz_1 , points_1 $=$ 8 self . transition_downs [1]( xyz_0 , points_0 ) 9 x = points_1 10 11 # Add dummy class tokens to mimic ViT ’s style 12 cls_token $=$ self . cls_token . expand ( $\mathbf { x }$ . shape [0] , -1, -1) 13 $\begin{array} { r l } { \mathbf { x } } & { { } = } \end{array}$ torch . cat (( cls_token , x ) , $\mathrm { d i m } = 1$ ) 14 15 for blk in self . blocks : 16 $\begin{array} { r } { \begin{array} { c c l } { \mathbf { x } } & { = } & { \mathbf { b } \mathbf { l } \mathbf { k } \left( \mathbf { \hat { x } } \right) } \end{array} } \end{array}$ 17 $\begin{array} { r l } { \mathbf { x } } & { { } = } \end{array}$ self . norm ( x) 18 x = x [: , 1:] 19 $\begin{array} { r l } { \mathbf { x } } & { { } = } \end{array}$ self . transition_ups [0]( xyz_1 , x , xyz_0 , points_0 ) 20 $\begin{array} { r l } { \mathbf { x } } & { { } = } \end{array}$ self . transition_ups [1]( xyz_0 , x , xyz , f) 21 return x. mean (1)
337
+
338
+ # D Different Point Cloud Simple3D-Former Design
339
+
340
+ We additionally show different results regarding the number of TD/TU coupled layers as the ablation study of Simple3D-Former structure. Note that if TD/TU layer number is 0, only a MLP layer is applied to lift input point cloud features and another MLP is applied to encode absolute positions. Moreover, we fix two MLP layers back in Eqn. (10) to have the same output dimension for a reasonable comparison, when testing with 0 or 1 layer TD/TU setting. For 2 layer TD/TU setup, the dimension of MLP is changing according to the embedding dimension $D / 4$ based on different choices of backbones: DeIT-tiny, $D = 1 9 2$ ; DeIT-small, $D = 3 8 4$ ; DeIT-base, $D = 7 6 8$ .
341
+
342
+ As TD layer scales up the embedding dimension of point vectors while reducing the size of tokenized sequence, different ViT backbones, when equipped with same number of TD/TU layers, have different scalings. The experiment setup is the same as described in Section 4.2, with $M = 6 4$ for 2D knowledge infusing. All setups applied pretrained weight from the corresponding backbones as well.
343
+
344
+ Table 9 shows the result regarding different TD/TU layers. We found that by introducing point abstraction, the performance of a 2D pretrained ViT backbone can be further improved compared with MLP only setup (0 TD/TU layers), with the total computational cost relatively lower. This reflects the claim back in Section 3, where we point out the necessity of point cloud data modality modification to fit into the universal transformer backbone. Our Simple3D-Former can adapt from the change of data modality and obtain a good result, compare with CNN-based schemes.
345
+
346
+ Table 9: Different Simple3D-Formers’ performance over part segmentation task, evaluated in cat. mIoU. ( $\%$ ), ins. mIoU. ( $\%$ ) and MACs. (G).
347
+
348
+ <table><tr><td rowspan="2"># of TD/TU Layers</td><td colspan="3">cat. mIoU. (%)ns. moU. (%)</td></tr><tr><td></td><td></td><td>MACs. (G)</td></tr><tr><td>0 (DeIT-tiny)</td><td>81.7</td><td>84.7</td><td>5.53</td></tr><tr><td>1 (DeIT-small)</td><td>82.9</td><td>85.1</td><td>6.53</td></tr><tr><td>1 (DeIT-base)</td><td>82.5</td><td>84.9</td><td>26.04</td></tr><tr><td>2 (DeIT-tiny)</td><td>82.2</td><td>84.7</td><td>1.87</td></tr><tr><td>2 (DeIT-small)</td><td>82.5</td><td>84.7</td><td>7.42</td></tr><tr><td>2 (DeIT-base)</td><td>83.1</td><td>85.7</td><td>29.59</td></tr></table>
parse/test/vqIH0ObdqL/vqIH0ObdqL.md ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CAN LARGE LANGUAGE MODELS INFER CAUSATION FROM CORRELATION?
2
+
3
+ Zhijing $\mathbf { J i n } ^ { 1 , 2 , \ast , \ddagger }$ Jiarui $\mathbf { L i u } ^ { 3 , * }$ Zhiheng Lyu4 Spencer Poff5 Mrinmaya Sachan2 Rada Mihalcea6 Mona Diab3,‡,† Bernhard Schölkopf1,† 1Max Planck Institute for Intelligent Systems, Tübingen, Germany 2ETH Zürich 3LTI, CMU 4University of Hong Kong 5Meta AI 6University of Michigan jinzhi@ethz.ch jiarui@cmu.edu zhihenglyu.cs@gmail.com
4
+
5
+ # ABSTRACT
6
+
7
+ Causal inference is one of the hallmarks of human intelligence. While the field of Causal NLP has attracted much interest in the recent years, existing causal inference datasets in NLP primarily rely on discovering causality from empirical knowledge (e.g., commonsense knowledge). In this work, we propose the first benchmark dataset to test the pure causal inference skills of large language models (LLMs). Specifically, we formulate a novel task CORR2CAUSE, which takes a set of correlational statements and determines the causal relationship between the variables. We curate a large-scale dataset of more than 200K samples, on which we evaluate seventeen existing LLMs. Through our experiments, we identify a key shortcoming of LLMs in terms of their causal inference skills, and show that these models achieve almost close to random performance on the task. This shortcoming is somewhat mitigated when we try to re-purpose LLMs for this skill via finetuning, but we find that these models still fail to generalize – they can only perform causal inference in in-distribution settings when variable names and textual expressions used in the queries are similar to those in the training set, but fail in out-of-distribution settings generated by perturbing these queries. CORR2CAUSE is a challenging task for LLMs, and can be helpful in guiding future research on improving LLMs’ pure reasoning skills and generalizability.1
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Causal inference, i.e., the ability to establish the correct causal relationships between variables or events, is fundamental to human intelligence. There are two distinct ways this causal inference capability can be acquired: one through empirical knowledge, e.g., we know from common sense that touching a hot stove will get us burned; the other through pure causal reasoning, as causality can be formally argued and reasoned about using known procedures and rules from causal inference (Spirtes et al., 2000; Pearl, 2009; Peters et al., 2017). One example is that we have the a priori knowledge that the correlation between A and B does not necessarily imply causality. This is a formal rule that holds true regardless of the realizations of the variables A and B.
12
+
13
+ With the rise of large language models (LLMs) (Radford et al., 2019; Devlin et al., 2019; Ouyang et al., 2022; Zhang et al., 2022; OpenAI, 2023, inter alia), a crucial research question is whether they can do causal reasoning well. Recent studies have pointed out that LLMs are “causal parrots,” which recite the causal knowledge in the training data (Zecevi ˇ c et al., 2023). Moreover, the vast ´ majority of studies frame causal reasoning as a skill to navigate around empirical knowledge (Gordon et al., 2012; Sap et al., 2019a;b; Qin et al., 2019; Bhagavatula et al., 2020), and also treat LLMs as a knowledge base when evaluating its causal skills (Kıcıman et al., 2023; Tu et al., 2023; Xie et al., 2023). However, all the above lines of research frame causality as empirical knowledge, thus relying heavily on the quality and the coverage of the training data, overlooking the great potential of the formal causal reasoning skills to process correlational information to causal conclusions.
14
+
15
+ ![](images/602be0566ff5dbb1cae063115540306a3770631954a7d6a6dd0bc90de6f0ec56.jpg)
16
+ Figure 1: Illustration of the motivation behind our task and dataset.
17
+
18
+ Drawing inspirations from technical studies on causal discovery (Spirtes et al., 2000; Spirtes & Zhang, 2016; Glymour et al., 2019), we formulate a novel task for NLP, correlation-to-causation inference (CORR2CAUSE), which is an important skill for LLMs. Imagine the scenario in Figure 1, where the training corpus does not tediously cover every causal relation, but more pervasively talk about correlations, such as which events tend to co-occur. Learning a good CORR2CAUSE skill can enable LLMs to draw causal relations behind the mere correlational information on the surface. For example, several decades ago, there might be an observation that female university students tend to perform better, but behind the correlational statistics is the causal graph that female students have to achieve extra good performance to get into universities as the first place.
19
+
20
+ To this end, we collect the CORR2CAUSE dataset, the first dataset to test the pure causal reasoning abilities of LLMs. All the questions in this dataset are centered around testing when it is valid or invalid to infer causation from correlation. To systematically compose this dataset, we ground our generalization process in the formal framework of causal discovery (Spirtes et al., 1993; 2000; Glymour et al., 2016; Spirtes & Zhang, 2016), which provides rules about how to deduce causal relations among variables given their statistical correlation in the observational data. We generate more than 200K data points, and label a correlation-causation statement pair as valid if and only if there is a bijective mapping between the statistical correlation and the underlying causality.
21
+
22
+ Based on our CORR2CAUSE dataset with 200K samples, we investigate two main research questions: (1) How well do existing LLMs perform on this task? (2) Can existing LLMs be re-trained or re-purposed on this task and obtain robust causal inference skills? Through extensive experiments, we show empirically that none of the 17 existing LLMs we investigate perform well on this pure causal inference task. We also show that although LLMs can demonstrate better performance after being finetuned on the data, the causal inference skills attained by them are not robust. In summary, our contributions are as follows:
23
+
24
+ 1. We propose the novel task of CORR2CAUSE, to probe an aspect of LLM’s reasoning ability, pure causal inference;
25
+ 2. We compose a dataset of over 200K samples, using insights from causal discovery;
26
+ 3. We evaluate the performance of 17 LLMs on our dataset, finding that all of them perform poorly, close to the random baseline;
27
+ 4. We further explored whether LLMs can learn the skill through finetuning, and find that LLMs fail to robustly acquire this skill in out-of-distribution settings. Finally, we suggest future work to explore more ways to enhance the pure causal inference skill in LLMs.
28
+
29
+ # 2 PRELIMINARIES: CAUSAL INFERENCE
30
+
31
+ # 2.1 DIRECTED GRAPHICAL CAUSAL MODELS (DGCMS)
32
+
33
+ A directed graphical causal model (DGCM) is a commonly used representation to express the causal relations among a set of variables. Given a set of $N$ variables $\pmb { X } \doteq \{ X _ { 1 } , \ldots , X _ { N } \}$ , we can encode the causal relations among them using a directed graph $\mathcal { G } : = ( \boldsymbol { X } , \boldsymbol { E } )$ , where $\pmb { { \cal E } }$ is the set of directed edges. Each edge $e _ { i , j } \in E$ represents a causal link $X _ { i } \to X _ { j }$ , meaning that $X _ { i }$ is a direct cause of $X _ { j }$ . In the context of this work, we take the common assumption of directed acyclic graphs (DAGs), which most causal discovery methods use (Glymour et al., 2019), as graphs with cycles can make the causal discovery process arbitrarily hard.
34
+
35
+ Following the graph-theoretic terminology, we use an analogy of the ancestry tree to denote the relations between two variables. For example, we call $X _ { i }$ as a parent of $X _ { j }$ if there is a directed edge $X _ { i } \to X _ { j }$ in the graph, and, thus, $X _ { j }$ is a child of $X _ { i }$ . Similarly, we denote $X _ { i }$ as an ancestor of $X _ { j }$ if there exists a directed path from $X _ { i }$ to $X _ { j }$ , and, thus, $X _ { j }$ is a descendent of $X _ { i }$ . Note that a parent is a special case of an ancestor where the directed path has a length of 1.
36
+
37
+ For convenience, we also introduce the notions for some special three-variable relations. Given two variables $X _ { i }$ and $X _ { j }$ , we call a third variable $X _ { k }$ a confounder (i.e., common cause) if $X _ { k }$ is a parent of both $X _ { i }$ and $X _ { j }$ ; a collider (i.e., common effect) if $X _ { k }$ is a child of both $X _ { i }$ and $X _ { j }$ ; and a mediator if $X _ { k }$ is both a child of $X _ { i }$ , and a parent of $X _ { j }$ .
38
+
39
+ # 2.2 D-SEPARATION AND MARKOV PROPERTY
40
+
41
+ D-Separation D-separation (Pearl, 1988) is a fundamental concept in graphical models used to determine whether two sets of nodes $\boldsymbol { X }$ and $\mathbf { Y }$ in a DAG $\mathcal { G }$ are conditionally independent given a third set of nodes $z$ , where the three sets are disjoint. We say that $\boldsymbol { X }$ and $\mathbf { Y }$ are d-separated by $z$ if all paths between any node in $\boldsymbol { X }$ and any node in $\mathbf { Y }$ are blocked by the conditioning set $z$ . A path between $\boldsymbol { X }$ and $\mathbf { Y }$ is blocked by $z$ if there exists a node $A \in { \mathbf { Z } }$ which satisfies one of the following conditions: $A$ is the parent node in a fork structure on the path (i.e., $\cdot \left. A \right. \cdot )$ ; $A$ is the mediator node in a chain structure on the path (i.e., $\cdot A \cdot )$ ; or in any collider structure on the path (i.e., $\cdot \right. A \left. \cdot$ ), $z$ does not contain $A$ or its descendants.
42
+
43
+ Markov Property The Markov property in a DAG $\mathcal { G }$ states that each node $X _ { i }$ is conditionally independent of its non-descendants given its parents, namely $X _ { i }$ ⊥⊥ $\mathbf { N o n D e } ( X _ { i } ) | \mathbf { P a } ( X _ { i } )$ , where $\mathbf { N o } \bar { \mathbf { n } } \mathbf { D } \mathbf { e } ( X _ { i } )$ denotes the non-descendants of $X _ { i }$ excluding itself, and $\mathbf { P a } ( X _ { i } )$ denotes the parents of $X _ { i }$ . Using the Markov property, we can factorize the joint distribution of all the nodes in the graph into $\begin{array} { r } { P ( X _ { 1 } , \ldots , X _ { N } ) = \prod _ { i = 1 } ^ { N } P ( X _ { i } | \mathbf { P A } ( X _ { i } ) ) } \end{array}$ . To infer the causal graph from probability distributions, a common assumption is faithfulness, namely the validity to infer all the d-separation sets in the graph from the independence relations in the probability distribution. In our work, we also take this broadly taken assumption which holds for most real-world scenarios.
44
+
45
+ Markov Equivalence of Graphs We denote two DAGs as Markov equivalent if they induce the same joint distribution $P ( X )$ . The set of DAGs that are Markov equivalent to each other is called a Markov equivalence class (MEC). Causal graphs in the same MEC can be easily identified since they have the same skeleton (i.e., undirected edges) and V-structures (i.e., structures in the form of $A \right. B \left. C$ where $A$ and $C$ are not connected).
46
+
47
+ Obviously, there is a one-to-many mapping (i.e., surjection) between the causal graph and statistical distribution. Namely, each causal graph sufficiently determines a statistical distribution, but from a statistical distribution, we cannot necessarily induce a unique causal graph. This is why we say “correlation does not necessarily mean causation”.
48
+
49
+ # 2.3 CAUSAL DISCOVERY
50
+
51
+ Causal discovery aims to learn the causal relations by analyzing statistical properties in the observational data (Spirtes et al., 1993; 2000; Glymour et al., 2016; Spirtes & Zhang, 2016; Glymour et al., 2019). It can be achieved through constraint-based methods (Spirtes et al., 2000), score-based methods (Chickering, 2002), or other methods taking advantage of the functional causal models (Shimizu et al., 2006; Hoyer et al., 2008; Zhang & Hyvärinen, 2009).
52
+
53
+ To fit for the spirit of this paper to infer from correlation (expressed in natural language) to causation, we base our dataset design on the widely-used Peter-Clark (PC) algorithm (Spirtes et al., 2000). The PC algorithm is based on the principles of conditional independence and the causal Markov assumption, which allows it to efficiently identify causal relationships among variables in a given dataset. The algorithm first starts with a fully connected undirected graph among all the variables. Then it removes the edge between two variables if there is an unconditional or conditional independence relationship between them. Afterwards, it orients the directed edges whenever there is a V-structure. And finally, it iteratively checks the direction of the other edges until the entire causal graph is consistent with all the statistical correlations.
54
+
55
+ ![](images/871ce0b450763997ae8c810069b44df1184fdc24ab615aaabfef28092d26c534.jpg)
56
+ Figure 2: Pipeline of the data construction process.
57
+
58
+ # 3 DATASET CONSTRUCTION
59
+
60
+ We introduce the construction of our dataset in this section. We start with our task formulation for CORR2CAUSE, and then briefly give an overview of the data generation process, followed by detailed descriptions of each step. We conclude the section with the overall statistics of the dataset.
61
+
62
+ # 3.1 TASK FORMULATION
63
+
64
+ Given a set of $N$ variables $\pmb { X } = \{ X _ { 1 } , \ldots , X _ { N } \}$ , we have a statement $\pmb { s }$ about all the correlations among the variables, and a hypothesis $^ { h }$ describing the causal relation $r$ between the pair of variables $X _ { i }$ and $X _ { j }$ . The task is to learn a function $f : ( s , h ) \mapsto v$ which maps the correlation statement $\pmb { s }$ and the causal relation hypothesis $^ { h }$ to their validity $v \in \{ 0 , 1 \}$ , which takes the value 0 if this inference is invalid, and the value 1 if this inference is valid.
65
+
66
+ # 3.2 OVERVIEW OF THE DATA GENERATION PROCESS
67
+
68
+ We base the construction our dataset on several concepts of causal inference, including the DGCM, d-separation, and MECs, as introduced in Section 2.
69
+
70
+ As in the overview of our data generation process in Figure 2, we first choose the number $N$ of variables (Step 1) and generate all the unique DGCMs with $N$ nodes (Step 2), which we will introduce in the Section 3.3. Then we collect all the d-separation sets from these graphs to identify MECs (Step 3) in Section 3.4. Then, in Step 4, we create the formal form of data in Section 3.5. For each correspondence of the MEC to causal graphs, we compose the correlation statement based on the statistical relations in the MEC, and hypothesize a causal relation between two variables, and produce the validity $v = 1$ if the hypothesis is a shared property of all causal graphs in the MEC, and $v = 0$ if the hypothesis is not necessarily true for all the MEC graphs. Finally, we introduce the verbalization process in Section 3.6.
71
+
72
+ # 3.3 CONSTRUCTING THE GRAPHS WITH ISOMORPHISM CHECKS
73
+
74
+ The first step of the data generation is to compose the causal graphs, as in Step 1 and 2 of Figure 2. For a set of $N$ variables $\mathbf { \bar { X } } = \{ X _ { 1 } , \ldots , X _ { N } \}$ , there are $N ( N - 1 )$ possible directed edges, since each node can link to any node other than itself. To remove cycles in the graph, we make the nodes in topological order, which only allows edges $X _ { i } \to X _ { j }$ , where $i < j$ . We achieve this by limiting the adjacency matrix of the graph to only having non-zero values above the diagonal, resulting in $N ( N - 1 ) / 2$ possible directed edges for the DAGs.
75
+
76
+ At the first glance, for $N$ nodes, there should be $2 ^ { N ( N - 1 ) / 2 }$ possible DAGs (i.e., the power set of all edges). However, there could be isomorphic graphs in this set. To avoid this, we perform a graph
77
+
78
+ <table><tr><td># Nodes</td><td># Unique DAGs</td><td>#Edges/DAG</td><td>#MECs</td><td>#DAGs/MEC</td></tr><tr><td>2</td><td>2 out of 2</td><td>0.50</td><td>2</td><td>1.0</td></tr><tr><td>3</td><td>6 out of 23</td><td>1.67</td><td>5</td><td>1.2</td></tr><tr><td>4</td><td>31 out of 26</td><td>3.48</td><td>20</td><td>1.55</td></tr><tr><td>5</td><td>302 out of 210</td><td>5.89</td><td>142</td><td>2.13</td></tr><tr><td>6</td><td>5,984 out of 215</td><td>8.77</td><td>2,207</td><td>2.71</td></tr><tr><td>Total</td><td>6,325</td><td>8.60</td><td>2,376</td><td>2.66</td></tr></table>
79
+
80
+ Table 1: Statistics about the source causal graphs in our dataset. Given the number of nodes, we report the number of unique DAGs, average number of edges per DAG, number of MECs, and average number of DAGs per MEC.
81
+
82
+ isomorphism check (McKay & Piperno, 2014), and reduce the set so that only unique DAGs are retained, and we show their statistics in Table 1. Although we can handle large graphs, we mostly focus on smaller graphs that can still lead to a reasonably sized dataset, so we empirically set $N = 6$ but future work can use our open-sourced codes to extend to more nodes.
83
+
84
+ # 3.4 PROGRAMMATICALLY GENERATING THE D-SEPARATION SETS
85
+
86
+ Based on the set of unique DAGs, we then programmatically generate the d-separation sets by graph theoretical conditions, as in Step 3 of Figure 2. To realize this step, we code an efficient graph-theoretic algorithm to check for all the chain, fork, and collider structures to automatically identify the set of nodes that d-separate each pair of nodes. Using the d-separation sets and the faithfulness assumption, we form the statistical correlations as follows. For each pair of nodes, they are conditionally independent given the variables in the d-separation set. If the d-separation set is empty, then the two nodes are unconditionally independent. If no d-separation set can be found for the two nodes, then they are directly correlated.
87
+
88
+ Moreover, using the d-separation sets, we are able to cluster causal graphs to MECs. We achieve it by tracing the mapping between the causal graphs and the set of statistical correlations, and backtracking the graphs with the same d-separation sets to group them in the same MEC. We show in Table 1 that each MEC contains on average 2.66 DAGs.
89
+
90
+ # 3.5 COMPOSING THE HYPOTHESES AND LABEL
91
+
92
+ After generating the set of correlations based on the d-separation sets, we now generate the causal hypotheses. For the causal relation $r$ , we focus on six common causal relations between two nodes introduced in Section 2.1: Is-Parent, Is-Child, Is-Ancestor (excluding the parents), Is-Descendant (excluding the children), Has-Confounder (i.e., there exists a confounder, or common cause, of the two nodes), and Has-Collider (i.e., there exists a collider, or common effect, of the two nodes). In this way, the set of hypotheses contains all six meaningful causal relations between every pair of variables, resulting in a total size of $6 \cdot N ( N - 1 ) / 2 = 3 \bar { N } ( N - 1 )$ hypotheses for a graph with $N$ variables.
93
+
94
+ To generate the ground-truth validity label, we start from the correlation sets in Step 3, then look up all the causal graphs in the same MEC corresponding to the given set of correlations, and check the necessity of the hypothesized causal relation. If the causal relationship proposed in the hypothesis is valid for all causal graphs within the MEC, then we generate the validity $v = 1$ ; otherwise, we generate $v = 0$ . A special case of valid samples is that when the size of the MEC is 1, then there is a bijective mapping between the causal graph and the $\mathrm { d }$ -separation sets, so any hypothesis stating the causal properties of that unique causal graph is valid.
95
+
96
+ # 3.6 VERBALIZING INTO LANGUAGE
97
+
98
+ Finally, as in the last step of Figure 2, we convert all the information above to text data for our CORR2CAUSE task. For the correlation statement, we verbalize the set of correlations in Step 3 into a natural language statement $\pmb { s }$ . When two variables cannot be d-separated, i.e., $A \not \perp B$ , then we describe them as $^ { 6 6 } A$ correlates with $B ^ { \prime \prime }$ since they are directly correlated and cannot be independent by any condition. And if two variables have a valid d-separation set $C$ , then we describe them as $^ { 6 6 } A$ is independent of $B$ given $C$ .” In the special case when the d-separation set is empty, we directly say “ $A$ is independent of $B$ .” In addition, we disambiguate the setting by starting the correlation statement with the setup of a closed system of the given variables, and no hidden variables: “Suppose there is a closed system of $N$ variables, A, B, . . . All the statistical relations among these $N$ variables are as follows:”. Finally, to verbalize the hypothesis, we feed the causal relation triplet $( X _ { i } , r , X _ { j } )$
99
+
100
+ <table><tr><td>Causal Relation</td><td>Hypothesis Template</td></tr><tr><td>Is-Parent</td><td>{Vari} directly causes {Var j}.</td></tr><tr><td>Is-Ancestor</td><td>{Var i} causes something else which causes {Var j}.</td></tr><tr><td>Is-Child</td><td>{Var j} directlycauses {Var i}.</td></tr><tr><td>Is-Descendant</td><td>{Varj} isacause for {Vari},but not a direct one.</td></tr><tr><td>Has-Collider</td><td>There exists at least one collider (i.e.,common effect) of {Var i} and {Varj}.</td></tr><tr><td>Has-Confounder</td><td>There exists at least one confounder (i.e., common cause) of {Var i} and {Varj}.</td></tr></table>
101
+
102
+ Table 2: Templates for each causal relation in the hypothesis. We use {Var i} and $\{ \mathrm { V a r ~ \normalfont ~ \div ~ } \}$ as placeholders for the two variables.
103
+
104
+ into their hypothesis templates in Table 2. For example, we turn the triplet (A, Is-Parent, $B$ ) into “A directly causes $B ^ { \ast }$ , as in the example of Figure 2.
105
+
106
+ # 3.7 STATISTICS OF THE RESULTING DATA
107
+
108
+ We show the statistics of our CORR2CAUSE dataset in Table 3. Overall, our dataset contains 207,972 samples, where $1 8 . 5 7 \%$ of the samples have the positive label (i.e., with validity $= 1$ ). The average length of the premise is 424.11 tokens, and hypothesis 10.83 tokens. We split the data into 205,734 training samples, 1,076 development and 1,162 test samples.2 Since the main purpose of the dataset is to benchmark the performance of LLMs, we prioritize the test and development sets to have a comprehensive coverage over all sizes of graphs. Specifically, we iterate through the subset of our data for each $N$ , and split it entirely for only the test and development sets if the data is less than 1K, which is the case for $N = 2$ and 3. For the other subsets that are larger, we randomly sample up to 1K or $10 \%$ of the data, whichever is smaller, to the test and development sets. We set the cap to be 1K in order to form a reasonable computation budget, since many LLMs are expensive to query in the inference mode. Aside from the test and valid sets, all the rest of the data goes into the training set.
109
+
110
+ <table><tr><td rowspan="2"></td><td rowspan="2">Overall</td><td colspan="5">Statistics by the Number of Nodes N</td></tr><tr><td>N=2</td><td>N=3</td><td>N=4</td><td>N=5</td><td>N=6</td></tr><tr><td>#Samples</td><td>207,972</td><td>12</td><td>90</td><td>720</td><td>8,520</td><td>198,630</td></tr><tr><td>#Test</td><td>1,162</td><td>6</td><td>48</td><td>72</td><td>514</td><td>522</td></tr><tr><td># Dev</td><td>1,076</td><td>6</td><td>42</td><td>72</td><td>482</td><td>474</td></tr><tr><td>#Train</td><td>205,734</td><td>0</td><td>0</td><td>576</td><td>7,524</td><td>197,634</td></tr><tr><td># Tokens/Premise</td><td>424.11</td><td>31.5</td><td>52.0</td><td>104.0</td><td>212.61</td><td>434.54</td></tr><tr><td># Tokens/Hypothesis</td><td>10.83</td><td>10.83</td><td>10.83</td><td>10.83</td><td>10.83</td><td>10.83</td></tr><tr><td>% Positive Labels</td><td>18.57</td><td>0.00</td><td>3.33</td><td>7.50</td><td>13.01</td><td>18.85</td></tr><tr><td>Vocab Size</td><td>65</td><td>49</td><td>53</td><td>55</td><td>57</td><td>61</td></tr></table>
111
+
112
+ Table 3: Statistics of our CORR2CAUSE dataset, and by subsets. We report the total number of samples (# Samples); splits of the test (# Test), developement (# Dev) and training sets (# Train); number of tokens per premise (# Tokens/Premise) and hypothesis (# Tokens/Hypothesis); percentage of the positive labels $\%$ Positive Labels), and vocabulary size by the number of unique tokens (Vocab Size). Note that the number of unique graphs and MECs are in Table 1.
113
+
114
+ # 4 EXPERIMENTS
115
+
116
+ # 4.1 EXPERIMENTAL SETUP
117
+
118
+ We set up a diverse list of LLMs for the experiments on our CORR2CAUSE dataset. To test existing LLMs, we first include six commonly used BERT-based NLI models in the transformers library (Wolf et al., 2020): BERT (Devlin et al., 2019), RoBERTa (Liu et al., 2019), BART (Lewis et al., 2020), DeBERTa (He et al., 2021), DistilBERT (Sanh et al., 2019), and DistilBART (Shleifer & Rush, 2020). Apart from these BERT-based NLI models, we also evaluate the general-purpose autoregressive LLMs based on GPT (Radford et al., 2019): GPT-3 Ada, Babbage, Curie, Davinci (Brown et al., 2020); its instruction-tuned versions (Ouyang et al., 2022), text-davinci-001, text-davinci-002, and text-davinci-003; and GPT-3.5 (i.e., ChatGPT), and the latest GPT-4 (OpenAI, 2023) by April 2023,
119
+
120
+ <table><tr><td></td><td>F1</td><td>Precision</td><td>Recall</td><td>Accuracy</td></tr><tr><td>Random Baselines</td><td></td><td></td><td></td><td></td></tr><tr><td>Always Majority</td><td>0.0</td><td>0.0</td><td>0.0</td><td>84.77</td></tr><tr><td>Random (Proportional)</td><td>13.5</td><td>12.53</td><td>14.62</td><td>71.46</td></tr><tr><td>Random (Uniform)</td><td>20.38</td><td>15.11</td><td>31.29</td><td>62.78</td></tr><tr><td>BERT-Based Models</td><td></td><td></td><td></td><td></td></tr><tr><td>BERTMNLI</td><td>2.82</td><td>7.23</td><td>1.75</td><td>81.61</td></tr><tr><td>RoBERTaMNLI</td><td>22.79</td><td>34.73</td><td>16.96</td><td>82.50</td></tr><tr><td>DeBERTaMNLI</td><td>14.52</td><td>14.71</td><td>14.33</td><td>74.31</td></tr><tr><td>DistilBERTMNLI</td><td>20.70</td><td>24.12</td><td>18.13</td><td>78.85</td></tr><tr><td>DistilBARTMNLI</td><td>26.74</td><td>15.92</td><td>83.63</td><td>30.23</td></tr><tr><td>BARTMNLI</td><td>33.38</td><td>31.59</td><td>35.38</td><td>78.50</td></tr><tr><td>LLaMa-BasedModels</td><td></td><td></td><td></td><td></td></tr><tr><td>LLaMa-7B</td><td>26.81</td><td>15.50</td><td>99.42</td><td>17.36</td></tr><tr><td>Alpaca-7B</td><td>27.37</td><td>15.93</td><td>97.37</td><td>21.33</td></tr><tr><td>GPT-Based Models</td><td></td><td></td><td></td><td></td></tr><tr><td>GPT-3 Ada</td><td>0.00</td><td>0.00</td><td>0.00</td><td>84.77</td></tr><tr><td>GPT-3 Babbage</td><td>27.45</td><td>15.96</td><td>97.95</td><td>21.15</td></tr><tr><td>GPT-3 Curie</td><td>26.43</td><td>15.23</td><td>100.00</td><td>15.23</td></tr><tr><td>GPT-3 Davinci</td><td>27.82</td><td>16.57</td><td>86.55</td><td>31.61</td></tr><tr><td>GPT-3 Instruct (text-davinci-001)</td><td>17.99</td><td>11.84</td><td>37.43</td><td>48.04</td></tr><tr><td>GPT-3 Instruct (text-davinci-002)</td><td>21.87</td><td>13.46</td><td>58.19</td><td>36.69</td></tr><tr><td>GPT-3 Instruct (text-davinci-003)</td><td>15.72</td><td>13.4</td><td>19.01</td><td>68.97</td></tr><tr><td>GPT-3.5</td><td>21.69</td><td>17.79</td><td>27.78</td><td>69.46</td></tr><tr><td>GPT-4</td><td>29.08</td><td>20.92</td><td>47.66</td><td>64.60</td></tr></table>
121
+
122
+ Table 4: Overall performance. We report F1 (main metric), precision, recall and accuracy. For the main metric, F1 score, we use the bold font to highlight the overall best performance, and underline to highlight the best performance within each category of models.
123
+
124
+ using the OpenAI API (https://openai.com/api/) with temperature 0. We also evaluate the recent, more efficient models, LLaMa (Touvron et al., 2023) and Alpaca (Taori et al., 2023).
125
+
126
+ When inspecting the behavior of finetuned models, we adopt a large set of models, including GPTbased models (GPT-3 Ada, Babbage, Curie, and Davinci) using the OpenAI finetuning API for classification at https://platform.openai.com/docs/guides/fine-tuning, open-sourced decoder-only models (GPT2, GPT2-Large, GPT2-XL, LLaMA-7B, and LLaMA2-7B), BERT-based models from scratch (BERT-Base, BERT-Large, RoBERTa-Base, and RoBERTa-Large), and BERTBased NLI models (BERT-Base MNLI, BERT-Large MNLI, RoBERTa-Base MNLI, and RoBERTaLarge MNLI) using the transformers library (Wolf et al., 2020). See training details in Appendix A.
127
+
128
+ For the random baselines, we provide “always majority” to predict the majority class $100 \%$ of the time, “random (uniform)” to uniformly sample a label (i.e., $50 \%$ for each), and “random (proportional)” to sample a label from a Bernouli distribution proportional to the development set label distribution.
129
+
130
+ # 4.2 THE CORR2CAUSE SKILL IN EXISTING LLMS
131
+
132
+ We show the performance of seventeen LLMs in Table 4. We can see that pure causal inference is a very challenging task across all existing LLMs. Among all the LLMs, the best performance is $3 3 . 3 8 \%$ F1 by BART MNLI, which is even higher than the latest GPT-based model, GPT-4. Notably, many models are worse than random guess, which means that they totally fail at this pure causal inference task. The observation still holds for few-shot chain-of-thought prompts tested in Appendix G.
133
+
134
+ # 4.3 FINETUNED PERFORMANCE
135
+
136
+ Next, we address the question: Can we re-purpose LLMs to learn this task? The experimental results in Table 5a of 17 models finetuned on our CORR2CAUSE seem very strong at first sight. Most models see a substantial increase, among which the finetuned BERT-based NLI models demonstrate the strongest performance. The best-performing one, RoBERTa-Large MNLI, achieves $9 4 . 7 4 \%$ F1 score on this task, as well as very high precision, recall and accuracy scores.
137
+
138
+ <table><tr><td colspan="4">F1 Precison Recall Accuracy</td></tr><tr><td colspan="4">Finetuned GPT-Based Models Using OpenAI API</td></tr><tr><td>GPT-3 Ada</td><td>79.85 70.47</td><td>92.11</td><td>92.92</td></tr><tr><td>GPT-3 Babbage</td><td>78.19 69.98</td><td>88.60</td><td>92.48</td></tr><tr><td>GPT-3 Curie</td><td>81.23 75.00</td><td>88.60</td><td>93.77</td></tr><tr><td>GPT-3Davinci 85.52</td><td>80.26</td><td>91.52</td><td>95.28</td></tr><tr><td colspan="4">Finetuned Open-Sourced Decoder-Only Models</td></tr><tr><td>GPT2</td><td>89.18 88.03</td><td>90.35</td><td>96.66</td></tr><tr><td>GPT2-Large</td><td>94.29 92.18</td><td>96.49</td><td>98.22</td></tr><tr><td>GPT2-XL</td><td>94.30 91.94</td><td>96.78</td><td>98.22</td></tr><tr><td>LLaMA-7B</td><td>91.98 88.62</td><td>95.61</td><td>97.46</td></tr><tr><td>LLaMA2-7B</td><td>92.92 90.11</td><td>95.91</td><td>97.77</td></tr><tr><td colspan="4">Finetuned BERT-Based Models</td></tr><tr><td>BERT-Base</td><td>69.29 54.42</td><td>95.32</td><td>87.13</td></tr><tr><td>BERT-Large</td><td>85.26 77.51</td><td>94.74</td><td>95.01</td></tr><tr><td>RoBERTa-Base</td><td>87.60 78.47</td><td>99.12</td><td>95.73</td></tr><tr><td>RoBERTa-Large</td><td>89.10 82.54</td><td>96.78</td><td>96.39</td></tr><tr><td colspan="4">Finetuned BERT-Based NLI Models</td></tr><tr><td>BERT-Base MNLI</td><td>89.88 85.49</td><td>94.74</td><td>86.51</td></tr><tr><td>BERT-Large MNLI</td><td>90.19 84.44</td><td>96.78</td><td>96.79</td></tr><tr><td>RoBERTa-Base MNLI</td><td>94.27 90.35</td><td>98.54</td><td>98.17</td></tr><tr><td>RoBERTa-Large MNLI</td><td>94.74 92.24</td><td>97.37</td><td>98.35</td></tr><tr><td></td><td></td><td></td><td></td></tr></table>
139
+
140
+ (a) Performance of finetuned models on the original test set.
141
+
142
+ <table><tr><td>F1 (Paraph.)</td><td>F1 (Var. Ref.)</td></tr><tr><td>61.73 62.34</td><td>41.57 43.28</td></tr><tr><td>64.93 65.01</td><td>45.32 46.96</td></tr><tr><td>56.76 55.95 60.32</td><td>31.70 31.99 43.95 53.92</td></tr><tr><td>56.41 52.24</td><td>49.47 35.20</td></tr><tr><td>61.13 63.64 65.58</td><td>38.54 53.12</td></tr><tr><td>65.05</td><td>60.20</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td>65.56</td><td></td></tr><tr><td></td><td>31.50</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td>67.24</td><td>52.04</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td>57.42</td><td>62.83</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td>55.45</td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td>67.87</td></tr></table>
143
+
144
+ (b) F1 scores of finetuned models on the perturbed test sets by paraphrasing (Paraph.) and variable refactorization (Var. Ref.).
145
+
146
+ Table 5: Performance of finetuned models on the original test set and perturbed test sets.
147
+
148
+ <table><tr><td>Relation Type</td><td>F1</td><td>Precision</td><td>Recall</td><td>Accuracy</td></tr><tr><td>Is-Parent</td><td>96.18</td><td>95.45</td><td>96.92</td><td>98.67</td></tr><tr><td>Is-Ancestor</td><td>93.94</td><td>93.94</td><td>93.94</td><td>98.93</td></tr><tr><td>Is-Child</td><td>95.73</td><td>94.92</td><td>96.56</td><td>98.67</td></tr><tr><td>Is-Descendant</td><td>96.55</td><td>93.33</td><td>100</td><td>99.47</td></tr><tr><td>Has-Collider</td><td>92.19</td><td>87.41</td><td>97.52</td><td>94.64</td></tr><tr><td>Has-Confounder</td><td>98.67</td><td>97.37</td><td>100</td><td>99.73</td></tr></table>
149
+
150
+ (a) Fine-grained performance of RoBERTa-Large by causal relation type on the original test set.
151
+
152
+ <table><tr><td>F1</td><td>Precision</td><td>Recall</td><td>Accuracy</td></tr><tr><td>74.80</td><td>79.31</td><td>70.77</td><td>91.73</td></tr><tr><td>45.45</td><td>90.91</td><td>30.30</td><td>93.60</td></tr><tr><td>73.39</td><td>78.43</td><td>68.97</td><td>92.27</td></tr><tr><td>29.41</td><td>83.33</td><td>17.86</td><td>93.60</td></tr><tr><td>70.70</td><td>75.00</td><td>66.90</td><td>82.04</td></tr><tr><td>70.42</td><td>73.53</td><td>67.57</td><td>94.37</td></tr></table>
153
+
154
+ (b) Its fine-grained performance by relation type after variable refactorization.
155
+
156
+ Table 6: Fine-grained analysis of the best-performing model, RoBERTa-Large MNLI.
157
+
158
+ # 4.4 FINE-GRAINED PERFORMANCE BY CAUSAL RELATION
159
+
160
+ In addition to the overall results mentioned above, we conduct a fine-grained analysis to check the performance of the strongest finetuned model, RoBERTa-Large MNLI, by our six causal relation types. As in Table 6a, the model is very good at judging relations such as Is-Parent, Is-Descendant and Has-Confounder, all with more than $96 \%$ F1 scores, whereas it is several points weaker on the Has-Collider relations. This could be due to that the collider relation is the most special type, requiring identification of the V-structure based on both the unconditional independence based on the two variables only and correlations whenever conditioned on a common descendant. We also conduct error analysis for non-finetuned models in Appendix F.
161
+
162
+ # 4.5 ROBUSTNESS ANALYSIS
163
+
164
+ Looking at the very high performance of the finetuned models, we raise the next question: Did the models really robustly learn the causal inference skills?
165
+
166
+ Two Robustness Tests We design two simple robustness tests: (1) paraphrasing, and (2) variable refactorization. For (1) paraphrasing, we simply paraphrase the hypothesis by changing the text template for each causal relation to some semantically-equivalent alternatives in Appendix C. For (2) variable refactorization, we reverse the alphabet of the variable names, namely flipping A, B, C, to Z, Y, X and so on. The inspiration behind the two robustness tests comes from the spurious correlation analysis described in Appendix E.
167
+
168
+ Specifically, we adopt the common setup of text adversarial attack (Morris et al., 2020; Jin et al., 2020) to preserve the training set and keep the same saved models, but run the inference on the perturbed test set. In this way, we separate the possibilities of the models only overfitting on the training data vs. mastering the reasoning skills.
169
+
170
+ Results after Perturbation We can see from Table 5b that all the models drop drastically, by up to 39.29 on the paraphrased test set, and up to 62.30 after variable refactorization. The best-performing model, RoBERTa-Large MNLI, is especially sensitive towards paraphrasing, demonstrating the most drop among all models; however, it is the most robust against the variable refactorization, maintaining a high F1 score of 67.87. We conduct fine-grained analysis for RoBERTa-Large MNLI under perturbation in Table 6b. We can see the the main source of the performance drop of the model comes from the two classes, Is-Ancestor (decreasing to $4 5 . 4 5 \%$ ) and Is-Descendant (decreasing to $2 9 . 4 1 \%$ ), while the other classes stay relatively robust, keeping their F1 scores over $70 \%$ .
171
+
172
+ From this analysis, we make the following suggestions to future studies testing this CORR2CAUSE skill of LLMs. First, it is safe to use it as a test set to benchmark existing LLMs’ performance, since the data we generate is out-of-distribution from the training data of the current LLMs. Then, when testing finetuned models, it is very important to accompany adversarial attack together with the i.i.d. test set. We open-source our perturbed test sets for future work to test the generalizability skill.
173
+
174
+ # 4.6 EXTENSION TO NATURAL STORIES
175
+
176
+ We envision our CORR2CAUSE dataset to be a foundation for future extensions to various settings, such as instantiating the variables with actual phenomena and situating the story in a more natural setting. For example, the correlation does not imply causation rule can be instantiated with the ice cream sales and swimming pool attendance as the two variables, and argue that ice cream sales does not necessarily affect swimming pool attendance, because their correlation could be due to a third variable, such as hot weather. We provide a case study for how to instantiate the symbolic expressions in our dataset to more natural stories, and find that LLMs such as GPT-4 can generate realistic, daily life stories that has foreseeably broad applications. See more details in Appendix B.
177
+
178
+ # 5 RELATED WORK
179
+
180
+ Existing Causal Reasoning Tasks A large body of existing research of causal reasoning in NLP focuses on leveraging empirical knowledge to do tasks such as inferring the cause and effect of why an agent perform certain tasks (Sap et al., 2019a), the motivation and emotional reaction in a social context (Sap et al., 2019b), how people achieve a given goal with a set of concrete steps (Zhang et al., 2020), the development of a story given a different beginning (Qin et al., 2019), and how in general LLMs serve as a knowledge base of cause and effect (Willig et al., 2023; Kıcıman et al., 2023). In contrast, our CORR2CAUSE task focuses on the pure causal inference skill of models, which is a knowledge-dependent reasoning skill based on formally correct rules from causal inference.
181
+
182
+ Existing Logical and Inference Tasks Another related area of literature is logical and inference tasks, of which a well-established one is natural language inference (NLI), to identify the semantic relationship between a pair of sentences (MacCartney & Manning, 2008; Bowman et al., 2015). NLI datasets mainly focus on the set and paraphrase relations. For example, “a group of boys are playing football” can entail “some guys are playing football,” where “boys” are a sub-concept of “guys,” and “a group of” and “some” are paraphrases. Recently, there have been increasing efforts to extend the inference task to various logical inference skills such as deductive logic and propaganda techniques (Jin et al., 2022; Alhindi et al., 2022). Our CORR2CAUSE dataset is the first dataset testing the correlation-to-causation inference skill, which is unique of its type.
183
+
184
+ # 6 CONCLUSION
185
+
186
+ In this work, we introduced a novel task, CORR2CAUSE, to infer causation from correlation, and collected a large-scale dataset of over 200K samples. We evaluated an extensive list of LLMs on this new task, and showed that off-the-shelf LLMs perform poorly on this task. We also show that it is possible to re-purpose LLMs on this task by finetuning, but future work needs to be aware of the out-of-distribution generalization problem. To avoid the Goodhart’s law, we recommend using this dataset to benchmark the pure causal inference skills for LLMs that have not seen this dataset. Given the limited reasoning abilities of current LLMs, and the difficulty of separating actual reasoning from training-corpus-derived knowledge, it is imperative that our community focus on work aiming to accurately disentangle and measure both abilities. We believe the present work is a first such step.
187
+
188
+ # LIMITATIONS AND FUTURE WORK
189
+
190
+ We identify several limitations of this work and open future directions: First, in the context of this work, we limit the causal graphs to two to six nodes, but future work can feel free to explore larger graphs. Another aspect is that we do not assume hidden confounders in this inference problem, so we welcome future work to generate an even more challenging dataset to infer the existence of hidden confounders, analogous to the causal discovery algorithm of fast causal inference (FCI) (Spirtes et al., 2000). And also in general, explorations of other causal discovery algorithms are welcomed too. Finally, a lot of motivation behind proposing this task is inspired by the problem of invalid reasoning patterns in our daily reasoning (Jin et al., 2022), which could fertilize the ground for more pervasive spread of fake news. We believe false causal inference is a prevalent type of fallacious beliefs, and welcome future work to connect the idea of this benchmark to more real-world false beliefs based on confusing correlation with causation.
191
+
192
+ # ACKNOWLEDGMENT
193
+
194
+ We thank Riley Goodside for valuable suggestions to improve our prompts to LLMs. We thank Luigi Gresele and Amir Hossein Karimi for their suggestions to help us improve the formulation of our causal discovery questions.
195
+
196
+ This material is based in part upon work supported by the German Federal Ministry of Education and Research (BMBF): Tübingen AI Center, FKZ: 01IS18039B; by the Machine Learning Cluster of Excellence, EXC number 2064/1 – Project number 390727645; by a National Science Foundation award (#2306372); by a Swiss National Science Foundation award (#201009) and a Responsible AI grant by the Haslerstiftung. Zhijing Jin is supported by PhD fellowships from the Future of Life Institute and Open Philanthropy. We also thank OpenAI for granting Zhijing quota to their API of GPT series through the Researcher Access Program.
197
+
198
+ # REFERENCES
199
+
200
+ Tariq Alhindi, Tuhin Chakrabarty, Elena Musi, and Smaranda Muresan. Multitask instruction-based prompting for fallacy recognition. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pp. 8172–8187, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. URL https://aclanthology.org/ 2022.emnlp-main.560. 9
201
+
202
+ Chandra Bhagavatula, Ronan Le Bras, Chaitanya Malaviya, Keisuke Sakaguchi, Ari Holtzman, Hannah Rashkin, Doug Downey, Wen-tau Yih, and Yejin Choi. Abductive commonsense reasoning. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. URL https://openreview.net/forum?id= Byg1v1HKDB. 1
203
+
204
+ Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. A large annotated corpus for learning natural language inference. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 632–642, Lisbon, Portugal, September 2015. Association for Computational Linguistics. doi: 10.18653/v1/D15-1075. URL https: //aclanthology.org/D15-1075. 9
205
+
206
+ Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 1877–1901. Curran Associates, Inc., 2020. URL https://proceedings.neurips. cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf. 6
207
+
208
+ David Maxwell Chickering. Optimal structure identification with greedy search. J. Mach. Learn. Res., 3:507–554, 2002. URL http://jmlr.org/papers/v3/chickering02b.html. 3
209
+
210
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171��4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https: //aclanthology.org/N19-1423. 1, 6
211
+
212
+ Clark Glymour, Kun Zhang, and Peter Spirtes. Review of causal discovery methods based on graphical models. Frontiers in Genetics, 10:524, 2019. ISSN 1664-8021. doi: 10.3389/fgene.2019. 00524. URL https://www.frontiersin.org/article/10.3389/fgene.2019. 00524. 2, 3
213
+ Madelyn Glymour, Judea Pearl, and Nicholas P Jewell. Causal inference in statistics: A primer. John Wiley and Sons, 2016. 2, 3
214
+ Andrew Gordon, Zornitsa Kozareva, and Melissa Roemmele. SemEval-2012 task 7: Choice of plausible alternatives: An evaluation of commonsense causal reasoning. In \*SEM 2012: The First Joint Conference on Lexical and Computational Semantics – Volume 1: Proceedings of the main conference and the shared task, and Volume 2: Proceedings of the Sixth International Workshop on Semantic Evaluation (SemEval 2012), pp. 394–398, Montréal, Canada, 7-8 June 2012. Association for Computational Linguistics. URL https://aclanthology.org/S12-1052. 1
215
+ Pengcheng He, Xiaodong Liu, Jianfeng Gao, and Weizhu Chen. Deberta: Decoding-enhanced Bert with disentangled attention. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. URL https:// openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ XPZIaotutsD. 6
216
+ Patrik O. Hoyer, Dominik Janzing, Joris M. Mooij, Jonas Peters, and Bernhard Schölkopf. Nonlinear causal discovery with additive noise models. In Daphne Koller, Dale Schuurmans, Yoshua Bengio, and Léon Bottou (eds.), Advances in Neural Information Processing Systems 21, Proceedings of the Twenty-Second Annual Conference on Neural Information Processing Systems, Vancouver, British Columbia, Canada, December 8-11, 2008, pp. 689–696. Curran Associates, Inc., 2008. URL https://proceedings.neurips.cc/paper/2008/hash/ f7664060cc52bc6f3d620bcedc94a4b6-Abstract.html. 3
217
+ Di Jin, Zhijing Jin, Joey Tianyi Zhou, and Peter Szolovits. Is BERT really robust? A strong baseline for natural language attack on text classification and entailment. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pp. 8018– 8025. AAAI Press, 2020. URL https://aaai.org/ojs/index.php/AAAI/article/ view/6311. 9
218
+ Zhijing Jin, Abhinav Lalwani, Tejas Vaidhya, Xiaoyu Shen, Yiwen Ding, Zhiheng Lyu, Mrinmaya Sachan, Rada Mihalcea, and Bernhard Schölkopf. Logical fallacy detection. In Findings of the Association for Computational Linguistics: EMNLP 2022, pp. $\mathrm { \dot { 7 } 1 8 0 } \mathrm { \tilde { A } \mathrm { \acute { a } } }$ ‚¬âCœ–7198, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. URL https://arxiv.org/abs/2202.13758. 9, 10
219
+ Emre Kıcıman, Robert Ness, Amit Sharma, and Chenhao Tan. Causal reasoning and large language models: Opening a new frontier for causality. arXiv preprint arXiv:2305.00050, 2023. 1, 9
220
+ Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 7871–7880, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.703. URL https://aclanthology.org/2020.acl-main.703. 6
221
+ Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. RoBERTa: A robustly optimized BERT pretraining approach. CoRR, abs/1907.11692, 2019. URL http://arxiv.org/abs/1907.11692. 6
222
+
223
+ Bill MacCartney and Christopher D. Manning. Modeling semantic containment and exclusion in natural language inference. In Proceedings of the 22nd International Conference on Computational Linguistics (Coling 2008), pp. 521–528, Manchester, UK, August 2008. Coling 2008 Organizing Committee. URL https://aclanthology.org/C08-1066. 9
224
+
225
+ Brendan D. McKay and Adolfo Piperno. Practical graph isomorphism, II. J. Symb. Comput., 60: 94–112, 2014. doi: 10.1016/j.jsc.2013.09.003. URL https://doi.org/10.1016/j.jsc. 2013.09.003. 5
226
+ John Morris, Eli Lifland, Jin Yong Yoo, Jake Grigsby, Di Jin, and Yanjun Qi. TextAttack: A framework for adversarial attacks, data augmentation, and adversarial training in NLP. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 119–126, Online, October 2020. Association for Computational Linguistics. doi: 10.18653/v1/ 2020.emnlp-demos.16. URL https://aclanthology.org/2020.emnlp-demos.16. 9
227
+ OpenAI. GPT-4 technical report. CoRR, abs/2303.08774, 2023. doi: 10.48550/arXiv.2303.08774. URL https://doi.org/10.48550/arXiv.2303.08774. 1, 6
228
+ Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul F. Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback. CoRR, abs/2203.02155, 2022. doi: 10.48550/arXiv.2203.02155. URL https://doi.org/10. 48550/arXiv.2203.02155. 1, 6
229
+ Judea Pearl. Probabilistic reasoning in intelligent systems: Networks of plausible inference. Morgan Kaufmann, 1988. 3
230
+ Judea Pearl. Causality: Models, reasoning and inference (2nd ed.). Cambridge University Press, 2009. 1
231
+ Jonas Peters, Dominik Janzing, and Bernhard Schölkopf. Elements of causal inference: Foundations and learning algorithms. The MIT Press, 2017. URL https://mitpress.mit.edu/ books/elements-causal-inference. 1
232
+ Lianhui Qin, Antoine Bosselut, Ari Holtzman, Chandra Bhagavatula, Elizabeth Clark, and Yejin Choi. Counterfactual story reasoning and generation. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 5043–5053, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1509. URL https: //aclanthology.org/D19-1509. 1, 9
233
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI Blog, 1(8), 2019. 1, 6
234
+ Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. DistilBERT, a distilled version of BERT: Smaller, faster, cheaper and lighter. CoRR, abs/1910.01108, 2019. URL http: //arxiv.org/abs/1910.01108. 6
235
+ Maarten Sap, Ronan Le Bras, Emily Allaway, Chandra Bhagavatula, Nicholas Lourie, Hannah Rashkin, Brendan Roof, Noah A. Smith, and Yejin Choi. ATOMIC: an atlas of machine commonsense for if-then reasoning. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, The Thirty-First Innovative Applications of Artificial Intelligence Conference, IAAI 2019, The Ninth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2019, Honolulu, Hawaii, USA, January 27 - February 1, 2019, pp. 3027–3035. AAAI Press, 2019a. doi: 10.1609/aaai.v33i01.33013027. URL https://doi.org/10.1609/aaai.v33i01. 33013027. 1, 9
236
+ Maarten Sap, Hannah Rashkin, Derek Chen, Ronan Le Bras, and Yejin Choi. Social iqa: Commonsense reasoning about social interactions. In EMNLP 2019, 2019b. 1, 9
237
+
238
+ Shohei Shimizu, Patrik O. Hoyer, Aapo Hyvärinen, and Antti J. Kerminen. A linear non-gaussian acyclic model for causal discovery. J. Mach. Learn. Res., 7:2003–2030, 2006. URL http: //jmlr.org/papers/v7/shimizu06a.html. 3
239
+
240
+ Sam Shleifer and Alexander M. Rush. Pre-trained summarization distillation. CoRR, abs/2010.13002, 2020. URL https://arxiv.org/abs/2010.13002. 6
241
+ Peter Spirtes and Kun Zhang. Causal discovery and inference: Concepts and recent methodological advances. In Applied informatics, volume 3, pp. 1–28. SpringerOpen, 2016. 2, 3
242
+ Peter Spirtes, Clark Glymour, and Richard Scheines. Causation, prediction, and search. 1993. 2, 3
243
+ Peter Spirtes, Clark Glymour, and Richard Scheines. Causation, Prediction, and Search, Second Edition. Adaptive computation and machine learning. MIT Press, 2000. ISBN 978-0-262-19440-2. 1, 2, 3, 10
244
+ Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. https://github.com/tatsu-lab/stanford_alpaca, 2023. 7
245
+ Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurélien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models. CoRR, abs/2302.13971, 2023. doi: 10.48550/arXiv.2302.13971. URL https://doi. org/10.48550/arXiv.2302.13971. 7
246
+ Ruibo Tu, Chao Ma, and Cheng Zhang. Causal-discovery performance of chatgpt in the context of neuropathic pain diagnosis. arXiv preprint arXiv:2301.13819, 2023. 1
247
+ Moritz Willig, Matej Zecevi ˇ c, Devendra Singh Dhami, and Kristian Kersting. Probing for correlations ´ of causal facts: Large language models and causality, 2023. URL https://openreview. net/forum?id $=$ UPwzqPOs4-. 9
248
+ Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 38–45, Online, October 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-demos.6. URL https://aclanthology.org/2020.emnlp-demos.6. 6, 7, 14
249
+ Yuxi Xie, Guanzhen Li, and Min-Yen Kan. Echo: Event causality inference via human-centric reasoning. arXiv preprint arXiv:2305.14740, 2023. 1
250
+ Matej Zecevi ˇ c, Moritz Willig, Devendra Singh Dhami, and Kristian Kersting. Causal parrots: Large ´ language models may talk causality but are not causal. arXiv preprint arXiv:2308.13067, 2023. 1
251
+ Kun Zhang and Aapo Hyvärinen. Causality discovery with additive disturbances: An informationtheoretical perspective. In Machine Learning and Knowledge Discovery in Databases: European Conference, ECML PKDD 2009, Bled, Slovenia, September 7-11, 2009, Proceedings, Part II 20, pp. 570–585. Springer, 2009. 3
252
+ Li Zhang, Qing Lyu, and Chris Callison-Burch. Reasoning about goals, steps, and temporal ordering with WikiHow. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 4630–4639, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.374. URL https://aclanthology.org/ 2020.emnlp-main.374. 9
253
+ Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona T. Diab, Xian Li, Xi Victoria Lin, Todor Mihaylov, Myle Ott, Sam Shleifer, Kurt Shuster, Daniel Simig, Punit Singh Koura, Anjali Sridhar, Tianlu Wang, and Luke Zettlemoyer. OPT: open pre-trained transformer language models. CoRR, abs/2205.01068, 2022. doi: 10.48550/ arXiv.2205.01068. URL https://doi.org/10.48550/arXiv.2205.01068. 1
254
+
255
+ # A IMPLEMENTATION DETAILS
256
+
257
+ When finetuning on our data, for GPT-based models, we use the default settings of the OpenAI finetuning API; and for BERT-based models, we use the transformers library (Wolf et al., 2020) and train the models on a server with an NVIDIA Tesla A100 GPU with 40G of memory. To fit for the GPU memory, we set the batch size to be 8. We use the validation set to tune the learning rate, which takes value in {2e-6, 5e-6, 1e-5, 2e-5, 5e-5}; dropout rate, which takes value in $\{ 0 , 0 . 1 , 0 . 2$ , 0.3}; and weight decay, which takes value in {1e-4, 1e-5}. We train the models until convergence, which is usually around ten epochs.
258
+
259
+ Prompts When querying the autoregressive LLMs, we formulate the prompt as follows:
260
+
261
+ Question: [premise]
262
+
263
+ Can we deduct the following: [hypothesis]? Just answer "Yes" or "No."
264
+
265
+ Answer:
266
+
267
+ # B GENERATING NATURAL STORIES
268
+
269
+ To generate the natural stories based on our symbolic expressions, we utilize the state-of-the-art LLM, GPT-4, which is very good at story generation. We design detailed instructions in the prompt, and generate around 200 stories in our case study. We show two examples stories in Table 7, and the report the overall statistics in Table 8.
270
+
271
+ <table><tr><td>Example 1 (Label=Negative)</td><td>Symbolic Premise: Suppose there is a closed system</td><td>Example 2 (Label=Positive) Premise: Suppose there is a closed system</td></tr><tr><td>Form Natural</td><td>of 2 variables,A and B.All the statistical relations among these 2 variables are as fol- lows:A correlates with B. Hypothesis:A directly affects B. Relation between the promise and hypothe- sis: The premise does not a necessary con- dition for the hypothesis. Premise: Suppose there is a closed system</td><td>of3 variables,A,B and C.All the statisti- cal relations among these 3 variables are as follows: A correlates with C.B correlates with C.However,Ais independent ofB. Hypothesis: A directly affects C. Relation between the promise and hypoth- esis: The premise is a necessary condition for the hypothesis. So if the premise is true, the hypothesis must be true. Premise:Let&#x27;s consider three factors: eat-</td></tr><tr><td>Story</td><td>of 2 variables,ice cream sales and swim- ming pool attendance.All the statistical relations among these 2 variables are as fol- lows: ice cream sales correlate with swim- ming pool attendance. Hypothesis:Ice cream sales directly affect swimming pool attendance. Relation between the premise and hypoth- esis: The premise does not provide a nec- essary condition for the hypothesis. The correlation between ice cream sales and swimming pool attendance could be due to a third variable,such as hot weather, which increases both ice cream sales and swim- ming pool attendance.Therefore, it is not necessarily true that ice cream sales directly affect swimming pool attendance.</td><td>ing junk food (A), obesity (C),and watch- ing television (B). There is a correlation between eating junk food and obesity, and between watching television and obesity. However, eating junk food and watching television are independent from each other. Hypothesis: Eating junk food directly af- fects obesity. Relation between the premise and hypoth- esis: The premise provides the necessary conditions for the hypothesis.It establishes the independent variables A (eating junk food) and B (watching television) and their correlations with obesity. Given that these are true,it supports the hypothesis that eat- ing junk food directly affects obesity.</td></tr></table>
272
+
273
+ Table 7: Examples of natural stories generated based on the symbolic form in our CORR2CAUSE dataset, showing the broad application value of our dataset as the starting point for various verbalizations of the correlation-to-causation inference task.
274
+
275
+ Table 8: Statistics of our generated natural stories. We report the number of samples in the test and development sets; number of tokens per premise (# Tokens/Premise), hypothesis (# Tokens/Hypothesis), and explanation (# Tokens/Explanation); and percentage of the positive labels $\%$ Positive Labels).
276
+
277
+ <table><tr><td>Test Set Size Dev Set Size</td><td>102 102</td></tr><tr><td># Tokens/Premise</td><td>64.88</td></tr><tr><td># Tokens/Hypothesis</td><td>13.54</td></tr><tr><td># Tokens/Explanation</td><td>64.66</td></tr><tr><td>% Positive Labels</td><td>1.67</td></tr></table>
278
+
279
+ For more information, the exact prompt we use is “Here is a causal inference rule: [symbolic form] Please provide a real-world example instantiating this phenomenon. Format it also as "Premise:", "Hypothesis:", and "Relation between the promise and hypothesis:".”
280
+
281
+ # C TEMPLATES AND PARAPHRASES
282
+
283
+ We use the verbalization templates in Table 9 to compose the hypotheses for all six causal relations.
284
+
285
+ <table><tr><td>Causal Relation</td><td colspan="2">Hypothesis Template</td></tr><tr><td>Is-Parent</td><td></td><td>{Vari} directly causes {Var j}.</td></tr><tr><td>Is-Ancestor</td><td></td><td>{Vari} causes something else which causes {Var j}.</td></tr><tr><td>Is-Child</td><td></td><td>{Varj} directly causes {Var i}.</td></tr><tr><td>Is-Descendant</td><td></td><td>{Varj} isa cause for{Var i},but nota direct one.</td></tr><tr><td>Has-Collider</td><td></td><td>There exists at least one collider (i.e., common effect) of {Var i} and {Varj}.</td></tr><tr><td>Has-Confounder</td><td></td><td>There exists at least one confounder (i.e.,common cause)of {Var i} and {Varj}.</td></tr><tr><td colspan="2">Paraphrases</td><td></td></tr><tr><td>Is-Parent</td><td></td><td>{Vari}directlyaffects{Var j}.</td></tr><tr><td>Is-Ancestor</td><td></td><td>{Var i} influences {Var j} through some mediator(s).</td></tr><tr><td>Is-Child</td><td></td><td>{Varj} directly affects {Var i}.</td></tr><tr><td>Is-Descendant</td><td></td><td>{Varj} influences {Var i} through some mediator(s).</td></tr><tr><td>Has-Collider</td><td></td><td>{Vari} and {Var j} together cause some other variable(s).</td></tr><tr><td>Has-Confounder</td><td></td><td>Some variable(s) cause(s) both {Var i} and {Var j}.</td></tr></table>
286
+
287
+ Table 9: Templates and their paraphrases for each causal relation in the hypothesis. We use {Var i} and {Var j} as placeholders for the two variables.
288
+
289
+ D CHANGE LOG FOR THE DATASET VERSION UPDATE
290
+ Table 10: De-duplication methods for the six causal relation types and their verbalizations.
291
+
292
+ <table><tr><td>Two Equivalent Forms</td><td>Duplication Property</td><td>De-Duplication Method</td></tr><tr><td>{ Is-Parid(j, )</td><td>Two exact same strings</td><td>Keep only one, by forcing i&lt; j</td></tr><tr><td>{Is-Ancestor(i,j) (Original) (Is-Descendent(j,i) (Original)</td><td>Two different strings, but semantically equivalent</td><td>Randomly sample one out of the two</td></tr><tr><td>( Is-Asetor(i,j)(araphraded)</td><td>Two exact same strings</td><td>Keep only one, by forcing i&lt; j</td></tr><tr><td>{Has-Collider(i,j) (Has-Collider(j,i)</td><td>Two different strings, but semantically equivalent</td><td>Randomly sample one out of the two</td></tr><tr><td>{Has-Confounder(i,j) { Has-Confounder(j,i)</td><td>Two different strings, but semantically equivalent</td><td>Randomly sample one out of the two</td></tr></table>
293
+
294
+ De-Duplication Strategy As mentioned in Section 3.7 in the main paper, our original dataset (v1.0) has duplication due to symmetric relations and verbalizations. We introduce in Table 10 several reasons for why duplicated hypotheses exist in our original data. One typical reason is symmetric relations such as Is-Parent(A, B) and Is-Child(B, A), and, similarly, the paraphrased version of
295
+
296
+ Is-Ancestor(A, B) and Is-Descendent(B, A). Another typical reason is the semantic equivalence in the verbalization templates, which applies to the Has-Collider and Has-Confounder relations. For example, the verbalized texts of Has-Collider(A, B) and Collider(B, A) are “There exists at least one collider (i.e., common effect) of {A and B, B and A},” respectively, which are semantically-equivalent paraphrases of each other, so we randomly keep one out of the two.
297
+
298
+ # Resulting Dataset Statistics after De-Duplication
299
+
300
+ Since the reason for duplication in the first place is due to symmetry in the causal relation, or verbalization, the resulting new data, CORR2CAUSE v2.0, is exactly a half of the original data. As we reported previously in Table 3 of Section 3.7, the total number of samples cuts down to half, while the label distribution and all other properties are the same. To compose each split, we apply the same de-duplication method for the test, train, and development sets. We notice that some duplicates are across the splits, so we prioritize keeping the test and training sets untouched (to minimally affect the experimental results), and then reduce the development set by removing the cross-split duplicates, namely:
301
+
302
+ • test_ $2 . 0 =$ deduplicate(test_1.0) • train_ $2 . 0 =$ deduplicate(train_1.0) • dev_ $2 . 0 =$ deduplicate(dev_1.0) \ {test_2.0, train_2.0}
303
+
304
+ We expect minimal or almost no change to the experimental results. In case of the slight possibility that this change in the development set might affect the model selection in the training process, future work can feel free to re-train the models and update the exact performance number.
305
+
306
+ # E SPURIOUS CORRELATION ANALYSIS
307
+
308
+ The inspirations of our two robustness tests (paraphrasing and variable refactorization) come from our data analysis. We check for spurious correlations in the data by reporting in Table 11 the point-wise mutual information (PMI) between the label and any n-gram with no more than four tokens. In addition, we also report the difference of the PMI with the two labels in the |Diff| column of Table 11, and report the top $1 0 \mathrm { n }$ -grams.
309
+
310
+ The design spirit for our robustness test is that if the models’ correct judgment relies on exploiting these spurious correlations, then such reliance will be broken in our perturbations.
311
+
312
+ <table><tr><td>N-Gram</td><td>PMI w/Non-Ent.Label</td><td>PMI w/Ent. Label</td><td>[Diff]</td></tr><tr><td>a cause</td><td>1.692209</td><td>-1.025611</td><td>2.717820</td></tr><tr><td>a cause for</td><td>1.663640</td><td>-0.983790</td><td>2.647430</td></tr><tr><td>A causes</td><td>1.640679</td><td>-0.951610</td><td>2.592289</td></tr><tr><td>A causes something</td><td>1.621820</td><td>-0.926075</td><td>2.547895</td></tr><tr><td>a direct</td><td>1.606052</td><td>-0.905316</td><td>2.511369</td></tr><tr><td>a direct one</td><td>1.592673</td><td>-0.888107</td><td>2.480781</td></tr><tr><td>forD</td><td>1.584826</td><td>-0.878180</td><td>2.463006</td></tr><tr><td>for D but</td><td>1.583897</td><td>-0.877014</td><td>2.460911</td></tr><tr><td>forE</td><td>1.582980</td><td>-0.875864</td><td>2.458844</td></tr><tr><td>for E but</td><td>1.582074</td><td>-0.874728</td><td>2.456802</td></tr></table>
313
+
314
+ Table 11: PMI between the labels and n-grams. The labels include non-entailment (Non-Ent.) and entailment (Ent.). And the n-grams include all with no more than four words. The |Diff| column shows the absolute value of the difference between the PMIs with two labels. We show the top 10 n-grams with the largest differences of their PMIs with the two classes in the |Diff| column.
315
+
316
+ We can see that some spurious correlations are rooted in the framing of the hypothesis, such as “a cause (for)”, and “a direct (one)” (which we use the paraphrasing task to break), and others are connected to the variable names, such as “for D (but)” and “for E (but)” (which we use the variable refactorization to break).
317
+
318
+ # F FINE-GRAINED ERROR ANALYSIS
319
+
320
+ In addition to the fine-grained analysis by causal relation type in Table 6a for fine-tuned models, we also report such error analysis for non-finetuned models in Table 12.
321
+
322
+ Table 12: Fine-grained evaluation results for some selected non-fine-tuned models.
323
+
324
+ <table><tr><td>Selected Models</td><td>Relation Type</td><td>F1</td><td>Precision</td><td>Recall</td><td>Accuracy</td></tr><tr><td>GPT-3.5</td><td>All</td><td>21.69</td><td>17.79</td><td>27.78</td><td>69.46</td></tr><tr><td>GPT-3.5</td><td>Is-Parent</td><td>8.82</td><td>100</td><td>4.62</td><td>83.47</td></tr><tr><td>GPT-3.5</td><td>Is-Ancestor</td><td>0</td><td>0</td><td>0</td><td>90.67</td></tr><tr><td>GPT-3.5</td><td>Is-Child</td><td>9.84</td><td>100</td><td>5.17</td><td>85.33</td></tr><tr><td>GPT-3.5</td><td>Is-Descendant</td><td>14.29</td><td>11.9</td><td>17.86</td><td>84</td></tr><tr><td>GPT-3.5</td><td>Has-Collider</td><td>34.24</td><td>25.51</td><td>52.07</td><td>35.12</td></tr><tr><td>GPT-3.5</td><td>Has-Confounder</td><td>15.33</td><td>8.86</td><td>56.76</td><td>37.8</td></tr><tr><td>GPT-4</td><td>All</td><td>29.08</td><td>20.92</td><td>47.66</td><td>64.6</td></tr><tr><td>GPT-4</td><td>Is-Parent</td><td>0</td><td>0</td><td>0</td><td>82.67</td></tr><tr><td>GPT-4</td><td>Is-Ancestor</td><td>30.77</td><td>31.25</td><td>30.3</td><td>88</td></tr><tr><td>GPT-4</td><td>Is-Child</td><td>0</td><td>0</td><td>0</td><td>84.53</td></tr><tr><td>GPT-4</td><td>Is-Descendant</td><td>26.98</td><td>17.35</td><td>60.71</td><td>75.47</td></tr><tr><td>GPT-4</td><td>Has-Collider</td><td>44.1</td><td>30.18</td><td>81.82</td><td>32.71</td></tr><tr><td>GPT-4</td><td>Has-Confounder</td><td>20.67</td><td>11.53</td><td>100</td><td>23.86</td></tr><tr><td>RoBERTaMNLI</td><td>All</td><td>22.79</td><td>34.73</td><td>16.96</td><td>82.5</td></tr><tr><td>RoBERTaMNLI</td><td>Is-Parent</td><td>0</td><td>0</td><td>0</td><td>82.67</td></tr><tr><td>RoBERTaMNLI</td><td>Is-Ancestor</td><td>0</td><td>0</td><td>0</td><td>91.2</td></tr><tr><td>RoBERTaMNLI</td><td>Is-Child</td><td>0</td><td>0</td><td>0</td><td>84.53</td></tr><tr><td>RoBERTaMNLI</td><td>Is-Descendant</td><td>0</td><td>0</td><td>0</td><td>92.53</td></tr><tr><td>RoBERTaMNLI</td><td>Has-Collider</td><td>43.45</td><td>39.73</td><td>47.93</td><td>59.52</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RoBERTaMNLI</td><td>Has-Confounder</td><td>0</td><td>0</td><td>0</td><td>84.45</td></tr></table>
325
+
326
+ These results are particularly revealing, showing how off-the-shelf models perform in recognizing specific relations. Specifically, GPT-3.5 cannot recognize ancestor relations, whereas GPT-4 fails at all direct causation recognition with parents and children. And RoBERTa MNLI only did collider relation relatively correctly. Note that, when the F1 score is zero, the accuracy number is a result of always predicting the negative class of that relation.
327
+
328
+ # G LLM PERFORMANCE OPTIMIZATION
329
+
330
+ Since our experiments in Section 4.2 are based on plain, zero-shot prompts, we explore whether better prompting strategies could improve the performance. We enhance the query prompt by incorporating several strategies: (1) Utilizing a system prompt that specifies the model’s expertise (“You are a highly intelligent question-answering bot with profound knowledge of causal inference.”); (2) Including a pair of few-shot examples, one positive and one negative; (3) Implementing chain-of-thought prompting with “Let’s think step by step.” to encourage the language model to generate step-by-step reasoning. In Table 13, we present the evaluation results on the relatively affordable model, GPT-3.5, where the optimized prompt leads to a 4-point improvement in F1 over the original performance. However, we can see that despite the deployment of all three strategies, the model continues to struggle with this challenging task.
331
+
332
+ Table 13: Performance of GPT-3.5 with different queries. We quote the original performance from Table 4.
333
+
334
+ <table><tr><td></td><td>F1</td><td>Precision</td><td>Recall</td><td>Accuracy</td></tr><tr><td>GPT-3.5 (plain query; original)</td><td>21.69</td><td>17.79</td><td>27.78</td><td>69.46</td></tr><tr><td>GPT-3.5 (enhanced query)</td><td>25.44</td><td>17.29</td><td>48.11</td><td>52.01</td></tr></table>
parse/test/vqIH0ObdqL/vqIH0ObdqL_content_list.json ADDED
@@ -0,0 +1,803 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "CAN LARGE LANGUAGE MODELS INFER CAUSATION FROM CORRELATION? ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Zhijing $\\mathbf { J i n } ^ { 1 , 2 , \\ast , \\ddagger }$ Jiarui $\\mathbf { L i u } ^ { 3 , * }$ Zhiheng Lyu4 Spencer Poff5 Mrinmaya Sachan2 Rada Mihalcea6 Mona Diab3,‡,† Bernhard Schölkopf1,† 1Max Planck Institute for Intelligent Systems, Tübingen, Germany 2ETH Zürich 3LTI, CMU 4University of Hong Kong 5Meta AI 6University of Michigan jinzhi@ethz.ch jiarui@cmu.edu zhihenglyu.cs@gmail.com ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "ABSTRACT ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "Causal inference is one of the hallmarks of human intelligence. While the field of Causal NLP has attracted much interest in the recent years, existing causal inference datasets in NLP primarily rely on discovering causality from empirical knowledge (e.g., commonsense knowledge). In this work, we propose the first benchmark dataset to test the pure causal inference skills of large language models (LLMs). Specifically, we formulate a novel task CORR2CAUSE, which takes a set of correlational statements and determines the causal relationship between the variables. We curate a large-scale dataset of more than 200K samples, on which we evaluate seventeen existing LLMs. Through our experiments, we identify a key shortcoming of LLMs in terms of their causal inference skills, and show that these models achieve almost close to random performance on the task. This shortcoming is somewhat mitigated when we try to re-purpose LLMs for this skill via finetuning, but we find that these models still fail to generalize – they can only perform causal inference in in-distribution settings when variable names and textual expressions used in the queries are similar to those in the training set, but fail in out-of-distribution settings generated by perturbing these queries. CORR2CAUSE is a challenging task for LLMs, and can be helpful in guiding future research on improving LLMs’ pure reasoning skills and generalizability.1 ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "1 INTRODUCTION ",
27
+ "text_level": 1,
28
+ "page_idx": 0
29
+ },
30
+ {
31
+ "type": "text",
32
+ "text": "Causal inference, i.e., the ability to establish the correct causal relationships between variables or events, is fundamental to human intelligence. There are two distinct ways this causal inference capability can be acquired: one through empirical knowledge, e.g., we know from common sense that touching a hot stove will get us burned; the other through pure causal reasoning, as causality can be formally argued and reasoned about using known procedures and rules from causal inference (Spirtes et al., 2000; Pearl, 2009; Peters et al., 2017). One example is that we have the a priori knowledge that the correlation between A and B does not necessarily imply causality. This is a formal rule that holds true regardless of the realizations of the variables A and B. ",
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "With the rise of large language models (LLMs) (Radford et al., 2019; Devlin et al., 2019; Ouyang et al., 2022; Zhang et al., 2022; OpenAI, 2023, inter alia), a crucial research question is whether they can do causal reasoning well. Recent studies have pointed out that LLMs are “causal parrots,” which recite the causal knowledge in the training data (Zecevi ˇ c et al., 2023). Moreover, the vast ´ majority of studies frame causal reasoning as a skill to navigate around empirical knowledge (Gordon et al., 2012; Sap et al., 2019a;b; Qin et al., 2019; Bhagavatula et al., 2020), and also treat LLMs as a knowledge base when evaluating its causal skills (Kıcıman et al., 2023; Tu et al., 2023; Xie et al., 2023). However, all the above lines of research frame causality as empirical knowledge, thus relying heavily on the quality and the coverage of the training data, overlooking the great potential of the formal causal reasoning skills to process correlational information to causal conclusions. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "image",
42
+ "img_path": "images/602be0566ff5dbb1cae063115540306a3770631954a7d6a6dd0bc90de6f0ec56.jpg",
43
+ "image_caption": [
44
+ "Figure 1: Illustration of the motivation behind our task and dataset. "
45
+ ],
46
+ "image_footnote": [],
47
+ "page_idx": 1
48
+ },
49
+ {
50
+ "type": "text",
51
+ "text": "Drawing inspirations from technical studies on causal discovery (Spirtes et al., 2000; Spirtes & Zhang, 2016; Glymour et al., 2019), we formulate a novel task for NLP, correlation-to-causation inference (CORR2CAUSE), which is an important skill for LLMs. Imagine the scenario in Figure 1, where the training corpus does not tediously cover every causal relation, but more pervasively talk about correlations, such as which events tend to co-occur. Learning a good CORR2CAUSE skill can enable LLMs to draw causal relations behind the mere correlational information on the surface. For example, several decades ago, there might be an observation that female university students tend to perform better, but behind the correlational statistics is the causal graph that female students have to achieve extra good performance to get into universities as the first place. ",
52
+ "page_idx": 1
53
+ },
54
+ {
55
+ "type": "text",
56
+ "text": "To this end, we collect the CORR2CAUSE dataset, the first dataset to test the pure causal reasoning abilities of LLMs. All the questions in this dataset are centered around testing when it is valid or invalid to infer causation from correlation. To systematically compose this dataset, we ground our generalization process in the formal framework of causal discovery (Spirtes et al., 1993; 2000; Glymour et al., 2016; Spirtes & Zhang, 2016), which provides rules about how to deduce causal relations among variables given their statistical correlation in the observational data. We generate more than 200K data points, and label a correlation-causation statement pair as valid if and only if there is a bijective mapping between the statistical correlation and the underlying causality. ",
57
+ "page_idx": 1
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "Based on our CORR2CAUSE dataset with 200K samples, we investigate two main research questions: (1) How well do existing LLMs perform on this task? (2) Can existing LLMs be re-trained or re-purposed on this task and obtain robust causal inference skills? Through extensive experiments, we show empirically that none of the 17 existing LLMs we investigate perform well on this pure causal inference task. We also show that although LLMs can demonstrate better performance after being finetuned on the data, the causal inference skills attained by them are not robust. In summary, our contributions are as follows: ",
62
+ "page_idx": 1
63
+ },
64
+ {
65
+ "type": "text",
66
+ "text": "1. We propose the novel task of CORR2CAUSE, to probe an aspect of LLM’s reasoning ability, pure causal inference; \n2. We compose a dataset of over 200K samples, using insights from causal discovery; \n3. We evaluate the performance of 17 LLMs on our dataset, finding that all of them perform poorly, close to the random baseline; \n4. We further explored whether LLMs can learn the skill through finetuning, and find that LLMs fail to robustly acquire this skill in out-of-distribution settings. Finally, we suggest future work to explore more ways to enhance the pure causal inference skill in LLMs. ",
67
+ "page_idx": 1
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "2 PRELIMINARIES: CAUSAL INFERENCE ",
72
+ "text_level": 1,
73
+ "page_idx": 1
74
+ },
75
+ {
76
+ "type": "text",
77
+ "text": "2.1 DIRECTED GRAPHICAL CAUSAL MODELS (DGCMS) ",
78
+ "text_level": 1,
79
+ "page_idx": 1
80
+ },
81
+ {
82
+ "type": "text",
83
+ "text": "A directed graphical causal model (DGCM) is a commonly used representation to express the causal relations among a set of variables. Given a set of $N$ variables $\\pmb { X } \\doteq \\{ X _ { 1 } , \\ldots , X _ { N } \\}$ , we can encode the causal relations among them using a directed graph $\\mathcal { G } : = ( \\boldsymbol { X } , \\boldsymbol { E } )$ , where $\\pmb { { \\cal E } }$ is the set of directed edges. Each edge $e _ { i , j } \\in E$ represents a causal link $X _ { i } \\to X _ { j }$ , meaning that $X _ { i }$ is a direct cause of $X _ { j }$ . In the context of this work, we take the common assumption of directed acyclic graphs (DAGs), which most causal discovery methods use (Glymour et al., 2019), as graphs with cycles can make the causal discovery process arbitrarily hard. ",
84
+ "page_idx": 1
85
+ },
86
+ {
87
+ "type": "text",
88
+ "text": "Following the graph-theoretic terminology, we use an analogy of the ancestry tree to denote the relations between two variables. For example, we call $X _ { i }$ as a parent of $X _ { j }$ if there is a directed edge $X _ { i } \\to X _ { j }$ in the graph, and, thus, $X _ { j }$ is a child of $X _ { i }$ . Similarly, we denote $X _ { i }$ as an ancestor of $X _ { j }$ if there exists a directed path from $X _ { i }$ to $X _ { j }$ , and, thus, $X _ { j }$ is a descendent of $X _ { i }$ . Note that a parent is a special case of an ancestor where the directed path has a length of 1. ",
89
+ "page_idx": 2
90
+ },
91
+ {
92
+ "type": "text",
93
+ "text": "For convenience, we also introduce the notions for some special three-variable relations. Given two variables $X _ { i }$ and $X _ { j }$ , we call a third variable $X _ { k }$ a confounder (i.e., common cause) if $X _ { k }$ is a parent of both $X _ { i }$ and $X _ { j }$ ; a collider (i.e., common effect) if $X _ { k }$ is a child of both $X _ { i }$ and $X _ { j }$ ; and a mediator if $X _ { k }$ is both a child of $X _ { i }$ , and a parent of $X _ { j }$ . ",
94
+ "page_idx": 2
95
+ },
96
+ {
97
+ "type": "text",
98
+ "text": "2.2 D-SEPARATION AND MARKOV PROPERTY",
99
+ "text_level": 1,
100
+ "page_idx": 2
101
+ },
102
+ {
103
+ "type": "text",
104
+ "text": "D-Separation D-separation (Pearl, 1988) is a fundamental concept in graphical models used to determine whether two sets of nodes $\\boldsymbol { X }$ and $\\mathbf { Y }$ in a DAG $\\mathcal { G }$ are conditionally independent given a third set of nodes $z$ , where the three sets are disjoint. We say that $\\boldsymbol { X }$ and $\\mathbf { Y }$ are d-separated by $z$ if all paths between any node in $\\boldsymbol { X }$ and any node in $\\mathbf { Y }$ are blocked by the conditioning set $z$ . A path between $\\boldsymbol { X }$ and $\\mathbf { Y }$ is blocked by $z$ if there exists a node $A \\in { \\mathbf { Z } }$ which satisfies one of the following conditions: $A$ is the parent node in a fork structure on the path (i.e., $\\cdot \\left. A \\right. \\cdot )$ ; $A$ is the mediator node in a chain structure on the path (i.e., $\\cdot A \\cdot )$ ; or in any collider structure on the path (i.e., $\\cdot \\right. A \\left. \\cdot$ ), $z$ does not contain $A$ or its descendants. ",
105
+ "page_idx": 2
106
+ },
107
+ {
108
+ "type": "text",
109
+ "text": "Markov Property The Markov property in a DAG $\\mathcal { G }$ states that each node $X _ { i }$ is conditionally independent of its non-descendants given its parents, namely $X _ { i }$ ⊥⊥ $\\mathbf { N o n D e } ( X _ { i } ) | \\mathbf { P a } ( X _ { i } )$ , where $\\mathbf { N o } \\bar { \\mathbf { n } } \\mathbf { D } \\mathbf { e } ( X _ { i } )$ denotes the non-descendants of $X _ { i }$ excluding itself, and $\\mathbf { P a } ( X _ { i } )$ denotes the parents of $X _ { i }$ . Using the Markov property, we can factorize the joint distribution of all the nodes in the graph into $\\begin{array} { r } { P ( X _ { 1 } , \\ldots , X _ { N } ) = \\prod _ { i = 1 } ^ { N } P ( X _ { i } | \\mathbf { P A } ( X _ { i } ) ) } \\end{array}$ . To infer the causal graph from probability distributions, a common assumption is faithfulness, namely the validity to infer all the d-separation sets in the graph from the independence relations in the probability distribution. In our work, we also take this broadly taken assumption which holds for most real-world scenarios. ",
110
+ "page_idx": 2
111
+ },
112
+ {
113
+ "type": "text",
114
+ "text": "Markov Equivalence of Graphs We denote two DAGs as Markov equivalent if they induce the same joint distribution $P ( X )$ . The set of DAGs that are Markov equivalent to each other is called a Markov equivalence class (MEC). Causal graphs in the same MEC can be easily identified since they have the same skeleton (i.e., undirected edges) and V-structures (i.e., structures in the form of $A \\right. B \\left. C$ where $A$ and $C$ are not connected). ",
115
+ "page_idx": 2
116
+ },
117
+ {
118
+ "type": "text",
119
+ "text": "Obviously, there is a one-to-many mapping (i.e., surjection) between the causal graph and statistical distribution. Namely, each causal graph sufficiently determines a statistical distribution, but from a statistical distribution, we cannot necessarily induce a unique causal graph. This is why we say “correlation does not necessarily mean causation”. ",
120
+ "page_idx": 2
121
+ },
122
+ {
123
+ "type": "text",
124
+ "text": "2.3 CAUSAL DISCOVERY ",
125
+ "text_level": 1,
126
+ "page_idx": 2
127
+ },
128
+ {
129
+ "type": "text",
130
+ "text": "Causal discovery aims to learn the causal relations by analyzing statistical properties in the observational data (Spirtes et al., 1993; 2000; Glymour et al., 2016; Spirtes & Zhang, 2016; Glymour et al., 2019). It can be achieved through constraint-based methods (Spirtes et al., 2000), score-based methods (Chickering, 2002), or other methods taking advantage of the functional causal models (Shimizu et al., 2006; Hoyer et al., 2008; Zhang & Hyvärinen, 2009). ",
131
+ "page_idx": 2
132
+ },
133
+ {
134
+ "type": "text",
135
+ "text": "To fit for the spirit of this paper to infer from correlation (expressed in natural language) to causation, we base our dataset design on the widely-used Peter-Clark (PC) algorithm (Spirtes et al., 2000). The PC algorithm is based on the principles of conditional independence and the causal Markov assumption, which allows it to efficiently identify causal relationships among variables in a given dataset. The algorithm first starts with a fully connected undirected graph among all the variables. Then it removes the edge between two variables if there is an unconditional or conditional independence relationship between them. Afterwards, it orients the directed edges whenever there is a V-structure. And finally, it iteratively checks the direction of the other edges until the entire causal graph is consistent with all the statistical correlations. ",
136
+ "page_idx": 2
137
+ },
138
+ {
139
+ "type": "image",
140
+ "img_path": "images/871ce0b450763997ae8c810069b44df1184fdc24ab615aaabfef28092d26c534.jpg",
141
+ "image_caption": [
142
+ "Figure 2: Pipeline of the data construction process. "
143
+ ],
144
+ "image_footnote": [],
145
+ "page_idx": 3
146
+ },
147
+ {
148
+ "type": "text",
149
+ "text": "3 DATASET CONSTRUCTION ",
150
+ "text_level": 1,
151
+ "page_idx": 3
152
+ },
153
+ {
154
+ "type": "text",
155
+ "text": "We introduce the construction of our dataset in this section. We start with our task formulation for CORR2CAUSE, and then briefly give an overview of the data generation process, followed by detailed descriptions of each step. We conclude the section with the overall statistics of the dataset. ",
156
+ "page_idx": 3
157
+ },
158
+ {
159
+ "type": "text",
160
+ "text": "3.1 TASK FORMULATION ",
161
+ "text_level": 1,
162
+ "page_idx": 3
163
+ },
164
+ {
165
+ "type": "text",
166
+ "text": "Given a set of $N$ variables $\\pmb { X } = \\{ X _ { 1 } , \\ldots , X _ { N } \\}$ , we have a statement $\\pmb { s }$ about all the correlations among the variables, and a hypothesis $^ { h }$ describing the causal relation $r$ between the pair of variables $X _ { i }$ and $X _ { j }$ . The task is to learn a function $f : ( s , h ) \\mapsto v$ which maps the correlation statement $\\pmb { s }$ and the causal relation hypothesis $^ { h }$ to their validity $v \\in \\{ 0 , 1 \\}$ , which takes the value 0 if this inference is invalid, and the value 1 if this inference is valid. ",
167
+ "page_idx": 3
168
+ },
169
+ {
170
+ "type": "text",
171
+ "text": "3.2 OVERVIEW OF THE DATA GENERATION PROCESS ",
172
+ "text_level": 1,
173
+ "page_idx": 3
174
+ },
175
+ {
176
+ "type": "text",
177
+ "text": "We base the construction our dataset on several concepts of causal inference, including the DGCM, d-separation, and MECs, as introduced in Section 2. ",
178
+ "page_idx": 3
179
+ },
180
+ {
181
+ "type": "text",
182
+ "text": "As in the overview of our data generation process in Figure 2, we first choose the number $N$ of variables (Step 1) and generate all the unique DGCMs with $N$ nodes (Step 2), which we will introduce in the Section 3.3. Then we collect all the d-separation sets from these graphs to identify MECs (Step 3) in Section 3.4. Then, in Step 4, we create the formal form of data in Section 3.5. For each correspondence of the MEC to causal graphs, we compose the correlation statement based on the statistical relations in the MEC, and hypothesize a causal relation between two variables, and produce the validity $v = 1$ if the hypothesis is a shared property of all causal graphs in the MEC, and $v = 0$ if the hypothesis is not necessarily true for all the MEC graphs. Finally, we introduce the verbalization process in Section 3.6. ",
183
+ "page_idx": 3
184
+ },
185
+ {
186
+ "type": "text",
187
+ "text": "3.3 CONSTRUCTING THE GRAPHS WITH ISOMORPHISM CHECKS",
188
+ "text_level": 1,
189
+ "page_idx": 3
190
+ },
191
+ {
192
+ "type": "text",
193
+ "text": "The first step of the data generation is to compose the causal graphs, as in Step 1 and 2 of Figure 2. For a set of $N$ variables $\\mathbf { \\bar { X } } = \\{ X _ { 1 } , \\ldots , X _ { N } \\}$ , there are $N ( N - 1 )$ possible directed edges, since each node can link to any node other than itself. To remove cycles in the graph, we make the nodes in topological order, which only allows edges $X _ { i } \\to X _ { j }$ , where $i < j$ . We achieve this by limiting the adjacency matrix of the graph to only having non-zero values above the diagonal, resulting in $N ( N - 1 ) / 2$ possible directed edges for the DAGs. ",
194
+ "page_idx": 3
195
+ },
196
+ {
197
+ "type": "text",
198
+ "text": "At the first glance, for $N$ nodes, there should be $2 ^ { N ( N - 1 ) / 2 }$ possible DAGs (i.e., the power set of all edges). However, there could be isomorphic graphs in this set. To avoid this, we perform a graph ",
199
+ "page_idx": 3
200
+ },
201
+ {
202
+ "type": "table",
203
+ "img_path": "images/7e92e35c8dca31cae92c2c78846bf83f29e30240033becd01e2c5c34e0113f1a.jpg",
204
+ "table_caption": [],
205
+ "table_footnote": [],
206
+ "table_body": "<table><tr><td># Nodes</td><td># Unique DAGs</td><td>#Edges/DAG</td><td>#MECs</td><td>#DAGs/MEC</td></tr><tr><td>2</td><td>2 out of 2</td><td>0.50</td><td>2</td><td>1.0</td></tr><tr><td>3</td><td>6 out of 23</td><td>1.67</td><td>5</td><td>1.2</td></tr><tr><td>4</td><td>31 out of 26</td><td>3.48</td><td>20</td><td>1.55</td></tr><tr><td>5</td><td>302 out of 210</td><td>5.89</td><td>142</td><td>2.13</td></tr><tr><td>6</td><td>5,984 out of 215</td><td>8.77</td><td>2,207</td><td>2.71</td></tr><tr><td>Total</td><td>6,325</td><td>8.60</td><td>2,376</td><td>2.66</td></tr></table>",
207
+ "page_idx": 4
208
+ },
209
+ {
210
+ "type": "text",
211
+ "text": "Table 1: Statistics about the source causal graphs in our dataset. Given the number of nodes, we report the number of unique DAGs, average number of edges per DAG, number of MECs, and average number of DAGs per MEC. ",
212
+ "page_idx": 4
213
+ },
214
+ {
215
+ "type": "text",
216
+ "text": "isomorphism check (McKay & Piperno, 2014), and reduce the set so that only unique DAGs are retained, and we show their statistics in Table 1. Although we can handle large graphs, we mostly focus on smaller graphs that can still lead to a reasonably sized dataset, so we empirically set $N = 6$ but future work can use our open-sourced codes to extend to more nodes. ",
217
+ "page_idx": 4
218
+ },
219
+ {
220
+ "type": "text",
221
+ "text": "3.4 PROGRAMMATICALLY GENERATING THE D-SEPARATION SETS ",
222
+ "text_level": 1,
223
+ "page_idx": 4
224
+ },
225
+ {
226
+ "type": "text",
227
+ "text": "Based on the set of unique DAGs, we then programmatically generate the d-separation sets by graph theoretical conditions, as in Step 3 of Figure 2. To realize this step, we code an efficient graph-theoretic algorithm to check for all the chain, fork, and collider structures to automatically identify the set of nodes that d-separate each pair of nodes. Using the d-separation sets and the faithfulness assumption, we form the statistical correlations as follows. For each pair of nodes, they are conditionally independent given the variables in the d-separation set. If the d-separation set is empty, then the two nodes are unconditionally independent. If no d-separation set can be found for the two nodes, then they are directly correlated. ",
228
+ "page_idx": 4
229
+ },
230
+ {
231
+ "type": "text",
232
+ "text": "Moreover, using the d-separation sets, we are able to cluster causal graphs to MECs. We achieve it by tracing the mapping between the causal graphs and the set of statistical correlations, and backtracking the graphs with the same d-separation sets to group them in the same MEC. We show in Table 1 that each MEC contains on average 2.66 DAGs. ",
233
+ "page_idx": 4
234
+ },
235
+ {
236
+ "type": "text",
237
+ "text": "3.5 COMPOSING THE HYPOTHESES AND LABEL ",
238
+ "text_level": 1,
239
+ "page_idx": 4
240
+ },
241
+ {
242
+ "type": "text",
243
+ "text": "After generating the set of correlations based on the d-separation sets, we now generate the causal hypotheses. For the causal relation $r$ , we focus on six common causal relations between two nodes introduced in Section 2.1: Is-Parent, Is-Child, Is-Ancestor (excluding the parents), Is-Descendant (excluding the children), Has-Confounder (i.e., there exists a confounder, or common cause, of the two nodes), and Has-Collider (i.e., there exists a collider, or common effect, of the two nodes). In this way, the set of hypotheses contains all six meaningful causal relations between every pair of variables, resulting in a total size of $6 \\cdot N ( N - 1 ) / 2 = 3 \\bar { N } ( N - 1 )$ hypotheses for a graph with $N$ variables. ",
244
+ "page_idx": 4
245
+ },
246
+ {
247
+ "type": "text",
248
+ "text": "To generate the ground-truth validity label, we start from the correlation sets in Step 3, then look up all the causal graphs in the same MEC corresponding to the given set of correlations, and check the necessity of the hypothesized causal relation. If the causal relationship proposed in the hypothesis is valid for all causal graphs within the MEC, then we generate the validity $v = 1$ ; otherwise, we generate $v = 0$ . A special case of valid samples is that when the size of the MEC is 1, then there is a bijective mapping between the causal graph and the $\\mathrm { d }$ -separation sets, so any hypothesis stating the causal properties of that unique causal graph is valid. ",
249
+ "page_idx": 4
250
+ },
251
+ {
252
+ "type": "text",
253
+ "text": "3.6 VERBALIZING INTO LANGUAGE ",
254
+ "text_level": 1,
255
+ "page_idx": 4
256
+ },
257
+ {
258
+ "type": "text",
259
+ "text": "Finally, as in the last step of Figure 2, we convert all the information above to text data for our CORR2CAUSE task. For the correlation statement, we verbalize the set of correlations in Step 3 into a natural language statement $\\pmb { s }$ . When two variables cannot be d-separated, i.e., $A \\not \\perp B$ , then we describe them as $^ { 6 6 } A$ correlates with $B ^ { \\prime \\prime }$ since they are directly correlated and cannot be independent by any condition. And if two variables have a valid d-separation set $C$ , then we describe them as $^ { 6 6 } A$ is independent of $B$ given $C$ .” In the special case when the d-separation set is empty, we directly say “ $A$ is independent of $B$ .” In addition, we disambiguate the setting by starting the correlation statement with the setup of a closed system of the given variables, and no hidden variables: “Suppose there is a closed system of $N$ variables, A, B, . . . All the statistical relations among these $N$ variables are as follows:”. Finally, to verbalize the hypothesis, we feed the causal relation triplet $( X _ { i } , r , X _ { j } )$ ",
260
+ "page_idx": 4
261
+ },
262
+ {
263
+ "type": "table",
264
+ "img_path": "images/e8a03364822dfbcca33967f89e55a05b4e0515e41d6af2fbc6c46d82e4631d9b.jpg",
265
+ "table_caption": [],
266
+ "table_footnote": [],
267
+ "table_body": "<table><tr><td>Causal Relation</td><td>Hypothesis Template</td></tr><tr><td>Is-Parent</td><td>{Vari} directly causes {Var j}.</td></tr><tr><td>Is-Ancestor</td><td>{Var i} causes something else which causes {Var j}.</td></tr><tr><td>Is-Child</td><td>{Var j} directlycauses {Var i}.</td></tr><tr><td>Is-Descendant</td><td>{Varj} isacause for {Vari},but not a direct one.</td></tr><tr><td>Has-Collider</td><td>There exists at least one collider (i.e.,common effect) of {Var i} and {Varj}.</td></tr><tr><td>Has-Confounder</td><td>There exists at least one confounder (i.e., common cause) of {Var i} and {Varj}.</td></tr></table>",
268
+ "page_idx": 5
269
+ },
270
+ {
271
+ "type": "text",
272
+ "text": "Table 2: Templates for each causal relation in the hypothesis. We use {Var i} and $\\{ \\mathrm { V a r ~ \\normalfont ~ \\div ~ } \\}$ as placeholders for the two variables. ",
273
+ "page_idx": 5
274
+ },
275
+ {
276
+ "type": "text",
277
+ "text": "into their hypothesis templates in Table 2. For example, we turn the triplet (A, Is-Parent, $B$ ) into “A directly causes $B ^ { \\ast }$ , as in the example of Figure 2. ",
278
+ "page_idx": 5
279
+ },
280
+ {
281
+ "type": "text",
282
+ "text": "3.7 STATISTICS OF THE RESULTING DATA ",
283
+ "text_level": 1,
284
+ "page_idx": 5
285
+ },
286
+ {
287
+ "type": "text",
288
+ "text": "We show the statistics of our CORR2CAUSE dataset in Table 3. Overall, our dataset contains 207,972 samples, where $1 8 . 5 7 \\%$ of the samples have the positive label (i.e., with validity $= 1$ ). The average length of the premise is 424.11 tokens, and hypothesis 10.83 tokens. We split the data into 205,734 training samples, 1,076 development and 1,162 test samples.2 Since the main purpose of the dataset is to benchmark the performance of LLMs, we prioritize the test and development sets to have a comprehensive coverage over all sizes of graphs. Specifically, we iterate through the subset of our data for each $N$ , and split it entirely for only the test and development sets if the data is less than 1K, which is the case for $N = 2$ and 3. For the other subsets that are larger, we randomly sample up to 1K or $10 \\%$ of the data, whichever is smaller, to the test and development sets. We set the cap to be 1K in order to form a reasonable computation budget, since many LLMs are expensive to query in the inference mode. Aside from the test and valid sets, all the rest of the data goes into the training set. ",
289
+ "page_idx": 5
290
+ },
291
+ {
292
+ "type": "table",
293
+ "img_path": "images/80d8dfa5768f1322113077e85467e19b2b04c6fa4350255252bc10c02db3206c.jpg",
294
+ "table_caption": [],
295
+ "table_footnote": [],
296
+ "table_body": "<table><tr><td rowspan=\"2\"></td><td rowspan=\"2\">Overall</td><td colspan=\"5\">Statistics by the Number of Nodes N</td></tr><tr><td>N=2</td><td>N=3</td><td>N=4</td><td>N=5</td><td>N=6</td></tr><tr><td>#Samples</td><td>207,972</td><td>12</td><td>90</td><td>720</td><td>8,520</td><td>198,630</td></tr><tr><td>#Test</td><td>1,162</td><td>6</td><td>48</td><td>72</td><td>514</td><td>522</td></tr><tr><td># Dev</td><td>1,076</td><td>6</td><td>42</td><td>72</td><td>482</td><td>474</td></tr><tr><td>#Train</td><td>205,734</td><td>0</td><td>0</td><td>576</td><td>7,524</td><td>197,634</td></tr><tr><td># Tokens/Premise</td><td>424.11</td><td>31.5</td><td>52.0</td><td>104.0</td><td>212.61</td><td>434.54</td></tr><tr><td># Tokens/Hypothesis</td><td>10.83</td><td>10.83</td><td>10.83</td><td>10.83</td><td>10.83</td><td>10.83</td></tr><tr><td>% Positive Labels</td><td>18.57</td><td>0.00</td><td>3.33</td><td>7.50</td><td>13.01</td><td>18.85</td></tr><tr><td>Vocab Size</td><td>65</td><td>49</td><td>53</td><td>55</td><td>57</td><td>61</td></tr></table>",
297
+ "page_idx": 5
298
+ },
299
+ {
300
+ "type": "text",
301
+ "text": "Table 3: Statistics of our CORR2CAUSE dataset, and by subsets. We report the total number of samples (# Samples); splits of the test (# Test), developement (# Dev) and training sets (# Train); number of tokens per premise (# Tokens/Premise) and hypothesis (# Tokens/Hypothesis); percentage of the positive labels $\\%$ Positive Labels), and vocabulary size by the number of unique tokens (Vocab Size). Note that the number of unique graphs and MECs are in Table 1. ",
302
+ "page_idx": 5
303
+ },
304
+ {
305
+ "type": "text",
306
+ "text": "4 EXPERIMENTS ",
307
+ "text_level": 1,
308
+ "page_idx": 5
309
+ },
310
+ {
311
+ "type": "text",
312
+ "text": "4.1 EXPERIMENTAL SETUP ",
313
+ "text_level": 1,
314
+ "page_idx": 5
315
+ },
316
+ {
317
+ "type": "text",
318
+ "text": "We set up a diverse list of LLMs for the experiments on our CORR2CAUSE dataset. To test existing LLMs, we first include six commonly used BERT-based NLI models in the transformers library (Wolf et al., 2020): BERT (Devlin et al., 2019), RoBERTa (Liu et al., 2019), BART (Lewis et al., 2020), DeBERTa (He et al., 2021), DistilBERT (Sanh et al., 2019), and DistilBART (Shleifer & Rush, 2020). Apart from these BERT-based NLI models, we also evaluate the general-purpose autoregressive LLMs based on GPT (Radford et al., 2019): GPT-3 Ada, Babbage, Curie, Davinci (Brown et al., 2020); its instruction-tuned versions (Ouyang et al., 2022), text-davinci-001, text-davinci-002, and text-davinci-003; and GPT-3.5 (i.e., ChatGPT), and the latest GPT-4 (OpenAI, 2023) by April 2023, ",
319
+ "page_idx": 5
320
+ },
321
+ {
322
+ "type": "table",
323
+ "img_path": "images/abcfed6b97fd88e0d1b46d2734b60b63afb40301ff4a8053c34d5c20e87fb0f7.jpg",
324
+ "table_caption": [],
325
+ "table_footnote": [],
326
+ "table_body": "<table><tr><td></td><td>F1</td><td>Precision</td><td>Recall</td><td>Accuracy</td></tr><tr><td>Random Baselines</td><td></td><td></td><td></td><td></td></tr><tr><td>Always Majority</td><td>0.0</td><td>0.0</td><td>0.0</td><td>84.77</td></tr><tr><td>Random (Proportional)</td><td>13.5</td><td>12.53</td><td>14.62</td><td>71.46</td></tr><tr><td>Random (Uniform)</td><td>20.38</td><td>15.11</td><td>31.29</td><td>62.78</td></tr><tr><td>BERT-Based Models</td><td></td><td></td><td></td><td></td></tr><tr><td>BERTMNLI</td><td>2.82</td><td>7.23</td><td>1.75</td><td>81.61</td></tr><tr><td>RoBERTaMNLI</td><td>22.79</td><td>34.73</td><td>16.96</td><td>82.50</td></tr><tr><td>DeBERTaMNLI</td><td>14.52</td><td>14.71</td><td>14.33</td><td>74.31</td></tr><tr><td>DistilBERTMNLI</td><td>20.70</td><td>24.12</td><td>18.13</td><td>78.85</td></tr><tr><td>DistilBARTMNLI</td><td>26.74</td><td>15.92</td><td>83.63</td><td>30.23</td></tr><tr><td>BARTMNLI</td><td>33.38</td><td>31.59</td><td>35.38</td><td>78.50</td></tr><tr><td>LLaMa-BasedModels</td><td></td><td></td><td></td><td></td></tr><tr><td>LLaMa-7B</td><td>26.81</td><td>15.50</td><td>99.42</td><td>17.36</td></tr><tr><td>Alpaca-7B</td><td>27.37</td><td>15.93</td><td>97.37</td><td>21.33</td></tr><tr><td>GPT-Based Models</td><td></td><td></td><td></td><td></td></tr><tr><td>GPT-3 Ada</td><td>0.00</td><td>0.00</td><td>0.00</td><td>84.77</td></tr><tr><td>GPT-3 Babbage</td><td>27.45</td><td>15.96</td><td>97.95</td><td>21.15</td></tr><tr><td>GPT-3 Curie</td><td>26.43</td><td>15.23</td><td>100.00</td><td>15.23</td></tr><tr><td>GPT-3 Davinci</td><td>27.82</td><td>16.57</td><td>86.55</td><td>31.61</td></tr><tr><td>GPT-3 Instruct (text-davinci-001)</td><td>17.99</td><td>11.84</td><td>37.43</td><td>48.04</td></tr><tr><td>GPT-3 Instruct (text-davinci-002)</td><td>21.87</td><td>13.46</td><td>58.19</td><td>36.69</td></tr><tr><td>GPT-3 Instruct (text-davinci-003)</td><td>15.72</td><td>13.4</td><td>19.01</td><td>68.97</td></tr><tr><td>GPT-3.5</td><td>21.69</td><td>17.79</td><td>27.78</td><td>69.46</td></tr><tr><td>GPT-4</td><td>29.08</td><td>20.92</td><td>47.66</td><td>64.60</td></tr></table>",
327
+ "page_idx": 6
328
+ },
329
+ {
330
+ "type": "text",
331
+ "text": "Table 4: Overall performance. We report F1 (main metric), precision, recall and accuracy. For the main metric, F1 score, we use the bold font to highlight the overall best performance, and underline to highlight the best performance within each category of models. ",
332
+ "page_idx": 6
333
+ },
334
+ {
335
+ "type": "text",
336
+ "text": "using the OpenAI API (https://openai.com/api/) with temperature 0. We also evaluate the recent, more efficient models, LLaMa (Touvron et al., 2023) and Alpaca (Taori et al., 2023). ",
337
+ "page_idx": 6
338
+ },
339
+ {
340
+ "type": "text",
341
+ "text": "When inspecting the behavior of finetuned models, we adopt a large set of models, including GPTbased models (GPT-3 Ada, Babbage, Curie, and Davinci) using the OpenAI finetuning API for classification at https://platform.openai.com/docs/guides/fine-tuning, open-sourced decoder-only models (GPT2, GPT2-Large, GPT2-XL, LLaMA-7B, and LLaMA2-7B), BERT-based models from scratch (BERT-Base, BERT-Large, RoBERTa-Base, and RoBERTa-Large), and BERTBased NLI models (BERT-Base MNLI, BERT-Large MNLI, RoBERTa-Base MNLI, and RoBERTaLarge MNLI) using the transformers library (Wolf et al., 2020). See training details in Appendix A. ",
342
+ "page_idx": 6
343
+ },
344
+ {
345
+ "type": "text",
346
+ "text": "For the random baselines, we provide “always majority” to predict the majority class $100 \\%$ of the time, “random (uniform)” to uniformly sample a label (i.e., $50 \\%$ for each), and “random (proportional)” to sample a label from a Bernouli distribution proportional to the development set label distribution. ",
347
+ "page_idx": 6
348
+ },
349
+ {
350
+ "type": "text",
351
+ "text": "4.2 THE CORR2CAUSE SKILL IN EXISTING LLMS ",
352
+ "text_level": 1,
353
+ "page_idx": 6
354
+ },
355
+ {
356
+ "type": "text",
357
+ "text": "We show the performance of seventeen LLMs in Table 4. We can see that pure causal inference is a very challenging task across all existing LLMs. Among all the LLMs, the best performance is $3 3 . 3 8 \\%$ F1 by BART MNLI, which is even higher than the latest GPT-based model, GPT-4. Notably, many models are worse than random guess, which means that they totally fail at this pure causal inference task. The observation still holds for few-shot chain-of-thought prompts tested in Appendix G. ",
358
+ "page_idx": 6
359
+ },
360
+ {
361
+ "type": "text",
362
+ "text": "4.3 FINETUNED PERFORMANCE ",
363
+ "text_level": 1,
364
+ "page_idx": 6
365
+ },
366
+ {
367
+ "type": "text",
368
+ "text": "Next, we address the question: Can we re-purpose LLMs to learn this task? The experimental results in Table 5a of 17 models finetuned on our CORR2CAUSE seem very strong at first sight. Most models see a substantial increase, among which the finetuned BERT-based NLI models demonstrate the strongest performance. The best-performing one, RoBERTa-Large MNLI, achieves $9 4 . 7 4 \\%$ F1 score on this task, as well as very high precision, recall and accuracy scores. ",
369
+ "page_idx": 6
370
+ },
371
+ {
372
+ "type": "table",
373
+ "img_path": "images/3f33391a81c3ead37fb270a8ffc80c4bb817662ffb8c6c1c4b3e7339abebefd1.jpg",
374
+ "table_caption": [],
375
+ "table_footnote": [
376
+ "(a) Performance of finetuned models on the original test set. "
377
+ ],
378
+ "table_body": "<table><tr><td colspan=\"4\">F1 Precison Recall Accuracy</td></tr><tr><td colspan=\"4\">Finetuned GPT-Based Models Using OpenAI API</td></tr><tr><td>GPT-3 Ada</td><td>79.85 70.47</td><td>92.11</td><td>92.92</td></tr><tr><td>GPT-3 Babbage</td><td>78.19 69.98</td><td>88.60</td><td>92.48</td></tr><tr><td>GPT-3 Curie</td><td>81.23 75.00</td><td>88.60</td><td>93.77</td></tr><tr><td>GPT-3Davinci 85.52</td><td>80.26</td><td>91.52</td><td>95.28</td></tr><tr><td colspan=\"4\">Finetuned Open-Sourced Decoder-Only Models</td></tr><tr><td>GPT2</td><td>89.18 88.03</td><td>90.35</td><td>96.66</td></tr><tr><td>GPT2-Large</td><td>94.29 92.18</td><td>96.49</td><td>98.22</td></tr><tr><td>GPT2-XL</td><td>94.30 91.94</td><td>96.78</td><td>98.22</td></tr><tr><td>LLaMA-7B</td><td>91.98 88.62</td><td>95.61</td><td>97.46</td></tr><tr><td>LLaMA2-7B</td><td>92.92 90.11</td><td>95.91</td><td>97.77</td></tr><tr><td colspan=\"4\">Finetuned BERT-Based Models</td></tr><tr><td>BERT-Base</td><td>69.29 54.42</td><td>95.32</td><td>87.13</td></tr><tr><td>BERT-Large</td><td>85.26 77.51</td><td>94.74</td><td>95.01</td></tr><tr><td>RoBERTa-Base</td><td>87.60 78.47</td><td>99.12</td><td>95.73</td></tr><tr><td>RoBERTa-Large</td><td>89.10 82.54</td><td>96.78</td><td>96.39</td></tr><tr><td colspan=\"4\">Finetuned BERT-Based NLI Models</td></tr><tr><td>BERT-Base MNLI</td><td>89.88 85.49</td><td>94.74</td><td>86.51</td></tr><tr><td>BERT-Large MNLI</td><td>90.19 84.44</td><td>96.78</td><td>96.79</td></tr><tr><td>RoBERTa-Base MNLI</td><td>94.27 90.35</td><td>98.54</td><td>98.17</td></tr><tr><td>RoBERTa-Large MNLI</td><td>94.74 92.24</td><td>97.37</td><td>98.35</td></tr><tr><td></td><td></td><td></td><td></td></tr></table>",
379
+ "page_idx": 7
380
+ },
381
+ {
382
+ "type": "table",
383
+ "img_path": "images/d44c9775bd0d64a62d86fe924c2a9a7baa7148ce0e57f10b5a003ff09d45be00.jpg",
384
+ "table_caption": [],
385
+ "table_footnote": [],
386
+ "table_body": "<table><tr><td>F1 (Paraph.)</td><td>F1 (Var. Ref.)</td></tr><tr><td>61.73 62.34</td><td>41.57 43.28</td></tr><tr><td>64.93 65.01</td><td>45.32 46.96</td></tr><tr><td>56.76 55.95 60.32</td><td>31.70 31.99 43.95 53.92</td></tr><tr><td>56.41 52.24</td><td>49.47 35.20</td></tr><tr><td>61.13 63.64 65.58</td><td>38.54 53.12</td></tr><tr><td>65.05</td><td>60.20</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td>65.56</td><td></td></tr><tr><td></td><td>31.50</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td>67.24</td><td>52.04</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td>57.42</td><td>62.83</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td>55.45</td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td>67.87</td></tr></table>",
387
+ "page_idx": 7
388
+ },
389
+ {
390
+ "type": "text",
391
+ "text": "(b) F1 scores of finetuned models on the perturbed test sets by paraphrasing (Paraph.) and variable refactorization (Var. Ref.). ",
392
+ "page_idx": 7
393
+ },
394
+ {
395
+ "type": "table",
396
+ "img_path": "images/248141cf16db6f7aaf530e42dd31b68eef982744cd3683feeb669d6edaaf91f2.jpg",
397
+ "table_caption": [
398
+ "Table 5: Performance of finetuned models on the original test set and perturbed test sets. "
399
+ ],
400
+ "table_footnote": [
401
+ "(a) Fine-grained performance of RoBERTa-Large by causal relation type on the original test set. "
402
+ ],
403
+ "table_body": "<table><tr><td>Relation Type</td><td>F1</td><td>Precision</td><td>Recall</td><td>Accuracy</td></tr><tr><td>Is-Parent</td><td>96.18</td><td>95.45</td><td>96.92</td><td>98.67</td></tr><tr><td>Is-Ancestor</td><td>93.94</td><td>93.94</td><td>93.94</td><td>98.93</td></tr><tr><td>Is-Child</td><td>95.73</td><td>94.92</td><td>96.56</td><td>98.67</td></tr><tr><td>Is-Descendant</td><td>96.55</td><td>93.33</td><td>100</td><td>99.47</td></tr><tr><td>Has-Collider</td><td>92.19</td><td>87.41</td><td>97.52</td><td>94.64</td></tr><tr><td>Has-Confounder</td><td>98.67</td><td>97.37</td><td>100</td><td>99.73</td></tr></table>",
404
+ "page_idx": 7
405
+ },
406
+ {
407
+ "type": "table",
408
+ "img_path": "images/582e94955652b3ff6a5edb126f1b15049f605ca77f4ea45b92f30f51c6b13d05.jpg",
409
+ "table_caption": [],
410
+ "table_footnote": [],
411
+ "table_body": "<table><tr><td>F1</td><td>Precision</td><td>Recall</td><td>Accuracy</td></tr><tr><td>74.80</td><td>79.31</td><td>70.77</td><td>91.73</td></tr><tr><td>45.45</td><td>90.91</td><td>30.30</td><td>93.60</td></tr><tr><td>73.39</td><td>78.43</td><td>68.97</td><td>92.27</td></tr><tr><td>29.41</td><td>83.33</td><td>17.86</td><td>93.60</td></tr><tr><td>70.70</td><td>75.00</td><td>66.90</td><td>82.04</td></tr><tr><td>70.42</td><td>73.53</td><td>67.57</td><td>94.37</td></tr></table>",
412
+ "page_idx": 7
413
+ },
414
+ {
415
+ "type": "text",
416
+ "text": "(b) Its fine-grained performance by relation type after variable refactorization. ",
417
+ "page_idx": 7
418
+ },
419
+ {
420
+ "type": "text",
421
+ "text": "Table 6: Fine-grained analysis of the best-performing model, RoBERTa-Large MNLI. ",
422
+ "page_idx": 7
423
+ },
424
+ {
425
+ "type": "text",
426
+ "text": "4.4 FINE-GRAINED PERFORMANCE BY CAUSAL RELATION ",
427
+ "text_level": 1,
428
+ "page_idx": 7
429
+ },
430
+ {
431
+ "type": "text",
432
+ "text": "In addition to the overall results mentioned above, we conduct a fine-grained analysis to check the performance of the strongest finetuned model, RoBERTa-Large MNLI, by our six causal relation types. As in Table 6a, the model is very good at judging relations such as Is-Parent, Is-Descendant and Has-Confounder, all with more than $96 \\%$ F1 scores, whereas it is several points weaker on the Has-Collider relations. This could be due to that the collider relation is the most special type, requiring identification of the V-structure based on both the unconditional independence based on the two variables only and correlations whenever conditioned on a common descendant. We also conduct error analysis for non-finetuned models in Appendix F. ",
433
+ "page_idx": 7
434
+ },
435
+ {
436
+ "type": "text",
437
+ "text": "4.5 ROBUSTNESS ANALYSIS ",
438
+ "text_level": 1,
439
+ "page_idx": 7
440
+ },
441
+ {
442
+ "type": "text",
443
+ "text": "Looking at the very high performance of the finetuned models, we raise the next question: Did the models really robustly learn the causal inference skills? ",
444
+ "page_idx": 7
445
+ },
446
+ {
447
+ "type": "text",
448
+ "text": "Two Robustness Tests We design two simple robustness tests: (1) paraphrasing, and (2) variable refactorization. For (1) paraphrasing, we simply paraphrase the hypothesis by changing the text template for each causal relation to some semantically-equivalent alternatives in Appendix C. For (2) variable refactorization, we reverse the alphabet of the variable names, namely flipping A, B, C, to Z, Y, X and so on. The inspiration behind the two robustness tests comes from the spurious correlation analysis described in Appendix E. ",
449
+ "page_idx": 7
450
+ },
451
+ {
452
+ "type": "text",
453
+ "text": "Specifically, we adopt the common setup of text adversarial attack (Morris et al., 2020; Jin et al., 2020) to preserve the training set and keep the same saved models, but run the inference on the perturbed test set. In this way, we separate the possibilities of the models only overfitting on the training data vs. mastering the reasoning skills. ",
454
+ "page_idx": 8
455
+ },
456
+ {
457
+ "type": "text",
458
+ "text": "Results after Perturbation We can see from Table 5b that all the models drop drastically, by up to 39.29 on the paraphrased test set, and up to 62.30 after variable refactorization. The best-performing model, RoBERTa-Large MNLI, is especially sensitive towards paraphrasing, demonstrating the most drop among all models; however, it is the most robust against the variable refactorization, maintaining a high F1 score of 67.87. We conduct fine-grained analysis for RoBERTa-Large MNLI under perturbation in Table 6b. We can see the the main source of the performance drop of the model comes from the two classes, Is-Ancestor (decreasing to $4 5 . 4 5 \\%$ ) and Is-Descendant (decreasing to $2 9 . 4 1 \\%$ ), while the other classes stay relatively robust, keeping their F1 scores over $70 \\%$ . ",
459
+ "page_idx": 8
460
+ },
461
+ {
462
+ "type": "text",
463
+ "text": "From this analysis, we make the following suggestions to future studies testing this CORR2CAUSE skill of LLMs. First, it is safe to use it as a test set to benchmark existing LLMs’ performance, since the data we generate is out-of-distribution from the training data of the current LLMs. Then, when testing finetuned models, it is very important to accompany adversarial attack together with the i.i.d. test set. We open-source our perturbed test sets for future work to test the generalizability skill. ",
464
+ "page_idx": 8
465
+ },
466
+ {
467
+ "type": "text",
468
+ "text": "4.6 EXTENSION TO NATURAL STORIES ",
469
+ "text_level": 1,
470
+ "page_idx": 8
471
+ },
472
+ {
473
+ "type": "text",
474
+ "text": "We envision our CORR2CAUSE dataset to be a foundation for future extensions to various settings, such as instantiating the variables with actual phenomena and situating the story in a more natural setting. For example, the correlation does not imply causation rule can be instantiated with the ice cream sales and swimming pool attendance as the two variables, and argue that ice cream sales does not necessarily affect swimming pool attendance, because their correlation could be due to a third variable, such as hot weather. We provide a case study for how to instantiate the symbolic expressions in our dataset to more natural stories, and find that LLMs such as GPT-4 can generate realistic, daily life stories that has foreseeably broad applications. See more details in Appendix B. ",
475
+ "page_idx": 8
476
+ },
477
+ {
478
+ "type": "text",
479
+ "text": "5 RELATED WORK ",
480
+ "text_level": 1,
481
+ "page_idx": 8
482
+ },
483
+ {
484
+ "type": "text",
485
+ "text": "Existing Causal Reasoning Tasks A large body of existing research of causal reasoning in NLP focuses on leveraging empirical knowledge to do tasks such as inferring the cause and effect of why an agent perform certain tasks (Sap et al., 2019a), the motivation and emotional reaction in a social context (Sap et al., 2019b), how people achieve a given goal with a set of concrete steps (Zhang et al., 2020), the development of a story given a different beginning (Qin et al., 2019), and how in general LLMs serve as a knowledge base of cause and effect (Willig et al., 2023; Kıcıman et al., 2023). In contrast, our CORR2CAUSE task focuses on the pure causal inference skill of models, which is a knowledge-dependent reasoning skill based on formally correct rules from causal inference. ",
486
+ "page_idx": 8
487
+ },
488
+ {
489
+ "type": "text",
490
+ "text": "Existing Logical and Inference Tasks Another related area of literature is logical and inference tasks, of which a well-established one is natural language inference (NLI), to identify the semantic relationship between a pair of sentences (MacCartney & Manning, 2008; Bowman et al., 2015). NLI datasets mainly focus on the set and paraphrase relations. For example, “a group of boys are playing football” can entail “some guys are playing football,” where “boys” are a sub-concept of “guys,” and “a group of” and “some” are paraphrases. Recently, there have been increasing efforts to extend the inference task to various logical inference skills such as deductive logic and propaganda techniques (Jin et al., 2022; Alhindi et al., 2022). Our CORR2CAUSE dataset is the first dataset testing the correlation-to-causation inference skill, which is unique of its type. ",
491
+ "page_idx": 8
492
+ },
493
+ {
494
+ "type": "text",
495
+ "text": "6 CONCLUSION ",
496
+ "text_level": 1,
497
+ "page_idx": 8
498
+ },
499
+ {
500
+ "type": "text",
501
+ "text": "In this work, we introduced a novel task, CORR2CAUSE, to infer causation from correlation, and collected a large-scale dataset of over 200K samples. We evaluated an extensive list of LLMs on this new task, and showed that off-the-shelf LLMs perform poorly on this task. We also show that it is possible to re-purpose LLMs on this task by finetuning, but future work needs to be aware of the out-of-distribution generalization problem. To avoid the Goodhart’s law, we recommend using this dataset to benchmark the pure causal inference skills for LLMs that have not seen this dataset. Given the limited reasoning abilities of current LLMs, and the difficulty of separating actual reasoning from training-corpus-derived knowledge, it is imperative that our community focus on work aiming to accurately disentangle and measure both abilities. We believe the present work is a first such step. ",
502
+ "page_idx": 8
503
+ },
504
+ {
505
+ "type": "text",
506
+ "text": "LIMITATIONS AND FUTURE WORK ",
507
+ "text_level": 1,
508
+ "page_idx": 9
509
+ },
510
+ {
511
+ "type": "text",
512
+ "text": "We identify several limitations of this work and open future directions: First, in the context of this work, we limit the causal graphs to two to six nodes, but future work can feel free to explore larger graphs. Another aspect is that we do not assume hidden confounders in this inference problem, so we welcome future work to generate an even more challenging dataset to infer the existence of hidden confounders, analogous to the causal discovery algorithm of fast causal inference (FCI) (Spirtes et al., 2000). And also in general, explorations of other causal discovery algorithms are welcomed too. Finally, a lot of motivation behind proposing this task is inspired by the problem of invalid reasoning patterns in our daily reasoning (Jin et al., 2022), which could fertilize the ground for more pervasive spread of fake news. We believe false causal inference is a prevalent type of fallacious beliefs, and welcome future work to connect the idea of this benchmark to more real-world false beliefs based on confusing correlation with causation. ",
513
+ "page_idx": 9
514
+ },
515
+ {
516
+ "type": "text",
517
+ "text": "ACKNOWLEDGMENT ",
518
+ "text_level": 1,
519
+ "page_idx": 9
520
+ },
521
+ {
522
+ "type": "text",
523
+ "text": "We thank Riley Goodside for valuable suggestions to improve our prompts to LLMs. We thank Luigi Gresele and Amir Hossein Karimi for their suggestions to help us improve the formulation of our causal discovery questions. ",
524
+ "page_idx": 9
525
+ },
526
+ {
527
+ "type": "text",
528
+ "text": "This material is based in part upon work supported by the German Federal Ministry of Education and Research (BMBF): Tübingen AI Center, FKZ: 01IS18039B; by the Machine Learning Cluster of Excellence, EXC number 2064/1 – Project number 390727645; by a National Science Foundation award (#2306372); by a Swiss National Science Foundation award (#201009) and a Responsible AI grant by the Haslerstiftung. Zhijing Jin is supported by PhD fellowships from the Future of Life Institute and Open Philanthropy. We also thank OpenAI for granting Zhijing quota to their API of GPT series through the Researcher Access Program. ",
529
+ "page_idx": 9
530
+ },
531
+ {
532
+ "type": "text",
533
+ "text": "REFERENCES ",
534
+ "text_level": 1,
535
+ "page_idx": 9
536
+ },
537
+ {
538
+ "type": "text",
539
+ "text": "Tariq Alhindi, Tuhin Chakrabarty, Elena Musi, and Smaranda Muresan. Multitask instruction-based prompting for fallacy recognition. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pp. 8172–8187, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. URL https://aclanthology.org/ 2022.emnlp-main.560. 9 ",
540
+ "page_idx": 9
541
+ },
542
+ {
543
+ "type": "text",
544
+ "text": "Chandra Bhagavatula, Ronan Le Bras, Chaitanya Malaviya, Keisuke Sakaguchi, Ari Holtzman, Hannah Rashkin, Doug Downey, Wen-tau Yih, and Yejin Choi. Abductive commonsense reasoning. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. URL https://openreview.net/forum?id= Byg1v1HKDB. 1 ",
545
+ "page_idx": 9
546
+ },
547
+ {
548
+ "type": "text",
549
+ "text": "Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. A large annotated corpus for learning natural language inference. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 632–642, Lisbon, Portugal, September 2015. Association for Computational Linguistics. doi: 10.18653/v1/D15-1075. URL https: //aclanthology.org/D15-1075. 9 ",
550
+ "page_idx": 9
551
+ },
552
+ {
553
+ "type": "text",
554
+ "text": "Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 1877–1901. Curran Associates, Inc., 2020. URL https://proceedings.neurips. cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf. 6 ",
555
+ "page_idx": 9
556
+ },
557
+ {
558
+ "type": "text",
559
+ "text": "David Maxwell Chickering. Optimal structure identification with greedy search. J. Mach. Learn. Res., 3:507–554, 2002. URL http://jmlr.org/papers/v3/chickering02b.html. 3 ",
560
+ "page_idx": 9
561
+ },
562
+ {
563
+ "type": "text",
564
+ "text": "Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https: //aclanthology.org/N19-1423. 1, 6 ",
565
+ "page_idx": 10
566
+ },
567
+ {
568
+ "type": "text",
569
+ "text": "Clark Glymour, Kun Zhang, and Peter Spirtes. Review of causal discovery methods based on graphical models. Frontiers in Genetics, 10:524, 2019. ISSN 1664-8021. doi: 10.3389/fgene.2019. 00524. URL https://www.frontiersin.org/article/10.3389/fgene.2019. 00524. 2, 3 \nMadelyn Glymour, Judea Pearl, and Nicholas P Jewell. Causal inference in statistics: A primer. John Wiley and Sons, 2016. 2, 3 \nAndrew Gordon, Zornitsa Kozareva, and Melissa Roemmele. SemEval-2012 task 7: Choice of plausible alternatives: An evaluation of commonsense causal reasoning. In \\*SEM 2012: The First Joint Conference on Lexical and Computational Semantics – Volume 1: Proceedings of the main conference and the shared task, and Volume 2: Proceedings of the Sixth International Workshop on Semantic Evaluation (SemEval 2012), pp. 394–398, Montréal, Canada, 7-8 June 2012. Association for Computational Linguistics. URL https://aclanthology.org/S12-1052. 1 \nPengcheng He, Xiaodong Liu, Jianfeng Gao, and Weizhu Chen. Deberta: Decoding-enhanced Bert with disentangled attention. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. URL https:// openreview.net/forum?id $\\underline { { \\underline { { \\mathbf { \\Pi } } } } } =$ XPZIaotutsD. 6 \nPatrik O. Hoyer, Dominik Janzing, Joris M. Mooij, Jonas Peters, and Bernhard Schölkopf. Nonlinear causal discovery with additive noise models. In Daphne Koller, Dale Schuurmans, Yoshua Bengio, and Léon Bottou (eds.), Advances in Neural Information Processing Systems 21, Proceedings of the Twenty-Second Annual Conference on Neural Information Processing Systems, Vancouver, British Columbia, Canada, December 8-11, 2008, pp. 689–696. Curran Associates, Inc., 2008. URL https://proceedings.neurips.cc/paper/2008/hash/ f7664060cc52bc6f3d620bcedc94a4b6-Abstract.html. 3 \nDi Jin, Zhijing Jin, Joey Tianyi Zhou, and Peter Szolovits. Is BERT really robust? A strong baseline for natural language attack on text classification and entailment. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pp. 8018– 8025. AAAI Press, 2020. URL https://aaai.org/ojs/index.php/AAAI/article/ view/6311. 9 \nZhijing Jin, Abhinav Lalwani, Tejas Vaidhya, Xiaoyu Shen, Yiwen Ding, Zhiheng Lyu, Mrinmaya Sachan, Rada Mihalcea, and Bernhard Schölkopf. Logical fallacy detection. In Findings of the Association for Computational Linguistics: EMNLP 2022, pp. $\\mathrm { \\dot { 7 } 1 8 0 } \\mathrm { \\tilde { A } \\mathrm { \\acute { a } } }$ ‚¬âCœ–7198, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. URL https://arxiv.org/abs/2202.13758. 9, 10 \nEmre Kıcıman, Robert Ness, Amit Sharma, and Chenhao Tan. Causal reasoning and large language models: Opening a new frontier for causality. arXiv preprint arXiv:2305.00050, 2023. 1, 9 \nMike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 7871–7880, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.703. URL https://aclanthology.org/2020.acl-main.703. 6 \nYinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. RoBERTa: A robustly optimized BERT pretraining approach. CoRR, abs/1907.11692, 2019. URL http://arxiv.org/abs/1907.11692. 6 ",
570
+ "page_idx": 10
571
+ },
572
+ {
573
+ "type": "text",
574
+ "text": "Bill MacCartney and Christopher D. Manning. Modeling semantic containment and exclusion in natural language inference. In Proceedings of the 22nd International Conference on Computational Linguistics (Coling 2008), pp. 521–528, Manchester, UK, August 2008. Coling 2008 Organizing Committee. URL https://aclanthology.org/C08-1066. 9 ",
575
+ "page_idx": 11
576
+ },
577
+ {
578
+ "type": "text",
579
+ "text": "Brendan D. McKay and Adolfo Piperno. Practical graph isomorphism, II. J. Symb. Comput., 60: 94–112, 2014. doi: 10.1016/j.jsc.2013.09.003. URL https://doi.org/10.1016/j.jsc. 2013.09.003. 5 \nJohn Morris, Eli Lifland, Jin Yong Yoo, Jake Grigsby, Di Jin, and Yanjun Qi. TextAttack: A framework for adversarial attacks, data augmentation, and adversarial training in NLP. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 119–126, Online, October 2020. Association for Computational Linguistics. doi: 10.18653/v1/ 2020.emnlp-demos.16. URL https://aclanthology.org/2020.emnlp-demos.16. 9 \nOpenAI. GPT-4 technical report. CoRR, abs/2303.08774, 2023. doi: 10.48550/arXiv.2303.08774. URL https://doi.org/10.48550/arXiv.2303.08774. 1, 6 \nLong Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul F. Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback. CoRR, abs/2203.02155, 2022. doi: 10.48550/arXiv.2203.02155. URL https://doi.org/10. 48550/arXiv.2203.02155. 1, 6 \nJudea Pearl. Probabilistic reasoning in intelligent systems: Networks of plausible inference. Morgan Kaufmann, 1988. 3 \nJudea Pearl. Causality: Models, reasoning and inference (2nd ed.). Cambridge University Press, 2009. 1 \nJonas Peters, Dominik Janzing, and Bernhard Schölkopf. Elements of causal inference: Foundations and learning algorithms. The MIT Press, 2017. URL https://mitpress.mit.edu/ books/elements-causal-inference. 1 \nLianhui Qin, Antoine Bosselut, Ari Holtzman, Chandra Bhagavatula, Elizabeth Clark, and Yejin Choi. Counterfactual story reasoning and generation. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 5043–5053, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1509. URL https: //aclanthology.org/D19-1509. 1, 9 \nAlec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI Blog, 1(8), 2019. 1, 6 \nVictor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. DistilBERT, a distilled version of BERT: Smaller, faster, cheaper and lighter. CoRR, abs/1910.01108, 2019. URL http: //arxiv.org/abs/1910.01108. 6 \nMaarten Sap, Ronan Le Bras, Emily Allaway, Chandra Bhagavatula, Nicholas Lourie, Hannah Rashkin, Brendan Roof, Noah A. Smith, and Yejin Choi. ATOMIC: an atlas of machine commonsense for if-then reasoning. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, The Thirty-First Innovative Applications of Artificial Intelligence Conference, IAAI 2019, The Ninth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2019, Honolulu, Hawaii, USA, January 27 - February 1, 2019, pp. 3027–3035. AAAI Press, 2019a. doi: 10.1609/aaai.v33i01.33013027. URL https://doi.org/10.1609/aaai.v33i01. 33013027. 1, 9 \nMaarten Sap, Hannah Rashkin, Derek Chen, Ronan Le Bras, and Yejin Choi. Social iqa: Commonsense reasoning about social interactions. In EMNLP 2019, 2019b. 1, 9 ",
580
+ "page_idx": 11
581
+ },
582
+ {
583
+ "type": "text",
584
+ "text": "Shohei Shimizu, Patrik O. Hoyer, Aapo Hyvärinen, and Antti J. Kerminen. A linear non-gaussian acyclic model for causal discovery. J. Mach. Learn. Res., 7:2003–2030, 2006. URL http: //jmlr.org/papers/v7/shimizu06a.html. 3 ",
585
+ "page_idx": 12
586
+ },
587
+ {
588
+ "type": "text",
589
+ "text": "Sam Shleifer and Alexander M. Rush. Pre-trained summarization distillation. CoRR, abs/2010.13002, 2020. URL https://arxiv.org/abs/2010.13002. 6 \nPeter Spirtes and Kun Zhang. Causal discovery and inference: Concepts and recent methodological advances. In Applied informatics, volume 3, pp. 1–28. SpringerOpen, 2016. 2, 3 \nPeter Spirtes, Clark Glymour, and Richard Scheines. Causation, prediction, and search. 1993. 2, 3 \nPeter Spirtes, Clark Glymour, and Richard Scheines. Causation, Prediction, and Search, Second Edition. Adaptive computation and machine learning. MIT Press, 2000. ISBN 978-0-262-19440-2. 1, 2, 3, 10 \nRohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. https://github.com/tatsu-lab/stanford_alpaca, 2023. 7 \nHugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurélien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models. CoRR, abs/2302.13971, 2023. doi: 10.48550/arXiv.2302.13971. URL https://doi. org/10.48550/arXiv.2302.13971. 7 \nRuibo Tu, Chao Ma, and Cheng Zhang. Causal-discovery performance of chatgpt in the context of neuropathic pain diagnosis. arXiv preprint arXiv:2301.13819, 2023. 1 \nMoritz Willig, Matej Zecevi ˇ c, Devendra Singh Dhami, and Kristian Kersting. Probing for correlations ´ of causal facts: Large language models and causality, 2023. URL https://openreview. net/forum?id $=$ UPwzqPOs4-. 9 \nThomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 38–45, Online, October 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-demos.6. URL https://aclanthology.org/2020.emnlp-demos.6. 6, 7, 14 \nYuxi Xie, Guanzhen Li, and Min-Yen Kan. Echo: Event causality inference via human-centric reasoning. arXiv preprint arXiv:2305.14740, 2023. 1 \nMatej Zecevi ˇ c, Moritz Willig, Devendra Singh Dhami, and Kristian Kersting. Causal parrots: Large ´ language models may talk causality but are not causal. arXiv preprint arXiv:2308.13067, 2023. 1 \nKun Zhang and Aapo Hyvärinen. Causality discovery with additive disturbances: An informationtheoretical perspective. In Machine Learning and Knowledge Discovery in Databases: European Conference, ECML PKDD 2009, Bled, Slovenia, September 7-11, 2009, Proceedings, Part II 20, pp. 570–585. Springer, 2009. 3 \nLi Zhang, Qing Lyu, and Chris Callison-Burch. Reasoning about goals, steps, and temporal ordering with WikiHow. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 4630–4639, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.374. URL https://aclanthology.org/ 2020.emnlp-main.374. 9 \nSusan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona T. Diab, Xian Li, Xi Victoria Lin, Todor Mihaylov, Myle Ott, Sam Shleifer, Kurt Shuster, Daniel Simig, Punit Singh Koura, Anjali Sridhar, Tianlu Wang, and Luke Zettlemoyer. OPT: open pre-trained transformer language models. CoRR, abs/2205.01068, 2022. doi: 10.48550/ arXiv.2205.01068. URL https://doi.org/10.48550/arXiv.2205.01068. 1 ",
590
+ "page_idx": 12
591
+ },
592
+ {
593
+ "type": "text",
594
+ "text": "A IMPLEMENTATION DETAILS ",
595
+ "text_level": 1,
596
+ "page_idx": 13
597
+ },
598
+ {
599
+ "type": "text",
600
+ "text": "When finetuning on our data, for GPT-based models, we use the default settings of the OpenAI finetuning API; and for BERT-based models, we use the transformers library (Wolf et al., 2020) and train the models on a server with an NVIDIA Tesla A100 GPU with 40G of memory. To fit for the GPU memory, we set the batch size to be 8. We use the validation set to tune the learning rate, which takes value in {2e-6, 5e-6, 1e-5, 2e-5, 5e-5}; dropout rate, which takes value in $\\{ 0 , 0 . 1 , 0 . 2$ , 0.3}; and weight decay, which takes value in {1e-4, 1e-5}. We train the models until convergence, which is usually around ten epochs. ",
601
+ "page_idx": 13
602
+ },
603
+ {
604
+ "type": "text",
605
+ "text": "Prompts When querying the autoregressive LLMs, we formulate the prompt as follows: ",
606
+ "page_idx": 13
607
+ },
608
+ {
609
+ "type": "text",
610
+ "text": "Question: [premise] ",
611
+ "page_idx": 13
612
+ },
613
+ {
614
+ "type": "text",
615
+ "text": "Can we deduct the following: [hypothesis]? Just answer \"Yes\" or \"No.\" ",
616
+ "page_idx": 13
617
+ },
618
+ {
619
+ "type": "text",
620
+ "text": "Answer: ",
621
+ "page_idx": 13
622
+ },
623
+ {
624
+ "type": "text",
625
+ "text": "B GENERATING NATURAL STORIES ",
626
+ "text_level": 1,
627
+ "page_idx": 13
628
+ },
629
+ {
630
+ "type": "text",
631
+ "text": "To generate the natural stories based on our symbolic expressions, we utilize the state-of-the-art LLM, GPT-4, which is very good at story generation. We design detailed instructions in the prompt, and generate around 200 stories in our case study. We show two examples stories in Table 7, and the report the overall statistics in Table 8. ",
632
+ "page_idx": 13
633
+ },
634
+ {
635
+ "type": "table",
636
+ "img_path": "images/e268b6154d299e4972c7ac079739539768e3777722681d376112d808d50b6e25.jpg",
637
+ "table_caption": [],
638
+ "table_footnote": [
639
+ "Table 7: Examples of natural stories generated based on the symbolic form in our CORR2CAUSE dataset, showing the broad application value of our dataset as the starting point for various verbalizations of the correlation-to-causation inference task. "
640
+ ],
641
+ "table_body": "<table><tr><td>Example 1 (Label=Negative)</td><td>Symbolic Premise: Suppose there is a closed system</td><td>Example 2 (Label=Positive) Premise: Suppose there is a closed system</td></tr><tr><td>Form Natural</td><td>of 2 variables,A and B.All the statistical relations among these 2 variables are as fol- lows:A correlates with B. Hypothesis:A directly affects B. Relation between the promise and hypothe- sis: The premise does not a necessary con- dition for the hypothesis. Premise: Suppose there is a closed system</td><td>of3 variables,A,B and C.All the statisti- cal relations among these 3 variables are as follows: A correlates with C.B correlates with C.However,Ais independent ofB. Hypothesis: A directly affects C. Relation between the promise and hypoth- esis: The premise is a necessary condition for the hypothesis. So if the premise is true, the hypothesis must be true. Premise:Let&#x27;s consider three factors: eat-</td></tr><tr><td>Story</td><td>of 2 variables,ice cream sales and swim- ming pool attendance.All the statistical relations among these 2 variables are as fol- lows: ice cream sales correlate with swim- ming pool attendance. Hypothesis:Ice cream sales directly affect swimming pool attendance. Relation between the premise and hypoth- esis: The premise does not provide a nec- essary condition for the hypothesis. The correlation between ice cream sales and swimming pool attendance could be due to a third variable,such as hot weather, which increases both ice cream sales and swim- ming pool attendance.Therefore, it is not necessarily true that ice cream sales directly affect swimming pool attendance.</td><td>ing junk food (A), obesity (C),and watch- ing television (B). There is a correlation between eating junk food and obesity, and between watching television and obesity. However, eating junk food and watching television are independent from each other. Hypothesis: Eating junk food directly af- fects obesity. Relation between the premise and hypoth- esis: The premise provides the necessary conditions for the hypothesis.It establishes the independent variables A (eating junk food) and B (watching television) and their correlations with obesity. Given that these are true,it supports the hypothesis that eat- ing junk food directly affects obesity.</td></tr></table>",
642
+ "page_idx": 13
643
+ },
644
+ {
645
+ "type": "table",
646
+ "img_path": "images/8f1bd656fd0649c67bfb5ddf12dcd56fa974ee67dbd36e14e9948312c292d8eb.jpg",
647
+ "table_caption": [
648
+ "Table 8: Statistics of our generated natural stories. We report the number of samples in the test and development sets; number of tokens per premise (# Tokens/Premise), hypothesis (# Tokens/Hypothesis), and explanation (# Tokens/Explanation); and percentage of the positive labels $\\%$ Positive Labels). "
649
+ ],
650
+ "table_footnote": [],
651
+ "table_body": "<table><tr><td>Test Set Size Dev Set Size</td><td>102 102</td></tr><tr><td># Tokens/Premise</td><td>64.88</td></tr><tr><td># Tokens/Hypothesis</td><td>13.54</td></tr><tr><td># Tokens/Explanation</td><td>64.66</td></tr><tr><td>% Positive Labels</td><td>1.67</td></tr></table>",
652
+ "page_idx": 14
653
+ },
654
+ {
655
+ "type": "text",
656
+ "text": "For more information, the exact prompt we use is “Here is a causal inference rule: [symbolic form] Please provide a real-world example instantiating this phenomenon. Format it also as \"Premise:\", \"Hypothesis:\", and \"Relation between the promise and hypothesis:\".” ",
657
+ "page_idx": 14
658
+ },
659
+ {
660
+ "type": "text",
661
+ "text": "C TEMPLATES AND PARAPHRASES ",
662
+ "text_level": 1,
663
+ "page_idx": 14
664
+ },
665
+ {
666
+ "type": "text",
667
+ "text": "We use the verbalization templates in Table 9 to compose the hypotheses for all six causal relations. ",
668
+ "page_idx": 14
669
+ },
670
+ {
671
+ "type": "table",
672
+ "img_path": "images/d10e2605b8a0e03a1ad68f9cbdb1a3b7a3d09581ecc2237fb345d573a298ab68.jpg",
673
+ "table_caption": [],
674
+ "table_footnote": [],
675
+ "table_body": "<table><tr><td>Causal Relation</td><td colspan=\"2\">Hypothesis Template</td></tr><tr><td>Is-Parent</td><td></td><td>{Vari} directly causes {Var j}.</td></tr><tr><td>Is-Ancestor</td><td></td><td>{Vari} causes something else which causes {Var j}.</td></tr><tr><td>Is-Child</td><td></td><td>{Varj} directly causes {Var i}.</td></tr><tr><td>Is-Descendant</td><td></td><td>{Varj} isa cause for{Var i},but nota direct one.</td></tr><tr><td>Has-Collider</td><td></td><td>There exists at least one collider (i.e., common effect) of {Var i} and {Varj}.</td></tr><tr><td>Has-Confounder</td><td></td><td>There exists at least one confounder (i.e.,common cause)of {Var i} and {Varj}.</td></tr><tr><td colspan=\"2\">Paraphrases</td><td></td></tr><tr><td>Is-Parent</td><td></td><td>{Vari}directlyaffects{Var j}.</td></tr><tr><td>Is-Ancestor</td><td></td><td>{Var i} influences {Var j} through some mediator(s).</td></tr><tr><td>Is-Child</td><td></td><td>{Varj} directly affects {Var i}.</td></tr><tr><td>Is-Descendant</td><td></td><td>{Varj} influences {Var i} through some mediator(s).</td></tr><tr><td>Has-Collider</td><td></td><td>{Vari} and {Var j} together cause some other variable(s).</td></tr><tr><td>Has-Confounder</td><td></td><td>Some variable(s) cause(s) both {Var i} and {Var j}.</td></tr></table>",
676
+ "page_idx": 14
677
+ },
678
+ {
679
+ "type": "text",
680
+ "text": "Table 9: Templates and their paraphrases for each causal relation in the hypothesis. We use {Var i} and {Var j} as placeholders for the two variables. ",
681
+ "page_idx": 14
682
+ },
683
+ {
684
+ "type": "table",
685
+ "img_path": "images/d2c3439cd6d88f7cbb27975146c2edeee48c7dfaea581d6e76e5e48fb1dc7444.jpg",
686
+ "table_caption": [
687
+ "D CHANGE LOG FOR THE DATASET VERSION UPDATE ",
688
+ "Table 10: De-duplication methods for the six causal relation types and their verbalizations. "
689
+ ],
690
+ "table_footnote": [],
691
+ "table_body": "<table><tr><td>Two Equivalent Forms</td><td>Duplication Property</td><td>De-Duplication Method</td></tr><tr><td>{ Is-Parid(j, )</td><td>Two exact same strings</td><td>Keep only one, by forcing i&lt; j</td></tr><tr><td>{Is-Ancestor(i,j) (Original) (Is-Descendent(j,i) (Original)</td><td>Two different strings, but semantically equivalent</td><td>Randomly sample one out of the two</td></tr><tr><td>( Is-Asetor(i,j)(araphraded)</td><td>Two exact same strings</td><td>Keep only one, by forcing i&lt; j</td></tr><tr><td>{Has-Collider(i,j) (Has-Collider(j,i)</td><td>Two different strings, but semantically equivalent</td><td>Randomly sample one out of the two</td></tr><tr><td>{Has-Confounder(i,j) { Has-Confounder(j,i)</td><td>Two different strings, but semantically equivalent</td><td>Randomly sample one out of the two</td></tr></table>",
692
+ "page_idx": 14
693
+ },
694
+ {
695
+ "type": "text",
696
+ "text": "De-Duplication Strategy As mentioned in Section 3.7 in the main paper, our original dataset (v1.0) has duplication due to symmetric relations and verbalizations. We introduce in Table 10 several reasons for why duplicated hypotheses exist in our original data. One typical reason is symmetric relations such as Is-Parent(A, B) and Is-Child(B, A), and, similarly, the paraphrased version of ",
697
+ "page_idx": 14
698
+ },
699
+ {
700
+ "type": "text",
701
+ "text": "Is-Ancestor(A, B) and Is-Descendent(B, A). Another typical reason is the semantic equivalence in the verbalization templates, which applies to the Has-Collider and Has-Confounder relations. For example, the verbalized texts of Has-Collider(A, B) and Collider(B, A) are “There exists at least one collider (i.e., common effect) of {A and B, B and A},” respectively, which are semantically-equivalent paraphrases of each other, so we randomly keep one out of the two. ",
702
+ "page_idx": 15
703
+ },
704
+ {
705
+ "type": "text",
706
+ "text": "Resulting Dataset Statistics after De-Duplication ",
707
+ "text_level": 1,
708
+ "page_idx": 15
709
+ },
710
+ {
711
+ "type": "text",
712
+ "text": "Since the reason for duplication in the first place is due to symmetry in the causal relation, or verbalization, the resulting new data, CORR2CAUSE v2.0, is exactly a half of the original data. As we reported previously in Table 3 of Section 3.7, the total number of samples cuts down to half, while the label distribution and all other properties are the same. To compose each split, we apply the same de-duplication method for the test, train, and development sets. We notice that some duplicates are across the splits, so we prioritize keeping the test and training sets untouched (to minimally affect the experimental results), and then reduce the development set by removing the cross-split duplicates, namely: ",
713
+ "page_idx": 15
714
+ },
715
+ {
716
+ "type": "text",
717
+ "text": "• test_ $2 . 0 =$ deduplicate(test_1.0) • train_ $2 . 0 =$ deduplicate(train_1.0) • dev_ $2 . 0 =$ deduplicate(dev_1.0) \\ {test_2.0, train_2.0} ",
718
+ "page_idx": 15
719
+ },
720
+ {
721
+ "type": "text",
722
+ "text": "We expect minimal or almost no change to the experimental results. In case of the slight possibility that this change in the development set might affect the model selection in the training process, future work can feel free to re-train the models and update the exact performance number. ",
723
+ "page_idx": 15
724
+ },
725
+ {
726
+ "type": "text",
727
+ "text": "E SPURIOUS CORRELATION ANALYSIS ",
728
+ "text_level": 1,
729
+ "page_idx": 15
730
+ },
731
+ {
732
+ "type": "text",
733
+ "text": "The inspirations of our two robustness tests (paraphrasing and variable refactorization) come from our data analysis. We check for spurious correlations in the data by reporting in Table 11 the point-wise mutual information (PMI) between the label and any n-gram with no more than four tokens. In addition, we also report the difference of the PMI with the two labels in the |Diff| column of Table 11, and report the top $1 0 \\mathrm { n }$ -grams. ",
734
+ "page_idx": 15
735
+ },
736
+ {
737
+ "type": "table",
738
+ "img_path": "images/bda37b83dc616fe358755ea83fa997c8f643170950cedb650cd1ecbdbc7d7fff.jpg",
739
+ "table_caption": [
740
+ "The design spirit for our robustness test is that if the models’ correct judgment relies on exploiting these spurious correlations, then such reliance will be broken in our perturbations. "
741
+ ],
742
+ "table_footnote": [],
743
+ "table_body": "<table><tr><td>N-Gram</td><td>PMI w/Non-Ent.Label</td><td>PMI w/Ent. Label</td><td>[Diff]</td></tr><tr><td>a cause</td><td>1.692209</td><td>-1.025611</td><td>2.717820</td></tr><tr><td>a cause for</td><td>1.663640</td><td>-0.983790</td><td>2.647430</td></tr><tr><td>A causes</td><td>1.640679</td><td>-0.951610</td><td>2.592289</td></tr><tr><td>A causes something</td><td>1.621820</td><td>-0.926075</td><td>2.547895</td></tr><tr><td>a direct</td><td>1.606052</td><td>-0.905316</td><td>2.511369</td></tr><tr><td>a direct one</td><td>1.592673</td><td>-0.888107</td><td>2.480781</td></tr><tr><td>forD</td><td>1.584826</td><td>-0.878180</td><td>2.463006</td></tr><tr><td>for D but</td><td>1.583897</td><td>-0.877014</td><td>2.460911</td></tr><tr><td>forE</td><td>1.582980</td><td>-0.875864</td><td>2.458844</td></tr><tr><td>for E but</td><td>1.582074</td><td>-0.874728</td><td>2.456802</td></tr></table>",
744
+ "page_idx": 15
745
+ },
746
+ {
747
+ "type": "text",
748
+ "text": "Table 11: PMI between the labels and n-grams. The labels include non-entailment (Non-Ent.) and entailment (Ent.). And the n-grams include all with no more than four words. The |Diff| column shows the absolute value of the difference between the PMIs with two labels. We show the top 10 n-grams with the largest differences of their PMIs with the two classes in the |Diff| column. ",
749
+ "page_idx": 15
750
+ },
751
+ {
752
+ "type": "text",
753
+ "text": "We can see that some spurious correlations are rooted in the framing of the hypothesis, such as “a cause (for)”, and “a direct (one)” (which we use the paraphrasing task to break), and others are connected to the variable names, such as “for D (but)” and “for E (but)” (which we use the variable refactorization to break). ",
754
+ "page_idx": 15
755
+ },
756
+ {
757
+ "type": "text",
758
+ "text": "F FINE-GRAINED ERROR ANALYSIS ",
759
+ "text_level": 1,
760
+ "page_idx": 15
761
+ },
762
+ {
763
+ "type": "text",
764
+ "text": "In addition to the fine-grained analysis by causal relation type in Table 6a for fine-tuned models, we also report such error analysis for non-finetuned models in Table 12. ",
765
+ "page_idx": 15
766
+ },
767
+ {
768
+ "type": "table",
769
+ "img_path": "images/4e275b944db254619c71f9717bf22c969c4a846c41b19f07558c03b567120704.jpg",
770
+ "table_caption": [
771
+ "Table 12: Fine-grained evaluation results for some selected non-fine-tuned models. "
772
+ ],
773
+ "table_footnote": [],
774
+ "table_body": "<table><tr><td>Selected Models</td><td>Relation Type</td><td>F1</td><td>Precision</td><td>Recall</td><td>Accuracy</td></tr><tr><td>GPT-3.5</td><td>All</td><td>21.69</td><td>17.79</td><td>27.78</td><td>69.46</td></tr><tr><td>GPT-3.5</td><td>Is-Parent</td><td>8.82</td><td>100</td><td>4.62</td><td>83.47</td></tr><tr><td>GPT-3.5</td><td>Is-Ancestor</td><td>0</td><td>0</td><td>0</td><td>90.67</td></tr><tr><td>GPT-3.5</td><td>Is-Child</td><td>9.84</td><td>100</td><td>5.17</td><td>85.33</td></tr><tr><td>GPT-3.5</td><td>Is-Descendant</td><td>14.29</td><td>11.9</td><td>17.86</td><td>84</td></tr><tr><td>GPT-3.5</td><td>Has-Collider</td><td>34.24</td><td>25.51</td><td>52.07</td><td>35.12</td></tr><tr><td>GPT-3.5</td><td>Has-Confounder</td><td>15.33</td><td>8.86</td><td>56.76</td><td>37.8</td></tr><tr><td>GPT-4</td><td>All</td><td>29.08</td><td>20.92</td><td>47.66</td><td>64.6</td></tr><tr><td>GPT-4</td><td>Is-Parent</td><td>0</td><td>0</td><td>0</td><td>82.67</td></tr><tr><td>GPT-4</td><td>Is-Ancestor</td><td>30.77</td><td>31.25</td><td>30.3</td><td>88</td></tr><tr><td>GPT-4</td><td>Is-Child</td><td>0</td><td>0</td><td>0</td><td>84.53</td></tr><tr><td>GPT-4</td><td>Is-Descendant</td><td>26.98</td><td>17.35</td><td>60.71</td><td>75.47</td></tr><tr><td>GPT-4</td><td>Has-Collider</td><td>44.1</td><td>30.18</td><td>81.82</td><td>32.71</td></tr><tr><td>GPT-4</td><td>Has-Confounder</td><td>20.67</td><td>11.53</td><td>100</td><td>23.86</td></tr><tr><td>RoBERTaMNLI</td><td>All</td><td>22.79</td><td>34.73</td><td>16.96</td><td>82.5</td></tr><tr><td>RoBERTaMNLI</td><td>Is-Parent</td><td>0</td><td>0</td><td>0</td><td>82.67</td></tr><tr><td>RoBERTaMNLI</td><td>Is-Ancestor</td><td>0</td><td>0</td><td>0</td><td>91.2</td></tr><tr><td>RoBERTaMNLI</td><td>Is-Child</td><td>0</td><td>0</td><td>0</td><td>84.53</td></tr><tr><td>RoBERTaMNLI</td><td>Is-Descendant</td><td>0</td><td>0</td><td>0</td><td>92.53</td></tr><tr><td>RoBERTaMNLI</td><td>Has-Collider</td><td>43.45</td><td>39.73</td><td>47.93</td><td>59.52</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RoBERTaMNLI</td><td>Has-Confounder</td><td>0</td><td>0</td><td>0</td><td>84.45</td></tr></table>",
775
+ "page_idx": 16
776
+ },
777
+ {
778
+ "type": "text",
779
+ "text": "These results are particularly revealing, showing how off-the-shelf models perform in recognizing specific relations. Specifically, GPT-3.5 cannot recognize ancestor relations, whereas GPT-4 fails at all direct causation recognition with parents and children. And RoBERTa MNLI only did collider relation relatively correctly. Note that, when the F1 score is zero, the accuracy number is a result of always predicting the negative class of that relation. ",
780
+ "page_idx": 16
781
+ },
782
+ {
783
+ "type": "text",
784
+ "text": "G LLM PERFORMANCE OPTIMIZATION ",
785
+ "text_level": 1,
786
+ "page_idx": 16
787
+ },
788
+ {
789
+ "type": "text",
790
+ "text": "Since our experiments in Section 4.2 are based on plain, zero-shot prompts, we explore whether better prompting strategies could improve the performance. We enhance the query prompt by incorporating several strategies: (1) Utilizing a system prompt that specifies the model’s expertise (“You are a highly intelligent question-answering bot with profound knowledge of causal inference.”); (2) Including a pair of few-shot examples, one positive and one negative; (3) Implementing chain-of-thought prompting with “Let’s think step by step.” to encourage the language model to generate step-by-step reasoning. In Table 13, we present the evaluation results on the relatively affordable model, GPT-3.5, where the optimized prompt leads to a 4-point improvement in F1 over the original performance. However, we can see that despite the deployment of all three strategies, the model continues to struggle with this challenging task. ",
791
+ "page_idx": 16
792
+ },
793
+ {
794
+ "type": "table",
795
+ "img_path": "images/05323d2fd75ae2a4449d1b430ef0f1f6bf101e2bf9ec1922ac44e6cbf9d6e38f.jpg",
796
+ "table_caption": [
797
+ "Table 13: Performance of GPT-3.5 with different queries. We quote the original performance from Table 4. "
798
+ ],
799
+ "table_footnote": [],
800
+ "table_body": "<table><tr><td></td><td>F1</td><td>Precision</td><td>Recall</td><td>Accuracy</td></tr><tr><td>GPT-3.5 (plain query; original)</td><td>21.69</td><td>17.79</td><td>27.78</td><td>69.46</td></tr><tr><td>GPT-3.5 (enhanced query)</td><td>25.44</td><td>17.29</td><td>48.11</td><td>52.01</td></tr></table>",
801
+ "page_idx": 16
802
+ }
803
+ ]
parse/test/vqIH0ObdqL/vqIH0ObdqL_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/vqIH0ObdqL/vqIH0ObdqL_model.json ADDED
The diff for this file is too large to render. See raw diff