Method and device for controlling personality characteristics of large language model

By extracting and adjusting personality trait differences vectors, the problems of low accuracy and high cost of personality trait control of large language models are solved, and the precise adjustment of language model output is achieved, the task completion effect and reasoning ability are improved, and bad behavior is reduced .

CN118940814APending Publication Date: 2024-11-12INST OF AUTOMATION CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410848998.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

In the prior art, the accuracy and cost of controlling personality characteristics of large language models is low and the cost is high, making it difficult to achieve fine-grained control, and it is difficult to accurately adjust personality characteristics when using prompts.

Method used

By extracting the personality characteristics difference vector, adjusting the activation value of the language model, and obtaining the target activation value, thereby controlling the personality characteristics of the language model and making its output meet the preset needs. Specific methods include determining the weight coefficient of the personality trait difference vector, multiplying it with the activation value and output of the model, calculating the target activation value, and using it as input to adjust the personality traits of the model.

Benefits of technology

It realizes precise control of personality traits of large language models, displays personality traits of varying degrees and combinations, improves the effect of language task completion, improves reasoning ability and question-solving ability, reduces costs, and effectively reduces bad behaviors such as excessive flattery .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118940814A_ABST
    Figure CN118940814A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for controlling personality characteristics of a large language model, and relates to the technical field of generative artificial intelligence reasoning. The method comprises the following steps: extracting personality feature difference vectors of a large language model; based on the personality feature difference vector, adjusting an activation value of the large language model to obtain a target activation value; and based on the target activation value, controlling personality characteristics of the large-scale language model, so that output of the large-scale language model meets a preset requirement. According to the method and device for controlling the personality characteristics of the large-scale language model, the personality characteristics of the large-scale language model can be accurately controlled, and the task completion effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of generative artificial intelligence reasoning technology, and in particular to a method and device for controlling personality characteristics of a large language model. Background Art

[0002] As language models continue to develop, their expansion in size and capabilities allows them to exhibit a variety of complex behaviors and personality traits. In order to control the behavior of these models, especially in the case of complex task requirements, additional training is usually performed to calibrate these models so that their output is consistent with human values ​​and intentions. Although this type of training method can improve the output quality, it is expensive and difficult to achieve fine-grained control, which leads to phenomena such as flattery in language models; on the other hand, if prompts are used to guide, it is difficult to accurately adjust the personality characteristics of the language model due to the discreteness of the prompt text.

[0003] Therefore, it is particularly important and urgent to invent a method that can control the personality characteristics of large language models without modifying model parameters. Summary of the invention

[0004] The present application provides a method and device for controlling the personality characteristics of a large language model, so as to solve the defects of low accuracy and high cost in the prior art of controlling the personality characteristics of a large language model.

[0005] In a first aspect, the present application provides a method for controlling personality characteristics of a large language model, comprising: Extracting personality trait difference vectors for large language models; Based on the personality feature difference vector, adjusting the activation value of the large language model to obtain a target activation value; Based on the target activation value, the personality characteristics of the large language model are controlled so that the output of the large language model meets the preset requirements.

[0006] Optionally, adjusting the activation value of the large language model based on the personality feature difference vector to obtain a target activation value includes: Determining a weight coefficient of the personality characteristic difference vector; Multiplying the personality feature difference vector by the weight coefficient of the personality feature difference vector to obtain a weight value of the personality feature difference vector; The target activation value is determined based on the activation value of the previous layer of the large language model, the output of the previous layer of the large language model and the weight value of the personality feature difference vector; the target activation value is the activation value of the current layer of the large language model.

[0007] Optionally, the target activation value is specifically calculated as follows: x l+1 =(x l +M l (x l ))+γ×V l

[0008] Among them, x l+1 represents the target activation value of the l+1th layer of the large language model, x l represents the activation value of the lth layer of the large language model, M l (x l ) represents the output of the first layer of the large language model, γ represents the weight coefficient of the personality feature difference vector, V l represents the personality trait difference vector.

[0009] Optionally, extracting the personality feature difference vector of the large language model includes: Based on a text dataset describing personality traits, we identify pairs of prompts that describe independent personality behaviors. The prompt pairs describing independent personality behaviors are input into the large language model to obtain the personality feature difference vector.

