Datasets:

ArXiv:
License:
Dataset Viewer
The dataset viewer is not available for this dataset.
Cannot get the config names for the dataset.
Error code:   ConfigNamesError
Exception:    ValueError
Message:      
Expected data_files in YAML to be either a string or a list of strings
or a list of dicts with two keys: 'split' and 'path', but got [{'split': 'K-Standard-NumRule5-RandomSampleFalse', 'path': 'nl2rule/K-Standard-NumRule5-RandomSampleFalse-*'}, {'split': 'K-Standard-NumRule5-RandomSampleTrue', 'path': 'nl2rule/K-Standard-NumRule5-RandomSampleTrue-*'}, {'split': 'K-NonStandard-NumRule5-RandomSampleFalse', 'path': 'nl2rule/K-NonStandard-NumRule5-RandomSampleFalse-*'}, {'split': 'K-NonStandard-NumRule5-RandomSampleTrue', 'path': 'nl2rule/K-NonStandard-NumRule5-RandomSampleTrue-*'}, {'split': 'S-Standard-NumRule5-RandomSampleFalse', 'path': 'nl2rule/S-Standard-NumRule5-RandomSampleFalse-*'}, {'split': 'S-Standard-NumRule5-RandomSampleTrue', 'path': 'nl2rule/S-Standard-NumRule5-RandomSampleTrue-*'}, {'split': 'S-NonStandard-NumRule5-RandomSampleFalse', 'path': 'nl2rule/S-NonStandard-NumRule5-RandomSampleFalse-*'}, {'split': 'S-NonStandard-NumRule5-RandomSampleTrue', 'path': 'nl2rule/S-NonStandard-NumRule5-RandomSampleTrue-*'}]
Examples of data_files in YAML:

   data_files: data.csv

   data_files: data/*.png

   data_files:
    - part0/*
    - part1/*

   data_files:
    - split: train
      path: train/*
    - split: test
      path: test/*

   data_files:
    - split: train
      path:
      - train/part1/*
      - train/part2/*
    - split: test
      path: test/*

PS: some symbols like dashes '-' are not allowed in split names

Traceback:    Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/dataset/config_names.py", line 67, in compute_config_names_response
                  config_names = get_dataset_config_names(
                      path=dataset,
                      token=hf_token,
                  )
                File "/usr/local/lib/python3.14/site-packages/datasets/inspect.py", line 161, in get_dataset_config_names
                  dataset_module = dataset_module_factory(
                      path,
                  ...<4 lines>...
                      **download_kwargs,
                  )
                File "/usr/local/lib/python3.14/site-packages/datasets/load.py", line 1217, in dataset_module_factory
                  raise e1 from None
                File "/usr/local/lib/python3.14/site-packages/datasets/load.py", line 1192, in dataset_module_factory
                  ).get_module()
                    ~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/load.py", line 621, in get_module
                  metadata_configs = MetadataConfigs.from_dataset_card_data(dataset_card_data)
                File "/usr/local/lib/python3.14/site-packages/datasets/utils/metadata.py", line 153, in from_dataset_card_data
                  cls._raise_if_data_files_field_not_valid(metadata_config)
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/utils/metadata.py", line 100, in _raise_if_data_files_field_not_valid
                  raise ValueError(yaml_error_message)
              ValueError: 
              Expected data_files in YAML to be either a string or a list of strings
              or a list of dicts with two keys: 'split' and 'path', but got [{'split': 'K-Standard-NumRule5-RandomSampleFalse', 'path': 'nl2rule/K-Standard-NumRule5-RandomSampleFalse-*'}, {'split': 'K-Standard-NumRule5-RandomSampleTrue', 'path': 'nl2rule/K-Standard-NumRule5-RandomSampleTrue-*'}, {'split': 'K-NonStandard-NumRule5-RandomSampleFalse', 'path': 'nl2rule/K-NonStandard-NumRule5-RandomSampleFalse-*'}, {'split': 'K-NonStandard-NumRule5-RandomSampleTrue', 'path': 'nl2rule/K-NonStandard-NumRule5-RandomSampleTrue-*'}, {'split': 'S-Standard-NumRule5-RandomSampleFalse', 'path': 'nl2rule/S-Standard-NumRule5-RandomSampleFalse-*'}, {'split': 'S-Standard-NumRule5-RandomSampleTrue', 'path': 'nl2rule/S-Standard-NumRule5-RandomSampleTrue-*'}, {'split': 'S-NonStandard-NumRule5-RandomSampleFalse', 'path': 'nl2rule/S-NonStandard-NumRule5-RandomSampleFalse-*'}, {'split': 'S-NonStandard-NumRule5-RandomSampleTrue', 'path': 'nl2rule/S-NonStandard-NumRule5-RandomSampleTrue-*'}]
              Examples of data_files in YAML:
              
                 data_files: data.csv
              
                 data_files: data/*.png
              
                 data_files:
                  - part0/*
                  - part1/*
              
                 data_files:
                  - split: train
                    path: train/*
                  - split: test
                    path: test/*
              
                 data_files:
                  - split: train
                    path:
                    - train/part1/*
                    - train/part2/*
                  - split: test
                    path: test/*
              
              PS: some symbols like dashes '-' are not allowed in split names

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

The 43rd International Conference on Machine Learning (ICML 2026), Seoul, South Korea

LLMs Lean on Priors, Not Programming Language Semantics PLSemanticsBench logo

by Aditya Thimmaiah1, Jiyang Zhang1, Jayanth Srinivasa2, Junyi Jessy Li1, Milos Gligoric1

1The University of Texas at Austin     2Cisco Research

Website arXiv Code Dataset


TLDR: Frontier LLMs execute programs with up to 90–100% accuracy when symbols retain their usual meanings (e.g., + means addition). Under counterfactual semantic shifts (e.g., redefining + to mean subtraction) accuracy collapses by 40–70 percentage points. Despite handing the complete formal rules, the models keep answering as if the rules were never changed. LLMs don't faithfully interpret the semantics they are given—they retrieve what symbols usually mean from pretraining.

Abstract

Recent work asks whether large language models (LLMs) condition their reasoning on explicit rules rather than statistical regularities from pre-training. Program execution provides a canonical instance: formal semantics define behavior through symbolic transition rules that can be systematically altered under distribution shift. We investigate whether LLMs can condition their reasoning on formal semantics through program execution and introduce PLSEMANTICSBENCH, pairing featherweight C programs with two semantic systems—small-step operational semantics and K semantics—and probing four capabilities: composing rules for final states, selecting rules when state is unmutated, sustaining such conditioning over long traces, and following supplied rules under novel semantics. To decouple semantic reasoning from syntactic familiarity, we redefine familiar operators to induce symbol-meaning conflict and introduce novel symbols defined only through the supplied rules, and stress-test models on Human-Written, LLM-Translated, and Fuzzer-Generated splits with increasing structural complexity. Across 11 frontier LLMs, strong final-state accuracy under standard semantics (up to 90%) drops sharply—by as much as 40–60% points—under semantic mutations and increasing structural complexity. Only a handful of models achieve non-zero long-horizon conditioning accuracy, and even the best systems reach just 35%. Together, these results suggest that contemporary LLMs often rely on pretrained lexical associations rather than systematically conditioning on supplied formal rules.

About

PLSemanticsBench is the first counterfactual PL semantics dataset for rule-conditioned reasoning of LLMs. We introduce three tasks to evaluate this:

Task Description
PredState Predicts the final program state
PredRule Predicts the ordered sequence of semantic rules needed to evaluate a program
PredTrace Predicts the step-by-step execution of a program

You must implement BaseRunner(_query method) to evaluate your models. We provide two example implementations for OpenAI models (GPTRunner) and Ollama models (OllamaRunner).

Installation

System Requirements

  • Python 3.11 or higher
  • OpenAI API key (for running experiments with OpenAI models)

Step-by-Step Installation

  1. Create and activate the conda environment:
conda env create -f env.yaml
conda activate plsemanticsbench
  1. Set up your OpenAI API key (only for OpenAI models):
export OPENAI_API_KEY='your-api-key-here'

Quick Start

We provide a bash script quick that:

  1. Sets up the plsemanticsbench conda environment.
  2. Pulls the DeepSeek-R1 1.5B model.
  3. Evaluates the DeepSeek-R1 1.5B model on the PredState task with no-semantics and chain-of-thought prompting on the Human-Written dataset.
  4. Prints the accuracy and malformed-count to screen.
  5. Creates metrics-predstate-deepseek-r1:1.5b.json that contains the evaluation result.
bash quick

Detailed Usage

Basic Example

Here's a minimal example to get started:

from plsemanticsbench import GPTRunner
from plsemanticsbench import ExperimentArgs, LLMEvaluator
from plsemanticsbench import (
    PROMPT_STRATEGY,
    Task,
    Formalization,
    Semantics_Type,
    Language,
    PLDataset
)

# Model name
model_name = "o3-mini"

# Experiment args: Run the PredState task on the IMP language with
# standard semantics formalized using SOS and with direct prompting
exp_args = ExperimentArgs(
    dataset=PLDataset.Human_Written,
    task=Task.PredState,
    language=Language.IMP,
    formalization=Formalization.SOS,
    semantics_type=Semantics_Type.Standard,
    model_name=model_name,
    prompt_strategy=PROMPT_STRATEGY.DA,
    num_datapoints_to_run=2, # Run just 2 datapoints (omit to run entire dataset)
)
                        
# Run inference using the OpenAI API
gpt_runner = GPTRunner(args=exp_args)

# Generation (generate LLM prediction on the predstate task)
predictions = gpt_runner.do_experiment() # path to dump results can be provided

# Evaluation (evaluate LLM prediction against ground-truth)
llm_eval = LLMEvaluator(task=exp_args.task, semantics_type=exp_args.semantics_type)
evaluation_result = llm_eval.evaluate_from_list(results=predictions, model_name=model_name)
print(evaluation_result)

Expected Output

{
    'accuracy': 1,
    'malformed-count': 0,
}

Benchmark

You can load the dataset using the datasets library. Here is an example:

from datasets import load_dataset

# Load PredState task with standard semantics (uk) and K-semantics formalization (K) and with the Human Written (human-written) dataset
predstate_IMP_K_uk_human_written = load_dataset("EngineeringSoftware/PLSemanticsBench", name="predstate-IMP-K-uk-human-written")

# Load PredRule task with nonstandard semantics (mk) ans SOS formalization (SOS) and with the LLM Translated (llm-translated) dataset
predrule_IMP_SOS_mk_llm_translated = load_dataset("EngineeringSoftware/PLSemanticsBench", name="predrule-IMP-SOS-mk-llm-translated")

# Load PredState task with no-semantics (nk) and with the Fuzzer Generated (fuzzer-generated) dataset
predstate_IMP_nk_fuzzer_generated = load_dataset("EngineeringSoftware/PLSemanticsBench", name="predstate-IMP-nk-fuzzer-generated")

Dataset Split

Task Split Description
PredState
(Final State Prediction)
predstate-IMP-nk-{dataset-name} No semantics
predstate-IMP-K-uk-{dataset-name} Standard semantics with K-semantics formalization
predstate-IMP-K-mk-{dataset-name} Nonstandard semantics with K-semantics formalization
predstate-IMP-SOS-uk-{dataset-name} Standard semantics with SOS formalization
predstate-IMP-SOS-mk-{dataset-name} Nonstandard semantics with SOS formalization
PredRule
(Semantic Rule Prediction)
predrule-IMP-K-uk-human-written Standard semantics with K-semantics formalization
predrule-IMP-K-mk-human-written Nonstandard semantics with K-semantics formalization
predrule-IMP-SOS-uk-human-written Standard semantics with SOS formalization
predrule-IMP-SOS-mk-human-written Nonstandard semantics with SOS formalization
PredTrace
(Execution Trace Prediction)
predtrace-IMP-K-uk-human-written Standard semantics with K-semantics formalization
predtrace-IMP-K-mk-human-written Nonstandard semantics with K-semantics formalization
predtrace-IMP-SOS-uk-human-written Standard semantics with SOS formalization
predtrace-IMP-SOS-mk-human-written Nonstandard semantics with SOS formalization

Data Example

One example of the dataset is as follows:

{
  "program": "int ans; ans = 1; ...",
  "syntax": "<program> :: ...",
  "semantics": "ℤ := Set of integers ...",
  "mutated-program": "int ans; ans = 1; ...",
  "mutation-pattern": "KeyWordSwap",
  "exec-trace": [
    {
      "linenumber": 1,
      "rule": ["Rule 38", "Rule 39"],
      "state": {"ans": 1}
    }
  ],
  "ground-truth": "<answer>...</answer>"
}

Citation

@inproceedings{ThimmaiahETAL25PLSemanticsBench,
  title     = {LLMs Lean on Priors, Not Programming Language Semantics},
  author    = {Thimmaiah, Aditya and Zhang, Jiyang and Srinivasa, Jayanth
               and Li, Junyi Jessy and Gligoric, Milos},
  booktitle = {ICML},
  year      = {2026}
}

License

This project is licensed under the CC BY 4.0 License.

Downloads last month
331

Paper for EngineeringSoftware/PLSemanticsBench