Papers
Topics
Authors
Recent
Search
2000 character limit reached

Logic-Preserving Distillation

Updated 4 February 2026
  • The paper demonstrates that logic-preserving distillation retains modular symbolic reasoning by decomposing a teacher’s strategy into verifiable function bases.
  • It employs stagewise cross-entropy and dense retrieval techniques to achieve 100% rule compliance and more robust decision-making than standard KD.
  • Experimental results validate its efficacy in both language models and quantum protocols, highlighting scalable, interpretable, and fault-tolerant architectures.

Logic-preserving distillation refers to a class of protocols and frameworks in both artificial intelligence and quantum information processing that aim to transfer or refine “logical” features—from modular reasoning pipelines in LLMs to error-corrected logical entanglement in quantum systems—while maintaining explicit logical or symbolic structure throughout the distillation procedure. In contrast to standard output-matching distillation, logic-preserving approaches are expressly designed so that the distilled student or purified state mirrors not merely the outputs, but the compositional and interpretable logical mechanisms or encodings of the teacher or parent system.

1. Formalizing Logic-Preserving Distillation in LLMs

Logic Distillation (LD) addresses the challenge of equipping small LLMs (S-LLMs) with the symbolic/logical reasoning competencies observed in LLMs (L-LLMs), especially in interactive planning and decision-making contexts. The key insight is that while traditional knowledge distillation (KD) protocols train S-LLMs to mimic outputs, this practice fails to transfer the modular logical pipelines underpinning the teacher’s decisions, resulting in brittle student behavior and rule violations (Chen et al., 2024).

Mathematically, let xx represent the combination of rule set and current state, pθLp_{\theta_L} denote the L-LLM, and pθSp_{\theta_S} the S-LLM student. The aim is to construct pθSp_{\theta_S} such that it, given xx, yields an action sequence OO satisfying all rules and achieving the intended task. Rather than direct trajectory supervision, LD factors the teacher’s solution into intermediate code-level functions, then trains the student to orchestrate these atomic operations in the correct sequence—preserving the symbolic logic pipeline.

2. Construction and Utilization of Function Bases

The LD framework builds a “function base” (DfD_f), instantiated by prompting the L-LLM to emit:

  • A set of code-style, self-contained functions fif_i that each encapsulate a distinct logical sub-operation,
  • An associated “user manual” uiu_i for each fif_i, detailing signature, usage, intent, and invocation context.

Let y=(y1,y2,)y = (y_1, y_2, \dots) be the generated token sequence representing all function- and manual-defining output. The decomposition is modeled as:

pθL(f,ux)=i=1ypθL(yix,y<i)p_{\theta_L}(f,u \mid x) = \prod_{i=1}^{|y|} p_{\theta_L}(y_i \mid x, y_{<i})

The function base is thus Df={(fi,ui)}i=1ND_f = \{(f_i, u_i)\}_{i=1}^N.

During inference, the S-LLM does not operate monolithically; instead, it acts as an orchestrator, selecting and invoking functions from DfD_f at each stage. This enforces preservation of the original system’s logical compositionality.

3. Training, Function Retrieval, and Invocation Mechanisms

Training in LD focuses on function selection at each decision stage. The S-LLM must select the correct function fjf_j from a candidate set Dcand(j)D_{cand}^{(j)} based on xx, manuals uu, and current context. The principal loss is the stagewise cross-entropy:

Lsel=j=1JlogpθS(fjx,u,Dcand(j))L_{sel} = -\sum_{j=1}^J \log p_{\theta_S}(f_j^* \mid x, u, D_{cand}^{(j)})

where fjf_j^* is the supervised function at stage jj.

For scalability, retrieval is handled by a dense retriever pθRp_{\theta_R} with bi-encoder architecture:

pθR(fx)exp(d(f)q(x))p_{\theta_R}(f \mid x) \propto \exp(d(f)^\top q(x))

d(f)d(f) encodes a function’s code and manual; q(x)q(x) encodes the instruction and state. At each stage, the retriever ranks DfD_f to yield KK most pertinent candidates:

