Source-linked AI summary

Knowledge-Graph-Gated Defactualization for Style-Controllable and Fact-Preserving Generation in Agentic Conversational AI

Tanmay Kumar Shrivastava, Darsh Rohit Nandu, Rajesh Kumar Mundotiya

arXiv:2608.20393v1cs.CLcs.AI

TL;DR

Fact-sensitive conversational LLMs must preserve verifiable entities while controlling style, but activation steering does not explicitly separate factual from stylistic content. DSR inserts a typed, salience-weighted KG to mask entities before steering and deterministically restore them afterward. Across six LLaMA variants, DSR improved entity coverage over steering-only generation while preserving style metrics, although the absolute recovery gain remained modest.

  • Problem

    Activation steering controls style without explicitly distinguishing fact-bearing tokens from stylistic content, leaving joint factual preservation and style control insufficiently addressed.

  • Method

    DSR extracts a typed, salience-weighted KG, replaces input entities with typed placeholders before steering, and deterministically rehydrates verified values afterward.

  • Results

    DSR significantly increased entity coverage relative to a steering-only baseline while preserving measured style-fidelity metrics across six LLaMA variants, 600 cases, and 1,200 generations.

  • Takeaways & Limitations

    The results support combining explicit knowledge engineering with representation-level steering for fact-sensitive, style-controlled generation without modifying model weights.

  • Takeaways & Limitations

    Entity-coverage gains remain modest and do not guarantee complete factual grounding; full six-model replication of the ablation remains future work.

Abstract

from arXiv · show