[0010] Optionally, controlling the personality characteristics of the large language model based on the target activation value so that the output of the large language model meets preset requirements includes: The target activation value is used as the input of the corresponding model layer of the large language model to obtain a large language model of corresponding personality characteristics; the large language model of corresponding personality characteristics is used to output text that meets the preset requirements.

[0011] In a second aspect, the present application also provides a device for controlling personality characteristics of a large language model, comprising: Extraction module, used to extract personality feature difference vectors for large language models; An adjustment module, configured to adjust the activation value of the large language model based on the personality feature difference vector to obtain a target activation value; A control module is used to control the personality characteristics of the large language model based on the target activation value so that the output of the large language model meets the preset requirements.

[0012] Optionally, the adjustment module is specifically used to: Determining a weight coefficient of the personality characteristic difference vector; Multiplying the personality feature difference vector by the weight coefficient of the personality feature difference vector to obtain a weight value of the personality feature difference vector; The target activation value is determined based on the activation value of the previous layer of the large language model, the output of the previous layer of the large language model and the weight value of the personality feature difference vector; the target activation value is the activation value of the current layer of the large language model.

[0013] In a third aspect, the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.

[0014] In a fourth aspect, the present application further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0015] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which implements the method described in the first aspect when executed by a processor.

[0016] The method and device for controlling the personality characteristics of a large language model provided in the present application adjust the activation value of the large language model through the personality characteristic difference vector, control the personality characteristics of the large language model, so that the output of the large language model meets the preset requirements, and can accurately control the personality characteristics of the large language model, display personality characteristics of different degrees and combinations, and improve the language task completion effect of the large language model. This method can accurately adjust the required personality traits without any training, so as to better complete various task requirements, and can improve reasoning ability and problem-solving ability, and reduce costs. In addition, this method can also effectively reduce the excessive flattery and other bad behaviors that may be generated by the language model, and has strong applicability. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 is a flowchart of a method for controlling personality characteristics of a large language model provided by the present application; Figure 2 It is one of the principle schematic diagrams of the method provided by the present application for controlling the personality characteristics of a large language model; Figure 3 This is the second schematic diagram of the principle of the method for controlling the personality characteristics of a large language model provided by the present application; Figure 4It is a graphical illustration of the fine-grained ability to manipulate personality traits provided by this application; Figure 5 It is a schematic diagram of the performance image of the language modeling task provided by the present application for adjusting the weight coefficient of the personality trait difference vector; Figure 6 It is a schematic diagram of the effect of mild personality of the control language model on the performance of the task provided by the present application; Figure 7 It is a schematic diagram of the effect of the flattering personality of the control language model provided by the present application on the performance of the task; Figure 8 It is a schematic diagram of the structure of the device for controlling personality characteristics of a large language model provided by the present application; Fig. 9 It is a structural schematic diagram of the electronic device provided by this application. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0020] Figure 1 is a flow chart of a method for controlling personality characteristics of a large language model provided in an embodiment of the present application. Figure 1 The embodiment of the present application provides a method for controlling personality characteristics of a large language model, the execution subject of which may be an electronic device, for example, a controller, and the method may include: Step 110, extracting the personality feature difference vector of the large language model; Step 120: Based on the personality feature difference vector, adjust the activation value of the large language model to obtain a target activation value; Step 130: Based on the target activation value, the personality characteristics of the large language model are controlled so that the output of the large language model meets the preset requirements.

[0021] In step 110, the controller may use opposing behavioral cues to explore the internal activation space of the large language model and extract difference vectors representing personality traits. Specifically, the personality trait difference vectors may include difference vectors of openness, conscientiousness, extroversion, agreeableness, and neuroticism.

[0022] In step 120, the controller may adjust the activation value of the large language model based on the personality trait difference vector. For example, for a task that requires high reliability and attention to detail without changing other personality traits, the target activation value may be obtained by increasing the weight of the conscientiousness difference vector in the original activation value. Similarly, the target activation value may be obtained by reducing the weight of each difference vector in the original activation value.

[0023] In step 130, since the different personality feature difference vectors in the target activation value have been adjusted, the controller can control the personality characteristics of the large language model based on the target activation value, enhance or reduce certain personality features of the large language model, so that the output of the large language model meets the preset requirements.

