Decoupling Task-Solving and Output Formatting in LLM Generation

Haikang Deng, Po-Nien Kung, Nanyun Peng · DOI

Large Language Models (LLMs) are remarkably adept at following instructions, yet they face a significant challenge when required to perform complex reasoning while simultaneously adhering to rigid output formats, such as JSON or specific templates. This "multitasking" often leads to a performance degradation where the model's reasoning capacity is drained by the effort to maintain structural constraints.

Researchers from UCLA have introduced DECO-G, a decoding framework designed to explicitly decouple task-solving from output formatting. By offloading the formatting burden to an external module, DECO-G allows the LLM to focus entirely on reasoning, ensuring both logical accuracy and 100% format compliance.

The Formatting-Reasoning Trade-off

Existing prompting strategies typically entangle logic and structure. When a model is prompted with both a task and a format constraint, it often experiences a "cognitive tax." As shown in Figure 1, standard prompting without constraints might yield the correct answer but fail the required format. Conversely, adding format constraints directly into the prompt can lead to "brain fry," where the model adheres to the format but produces an incorrect logical result.

Comparison of prompting strategies: standard prompting without constraints often yields correct answers but incorrect formats, while adding constraints improves format compliance at the cost of reasoning accuracy. DECO-G achieves both.

The DECO-G Framework

The core innovation of DECO-G is the Format Estimation Module (FEM), which operates alongside the LLM during the decoding process. This separation allows the LLM to be prompted solely with task instructions, while the formatting requirements are handled externally.

Architecture and Mechanism

The FEM combines probabilistic modeling with formal language theory to steer the LLM's output without being invasive. It consists of two primary components:

  1. Hidden Markov Model (HMM): This acts as a "lite" probabilistic proxy for the LLM. It is distilled from over a million instruction-response pairs to understand how the model typically behaves during a task.
  2. Deterministic Finite Automaton (DFA): This component represents the target format constraints. It ensures that the generated sequence strictly follows the required structure.
The DECO-G architecture: The LLM processes task instructions while the FEM (combining an HMM and DFA) manages format constraints. The final output distribution is a combination of both.

During generation, the LLM provides its standard token probabilities. Simultaneously, the FEM calculates the likelihood that a given token will eventually lead to a format-compliant sequence. By multiplying these probabilities, DECO-G "steers" the LLM toward the correct format while preserving its natural reasoning flow.

Key Insights and Results

Evaluation across mathematical reasoning (GSM8k), LLM-as-a-Judge (SummEval), and Event Argument Extraction (ACE05-EN) tasks demonstrated the effectiveness of this decoupled approach:

  • Performance Gains: On the GSM8k benchmark, DECO-G achieved an accuracy of 88.6% using Qwen2.5-7B, a significant improvement over standard natural language prompting (83.6%) and structured prompting (82.7%).
  • Guaranteed Compliance: Unlike standard prompting, which can drop to 64% compliance for complex formats, DECO-G achieved a perfect 100% format adherence across all tests.
  • Efficiency: To ensure real-time applicability, the authors implemented HMM state pruning, focusing only on the top 5% of hidden states. This resulted in a 13x speedup, making the FEM's computational overhead negligible (approximately 0.53% of the total workload).

Conclusion

DECO-G represents a shift in how we interact with LLMs, moving away from complex, multi-objective prompts toward a more modular generation process. By treating formatting as a decoding-time constraint rather than a prompting-time instruction, researchers can unlock higher reasoning performance while maintaining the strict structural integrity required for downstream applications.

Summary updated

BibTeX
@misc{deng2025decoupling,
  author = {Haikang Deng and Po-Nien Kung and Nanyun Peng},
  title = {{Decoupling Task-Solving and Output Formatting in LLM Generation}},
  year = {2025},
  eprint = {2510.03595},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.03595},
}
Figure