PersonaAgent with GraphRAG: Community-Aware Knowledge Graphs for Personalized LLM
Problem Statement
Standard LLMs lack the ability to consistently adapt to individual user preferences and historical behaviors, producing generic outputs that fail personalization tasks. Prior RAG methods retrieve documents in isolation without capturing relational or community-level patterns in user behavior. This work addresses the gap between flat retrieval approaches and richer, graph-structured contextual understanding needed for genuine personalization.
Key Novelty
- Construction of an LLM-derived Knowledge Graph index over user-relevant documents to capture structured relational information about user preferences and behaviors
- Graph-based community detection to identify and summarize clusters of related interaction patterns, enabling global preference signals to augment local user history
- Dynamic persona-aligned prompt engineering that fuses user-specific behavioral summaries from the KG with community-level knowledge for consistent agent persona maintenance
Evaluation Highlights
- On the LaMP benchmark, news categorization F1 improved by 11.1% and movie tagging F1 improved by 56.1% over prior methods
- Product rating prediction MAE reduced by 10.4% over prior methods on the LaMP benchmark, demonstrating improved regression-style personalization
Breakthrough Assessment
Methodology
- Step 1 — Graph Index Construction: An LLM processes user historical documents and interactions to extract entities and relationships, building a structured Knowledge Graph that represents the user's behavioral and preference landscape.
- Step 2 — Community Detection & Summarization: Graph community detection algorithms (e.g., Leiden or Louvain) are applied to the KG to identify clusters of related information; an LLM then summarizes each community into compact, semantically rich representations of collective preference patterns.
- Step 3 — Personalized Prompt Generation & Inference: At query time, relevant user-specific summaries and global community summaries are retrieved and combined into a dynamic persona-aligned prompt, which is fed to the LLM agent to generate outputs consistent with the user's persona.
System Components
The core LLM-powered agent that embodies a user's persona (profile, tastes, preferences) and generates personalized responses based on dynamically constructed prompts
Processes user historical documents using an LLM to extract entities, relations, and build a structured graph index capturing user behavioral patterns
Applies graph community detection to the KG to identify clusters of semantically related user interactions and preference patterns
Uses an LLM to generate concise natural language summaries of each detected community, encoding collective knowledge for retrieval
Combines user-specific KG summaries with relevant community-level summaries at inference time to construct context-rich, persona-aligned prompts for the LLM
Results
| Metric/Benchmark | Prior Best Baseline | PersonaAgent (This Paper) | Delta |
|---|---|---|---|
| LaMP News Categorization (F1) | Baseline F1 | +11.1% relative | +11.1% F1 |
| LaMP Movie Tagging (F1) | Baseline F1 | +56.1% relative | +56.1% F1 |
| LaMP Product Rating (MAE) | Baseline MAE | Lower MAE | -10.4% MAE |
Key Takeaways
- GraphRAG with community detection is a powerful drop-in enhancement for personalization tasks: structuring user history as a KG and summarizing communities captures global preference signals that flat retrieval misses, yielding large gains especially on tagging tasks.
- For LLM practitioners building personalized agents, dynamic persona-prompt construction—combining individual behavioral summaries with community-level patterns—is more effective than static user profiles or naive document retrieval alone.
- The LaMP benchmark provides a useful testbed for personalization research; the 56.1% F1 gain on movie tagging suggests that relational structure in user-item interaction data is highly underexploited by standard RAG pipelines.
Abstract
We propose a novel framework for persona-based language model system, motivated by the need for personalized AI agents that adapt to individual user preferences. In our approach, the agent embodies the user's"persona"(e.g. user profile or taste) and is powered by a large language model (LLM). To enable the agent to leverage rich contextual information, we introduce a Knowledge-Graph-enhanced Retrieval-Augmented Generation (Graph RAG) mechanism that constructs an LLM-derived graph index of relevant documents and summarizes communities of related information. Our framework generates personalized prompts by combining: (1) a summary of the user's historical behaviors and preferences extracted from the knowledge graph, and (2) relevant global interaction patterns identified through graph-based community detection. This dynamic prompt engineering approach allows the agent to maintain consistent persona-aligned behaviors while benefiting from collective knowledge. On the LaMP benchmark, our method improves news categorization F1 by 11.1%, movie tagging F1 by 56.1%, and reduces product rating MAE by 10.4% over prior methods. Our code is available at https://anonymous.4open.science/r/PersonaAgentwGraphRAG-DE6F