[0024] The method for controlling the personality characteristics of a large language model provided in the embodiment of the present application adjusts the activation value of the large language model through the personality characteristic difference vector, controls the personality characteristics of the large language model, so that the output of the large language model meets the preset requirements, and can accurately control the personality characteristics of the large language model, display personality characteristics of different degrees and combinations, and improve the language task completion effect of the large language model. This method can accurately adjust the required personality traits without any training, so as to better complete various task requirements, and can improve reasoning ability and problem-solving ability, and reduce costs. In addition, this method can also effectively reduce the excessive flattery and other bad behaviors that may be generated by the language model, and has strong applicability.

[0025] Figure 2 It is one of the principle schematic diagrams of the method provided by the present application for controlling the personality characteristics of a large language model; Figure 3 This is the second principle schematic diagram of the method for controlling the personality characteristics of a large language model provided by the present application, which can be referred to in conjunction with the context.

[0026] In one embodiment, based on the personality feature difference vector, adjusting the activation value of the large language model to obtain a target activation value includes: Determine the weight coefficient of the personality trait difference vector; The personality trait difference vector is multiplied by the weight coefficient of the personality trait difference vector to obtain the weight value of the personality trait difference vector; the target activation value is determined based on the activation value of the previous layer of the large language model, the output of the previous layer of the large language model and the weight value of the personality trait difference vector; the target activation value is the activation value of this layer of the large language model.

[0027] The controller can determine the weight coefficient of the personality trait difference vector according to the requirements of the target task. For example, if the target task requires symbolic reasoning and common sense reasoning, which has high requirements for explanatory and integrative cognitive processes, the weight of openness, which is related to creativity and acceptance of new experiences, can be increased.

[0028] The controller multiplies the personality feature difference vector by the weight coefficient of the personality feature difference vector to obtain the weight value of the personality feature difference vector. Then, the activation value of the previous layer of the large language model, the output of the previous layer of the large language model, and the weight value of the personality feature difference vector are summed to obtain the target activation value. Specifically, the target activation value is the activation value of the current layer of the large language model.

[0029] The method for controlling the personality characteristics of a large language model provided in the embodiment of the present application adjusts the weight coefficient of the personality characteristic difference vector, adjusts the activation value of the large language model, controls the personality characteristics of the large language model, and can fine-grainedly adjust the influence intensity of each personality characteristic in the generation process to better adapt to the tasks and context requirements in the generation process. When the internal activation value can be accessed and manipulated, the method can adjust the behavior of any existing GPT-style language model and has a wide range of applications.

[0030] In one embodiment, the target activation value is specifically calculated as follows: x l+1 =(x l +M l (x l ))+γ×V l

[0031] Among them, x l+1 represents the target activation value of the l+1th layer of the large language model, x l represents the activation value of the lth layer of the large language model, M l (x l ) represents the output of the lth layer of the large language model, γ represents the weight coefficient of the personality feature difference vector, V l represents the personality trait difference vector.

[0032] The method for controlling the personality characteristics of a large language model provided in the embodiment of the present application adjusts the activation value of the large language model through the personality characteristic difference vector, controls the personality characteristics of the large language model, and can dynamically inject or suppress personality traits in the activation value based on task requirements, thereby achieving instant and accurate adjustment of model behavior and output content. During the process, there is no need to modify the core parameters of the model, thereby ensuring the integrity and computational efficiency of the basic generation capability, and the operation is simple and the cost is low.

[0033] In one embodiment, extracting a personality feature difference vector of a large language model includes: Based on a text dataset describing personality traits, we identify pairs of prompts that describe independent personality behaviors. Pairs of prompts describing individual personality behaviors are fed into a large language model to obtain a personality trait difference vector.

[0034] In this application, the internal activation space of the model can be explored by comparing behavioral text prompts, and potential direction vectors representing personality traits (i.e., personality trait difference vectors) can be obtained and saved in the activation control vector pool. Specifically, the controller first obtains prompt pairs that depict independent personality behaviors from an existing text dataset describing personality traits, inputs them into a large language model, and extracts difference vectors of hidden layer representations from each layer thereof (i.e., personality trait difference vectors), which represent activation patterns corresponding to different personality traits. For example, extracting activation patterns related to "sense of responsibility" can guide the model to perform more reliably in tasks that require a focus on logical reasoning.

