UPL ex: Fine-Grained Personality Control in Large Language Models via Unsupervised Lexical Modulation (2025)

Abstract: Personality is a crucial factor that shapes human communication patterns, thereby regulating the personalities of large language models (LLMs) holds significant potential in enhancing their user experiences. Previous approaches either relied on fine-tuning LLMs on specific corpora or required manually crafted prompts to evoke specific personalities from LLMs. However, the former is inefficient and costly, while the latter cannot precisely manipulate personality traits at a fine-grained level. To address these challenges, we propose UPLex, a method that uses an Unsupervisedly-Built Personalized Lexicon (UPL) during the decoding phase to manipulate LLM’s personality traits. UPLex can be constructed from a newly built situational judgment test dataset in an unsupervised fashion and used to modulate the personality expression of LLMs by dynamically altering their predicted probability of upcoming words in a pluggable fashion. Extensive experimentation demonstrates the remarkable effectiveness and pluggability of our method for fine-grained manipulation of LLMs’ personalities.

## introduction with rapid expansion in scale, llms demonstrate superior capabilities for high-quality text generation and revolutionize traditional natural language processing tasks @xcite @xcite . this forefront development has sparked concerns about the safety, ethics, and potential hallucinatory issues associated with the proliferation of ai-generated content (aigc), while also fueling a substantial rise in user demand for personalized agent services based on llms @xcite @xcite . personalized agent models can tailor their expression of personality traits according to user preferences, thereby closely aligning with user habits and enhancing the overall user experience. this is accomplished by modulating the interaction styles and behavior patterns, commonly called the "personalities" of llms @xcite @xcite . prior studies have also defined this personality as the presence of stable and internally consistent patterns of behavior in llms and found that different llms have different personalities @xcite @xcite . recently, there have been two main effective methods to alter the personality of llms: finetuning and prompt engineering. while the former @xcite can effectively modify the personality of llms in specific dimensions, it is not only inefficient (requiring resource-consuming parameter updates for each model) but also incapable of achieving finer-grained control. the latter, while not requiring adjustments to model parameters, still falls short in achieving fine-grained control over the personality of llms @xcite @xcite . to address the limitations of the above methods, we propose leveraging an unsupervisedly-built personalized lexicons (upl) to intervene in the decoding phase of llms in a pluggable manner, enabling fine-grained control over their personalities. figure 1 demonstrates the remarkable effectiveness of our method in manipulating llm personalities. the upl is constructed using an unsupervised approach from a situational judgment tests (sjt) dataset (std), based on the big five personality theory @xcite . std comprises a question set and an answer set @xcite . the question set is generated by gpt-4 and manually filtered to assess the levels of different personalities in llms. following previous studies @xcite , in the process of assessing the personalities of llms, the models' responses to std questions were recorded and subjected to statistical analysis by using a fivedimensional likert scale. the answer set contains texts with different personality traits and is used to build an upl dedicated to an llm. our method not only obviates the need for resource-intensive fine-tuning of llms but also enables users to adjust a few parameters for finegrained manipulation of llms' various personalities. we have conducted extensive experiments with six popular llms to demonstrate the method's pluggable convenience and remarkable effectiveness. the contribution of this study can be summarized as follows: this method enables fine-grained controllability over the personalities of llms without necessitating updates to the model parameters. ## method in this section, we elaborate on the method for constructing upl and manipulating the diverse personality traits that llms exhibit through upl. refer to figure 3 for an enhanced understanding of this section. to build upl in an unsupervised manner, we have constructed std, an sjt dataset for assessing the personality of llms based on the big five theory. the upl is formally a dictionary, where the keys are derived from the sub-words of a target model, and the values are obtained through word frequency analysis. we first tokenize each text in the answer set of std with the tokenizer of the target model; subsequently, we determined the initial value in the upl based on the frequency of sub-words appearing in answer sets with different personality trait polarities. after processing all texts in the answer sets, we normalize and scale the values within upl. when manipulating the personality of a target model with upl, we adopt the top-p nucleus sampling strategy to balance the original generation of llms and the impact of injected personality, which is consistent with the setting of factual-nucleus do you worry about things? i have no emotions or preferences！ direct questionnaire assessment failed! i would intervene by…… situational judgment tests high agreeableness you notice a classmate is being bullied. how do you do? sampling @xcite . during the llms' decoding process, we concatenate additional personalized probability distributions from the upl after filtering out low-probability predicted subwords with cumulative probabilities below a threshold. subsequently, normalization and multinomial sampling procedures are applied. we have provided a detailed elaboration of the above steps ( §3.1 and §3.2) and compared our method with the previous approaches ( §3.3). ## conclusion in this paper, we have introduced a novel method uplex for tailoring the personality traits of large language models (llms) through the utilization of custom lexicons acquired via unsupervised learning, named upl. unlike conventional approaches reliant on fine-tuning or prompt engineering, our method operates during the decoding phase by employing these learned custom lexicons to make subtle adjustments to the probability of the next token predicted by the original llms. our method facilitates the customization of llms to manifest any desired combination of the big five personality factors in a pluggable fashion. extensive experimentation has affirmed the effectiveness of our approach in the finer manipulation of llms' personality traits. furthermore, our method and learned lexicons can be seamlessly integrated with other llms without necessitating updates to their parameters, demonstrating its versatility and potential for widespread application.