Engineering a Multi-Perspective Dialogue System: Architecture, State Management, and Evaluation

    This article presents an engineering approach to building multi-perspective dialogue systems by treating first-person, second-person, and third-person perspectives as first-class context views rather than mutually exclusive modes. It covers a five-layer architecture with explicit view isolation, parameterized rhythm control, automatic routing between scan and deep modes, versioned collaboration contracts, and guardrails against excessive mirroring and sycophancy. Readers will find data structure drafts, pseudocode for state management, overload protection strategies, observability guidance, and a three-layer evaluation loop for improving consistency and controllability in conversational AI, customer support, and educational training scenarios.

    When building dialogue systems, developers often run into three recurring problems: perspective confusion that causes context drift, rhythm and mode behavior that cannot adapt, and excessive accommodation that distorts output. This article maps the “self–other–observer” perspectives into implementable context views and a state machine. It provides a protocol design for rhythm control, scan/deep mode switching, and exchanging mutual “manuals,” along with illustrative code for state management and an evaluation loop. Readers will get an architecture layering, draft data structures, monitoring and alerting metrics, and an iteration method that can be applied directly to improve consistency and controllability in intelligent dialogue, customer service, and educational sparring scenarios.

    1. Problem Abstraction: Treat “Perspective” as a First-Class Citizen

    The source material discusses three stances in interpersonal conversation: the first person centered on “me,” the second person centered on “the other party,” and the third person that observes from a distance. In engineering terms, these can be modeled as three coexisting views rather than three mutually exclusive modes:

    • First-person view: preferences, goals, emotional state, unstated constraints.
    • Second-person view: profile of the other party, role settings, current request, acceptable response style.
    • Third-person view: objective facts, timeline, causal chains, verifiable information.

    The key insight is that the third-person view has the highest information density and the lowest noise, making it suitable as a “fact base,” while the first- and second-person views handle “relationship and experience.” System failures are often not caused by insufficient model capability, but by the three views being flattened into a single mixed text in the context, causing facts to be pulled by emotion and roles to be overwritten by temporary phrasing.

    2. Overall Architecture: Layering and View Isolation

    A five-layer structure is recommended, with views passed explicitly between layers and implicit mixing prohibited:

    1. Access layer: session identifiers, user and role metadata, channel differences.
    2. View layer: maintains independent storage and version numbers for the three views above.
    3. Orchestration layer: rhythm controller, mode router, policy and boundary checks.
    4. Generation layer: constrained templates and model calls; output must reference view fields.
    5. Observability layer: logging service, monitoring and alerting, metrics and tracing.

    Illustrative data structure (pseudocode):

    1. Session {
    2. id, createdAt
    3. views: {
    4. firstPerson: { goals[], affect, constraints[], version }
    5. secondPerson: { persona, roles[], request, styleProfile, version }
    6. thirdPerson: { facts[], timeline[], causality[], version }
    7. }
    8. rhythm: { speed: 0..1, turnBudget, pausePolicy }
    9. mode: SCAN | DEEP
    10. boundaries: { mirroringLimit, sycophancyGuard, topicGuard }
    11. }

    Key point: every generation must carry the version numbers of views, and after output, write back and increment the version, forming a traceable “state–output” correspondence.

    3. Rhythm Control: Adjustable Parameters for Fast and Slow

    Implement “fast/slow” as explicit parameters rather than relying on adjectives in prompts:

    • speed: affects sentence length distribution, information increment, and question density.
    • turnBudget: maximum number of subtopics advanced in a single turn, preventing information overload.
    • pausePolicy: inserts a confirmation turn when high uncertainty or high emotion is detected.
    1. def next_turn(session):
    2. if session.views.thirdPerson.version_changed():
    3. session.rhythm.speed = min(1.0, session.rhythm.speed + 0.1)
    4. if session.views.firstPerson.affect == "HIGH":
    5. session.rhythm.pausePolicy = "CONFIRM_FIRST"
    6. return plan_turn(session.rhythm, session.mode)

    Engineering benefit: rhythm becomes a variable that can be regression tested. Offline replay can evaluate the inflection points where “too fast increases the misunderstanding rate and too slow increases the abandonment rate.”

    4. Mode Routing: Automatic Switching Between Scan and Deep

    • Scan mode: breadth-first, outputs structured key points, controls tokens and latency.
    • Deep mode: depth-first, expands causal chains and boundary conditions, allows longer context.

    Routing signals are recommended to come from the change rate of the third-person view and explicit user instructions:

    1. if factChangeRate > θ1 or user asks "why/how": mode = DEEP
    2. elif turnLatency > L or budgetLow: mode = SCAN

    This avoids the common failure of “long-winded when it should be shallow, and a perfunctory list when it should be deep.”

    5. The “Manual” Protocol: Making Usage Explicit

    The material mentions “exchanging each other’s manuals,” which in engineering corresponds to a versionable collaboration contract:

    • Usage instructions: how to ask questions, expected level of detail, taboo topics.
    • Personality tags: stability, openness, conflict-handling style.
    • Role list: identities in different tasks (e.g., reviewer, coach, executor).

    Contract example:

    1. {
    2. "usage": {"detail": "medium", "preferBullets": true, "avoid": ["empty encouragement"]},
    3. "traits": {"stability": 0.8, "openness": 0.6},
    4. "roles": [{"name": "reviewer", "trigger": "code review"}]
    5. }

    Separation of contract and views: the contract is “meta-rules,” and the views are “current state.” During generation, read contract constraints first, then read view content, and finally let the boundary layer perform validation.

    6. Boundaries and Limits: Mirroring, Accommodation, and “Sincere Performance”

    Excessive mirroring and unprincipled accommodation are the biggest risks in relational dialogue. Three guardrails can be implemented:

    1. Mirroring limit: mirroringLimit restricts the intensity of style imitation; the fact layer must not be polluted by imitation.
    2. Anti-sycophancy check: if output conflicts with third-person facts, force down-weighting and annotate uncertainty.
    3. Topic guardrail: out-of-bounds requests enter a refusal or restatement flow rather than going along with them.
    1. def guard(candidate, session):
    2. if conflicts_with_facts(candidate, session.views.thirdPerson):
    3. candidate = annotate_uncertainty(candidate)
    4. if style_distance(candidate, session) > session.boundaries.mirroringLimit:
    5. candidate = neutralize_style(candidate)
    6. return candidate

    7. State Consistency and Handling “Irreversibility”

    After a relationship advances, state cannot be simply rolled back. Engineering uses “append–snapshot–branch” rather than overwrite:

    • Append log: write each interaction into an immutable event stream.
    • Snapshot: periodically solidify view versions for traceback and comparison.
    • Branch: when a mismatch or escalating conflict is detected, create a new branch rather than forcibly changing history.

    This ensures auditability and experimentation capability (different strategies can be compared on branches).

    8. The Metaphor of Mismatch and Physical Discomfort: Overload Protection

    The material mentions the discomfort reaction when the system is mismatched and eager to express itself, corresponding to engineering overload and jitter. Recommendations:

    • Circuit breaker: switch to a minimal viable reply when consecutive failures occur or latency exceeds the threshold.
    • Degradation: disable deep reasoning, keeping only fact confirmation and safe replies.
    • Cooldown: introduce backoff and a silent period to avoid the positive feedback of “the more errors, the more anxious.”

    9. Evaluation Loop: Making “Encounter Quality” Measurable

    Establish three layers of evaluation:

    • Fact layer: consistency with the third-person view, citation coverage.
    • Relationship layer: style match, role retention rate, contract violation rate.
    • Experience layer: proxy metrics for rhythm satisfaction (abandonment rate, repeated question rate).

    Offline replay plus online canary; metrics feed into monitoring and alerting; every policy change comes with a regression report, avoiding “feels better but metrics get worse.”

    10. Observability and Operations

    • Logging service: structured records of view versions, modes, and guardrail hits.
    • Monitoring and alerting: latency, failure rate, guardrail trigger rate, contract violation rate.
    • Tracing: the view evolution chain of a session can be replayed.

    11. Implementation Checklist

    1. Build the three views and version numbers first; prohibit mixing.
    2. Make rhythm and mode into parameters and routing, not adjectives.
    3. Version the manual contract; apply constraints before content during generation.
    4. Keep three guardrails always on: mirroring limit, anti-sycophancy, topic guardrail.
    5. Event stream + snapshot + branch to handle irreversibility.
    6. Overload protection: circuit breaker, degradation, cooldown.
    7. Three-layer evaluation + canary + regression report.

    With this paradigm, developers can translate abstract “dialogue philosophy” into stable engineering capabilities: perspectives can be switched, rhythm can be adjusted, boundaries can be constrained, and quality can be measured. On general cloud environments such as Baidu AI Cloud, object storage can hold the event stream, a message queue can decouple orchestration, a container platform can host generation services, and logging and monitoring services can support operations, forming a dialogue system that can iterate sustainably.