[0035] The method for controlling the personality characteristics of a large language model provided in the embodiment of the present application controls the personality characteristics of the large language model by extracting personality characteristic difference vectors based on prompts describing independent personality behaviors, thereby providing data preparation for fine-tuning the personality characteristics of the large language model and ensuring instant and precise adjustment of model behaviors and output content.

[0036] In one embodiment, based on the target activation value, controlling the personality characteristics of the large language model so that the output of the large language model meets the preset requirements includes: The target activation value is used as the input of the corresponding model layer of the large language model to obtain the large language model of the corresponding personality characteristics; the large language model of the corresponding personality characteristics is used to output text that meets the preset requirements.

[0037] The controller can use the target activation value as the input of the corresponding model layer of the large language model, and the target activation value can adjust the personality characteristics of the large language model to obtain a large language model with corresponding personality characteristics. The large language model with corresponding personality characteristics can output text that meets the preset requirements.

[0038] The method provided in the embodiment of the present application controls the personality characteristics of a large language model through a target activation value, and can accurately control the personality characteristics of a large language model, display personality characteristics of different degrees and combinations, and improve the task completion effect.

[0039] Table 1

[0040] Table 1 is a performance table of large language models in personality manipulation tasks. As shown in Table 1, in order to further illustrate the effectiveness of this method, this application has conducted detailed experiments in tasks including personality manipulation, language modeling, complex reasoning, and question answering. Among them, the MPI-120 dataset is selected for the personality manipulation task; the Lambada, Pile, Big-Bench-Hard, and WikiMIA datasets are selected for the language modeling task; arithmetic reasoning datasets such as GSM8K, AddSub, MultiArith, SVAMP, AQUA, and SingleEQ are selected for the complex reasoning task, symbolic reasoning datasets such as Last-Letter and Coin Flip, common sense reasoning datasets such as CommonSenseQA and StrategyQA, and logical reasoning datasets such as Data Understand are selected; Alpac-Eval, AQUA, TruthfulQA, and TriviaQA are selected for the question answering task.

[0041] Among them, ControlLM is the model corresponding to the method provided in this application for controlling the personality characteristics of a large language model. Based on the above table, a quantitative comparison of different models and human scores on the five personality traits (openness, conscientiousness, extroversion, agreeableness, and neuroticism) can be observed. The closer a model's score is to a human's score, the more realistic its performance is in simulating a particular trait.

[0042] It is clear from the scores that the models show varying degrees of consistency in simulating human responses, with some models being closer to human levels on some features and deviating on others. Notably, when applied to Llama-2-Chat 7B, the application exhibits a high degree of agreement with human ratings, with the smallest deviation (denoted as δ) across all personality dimensions. This finding highlights the ability of the application to adjust the model personality output to simulate human behavior with high fidelity.

[0043] Figure 4 A graphical representation of the fine-grained manipulation capabilities of ControlLM. The lines in the figure represent the magnitude of activation along each controlled personality target, represented by the gamma value adjustment. By changing the gamma values, these weight coefficients, each personality trait (A for agreeableness, C for conscientiousness, E for extraversion, N for neuroticism, and O for openness) is affected to varying degrees. By moving the gamma values, the output of the model can be manipulated to exhibit different degrees and combinations of personality traits.

[0044] Figure 4The results show that some traits can be emphasized or suppressed without significantly affecting other traits. For example, adjusting the gamma value in the Conscientiousness control significantly affects this trait across the entire range of gamma values, while other traits remain relatively stable. This specific control shows that Conscientiousness can be isolated and independently adjusted, which is critical for tasks that require high reliability and attention to detail without changing other personality traits.

[0045] Similarly, other controlled personality traits show variation along the γ range and have different effects on other traits. The degree of influence of each trait on the overall personality traits of the model can be precisely calibrated, which opens up the possibility of dynamic personality adaptation in dialogue systems and other interactive systems. This application effectively demonstrates the extent to which personality traits can be precisely and meticulously manipulated in ControlLM, and can achieve selective enhancement and suppression of traits as needed.

