Abstract
We present TRACE-cs, a novel hybrid system that combines logical reasoning with large language models (LLMs) to address contrastive queries in course scheduling problems. TRACE-cs leverages logic-based techniques to encode scheduling constraints and generate provably correct explanations, while utilizing an LLM to process natural language queries and refine logical explanations into user-friendly responses. This system showcases how combining symbolic KR methods with LLMs creates explainable AI agents that balance logical correctness with natural language accessibility, addressing a fundamental challenge in deployed scheduling systems.
Introduction
Automated scheduling systems are ubiquitous, yet they often operate as "black boxes." When a user—such as a student planning their degree—queries why a specific schedule change is not possible (e.g., "Why can't I take Algorithms this semester?"), standard solvers typically provide either a binary "No" or an incomprehensible list of logical constraints.
This highlights a fundamental trade-off in AI: symbolic logic-based systems are rigorous and provably correct but lack natural language fluency, while Large Language Models (LLMs) are excellent communicators but prone to logical "hallucinations." TRACE-CS (Trustworthy ReAsoning for Contrastive Explanations in Course Scheduling) bridges this gap by creating a neuro-symbolic system that is both logically sound and linguistically accessible.
System Architecture
The TRACE-CS architecture splits the workload into two specialized modules: a Symbolic Module for rigorous reasoning and an LLM Module for user interaction.
The Symbolic Module
The "brain" of the system consists of an Encoder and an Explainer. The Encoder translates university degree requirements, prerequisites, and credit limits into a Boolean Satisfiability (SAT) problem. When a contrastive query is received, the Explainer identifies the Minimal Unsatisfiable Set (MUS)—the smallest set of logical constraints that prevents the user's requested change.
The LLM Module
The "voice" of the system uses GPT-4 for two primary tasks. First, the Query Parser translates natural language questions into formal logical queries ($\phi$). Second, the Explanation Refiner takes the raw logical constraints from the Symbolic Module and translates them into a coherent, natural language response. A critical "User Query Verification" step ensures the system correctly interpreted the user's intent before proceeding to the solver.
Evaluation and Results
The system was evaluated using a real-world dataset of Computer Science degree requirements, involving over 200 courses and complex prerequisite chains. Researchers tested the system against 550 contrastive queries of varying complexity.
As shown in the results, TRACE-CS achieved 100% accuracy across all complexity levels, whereas a pure LLM baseline (GPT-4.1) averaged only 54.1%, with performance degrading significantly as query complexity increased. Furthermore, TRACE-CS produced more concise explanations (81.8 words vs. 159.4 words). While TRACE-CS has a higher average runtime (14.7s vs. 4.3s) due to the overhead of SAT solving and multiple LLM passes, this "speed tax" is a necessary trade-off for guaranteed correctness in high-stakes academic planning.
Conclusion
TRACE-CS demonstrates that anchoring LLMs in symbolic logic is essential for creating trustworthy AI agents in constrained domains. By focusing on minimal logical reasons for conflicts, the system provides explanations that are both accurate and easy to understand. Future work will explore reducing computational costs and extending this hybrid approach to other scheduling domains like logistics and healthcare.
Summary updated