Do LLMs "know" internally when they follow instructions?

Juyeon Heo, Christina Heinze-Deml, Oussama Elachqar, Shirley Ren, Udhay Nallasamy +3 more
2/12/2026

No official code found. Best implementation: apple/ml-internal-llms-instruction-following (14 stars, last commit 2025-03-19).

Abstract

Instruction-following is crucial for building AI agents with large language models (LLMs), as these models must adhere strictly to user-provided constraints and guidelines. However, LLMs often fail to follow even simple and clear instructions. To improve instruction-following behavior and prevent undesirable outputs, a deeper understanding of how LLMs' internal states relate to these outcomes is required. In this work, we investigate whether LLMs encode information in their representations that correlate with instruction-following success - a property we term knowing internally. Our analysis identifies a direction in the input embedding space, termed the instruction-following dimension, that predicts whether a response will comply with a given instruction. We find that this dimension generalizes well across unseen tasks but not across unseen instruction types. We demonstrate that modifying representations along this dimension improves instruction-following success rates compared to random changes, without compromising response quality. Further investigation reveals that this dimension is more closely related to the phrasing of prompts rather than the inherent difficulty of the task or instructions. This work provides insight into the internal workings of LLMs' instruction-following, paving the way for reliable LLM agents.

View on arXivView PDF

Code Implementations(1)

142Shell, PythonMar 19, 20251 years agoNOASSERTION

Similar Papers

Cite this paper

@article{heo2026llms,
  title  = {Do LLMs "know" internally when they follow instructions?},
  author = {Juyeon Heo and Christina Heinze-Deml and Oussama Elachqar and Shirley Ren and Udhay Nallasamy and Andy Miller and Kwan Ho Ryan Chan and Jaya Narain},
  year   = {2026},
  eprint = {2410.14516},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2410.14516},
  journal = {ICLR 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.14516.svg)](https://codeofpaper.com/paper/2410.14516)

Discussion