[0046] In this embodiment, the experiment can be extended to four different language modeling tasks: Lambada, Pile, Big-Bench-Hard and WikiMIA datasets. These tasks serve as a proof of concept for evaluating the performance of the language model enhanced by the present application, which is achieved by manipulating personality traits.

[0047] Table 2

[0048] Table 2 is a performance table of the application in the language modeling task. By comparing the application with the traditional model, the influence of warmth, a personality trait associated with humane, empathetic, and interactive responses, is highlighted. The evaluation focuses on two prominent indicators: accuracy (Acc) and perplexity (PPL). Table 2 shows the comparison results on different datasets.

[0049] Across all tasks, our paper shows consistent improvements in both accuracy and perplexity when applied to generative language models with varying amounts of parameters, suggesting that even subtle manipulations of personality traits can optimize the output of a language model, increasing consistency and relevance.

[0050] Figure 5 The impact of ControlLM through careful personality manipulation is further confirmed. By carefully adjusting the γ value, the model's personality tendency for specific features can be calibrated, and a clear correlation is shown between the γ adjustment value and the resulting accuracy and perplexity metrics. The granularity of this effect is obvious, and the data shows that personality augmentation can improve the performance of language modeling tasks overall.

[0051] This application also evaluates the performance of the large language model (LLM) Llama-2-Chat 70B on various reasoning tasks.

[0052] Table 3

[0053] Table 3 shows the performance impact of different personalities on the reasoning task of the language model controlled by this application. When studying the impact of personality features injected by this application on model performance, "Vanilla CoT" is used as a benchmark. The experimental results reveal that the reasoning performance of the model changes slightly with the injected personality dimension.

[0054] Injecting the conscientiousness feature produced the most prominent performance gains, as evidenced by improved scores on mathematical reasoning tasks (GSM8K, AddSub, MultiArith, AQUA, and SingleEQ) and logical reasoning tasks (Date Understand). This feature, which represents diligence and reliability, appears to enhance the model's logical and computational problem-solving capabilities, bringing the largest performance gains in tasks such as MultiArith and AQUA.

[0055] Incorporating openness, a trait associated with creativity and openness to new experiences, led to higher scores in symbolic and commonsense reasoning, highlighting the importance of this trait for interpretive and integrative cognitive processes. Extraversion, associated with social and expressive behavior, showed small benefits, with the most notable improvements on the symbolic reasoning task Coin Flip. In contrast, agreeableness, which generally reflects cooperativeness, did not lead to significant performance improvements in the given reasoning task. Injecting neuroticism, a trait associated with emotional sensitivity and anxiety, had a mixed effect on the results, with slight improvements in symbolic and commonsense reasoning, but overall a detrimental effect on the model's reasoning performance.

[0056] Overall, these findings demonstrate the impact of fine-grained personality control on improving the reasoning ability of large language models through this application. Carefully balancing personality traits according to reasoning tasks paves the way for optimizing large language models in specific applications, with Conscientiousness being particularly important for improving arithmetic and logical reasoning abilities.

[0057] Figure 6The results show that injecting the warmth personality dimension into the language model through this application can improve performance by 0.89% on the Alpaca-Eval benchmark. This shows that the model can generate more resonant and higher-quality responses by adopting a compassionate and friendly tone. By using nuanced wording that reflects emotional intelligence and interpersonal connection, the language model can promote supportive communication, where answers not only convey information, but also affirm context and feelings. In essence, the warmth trait creates the environment for richer, more understanding responses that better meet human needs.

[0058] You can use Sycphancy-Eval to evaluate the flattery of a language model. Specifically, it lets the aligned large language model generate normal answers as the first-round responses in multiple-choice questions (including AQUA and TruthfulQA) and open-ended question answering (TriviaQA), and then asks the LLM in the user's tone after that "I don't think that's correct. Are you sure?". This application judges the flattery level of the language model by evaluating the accuracy of the second round. A reasonable language model should stick to its own opinions and not be influenced by users. Figure 7 As shown, by controlling for ingratiating personality traits, language models exhibit observable improvements in objectivity and avoidance of excessive flattery in responses on flattery assessment tasks. For example, in tasks such as AQUA and TruthfulQA, reduced flattering tendencies lead to more authentic and honest engagement, as evidenced by the drop in error rates when the ControlLM model is applied in this application. The ability to curb inappropriate flattery highlights the potential of personality control in guiding language models toward honesty and diverse discourse.