$D_{cand}^{(j)} = \textrm{argtop}_K_{f \in D_f} d(f)^\top q(x)$

Optionally, the retriever is trained using the InfoNCE contrastive loss:

LR=(x,f+)logexp(d(f+)q(x)/τ)fDfexp(d(f)q(x)/τ)L_{R} = -\sum_{(x,f^+)} \log \frac{\exp(d(f^+)^\top q(x) / \tau)}{\sum_{f'\in D_f} \exp(d(f')^\top q(x) / \tau)}

During inference, for each fDcand(j)f \in D_{cand}^{(j)}, the S-LLM computes a score and applies softmax:

pθS(fx,u,Dcand(j))=softmax(scoreθS(x,u,f))p_{\theta_S}(f \mid x, u, D_{cand}^{(j)}) = \text{softmax}(\text{score}_{\theta_S}(x, u, f))

The selected fjf_j is invoked, its output feeds the next stage, and the process iterates for JJ steps, ultimately producing the output OO.

4. Logical Structure Preservation and Interpretability

Logic is preserved throughout the process by:

  • Fixing the set of admissible operations (functions) by L-LLM during function-base construction;
  • Constraining the student to select among these verified primitives via explicit supervision;
  • Guaranteeing each function’s semantic and correctness properties by formal documentation (manuals) and code-based implementation.

By structuring planning and decision-making as a modular pipeline of verifiable reasoning steps, the distilled student model inherits robust generalization and rule compliance. Cross-entropy over function indices (log KK) is a lower-entropy, more stable alternative to standard full-vocabulary losses.

5. Experimental Evaluation and Rule Compliance

Empirical results on interactive planning domains, such as the Pursuit Game and its emergency (restricted zone) variant, provide quantitative evidence for logic-preserving distillation’s efficacy.

Model Success Fail w/o Violation Fail w/ Violation Avg. Steps (succ.)
S-LLM 0% 0% 100%
L-LLM 96% 4% 0% 14.22
KD (LoRA) 88.5% 10.5% 1% 15.23
LD 100% 0% 0% 13.26

In both standard and emergency settings, LD achieves perfect rule compliance and expedient solutions, improving over baseline S-LLM and outperforming knowledge distillation which only matches outputs (Chen et al., 2024).

6. Logic-Preserving Distillation in Quantum Information

In quantum information, logic-preserving distillation refers to protocols designed to purify logical-qubit entanglement, maintaining logical encoding throughout error correction. Using cross-Kerr nonlinearity and quantum nondemolition (QND) parity checks, the protocol distinguishes, preserves, and corrects logic-level Bell states by:

  • Keeping logic encoding intact across rounds;
  • Correcting logic bit-flip, phase-flip, and physical bit-flip errors;
  • Realizing deterministic physical error correction and probabilistic logic-Bell distillation, with fidelity boosts of F=F2/(F2+(1F)2)F' = F^2/(F^2 + (1-F)^2) and success probabilities Ps=[F2+(1F)2]/4P_s = [F^2 + (1-F)^2]/4 per round (Sheng et al., 2016).

This methodology is crucial for fault-tolerant long-distance entanglement distribution.

7. Implications and Resource Challenges

Logic-preserving distillation protocols result in models and entangled states that are both interpretable and robust. In LLM settings, they produce lightweight, rule-compliant agents capable of generalizing to new instructions. In quantum communication, they ensure that logical-qubit entanglement fidelity can be boosted systematically while preserving the logical code.

Resource challenges arise in both domains: in LD, function base construction and retrieval may grow with domain complexity; in quantum logic-qubit distillation, resource consumption scales exponentially with target fidelity, and practical success rates are impacted by detection inefficiencies in QND gates and limitations in physical cross-Kerr strengths.

A plausible implication is that logic-preserving protocols may underpin scalable, robust, and interpretable architectures in future AI and quantum systems, provided limitations in resources and hardware are systematically addressed (Chen et al., 2024, Sheng et al., 2016).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Logic-Preserving Distillation.