Loading...
Loading...
Contributors:
Dataset URI:
10.5281/zenodo.23106759This artifact accompanies the paper "Every p Is Followed by a q": An Empirical Study of Ambiguity in Formalizing Temporal Requirements with LLMs. It contains the datasets of the study, the LLM-based filter that selected the real-world requirements and its decisions, the LLM responses we collected and the script that collects them, the trained regression models, and the scripts that reproduce every table of the paper. BUILDING THE DOCKER IMAGE The artifact is intended to be executed inside the provided Docker environment. Build the image from the artifact root: docker build -t ltl-ambiguity . The image builds the Spot library from source, so the first build takes about 20 minutes on a typical machine. It only needs to be done once. Start an interactive container, mounting out/ so that the results are also visible on the host: docker run --rm -it -v "$PWD/out:/workspace/out" ltl-ambiguity The working directory inside the container is /workspace; all commands below are run from there. REPRODUCING THE RESULTS bash run_all.sh runs every analysis from the shipped data and models in about one minute and writes its outputs to out/. The frozen outputs from which the paper's tables were taken are in results/, under the same file names, for comparison. Which script reproduces which part of the paper:- Table 3 and the RQ1 text (real-world vs. synthetic means, r = 0.73, the 7 and 25 diverging requirements): rq1_ambiguity_prevalence.py, writing rq1_table3.csv- Table 5 and the RQ2 text: rq2_model_analysis.py, writing rq2_table5.csv- Table 1: rq3_pattern_frequencies.py, writing rq3_table1_patterns.csv- Table 6, CV R^2 columns (also trains the models): rq3_model_fit.py, writing rq3_table6_cv.csv and the models in out/models/- Table 7 (and the features it omits): rq3_feature_selection.py, writing rq3_table7_selection_entropy.csv and rq3_table7_selection_distance.csv- Table 6, held-out rho columns; Table 8; the R^2 values of the RQ4 text: rq4_predictive_power.py, writing rq4_predictive_power.csv and rq4_predictions.csv- Table 10 and the RQ5 text on measured ambiguity: rq5_accuracy_ambiguity_correlation.py, writing rq5_table10.csv, rq5_table10.tex and rq5_accuracy_per_requirement.csv- RQ5 text and Figure 2 AUCs on predicted ambiguity: rq5_accuracy_predicted_ambiguity.py, writing rq5_predicted_accuracy.csv Each script prints the table as it appears in the paper. Tables 2, 4 and 9 are not computed by a script: Table 2 is a taxonomy, Table 4 lists example requirements whose responses are in responses/, and the predicted and measured values of Table 9 are in out/rq4_predictions.csv. Two steps are slower and are not part of run_all.sh:- Training the models (Table 6, CV R^2). python3 rq3_model_fit.py cross-validates the twenty configurations of Table 6 (five feature/corpus configurations, two methods, two proxies), then trains each on its full training data and saves it to out/models/. It takes about 15 minutes. The shipped models in models/ are not overwritten; to evaluate the retrained ones, pass --models out/models to rq4_predictive_power.py and rq5_accuracy_predicted_ambiguity.py.- Recomputing the RQ2 equivalence classes. rq2_model_analysis.py reports from the partition of each requirement's responses stored in cache/. python3 rq2_model_analysis.py --recluster recomputes it with Spot into out/rq2_cache/, which takes several hours. TRAINED MODELS models/ holds the twenty models used in RQ3-RQ5, one file per configuration, proxy and method, named <configuration>_<proxy>_<method>.joblib, where the configuration is full (all features, whole training corpus), temporal or non_temporal (temporal or general features only), or real_world or synthetic (one corpus group only). Each file holds the fitted scikit-learn model with the feature columns it expects. RQ4 uses all of them; RQ5 uses full_entropy_ElasticNet and full_distance_ElasticNet. Retraining is deterministic. ElasticNetCV uses fixed folds and cyclic coordinate descent, the random forests a fixed seed, and stability selection and cross-validation fixed seeds, so with the library versions pinned in the image, rq3_model_fit.py retrains the same models. We checked this: the shipped models were trained in this image, and retraining them in it reproduces all 7140 of their held-out predictions bit for bit. Against the environment in which we first ran the analyses (Python 3.14 instead of 3.12), the random forests' predictions are identical and ElasticNet's differ by at most 1e-15 (floating-point summation order), which leaves every reported number unchanged. Other library versions or hardware could change the last digits of the predictions, but not the results reported in the paper. CONTENTS - sources/: the eleven corpora in their original form (see sources/SOURCES.md)- filter_decisions/: the LLM-based filter's decision on every QuRE, PURE and Promise+ candidate- inputs/: per corpus, the requirements and atomic propositions sent to the LLMs- responses/: per corpus, the collected responses with entropy and distance- features/: the 105 features of every requirement: training_corpus.csv (the seven training corpora) and one file per held-out dataset- cache/: RQ2 equivalence classes of every requirement's responses- models/: trained regression models (RQ3-RQ5)- results/: frozen outputs of the scripts, as used in the paper- data_collection/: the real-world filter, the collection script and the trace-based distance- *.py, run_all.sh: the analyses; paths.py defines where each script reads and writes- out/: outputs of new runs DATA FORMATS responses/<corpus>.csv has one row per collected requirement: req (the text), APs (the atomic propositions given to the LLMs), normalized_entropy (the bounded entropy E), weighted_pairwise_distance (the distance D), avg_traces_per_formula, probabilities (the frequencies of the equivalence classes), and <llm>_sample_<k> for the three responses of each of the six LLMs (claude, gemini, gpt, llama, qwen, mistral). An empty response cell is a response discarded as unparseable or as using propositions outside the provided set. The files hold 4654 rows; 61 of them are not analysed: 60 whose equivalence or distance computation timed out (blank normalized_entropy or weighted_pairwise_distance), and one Dwyer entry whose source gives no requirement text (??). The analysed 4593 are those of features/. features/*.csv has one row per analysed requirement: req, source (training corpus only), the two proxies, and the 105 features. Feature names follow their family: grp_<family>_... for the per-family temporal features (count, max_A_log_length, max_A_depth, any_A_negated, the same for B, and any_marker_before_matrix, the "reversed" flag), pair_<f1>_<f2>_count for co-occurrences of two families, req_... for the general features of the requirement and ap_... for those of its atomic propositions. rq3_feature_selection.py maps them to the labels of Table 7. inputs/<corpus>.csv has the columns Natural Language (the requirement), Atomic Proposition (the propositions as given to the LLMs) and Ground Truth (the corpus's formula, filled for the four synthetic corpora, whose ground truths RQ5 reads from here; the ground truths of Dwyer, ARTEMIS and SpaceWire are read from sources/). DATA COLLECTION (FOR COMPLETENESS ONLY) The responses were collected in two steps, both included for transparency, not for exact replication: they need API credentials, the queries cost money, and LLM output is not deterministic. Filtering the real-world requirements QuRE, PURE and Promise+ were not written with LTL in mind, so an LLM-based filter selected the requirements that admit a temporal reading and, for each one it kept, formalized it to provide its atomic propositions (Section 5 of the paper).- data_collection/build_filter_inputs.py builds the candidate lists from sources/ into out/filter/: all 2187 QuRE and 3677 Promise+ requirements, and 2081 PURE requirements. For PURE it excludes five of the 18 documents, which are dominated by definitional or informational content (a usability style guide, interface definitions, a data dictionary, a procurement glossary, website content requirements), and elements that enumerate a nested list. It runs without credentials.- data_collection/filter_real_world_requirements.py is the filter: Claude Fable 5 at high reasoning effort, with Claude Opus 4.8 as a fallback, judges each candidate and formalizes the ones it keeps. We ran it unchanged on all three corpora, so its prompt names QuRE even for PURE and Promise+. It needs ANTHROPIC_API_KEY. filter_decisions/<corpus>.csv holds the decision on every candidate, with the columns id, requirement, keep, reason (the filter's justification), APs and formula (the filter's formalization, for kept requirements) and defect (the corpus's own label, passed through). The filter kept 633 QuRE, 703 PURE and 999 Promise+ requirements; after deduplication and the measurement timeouts, 617, 676 and 901 of them are analysed. The APs of the kept requirements are those in inputs/. Collecting the responses data_collection/generate_semantic_entropy.py collects the responses for one corpus and computes entropy and distance, producing a file in the format of responses/. It sends every requirement of an input file to the six LLMs of the paper, three times each at temperature 0.4, with the prompt of Figure 1. It needs API credentials for Anthropic, Google, OpenAI and OpenRouter, and its output is not deterministic: the LLMs sample at a non-zero temperature, proprietary models change over time, and the distance samples trace completions at random when there are more than 50. The analyses do not need it; they use the responses we collected, in responses/. Recomputing the proxies from those stored responses with the functions of this script gives the stored entropy exactly; the distance varies slightly with the random completions (by at most 0.008 on the SpaceWire requirements we checked). To run it on one corpus, pass the credentials into the container: docker run --rm -it -v "$PWD/out:/workspace/out" -e ANTHROPIC_API_KEY -e GEMINI_API_KEY -e OPENAI_API_KEY -e OPENROUTER_API_KEY ltl-ambiguitypython3 data_collection/generate_semantic_entropy.py inputs/spacewire.csv out/spacewire.csv SpaceWire, with 35 requirements, is the smallest corpus. ENVIRONMENT The image is based on Ubuntu 24.04 with Python 3.12, Spot 2.15.1, and the Python packages pinned in requirements.txt. We ran the artifact on a Linux machine with 8 CPU cores and 14 GB of RAM.
Keyword(s):
MeSH Term(s):
Grants and Funding:
No Grants or Funding Data Available
Associated Publication(s):
No Associated Publication Data Available
Supplementary Data:
No Supplementary Data Available
Related Dataset(s):
No Related Dataset Data Available
The National Library of Medicine (NLM) provides information about biomedical datasets. Inclusion on an NLM Web page does not imply endorsement of, or agreement with, the contents by NLM or the National Institutes of Health. Learn more: NLM Web Policies (nih.gov)