Training with Pseudo-Code for Instruction Following

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Kumar, Prince, Murthy, Rudra, Bhat, Riyaz, Contractor, Danish
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912960758153216
author Kumar, Prince
Murthy, Rudra
Bhat, Riyaz
Contractor, Danish
author_facet Kumar, Prince
Murthy, Rudra
Bhat, Riyaz
Contractor, Danish
contents Despite rapid advances in the capabilities of Large Language Models (LLMs), they continue to struggle with following relatively simple and unambiguous instructions, particularly when compositional structure is involved. Recent work suggests that models may follow instructions more effectively when they are expressed in pseudo-code rather than natural language. However, writing pseudo-code programs can be tedious, and relying on few-shot demonstrations or inference-time code prompting is often unnatural for non-expert users of LLMs. To overcome these limitations, we propose a training time approach that fine-tunes LLMs using instruction-tuning data augmented with pseudo-code representations of natural language instructions paired with final responses. We evaluate our method on 12 publicly available benchmarks spanning instruction-following, mathematical reasoning, and commonsense reasoning, across six base models. Our results show that models trained with pseudo-code follow instructions more reliably, achieving relative gains of 8-21\% on instruction following benchmarks, while largely preserving and in some cases improving performance on mathematical and commonsense reasoning tasks, with an average gain of up to 30\% across all evaluated benchmarks.
format Preprint
id arxiv_https___arxiv_org_abs_2505_18011
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Training with Pseudo-Code for Instruction Following
Kumar, Prince
Murthy, Rudra
Bhat, Riyaz
Contractor, Danish
Computation and Language
Artificial Intelligence
Despite rapid advances in the capabilities of Large Language Models (LLMs), they continue to struggle with following relatively simple and unambiguous instructions, particularly when compositional structure is involved. Recent work suggests that models may follow instructions more effectively when they are expressed in pseudo-code rather than natural language. However, writing pseudo-code programs can be tedious, and relying on few-shot demonstrations or inference-time code prompting is often unnatural for non-expert users of LLMs. To overcome these limitations, we propose a training time approach that fine-tunes LLMs using instruction-tuning data augmented with pseudo-code representations of natural language instructions paired with final responses. We evaluate our method on 12 publicly available benchmarks spanning instruction-following, mathematical reasoning, and commonsense reasoning, across six base models. Our results show that models trained with pseudo-code follow instructions more reliably, achieving relative gains of 8-21\% on instruction following benchmarks, while largely preserving and in some cases improving performance on mathematical and commonsense reasoning tasks, with an average gain of up to 30\% across all evaluated benchmarks.
title Training with Pseudo-Code for Instruction Following
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2505.18011