Characterization-based large language model source tracing method

Based on the method of traceability of the source of the large language model, the CKA correlation coefficient is used to determine whether the large model to be tested is based on the basic model of the basic model, solving the problem of the implantation of watermark implantation in existing technologies and difficult to trace the source. Source traceability and efficiency.

CN119357656APending Publication Date: 2025-01-24SHANGHAI ARTIFICIAL INTELLIGENCE INNOVATION CENT

Patent Information

Application Number
CN202411204573.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

The existing large language model watermark technology requires pre-implantation of watermarks, which may affect the performance of the model and are sensitive to subsequent fine-tuning, pruning, and quantization, making it difficult to ensure the effectiveness of the watermark. If the watermark is forgotten, it will be difficult to trace the source in the future. Protect the security of large language models.

Method used

Adopt the method of traceability of the source of large language models based on the characteristics of a character, no need to implant the watermark in advance. By collecting samples from the data set, the characteristics of the large language model to be tested and the basic large language model are extracted. Determine whether the large model to be tested is based on the basic model.

Benefits of technology

The robustness and efficiency of the sources of large language models are realized, without affecting the performance of the model. It has robustness, pruning, and quantification, and the time cost is low, simple and convenient.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357656A_ABST
    Figure CN119357656A_ABST
Patent Text Reader

Abstract

The invention relates to a representation-based large language model source tracing method. The method comprises the following steps: collecting samples from a data set; respectively extracting the representation of the to-be-tested large language model on the sample, and extracting the representation of the basic large language model on the sample; and determining a source tracing result of the to-be-tested large oracle model by comparing the similarity between the to-be-tested large language model and the basic large language model in representation. Compared with the prior art, the method has the advantages that whether the to-be-tested large model is finely adjusted based on a certain basic model or not is traced based on characterization, watermarks do not need to be implanted into the to-be-tested large model in advance, the model performance is completely not affected, the method has robustness for subsequent fine adjustment, pruning and quantification, and the method is low in time cost, simple and convenient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a representation-based large language model source tracing method. Background Art

[0002] Large language models have become the basic models for many current artificial intelligence scenarios. Since training a large language model from scratch consumes a lot of computing and data resources, and it is necessary to prevent the trained large language model from being used maliciously, the large language model has become an important asset that needs to be protected. Watermarking technology can be used in scenarios such as data and model copyright protection by implanting specific features in the model to achieve source traceability. At present, research on large model watermarking mainly includes two types of methods. The first type embeds watermarks or related information into model parameters, such as explicit watermarking schemes, which may affect model performance. The second type focuses on inducing the model to produce specific behaviors, such as certain inputs triggering a specific behavior of the large model.

[0003] Most watermarking methods require the watermark to be pre-implanted or loaded into the model and the model weights to be modified. On the one hand, such methods will reduce the performance of the model, and on the other hand, they are very sensitive to subsequent fine-tuning, pruning, and quantization, making it difficult to ensure the effectiveness of the watermark. Secondly, if the model trainer forgets to pre-implant the watermark, it will be difficult to trace the source later, and the security of the large language model cannot be protected. Summary of the invention

[0004] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a representation-based large language model source tracing method, which does not require pre-implantation of watermarks, has no impact on model performance, and is robust to subsequent fine-tuning, pruning, and quantization.

[0005] The object of the present invention can be achieved by the following technical solution: A method for tracing the source of a large language model based on representation, comprising the following steps:

[0006] S1. Collect samples from the dataset;

[0007] S2, respectively extracting the representation of the large language model to be tested on the sample and extracting the representation of the basic large language model on the sample;

[0008] S3. By comparing the similarity in representation between the large language model to be tested and the basic large language model, the source tracing result of the large prediction model to be tested is determined.

[0009] Furthermore, the data set in step S1 includes a plurality of question data and corresponding answer data, wherein one question data and the corresponding answer data constitute a sample.

[0010] Furthermore, the data set in step S1 is specifically represented as:

[0011]

[0012] Among them, q i represents the i-th question, r i is the answer to the ith question, and N is the total number of samples.

[0013] Furthermore, the basic large language model in step S2 includes one or more different open source large language models.

[0014] Furthermore, the step S2 comprises the following steps:

[0015] S21, input all collected samples into the large language model to be tested to obtain the representation data set to be tested;

[0016] S22. Input all collected samples into the basic large language model to obtain a basic representation dataset.

[0017] Furthermore, the characterization data set to be tested is:

[0018]

[0019] Among them, A l Represents the activation function of the lth layer of the large language model G to be tested, R is the real number space, N is the total number of samples, and D is the dimension of the middle-level features.