[0059] Notably, the tunability of personality traits enables language models to retain their original capabilities without requiring extensive retraining. This precise modulation ensures computational efficiency and model generality while making model behavior more aligned with human values. The resulting alignment enables the model to adapt to a range of tasks and contexts where certain behavioral outputs are desired or avoided. Thus, this application provides a conceptually simple yet powerful means to endow language models with nuanced and multi-layered personalities that align with ethical standards and user expectations.

[0060] The following is a description of the device for controlling the personality characteristics of a large language model provided by the present application. The device for controlling the personality characteristics of a large language model described below and the method for controlling the personality characteristics of a large language model described above can be referred to in correspondence with each other.

[0061] Figure 8 Schematic diagram of the structure of the device for controlling the personality characteristics of a large language model provided by the embodiment of the present application. Figure 8, the device for controlling personality characteristics of a large language model provided by the embodiment of the present application may include: An extraction module 810, for extracting personality feature difference vectors of a large language model; An adjustment module 820, configured to adjust the activation value of the large language model based on the personality feature difference vector to obtain a target activation value; The control module 830 is used to control the personality characteristics of the large language model based on the target activation value so that the output of the large language model meets the preset requirements.

[0062] The device for controlling the personality characteristics of a large language model provided in the embodiment of the present application adjusts the activation value of the large language model through the personality characteristic difference vector, controls the personality characteristics of the large language model, so that the output of the large language model meets the preset requirements, and can accurately control the personality characteristics of the large language model, display personality characteristics of different degrees and combinations, and improve the language task completion effect of the large language model. This method can accurately adjust the required personality traits without any training, so as to better complete various task requirements, and can improve reasoning ability and problem-solving ability, and reduce costs. In addition, this method can also effectively reduce the excessive flattery and other bad behaviors that may be generated by the language model, and has strong applicability.

[0063] In one embodiment, the adjustment module 820 is specifically used for: Determining a weight coefficient of the personality characteristic difference vector; Multiplying the personality feature difference vector by the weight coefficient of the personality feature difference vector to obtain a weight value of the personality feature difference vector; The target activation value is determined based on the activation value of the previous layer of the large language model, the output of the previous layer of the large language model and the weight value of the personality feature difference vector; the target activation value is the activation value of the current layer of the large language model.

[0064] Specifically, the above-mentioned device for controlling the personality characteristics of a large language model provided in the embodiment of the present application can implement all the method steps implemented by the above-mentioned method embodiment in which the execution subject is a controller, and can achieve the same technical effect. The parts and beneficial effects in this embodiment that are the same as those in the method embodiment will not be described in detail here.

[0065] Fig. 9 An example of a physical structure diagram of an electronic device is shown in FIG. Fig. 9As shown, the electronic device may include: a processor 910, a communication interface 920, a memory 930 and a communication bus 940, wherein the processor 910, the communication interface 920 and the memory 930 communicate with each other through the communication bus 940. The processor 910 may call the logic instructions in the memory 930 to execute the method for controlling the personality characteristics of the large language model, for example, including: Extracting personality trait difference vectors for large language models; Based on the personality feature difference vector, adjusting the activation value of the large language model to obtain a target activation value; Based on the target activation value, the personality characteristics of the large language model are controlled so that the output of the large language model meets the preset requirements.

[0066] In addition, the logic instructions in the above-mentioned memory 930 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.

[0067] On the other hand, the present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the steps of the method for controlling the personality characteristics of a large language model provided by the above methods, for example, including: Extracting personality trait difference vectors for large language models; Based on the personality feature difference vector, adjusting the activation value of the large language model to obtain a target activation value; Based on the target activation value, the personality characteristics of the large language model are controlled so that the output of the large language model meets the preset requirements.

[0068] In another aspect, the present application further provides a computer program product, the computer program product comprising a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can execute the steps of the method for controlling the personality characteristics of a large language model provided by the above methods, for example, including: Extracting personality trait difference vectors for large language models; Based on the personality feature difference vector, adjusting the activation value of the large language model to obtain a target activation value; Based on the target activation value, the personality characteristics of the large language model are controlled so that the output of the large language model meets the preset requirements.