Agentic large language models (LLMs) deployed in fact-sensitive applications such as customer support must simultaneously preserve factual correctness and generate responses in a controllable stylistic register. Activation steering enables fine-tuning-free style control by perturbing hidden representations, but it lacks an explicit mechanism for distinguishing verifiable facts from stylistic content, leading to semantic leakage. We address this challenge through \emph{Defactualize-Steer-Rehydrate} (DSR), a knowledge-engineering framework that integrates a typed, salience-weighted knowledge graph (KG) with activation steering. DSR extracts salient entities using a layered regex or NER or lexical-classifier pipeline, replaces them with typed placeholders prior to steering, and deterministically restores verified values through salience-guided rehydration after generation. DSR is evaluated across six LLaMA-family models (1B--13B parameters) on 600 A2A-generated customer-support cases (1,200 generations), with a dedicated KG ablation study. DSR significantly increases verified-entity recovery relative to a steering-only baseline (Cohen's $d=0.225$, $p_{\text{Bonf}}=1.0\times10^{-4}$), though the absolute recovery rate remains modest, while preserving effective style control across diverse model families. Layer-wise separability and steering-strength diagnostics further show previously unexplored interactions between representation-level steering and factual grounding. hese results demonstrate that explicit knowledge engineering can systematically enhance trustworthy, controllable, and reproducible generative AI without requiring model fine-tuning. Code, cached steering vectors, and evaluation scripts are publicly released to support reproducibility.\footnote{https://github.com/Tanmay-IITDSAI/KG-Gated-Defactualization}

I. INTRODUCTION

The paper frames fact-sensitive dialogue as a joint factual-preservation and style-control problem, then introduces DSR to connect typed knowledge engineering with activation steering. Its evaluation reports improved entity coverage, preserved stylistic fidelity, and diagnostics exposing layer- and strength-dependent interactions.

  • Motivation: Fact-sensitive agentic LLMs must satisfy exact entity schemas and requested stylistic registers simultaneously.The motivating examples include order identifiers, product names, reported defects, empathetic tone, and formal escalation tone.
  • Motivation: Existing fine-tuning, retrieval, and activation-steering methods address parts of the problem without treating factual preservation as a first-class constraint.The paper identifies entity paraphrasing, substitution, and interference between fact-bearing and stylistic tokens as limitations of steering alone.
  • Method: DSR combines a typed knowledge layer with activation steering by defactualizing factual entities, steering style, and deterministically rehydrating verified values.The architecture interfaces the knowledge graph with steering through defactualized text rather than modifying the steering operator.
  • Method: The extraction framework constructs a typed, salience-scored knowledge graph from unstructured support messages using regex, NER, and lexical classifiers.This data-engineering layer supplies the structured representation used by the DSR pipeline.
  • Evaluation: Across six models, 600 cases, and 1,200 generations, the KG ablation significantly improved entity coverage while preserving stylistic fidelity relative to steering-only generation.The reported ablation result is pBonf = 1.0×10^-4 and Cohen’s d = 0.225.
  • Evaluation: The diagnostic suite combines SAF, HSI, and TCI with layer-strength sensitivity analysis to reveal operating regions where hallucination severity saturates and tone consistency becomes non-monotonic.The paper presents these diagnostics as exposing interactions hidden by aggregate style metrics.

A. Knowledge Grounding and Representation Control in Generative AI

This section positions DSR between retrieval-based grounding, representation control, agent memory, and post-generation hallucination detection. It formalizes preservation of input entities under style control and presents a pipeline that extracts, masks, steers, and rehydrates those entities.

  • Knowledge Grounding: Knowledge-grounded LLMs commonly inject graph-derived facts as context, soft prompts, or auxiliary training signals, while GraphRAG retrieves structured neighborhoods during inference.These approaches primarily augment what the model observes rather than directly changing its internal representations.
  • Knowledge Grounding: RAG improves factual accuracy by conditioning generation on retrieved passages but remains orthogonal to interventions in hidden-state representations.The paper distinguishes retrieval of observable information from manipulation of activation dynamics.
  • Representation Control: Activation-steering methods derive vectors from contrastive prompt pairs and inject them into the residual stream to elicit targeted behaviors.This representation-level control does not itself specify how individual factual entities should be preserved.
  • Agent Memory: Existing agent-memory systems emphasize accumulation and retrieval of persistent context, whereas DSR focuses on preserving verified factual content during representation-steered generation.The paper presents these directions as related but distinct grounding mechanisms.
  • Research Gap: The stated gap is a unified pipeline that uses a typed, salience-scored graph for pre-generation masking and post-generation verification while retaining activation steering as the representation-control mechanism.This integration defines the core gap addressed by DSR.
  • Problem Formulation: DSR formalizes a frozen-model map from message and requested style to an output that preserves schema entities unchanged across empathetic and formal registers.The steering vector is estimated once per style and reused across incoming messages without depending on message-specific entities.
  • System Architecture: The seven-stage pipeline constructs the KG, defactualizes the input, applies steering at a selected layer, and rehydrates verified entities before output.Only steered generation invokes the frozen LLM; the knowledge-engineering stages are symbolic or post-generation operations.

V. METHODOLOGY

The methodology builds a small, typed knowledge graph from support messages using layered extraction and salience scoring, with graph construction performed independently for each request.

  • Knowledge Graph Construction: The extraction pipeline combines regex, named-entity recognition, and lexical classifiers without model training.Regex handles structured fields, NER handles names and issue spans, and classifiers produce urgency and sentiment labels with confidence scores.
  • Knowledge Graph Construction: Algorithm 1 constructs G = (V, E) by adding typed nodes from extracted values and optional metadata fallbacks.Fallback metadata nodes receive a fixed salience of 0.70 when no extracted node exists.
  • Salience Scoring: Corroborated values receive a +0.10 salience boost, while metadata-only fallback values are capped at 0.70.These are fixed hand-set constants rather than fitted hyperparameters.
  • Graph Structure: Edges connect adjacent typed pairs such as product–issue and order–product using multiplicative endpoint salience.The resulting graph is small, typed, directed, and rebuilt independently for each incoming message.
  • Design Choices: Salience alone governs rehydration candidate selection, separating data-quality scoring from graph topology and edge weights.The shallow ontology bounds |V| ≤ 10 while limiting richer relational modeling.

B. Defactualization

Defactualization masks extracted factual entities with typed placeholders before activation capture or perturbation, preventing entity-specific content from entering steering.

  • Defactualization: The defactualization operator replaces every graph-node value with its type-specific placeholder before steering.Replacement is case-insensitive and longest-match-first.
  • Defactualization: Sorting substitutions by descending value length prevents shorter values from matching substrings inside longer issue spans.This preserves complete masking of longer extracted spans.
  • Structural Separation: Contrastive steering pairs use a fixed closed placeholder vocabulary rather than case-specific entity values.No steering vector or activation used to build one is computed from text containing an unmasked entity.
  • Structural Separation: The KG gates which spans steering sees, while steering direction and magnitude are computed independently of the graph and message.This is the paper’s structural separation between factual control and stylistic steering.

C. Contrastive Steering Vector Construction

The paper constructs cached, style-specific steering directions from contrastive activations over placeholder-based examples and compares three estimators.

  • Contrastive Data: For each style, contrastive in-style and out-of-style pairs provide pooled activations and activation differences for estimating a steering direction.The examples use the placeholder vocabulary established during defactualization.
  • Direction Estimators: Three estimators are evaluated: principal component, mean difference, and logistic regression.Each estimator is implemented and cached per style–model pair.
  • Layer Separability: cos = 0.41 was the PCA estimator’s mean cosine similarity between empathetic and formal directions on the LLaMA-3.2-3B-Instruct pilot.The corresponding similarities were cos = 0.53 for mean difference and cos = 0.49 for logistic regression.

D. Steered Generation

Steered generation applies a cached style vector during greedy decoding of the defactualized prompt, then deterministically restores salient verified entities and strips unsupported placeholders.

  • Steered Generation: A forward hook adds the style vector to hidden states at a selected layer during prefill and autoregressive decoding.The perturbation is applied uniformly to placeholders and free text, with factual safety handled by masking and rehydration.
  • Salience-Ranked Rehydration: For each entity type, rehydration substitutes the placeholder with the single candidate having the highest salience.This deterministic lookup is the only stage where the factual schema re-enters surface text.
  • Generation Procedure: Algorithm 2 builds the KG, defactualizes the prompt, registers the steering hook, decodes, and removes the hook.The fallback prompt-steering path is used only when the raw output is empty, truncated, or overlong.
  • Salience-Ranked Rehydration: Unsupported or un emitted placeholders are stripped rather than left dangling, and rehydration is not a generative step.The paper states that this introduces no additional hallucination risk.
  • Evaluation Statistic: Entity coverage measures the fraction of KG node values recovered verbatim in the generated response.Corpus-level coverage is pooled across both empathetic and formal styles unless explicitly labeled otherwise.
  • Computational Cost: The symbolic DSR overhead is O(n + |V| + |E|) atop host-model decoding.Deterministic preprocessing and postprocessing are O(n), while decoding is bounded by max_new_tokens = 120.

F. Diagnostic Metrics: SAF, HSI, TCI

The paper introduces three per-generation diagnostics that separately measure style-direction fidelity, entity leakage, and tone alignment. Together, they expose trade-offs that aggregate style scores cannot diagnose, including settings where tone consistency and grounding are not jointly attainable.

  • SAF measures how strongly the intended style direction is represented in the hidden state produced for a generation.
  • HSI measures entity-level leakage between the input and response using named-entity sets, with lower values indicating better grounding.HSI = 0 means every response entity is grounded in the input.
  • TCI measures directional alignment with the requested style relative to its opposite style direction.
  • A well-steered, well-grounded generation should satisfy TCI > 0 and HSI ≈0, but these objectives are not always jointly attainable at every α.The diagnostics are therefore reported jointly rather than blended into a single score.

G. Computational Complexity

The pipeline is designed to add limited computational and storage overhead while operating on a compact per-request knowledge graph. Its evaluation uses 600 generated customer-support cases rendered into 1,200 style-controlled generations.

  • KG construction costs O(n) for extraction and O(|V | + |E|) for salience and edge assignment, with empirically bounded |V | ≤10.Because the graph is small, construction is effectively dominated by input length n.
  • Defactualization costs O(|V | log |V | + |V | n), which is effectively linear in n because |V | is small and bounded.
  • Steered generation adds one O(d) vector addition per token, asymptotically negligible relative to a transformer forward pass and independent of parameter count P.
  • Rehydration performs O(|V |) string replacements over the generated output.
  • The only persistent artifact beyond model weights is one cached style vector per style-model pair, requiring O(|S| d) floats.For |S| = 2 and d = 4096, storage is 32 KB per model versus approximately 16 GB of bf16 weights.
  • The main study uses 600 A2A-generated customer-support cases, each rendered in empathetic and formal styles for 1,200 generations.Cases vary across three sentiment levels and two urgency levels, with disjoint entity pools per case.

B. Models and Implementation

The study evaluates six LLaMA variants under fixed decoding and steering procedures, then isolates the KG layer through a paired ablation. The KG improves entity coverage without a detectable style-fidelity cost, although the effect is modest and coverage remains limited.

  • Six LLaMA variants spanning 1B–13B parameters and base, chat, and instruct regimes are evaluated without weight modification.The models include LLaMA 2 7B-base, 7B-chat, 13B-chat, and LLaMA 3 instruct variants.
  • KG structural statistics remain near-identical across all six host models, with every statistic's largest cross-model spread below 3% of its mean.Because KG construction never queries the model, its output distribution depends on the input scenarios and fixed extraction ontology.
  • Only Entity Coverage reaches significance after Bonferroni correction; other directionally favorable KG+Steer values are not statistically distinguishable from activation-only.
  • Entity coverage increases significantly from activation-only to KG-gated DSR in the paired ablation, while stylistic-fidelity metrics remain statistically unchanged.Response length is the sole significant style difference, with KG-gated responses shorter on average; placeholder leakage is zero across 100 cases.
  • Entity coverage shows no monotonic trend across urgency levels, suggesting the bottleneck lies in surface realization rather than KG extraction.The trend test reports z = −1.24 and p = 0.21.
  • The entity-coverage effect is statistically robust but modest, with Cohen's d = 0.225 and absolute coverage of 0.0056 on the empathetic-only branch.Pooled coverage across both styles for the same model and generations is 0.0193.

E. Style Fidelity Across Models

Across models and tones, activation steering produces measurable stylistic separation and consistency, while factual grounding remains low and does not scale monotonically with model size. Readability most consistently separates empathetic and formal outputs, and placeholder leakage remains zero.

  • Readability shows the strongest and most consistent separation between empathetic and formal outputs, while lexicon-based empathy and formality scores remain modest.Low cross-tone ROUGE overlap also indicates lexical rather than merely superficial stylistic differences.
  • Style Discrimination, Entity Coverage, and SCE remain low, with no monotonic relationship to model size.SCE measures each generation’s deviation from its model’s 90th-percentile style ceiling, where lower values indicate more consistent style execution.
  • Placeholder leakage is exactly 0.0 for every model and both styles across the full 600-case study.This indicates that Stage 6 does not emit raw unresolved placeholders across 1,200 generations, although correct entity recovery remains modest.
  • Entity coverage peaks at intermediate model sizes rather than the largest models, so parameter count alone is a poor predictor of factual grounding.The same non-monotonic pattern applies to empathy and entity coverage within the studied 1B–13B range.
  • Scenario Type explains more entity-coverage variance than Host Model, with η2 = 0.053 versus η2 = 0.040.The variance decomposition therefore attributes more factual-grounding variation to input conditions than to model identity.
  • SENTIMENT is never recovered in the empathetic pipeline, whereas URGENCY is the most recoverable entity type.The paper relates this pattern to shallow ontology design: urgency is lexically salient, while sentiment remains entangled with the steered style register.

H. Layer Separability and Steering-Strength Sensitivity

Diagnostics reveal that style separability and factual-grounding behavior depend on transformer layer and steering strength, while DSR improves entity coverage without changing style metrics. The gain remains modest, and persistent cross-turn deployment remains an open challenge.

  • Layer separability: Maximum style-direction separability occurs around layers 6–10 in LLaMA-3.2-3B-Instruct, whereas the deployed layer is L = 16.This indicates that alpha-sweep selection does not necessarily identify the layer with greatest style separability.
  • Steering-strength sensitivity: TCI varies non-monotonically with steering strength α, while HSI rapidly saturates across much of the sweep.This operating pattern appears in LLaMA-3.2-3B and LLaMA-2-13B-chat.
  • Factual grounding and style: Entity coverage improves significantly while all style metrics remain unchanged, showing that the symbolic knowledge layer coexists with representation-level steering.Across 1,200 generations, zero placeholder leakage was observed, and the activation-steering path produced no malformed response.
  • Limitations: Cohen’s d = 0.225, with absolute entity recovery ranging from low single digits to low tens of percent across models.DSR improves factual grounding but does not guarantee complete recovery.
  • Scalability: Cross-turn deployment remains an open challenge because the ephemeral KG would need to become a persistent, indexed store for long-term agent memory.The current design otherwise adds negligible overhead to a single host-model forward pass and requires one cached vector per style–model pair.
Loading 2608.20393v1…