Nanyang Technological University
Bridging logic and syntax: a dual-optimization framework for reliable structured generation in large language models
Abstract
dc:description.abstractLarge Language Models (LLMs) often struggle to generate strictly structured outputs, suffering from format illusions and semantic drift. In order to solve this problem, I have proposed a Dual-Optimization Structured Generation (DOSG) framework, which seamlessly integrates prompt engineering with deterministic reasoning constraints. DOSG consists of two core modules: a task-specific S-CoT prompt template adapted from the Structured Chain-of-Thought framework proposed by Li et al. (2025), and a Constraint Enforcement Module (CEM) that compiles target JSON schemas into Finite-State Machines (FSMs) for real-time logit masking. The original contribution of this study lies in adapting S-CoT to schema-constrained structured extraction and integrating it with CEM within a unified DOSG framework. Format illusions and semantic drift are mitigated through the collaboration between these two modules. The comparative experiment includes two datasets - Customer Review Dataset and Financial News Dataset - and two models – Llama-3-8B and GPT-4o. The results show that DOSG has achieved 100% syntactic compliance rate and 97% token efficiency. For the smaller open-weights model, the F1-score rises by a 25 percentage from 0.51 to 0.76. These results show that DOSG provides a structured solution for integrating LLMs into existing workflows.
Degree
thesis:*- College dc:contributor.school
- School of Electrical and Electronic Engineering
- Grantor dc:publisher
- Nanyang Technological University
- Year dc:date.issued
- 2026
Author and committee
dc:creator, dc:contributor.*- Author dc:creator
-
- Zhao, Weijie
- Advisor dc:contributor.supervisor
-
- Lihui Chen
Subjects
dc:subject × 1Rights
- Language dc:language.iso
- en
Identifiers
dc:identifier.*- Handle dc:identifier.uri
- https://hdl.handle.net/10356/218874