Views
No views yet
| Parameter | Value |
|---|---|
| LoRA Rank | 16 |
| LoRA Alpha | 32 |
| Target Modules | q_proj, v_proj |
| Training Data | PersonalityCafe forum (8,675 users, 50 posts each) |
| Training Samples | 9,418 (after SMOTE oversampling for class balance) |
| Optimizer | AdamW (8-bit) |
| Learning Rate | 1e-4 |
| Batch Size | 8 (effective) |
| Epochs | 3 (with early stopping) |
| Hardware | NVIDIA H200 (Lightning AI) |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3
4# Load base model (4-bit)
5base_model = AutoModelForCausalLM.from_pretrained(
6 "unsloth/DeepSeek-R1-Distill-Llama-8B-unsloth-bnb-4bit",
7 device_map="auto",
8 torch_dtype="float16",
9)
10
11# Attach fine-tuned adapter
12model = PeftModel.from_pretrained(base_model, "OmarGamal488/P2P-DeepSeek-R1-8B-MBTI-LoRA")
13tokenizer = AutoTokenizer.from_pretrained("OmarGamal488/P2P-DeepSeek-R1-8B-MBTI-LoRA")
14
15# Predict MBTI
16prompt = """Below is an instruction that describes a task. Write a response that appropriately completes the request.
17
18### Instruction:
19Predict the 4-letter Myers-Briggs personality type of the user from their social-media posts. Return only four uppercase letters.
20
21### Input:
22love debate theory logic prefer alone question everything analyze pattern fascinated philosophy
23
24### Response:
25"""
26
27inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
28outputs = model.generate(**inputs, max_new_tokens=10, do_sample=False)
29print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
30# Output: INTPUser Posts --> [This Model] --> Personality Features + Hidden States
|
v
FAISS (k=5 RAG)
|
v
[DeepSeek-V3 API] --> 4-letter MBTI Type| Type | Count | Type | Count |
|---|---|---|---|
| INFP | 1,832 | ISFP | 271 |
| INFJ | 1,470 | ENTJ | 231 |
| INTP | 1,304 | ISTJ | 205 |
| INTJ | 1,091 | ENFJ | 190 |
| ENTP | 685 | ISFJ | 166 |
| ENFP | 675 | ESTP | 89 |
| ISTP | 337 | ESFP | 48 |
| ESFJ | 42 | ||
| ESTJ | 39 |
1@inproceedings{ma2025p2p,
2 title={From Post To Personality: Harnessing LLMs for MBTI Prediction in Social Media},
3 author={Ma, Tian and Feng, Kaiyu and Rong, Yu and Zhao, Kangfei},
4 booktitle={Proceedings of the 34th ACM International Conference on Information and Knowledge Management},
5 year={2025},
6 publisher={ACM}
7}