Engineering a Multi-Perspective Dialogue System: Architecture and Implementation Practices
This article presents an engineering approach to building multi-perspective dialogue systems based on first-person, second-person, and third-person viewpoints. It covers a layered architecture with an orchestrator, perspective layer, state layer, and storage layer; an explicit state machine for perspective switching; hot, warm, and cold context management; tempo and frame matching; policy-based guardrails for factual consistency; observability metrics; and evaluation practices for consistent and reliable conversational AI systems.
1. Background: From the “Watching a Film” Mental Model to Dialogue System Architecture
When people watch films or TV shows, they have a dual capability: they can be emotionally drawn into the plot while simultaneously maintaining a detached, rational perspective to analyze causes and effects, character motivations, and narrative structure. This ability to be “both immersed and detached” maps directly to three reusable perspectives in conversational system design:
- First-person perspective: expresses and responds as the primary subject, focusing on immediate needs and emotions;
- Second-person perspective: centers on the other party, focusing on their instructions, personality traits, and role switching;
- Third-person perspective: scans the full picture as an objective recorder, accumulating facts, context, and reviewable information.
In engineering terms, if all three are mixed into the same context without distinction, the system can easily “fall into one identity” and be led by local emotions or short-term goals, resulting in topic drift, inconsistent commitments, and context pollution. Therefore, perspective is not a rhetorical device but a first-class architectural element.
2. Overall Architecture: Perspective Layering and State Machine
The system can be split into four layers that communicate through explicit contracts:
┌─────────────────────────────────────────────┐│ Orchestrator: tempo/framework/permission ││ scheduling │├─────────────────────────────────────────────┤│ Perspective: P1 / P2 / P3 channels │├─────────────────────────────────────────────┤│ State: persona profile, role stack, ││ relationship stage │├─────────────────────────────────────────────┤│ Storage: session logs, vector index, ││ object storage │└─────────────────────────────────────────────┘
The core of the perspective layer is an explicit state machine that avoids the unpredictability of implicit switching:
from enum import Enum, autoclass Perspective(Enum):P1_SELF = auto() # First person: self-expressionP2_OTHER = auto() # Second person: other-centeredP3_OBSERVER = auto() # Third person: objective recordingclass DialogState:def __init__(self):self.perspective = Perspective.P3_OBSERVERself.role_stack = [] # Role stack for multi-identity switchingself.tempo = "medium" # slow / medium / fastself.frame = "scan" # scan / deepself.trust = 0.0 # Relationship baseline: quantified placeholder for respect and trustdef switch(self, target: Perspective, reason: str):# Switching must carry a reason for auditing and replayassert reason, "perspective switch requires explicit reason"self.perspective = target
The key point is that every perspective switch must carry an explicit reason and be written to an audit log. This makes online troubleshooting easier and turns “why did it suddenly become emotional/detached” into an explainable event.
3. Context Layering: Making the Third Person “Remember More”
The value of the third-person perspective lies in its ability to objectively record more information. In implementation, this means context layering and lifecycle management:
- Hot context: the most recent turns in original text, preserving details and tone;
- Warm context: structured summaries including facts, timelines, and open questions;
- Cold context: long-term profiles and preferences stored in object storage, retrieved by similarity when needed.
{"session_id": "s-10086","hot": ["latest 3 turns of original text"],"warm": {"facts": ["the other party prefers conclusions before details"],"open_questions": ["delivery time not confirmed"],"timeline": ["T0 requirement raised", "T1 constraints added"]},"cold_ref": "profile://u-42"}
Engineering recommendations: hot context is held in memory or cache, warm context is periodically persisted to a database, and cold context is stored in object storage and recalled via a vector index. Logs and monitoring alerts cover switch events and retrieval hit rates, making it easier to continuously tune layering thresholds.
4. Tempo, Frame, and “Exchanging Instruction Manuals”
Dialogue quality depends largely on matching tempo and frame:
- Tempo: fast-slow switching, corresponding to information density and pauses;
- Frame: scan mode (breadth-first, quick localization) and deep mode (depth-first, tracing causes and effects).
The so-called “exchange of instruction manuals” can be abstracted as a machine-readable and human-readable collaboration contract:
my_manual:how_to_use_me: "Give conclusions first, then evidence; dislikes continuous follow-up questions"triggers: ["becomes defensive when professional expertise is questioned"]best_channel: "structured lists"their_manual:inferred_traits: ["prefers example-driven", "sensitive to terminology"]role_switches: ["engineer", "reviewer"]respect_baseline: 0.8
The orchestrator dynamically adjusts tempo and frame based on both manuals, and when a mismatch is detected, it proactively slows down and switches to scan mode to align before going deeper.
5. Boundaries and Permissions: Engineering the “Limits” of Sincere Expression
The original text mentions “going along with the other party and performing sincerely.” In an engineering context, this corresponds to the boundary between “style adaptation” and “factual consistency.” The principle is: style can be mirrored, facts must not drift, and permissions must not be exceeded.
def guard(response, facts, policy):if not facts_consistent(response, facts):return fallback(response) # Fall back if facts are inconsistentif policy.computed_cost(response) > policy.budget:return compress(response) # Compress if over budgetreturn response
At the same time, the system must explicitly define what it “cannot do”: not commit to unconfirmed deliverables, not fabricate interfaces or parameters, and not cross user-defined data boundaries. These constraints should be written into a policy engine rather than relying on the model’s self-discipline.
6. Mismatch and Overload: From “Physical Discomfort” to Observable Metrics
When a human-to-system mismatch occurs and expression is rushed, discomfort is triggered; the same applies to systems, manifesting as latency spikes, repetition, and irrelevant answers. Observability measures include:
- Metrics: first-token latency, turn completion rate, repetition rate, switch frequency;
- Logs: structured records of perspective switches and frame changes;
- Alerts: overload or drift thresholds trigger degradation strategies (slow down, switch to scan, request clarification).
7. Evaluation and Iteration
It is recommended to build three evaluation sets: perspective consistency (whether switches are explainable), factual consistency (whether drift occurs), and collaboration efficiency (turns to task completion). After launch, monitoring alerts and logging services close the iteration loop, gradually calibrating layering thresholds and policy budgets. If using general cloud capabilities, a container platform can host the orchestration service, a message queue can decouple perspective channels, object storage can hold cold context, and logging and monitoring services can support observability.
8. Conclusion
Only by making first-person, second-person, and third-person perspectives explicit, auditable, and schedulable architectural elements can a dialogue system be both “moved” and “clear-sighted.” Perspective switching is not mysticism but an implementable engineering discipline: layered context makes it remember more, the state machine makes switching explainable, the policy engine gives expression boundaries, and the observability system makes mismatches discoverable and fixable.