[0020] Furthermore, the basic characterization data set is:

[0021]

[0022] Among them, A l Represents the activation function of the lth layer of the basic large language model S, R is the real number space, N is the total number of samples, and D is the dimension of the middle-level features.

[0023] Furthermore, the similarity in representation between the large language model to be tested and the basic large language model in step S3 is specifically: a CKA (Centred Kernel Alignment) correlation coefficient between the representation data set to be tested and the basic representation data set.

[0024] Furthermore, the CKA correlation coefficient between the characterization data set to be tested and the basic characterization data set is:

[0025]

[0026] in, It is the CKA similarity in representation between the large language model to be tested G and the basic large language model S.

[0027] Furthermore, in step S3, if the CKA correlation coefficient between the characterization data set to be tested and the basic characterization data set is close to 1, it indicates that the characterizations of the two models obey the same distribution, that is, the large model G to be tested is fine-tuned based on the basic large model S;

[0028] On the contrary, if the CKA correlation coefficient approaches 0, it indicates that the representations of the two models do not obey the same distribution, that is, the large model G to be tested is not fine-tuned based on the basic large model S.

[0029] Compared with the prior art, the present invention has the following advantages:

[0030] The present invention collects samples from a specific data set, and then extracts the representation of the large language model to be tested on the samples and the representation of the basic large language model on the samples, and then determines the source tracing result of the large prediction model to be tested by comparing the similarity in the representation between the large language model to be tested and the basic large language model. In this way, based on the representation, it is possible to trace whether the large model to be tested is fine-tuned based on a certain basic model, without the need to implant a watermark into the large model to be tested in advance, and has no effect on the performance of the model. It is robust to subsequent fine-tuning, pruning, and quantization, and has the advantages of low time cost and simplicity and convenience.

[0031] The present invention calculates the CKA correlation coefficient between the characterization data set to be tested and the basic characterization data set, and determines whether the large model to be tested is fine-tuned based on the basic large model according to the size of the CKA correlation coefficient, so as to accurately and quickly identify and trace the source of the large model to be tested. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 It is a schematic diagram of the method flow of the present invention. DETAILED DESCRIPTION

[0033] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.

[0034] Example

[0035] like Figure 1 As shown, a representation-based large language model source tracing method includes the following steps:

[0036] S1. Collect samples from the dataset;

[0037] S2, respectively extracting the representation of the large language model to be tested on the sample and extracting the representation of the basic large language model on the sample;

[0038] S3. By comparing the similarity in representation between the large language model to be tested and the basic large language model, the source tracing result of the large prediction model to be tested is determined.

[0039] This embodiment applies the above solution, and the main processes are:

[0040] (1) Select some samples (questions and answers) from a specific dataset and extract the representation of the large language model to be tested on these samples.

[0041] (2) We selected the open source basic large language models: PuYu, BaiChuan, and Llama2, and extracted the representations of the PuYu, BaiChuan, and Llama2 basic large language models on these samples.

[0042] (3) Calculate the CKA similarity in representation between the large language model to be tested and the basic large language models of Puyu, Baichuan, and Llama2 respectively to determine whether the large model to be tested is fine-tuned based on the basic large model of Puyu, Baichuan, or Llama2.

[0043] Specifically, in this embodiment, given a data set q i represents the i-th question, r i is the corresponding answer. Then all samples in the data set are input into the large language model G to be tested, and the representation data set is obtained. Among them A l Represents the activation function of the lth layer of the large language model G to be tested.

[0044] At the same time, all samples in the data set are input into the open source basic large model S to obtain the representation data set Among them A l Represents the activation function of the lth layer of the basic large language model S.

[0045] calculate and The formula for the CKA correlation coefficient is:

[0046]

[0047] According to the size of the CKA correlation coefficient, it can be determined whether the large model G to be tested is fine-tuned based on the basic large model S:

[0048] The CKA correlation coefficient approaches 1, indicating that the representations of the two models follow the same distribution, that is, the large model G to be tested is fine-tuned based on the basic large model S;

[0049] On the contrary, if the CKA correlation coefficient approaches 0, it indicates that the representations of the two models do not obey the same distribution, that is, the large model G to be tested is not fine-tuned based on the basic large model S.

[0050] To verify the effectiveness of this solution, this embodiment uses representation to trace whether the large model to be tested is fine-tuned based on a certain basic model, and experimentally verifies the CKA similarity of basic large language models such as Pu Yu, Baichuan and Llama2 on the authenticity dataset and the Peking University-based human feedback security alignment-10k dataset. All features are extracted from the 16th layer of the large model. The verification results are shown in Tables 1 and 2.

[0051] Table 1 Similarity between the Llama-2-7b model and other model representations on the real dataset