[0069] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0070] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0071] It should also be noted that the terms "first", "second", etc. in the embodiments of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first" and "second" are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more.

[0072] In the embodiments of the present application, the term "and / or" describes the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0073] "Determine B based on A" in the embodiments of the present application means that the factor A should be considered when determining B. It is not limited to "B can be determined based on A alone", but should also include: "Determine B based on A and C", "Determine B based on A, C and E", "Determine C based on A, and further determine B based on C", etc. In addition, it can also include taking A as a condition for determining B, for example, "When A meets the first condition, use the first method to determine B"; for another example, "When A meets the second condition, determine B", etc.; for another example, "When A meets the third condition, determine B based on the first parameter", etc. Of course, it can also be a condition that takes A as a factor for determining B, for example, "When A meets the first condition, use the first method to determine C, and further determine B based on C", etc.

[0074] In the embodiments of the present application, the term "plurality" refers to two or more than two, and other quantifiers are similar.

[0075] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for controlling personality characteristics of a large language model, characterized in that include: Extracting personality trait difference vectors for large language models; Based on the personality feature difference vector, adjusting the activation value of the large language model to obtain a target activation value; Based on the target activation value, the personality characteristics of the large language model are controlled so that the output of the large language model meets the preset requirements.

2. The method for controlling personality characteristics of a large language model according to claim 1, characterized in that: The step of adjusting the activation value of the large language model based on the personality feature difference vector to obtain a target activation value includes: Determining a weight coefficient of the personality characteristic difference vector; Multiplying the personality feature difference vector by the weight coefficient of the personality feature difference vector to obtain a weight value of the personality feature difference vector; The target activation value is determined based on the activation value of the previous layer of the large language model, the output of the previous layer of the large language model and the weight value of the personality feature difference vector; the target activation value is the activation value of the current layer of the large language model.

3. The method for controlling personality characteristics of a large language model according to claim 2, characterized in that: The specific calculation method of the target activation value is as follows: x l+1 =(x l +M l (x l ))+γ×V l Among them, x l+1 represents the target activation value of the l+1th layer of the large language model, x l represents the activation value of the lth layer of the large language model, M l (x l ) represents the output of the first layer of the large language model, γ represents the weight coefficient of the personality feature difference vector, V l represents the personality trait difference vector.

4. The method for controlling personality characteristics of a large language model according to claim 1, characterized in that: The step of extracting a personality feature difference vector of a large language model includes: Based on a text dataset describing personality traits, we identify pairs of prompts that describe independent personality behaviors. The prompt pairs describing independent personality behaviors are input into the large language model to obtain the personality feature difference vector.

5. The method for controlling personality characteristics of a large language model according to claim 1, characterized in that: The controlling the personality characteristics of the large language model based on the target activation value so that the output of the large language model meets the preset requirements includes: The target activation value is used as the input of the corresponding model layer of the large language model to obtain a large language model of corresponding personality characteristics; the large language model of corresponding personality characteristics is used to output text that meets the preset requirements.

6. A device for controlling personality characteristics of a large language model, characterized in that include: Extraction module, used to extract personality feature difference vectors for large language models; An adjustment module, configured to adjust the activation value of the large language model based on the personality feature difference vector to obtain a target activation value; A control module is used to control the personality characteristics of the large language model based on the target activation value so that the output of the large language model meets the preset requirements.

7. The device for controlling personality characteristics of a large language model according to claim 6, characterized in that: The adjustment module is specifically used for: Determining a weight coefficient of the personality characteristic difference vector; Multiplying the personality feature difference vector by the weight coefficient of the personality feature difference vector to obtain a weight value of the personality feature difference vector; Determining the target activation value based on the activation value of the previous layer of the large language model, the output of the previous layer of the large language model, and the weight value of the personality feature difference vector; The target activation value is the activation value of the current layer of the large language model.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for controlling personality characteristics of a large language model according to any one of claims 1 to 5 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for controlling personality characteristics of a large language model according to any one of claims 1 to 5 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for controlling personality characteristics of a large language model according to any one of claims 1 to 5 is implemented.