LLM+m: 雙模型系統式ChatGPT 產品之對抗性攻擊和防禦的訓練和測試
LLM+m: Dual-model ChatGPT-based product training and testing with adversarial attack and defense
摘要
在大型語言模型中,ChatGPT 的能力已經在社會上引起很大的重視。而我們認為在未來會有很多的應用是建立在大型語言模型的能力下。而我們的研究在於利用ChatGPT(LLM) 去建立機器學習模型(m) 的產品,並且探討此種由LLM + m 所建立的雙模型系統的產品,在遇到對抗式攻擊與防禦後的效能。因此,我們建立三個基於ChatGPT 的機器學習模型產品在兩個領域中,分別是入侵偵測系統中的HIDS 和NIDS,與影像領域的影像辨識系統。而在建立雙模型系統時,我們透過大量的提示工程,並且採用兩個資料轉換的概念,將我們的資料集透過ChatGPT 轉換成預處理資料後,再透過ChatGPT 轉換成機器學習模型。此外,我們針對雙模型系統的產品做一系列完整的對抗式攻擊測試,利用催眠式攻擊,透過提示使得大型語言模型給予效能較差的回覆,並利用Adversarial Robustness Toolbox(ART) 上的傳統對抗式攻擊生成對抗式資料,直接降低機器學習模型的效能,以及合併兩種攻擊的組合式攻擊。最後,我們利用對抗式訓練和集成式模型來增強機器學習模型的效能,並且利用穩健性提示來使得大型語言模型不會被催眠式攻擊所催眠,進而給予正常的回覆。在實驗結果中,我們觀察到在基於ChatGPT 的HIDS、NIDS 和影像辨識系統中,面對到LLM vs m vs LLM+m 的對抗式攻擊,其F1 分數都是漸漸下降,這也代表著LLM+m 的組合式攻擊是需要被重視的,而組合式攻擊使得F1 分數與原始F1 分數相比分別下滑了50%、39% 和30%。而集成對抗式訓練模型與透過穩健性提示的防禦機制後,儘管最有效的組合式攻擊的F1 分數也只與原始F1 分數相差5% 左右。這也代表著在雙模式模型下,防禦的機制是很重要的。
In large language models, the capabilities of ChatGPT have already attracted significant attention in society. We believe that many future applications will be built upon the capabilities of large language models. Our research focuses on utilizing ChatGPT (LLM) to develop products based on machine learning models (m) and exploring the performance of such dual-model system products (LLM + m) when encountering adversarial attacks and defenses. Therefore, we established three ChatGPT-based machine learning model products in two domains: HIDS and NIDS in the intrusion detection system domain, and an image classification system in the image domain. In the dual-model system creation, we used extensive prompt engineering and adopted two data transformation concepts. We transformed our datasets into preprocessed data through ChatGPT and then converted them into machine-learning models via ChatGPT. Additionally, we conducted a series of comprehensive adversarial attack tests on the dual-model system products. These included using hypnotic attacks to prompt the large language model to give weakened responses, generating adversarial data using traditional adversarial attacks from the Adversarial Robustness Toolbox(ART) to directly degrade the performance of the machine learning model, and combining both types of attacks. Finally, we enhanced the performance of the machine learning models through adversarial training and ensemble models, and we used robustness prompts to prevent the large language model from being influenced by hypnotic attacks, ensuring it provides normal responses. In the experimental results, we observed that the F1 scores gradually decreased when facing adversarial attacks on the LLM, m, and LLM + m in the ChatGPT-based HIDS, NIDS, and image classification systems. This indicates that the combined attacks of LLM + m need to be taken seriously, as they resulted in F1 score drops of 50%, 39%, and 30% respectively compared to the original F1 scores. However, after applying ensemble adversarial training models and robustness prompt defense mechanisms, the F1 scores of the most effective combined attacks were only about 5% lower than the original F1 scores. This also indicates that in dual-model systems, defense mechanisms are essential.