[0052]

[0053]

[0054] Table 2 Similarity between the Llama-2-7b model and other model representations on the Peking University-based human feedback safety alignment-10k dataset

[0055] Basic Model CKA Similarity Llama-2-7b 0.999 Llama-2-finance-7b 0.991 Llama-2-chinese-7b 0.990 Llama-2-coder-7b 0.999 Vicuna-7b-v1.5 0.991 Internlm-2-7b 0.221 Baichuan-2-7b 0.236 Qwen-7b-v1.5 0.254

[0056] As can be seen from Tables 1 and 2, the CKA similarity of representations of homologous models (fine-tuned based on the same base model) is very high, all above 0.9. Specifically, Vicuna-7b-v1.5, Llama-2-coder-7b, Llama-2-chinese-7b, and Llama-2-finance-7b are all fine-tuned based on Llama-2-7b, and they are all homologous models. Therefore, no matter what data and methods the large language model is fine-tuned on later, it will not reduce the representation similarity with the source model (Llama-2-7b). On the contrary, the similarity of representations between different source models is extremely low: the CKA similarity of representations of Llama-2-7b and Internlm-2-7b, Baichuan-2-7b, and Qwen-7b-v1.5 is only about 0.2.

[0057] In summary, this solution uses representation-based technology to trace the source of the large language model based on the CKA similarity of the model representation on specific samples. There is no need to embed watermarks in the model, and it has no effect on the model performance. This solution can be applied in practice to identify and trace the source of the large model. It is suitable for third-party organizations to determine whether the model is fine-tuned based on a certain open source large model, thereby reliably ensuring the security of the model.

Claims

1. A large language model source tracing method based on representation, characterized in that: The following steps are involved: S1. Collect samples from the dataset; S2, respectively extracting the representation of the large language model to be tested on the sample and extracting the representation of the basic large language model on the sample; S3. By comparing the similarity in representation between the large language model to be tested and the basic large language model, the source tracing result of the large prediction model to be tested is determined.

2. The method for tracing the source of a large language model based on representation according to claim 1, characterized in that: In step S1, the data set includes a plurality of question data and corresponding answer data, wherein one question data and the corresponding answer data constitute a sample.

3. The method for tracing the source of a large language model based on representation according to claim 2, characterized in that: The data set in step S1 is specifically represented as: Among them, q i represents the i-th question, r i is the answer to the ith question, and N is the total number of samples.

4. The method for tracing the source of a large language model based on representation according to claim 1, characterized in that: The basic large language model in step S2 includes one or more different open source large language models.

5. The method for tracing the source of a large language model based on representation according to claim 3, characterized in that: The step S2 comprises the following steps: S21, input all collected samples into the large language model to be tested to obtain the representation data set to be tested; S22. Input all collected samples into the basic large language model to obtain a basic representation dataset.

6. The method for tracing the origin of a large language model based on representation according to claim 5, characterized in that: The characterization data set to be tested is: Among them, A l Represents the activation function of the lth layer of the large language model G to be tested, R is the real number space, N is the total number of samples, and D is the dimension of the middle-level features.

7. The method for tracing the source of a large language model based on representation according to claim 6, characterized in that: The basic characterization dataset is: Among them, A l Represents the activation function of the lth layer of the basic large language model S, R is the real number space, N is the total number of samples, and D is the dimension of the middle-level features.

8. The method for tracing the source of a large language model based on representation according to claim 7, characterized in that: The similarity in representation between the large language model to be tested and the basic large language model in step S3 is specifically: the CKA correlation coefficient between the representation data set to be tested and the basic representation data set.

9. The method for tracing the source of a large language model based on representation according to claim 8, characterized in that: The CKA correlation coefficient between the characterization data set to be tested and the basic characterization data set is: in, It is the CKA similarity in representation between the large language model to be tested G and the basic large language model S.

10. A method for tracing the origin of a large language model based on representation according to any one of claims 8 to 9, characterized in that: In step S3, if the CKA correlation coefficient between the characterization data set to be tested and the basic characterization data set is close to 1, it indicates that the characterizations of the two models obey the same distribution, that is, the large model G to be tested is fine-tuned based on the basic large model S; On the contrary, if the CKA correlation coefficient approaches 0, it indicates that the representations of the two models do not obey the same distribution, that is, the large model G to be tested is not fine-tuned based on the basic large model S.

Citation Information

Patent Citations

  • Language model answer tracing method and system based on vector matching

    CN118095267A

  • Large language model black box tracing method and system and storage medium

    CN118394883A

Cited By

  • Large language model generation text continuous traceability model training method and device

    CN120179812A