Background & Motivation
Foundation LLMs (Claude, GPT, Gemini, Llama, DeepSeek) overwhelmingly default to 1980s-era imperative Prolog constructs:
- Non-logical cuts (
!)
- Soft cuts (
( Cond -> Then ; Else ))
- Negation-as-failure (
\+) for inequality
- Procedural built-in list operations (
include/3, member/2 in conditional tests)
- Arithmetic evaluation (
is/2, <) that breaks query reversibility
This occurs due to a 1000:1 historical training distribution imbalance: over 99% of open-source Prolog code across GitHub, Rosetta Code, and textbooks (1980–2012) was written before modern ISO standardization and prior to Ulrich Neumerkel's development of library(reif) (2014+).
Modern AI alignment and post-training pipelines rely heavily on Direct Preference Optimization (DPO) and RLHF datasets hosted on Hugging Face (trl, axolotl, llama-factory). When a model is tuned with DPO, its loss function directly penalizes undesirable patterns and rewards preferred paradigms.
Currently, no curated, pure declarative Prolog DPO dataset exists on Hugging Face. Creating one provides an open resource that model creators can ingest to permanently improve future Prolog coding models.
Objective
Curate, validate, and publish an open-access DPO dataset on Hugging Face (e.g. dougransom/modern-pure-prolog-dpo or prolog-agent-toolkit/pure-prolog-dpo) under a permissive open license (Apache-2.0 / CC-BY-4.0).
Dataset Schema (DPO / Preference Triplet)
Each entry will follow the standard Hugging Face DPO schema:
{
"prompt": "User coding request or algorithmic task",
"chosen": "Modern, pure ISO Prolog solution using library(reif), CLP(Z), chars, and clean data representations",
"rejected": "Legacy imperative solution relying on cuts (!), soft cuts (->), is/2, or non-monotonic negation",
"rationale": "Detailed explanation of why the chosen solution preserves bidirectionality, monotonicity, and declarative debugging, while explaining why the rejected solution commits destructively or fails on uninstantiated variables."
}
Target Content & Problem Categories (300–500 pairs)
- List Filtering & Transformation:
chosen: tfilter(dif(X), List, Out) and higher-order closures.
rejected: Recursive loops with cuts remove(X, [X|Xs], Ys) :- !, ... or include/3.
- Conditional Branching & Option Lookups:
chosen: if_/3, memberd_t/3, cond_t/3, lookup_option/4.
rejected: ( member(Key(Val), Opts) -> ... ; Val = Default ).
- Declarative Integer Arithmetic:
chosen: library(clpz) constraints (#=, #<, #=<, domain declarations ins).
rejected: is/2, >, < causing instantiation errors when queried backwards.
- Clean vs. Defaulty Data Representations:
chosen: Terms distinguishable solely by principal functor (leaf(X) vs node(L, R)).
rejected: Catch-all default clauses or runtime var/1/nonvar/1 testing.
- Pure Definite Clause Grammars (DCGs):
chosen: Pure sequence parsing and generation with --> and { if_(...) }.
rejected: Non-logical cuts in DCG bodies or imperative peek lookaheads.
Quality Control & Automated Verification
To ensure this dataset is the highest-quality Prolog resource on Hugging Face:
- Purity Gate: Run
prolog-audit from prolog-agent-toolkit over every chosen solution to mathematically verify 0 unjustified cuts, 0 soft cuts, and 0 unsound negations.
- Bidirectionality Unit Tests: Run
prolog-safe (Scryer and Trealla runners) to assert that every chosen predicate succeeds both forward (?- pred(+In, -Out).) and backward (?- pred(-In, +Out).).
Deliverables
Background & Motivation
Foundation LLMs (Claude, GPT, Gemini, Llama, DeepSeek) overwhelmingly default to 1980s-era imperative Prolog constructs:
!)( Cond -> Then ; Else ))\+) for inequalityinclude/3,member/2in conditional tests)is/2,<) that breaks query reversibilityThis occurs due to a 1000:1 historical training distribution imbalance: over 99% of open-source Prolog code across GitHub, Rosetta Code, and textbooks (1980–2012) was written before modern ISO standardization and prior to Ulrich Neumerkel's development of
library(reif)(2014+).Modern AI alignment and post-training pipelines rely heavily on Direct Preference Optimization (DPO) and RLHF datasets hosted on Hugging Face (
trl,axolotl,llama-factory). When a model is tuned with DPO, its loss function directly penalizes undesirable patterns and rewards preferred paradigms.Currently, no curated, pure declarative Prolog DPO dataset exists on Hugging Face. Creating one provides an open resource that model creators can ingest to permanently improve future Prolog coding models.
Objective
Curate, validate, and publish an open-access DPO dataset on Hugging Face (e.g.
dougransom/modern-pure-prolog-dpoorprolog-agent-toolkit/pure-prolog-dpo) under a permissive open license (Apache-2.0 / CC-BY-4.0).Dataset Schema (DPO / Preference Triplet)
Each entry will follow the standard Hugging Face DPO schema:
{ "prompt": "User coding request or algorithmic task", "chosen": "Modern, pure ISO Prolog solution using library(reif), CLP(Z), chars, and clean data representations", "rejected": "Legacy imperative solution relying on cuts (!), soft cuts (->), is/2, or non-monotonic negation", "rationale": "Detailed explanation of why the chosen solution preserves bidirectionality, monotonicity, and declarative debugging, while explaining why the rejected solution commits destructively or fails on uninstantiated variables." }Target Content & Problem Categories (300–500 pairs)
chosen:tfilter(dif(X), List, Out)and higher-order closures.rejected: Recursive loops with cutsremove(X, [X|Xs], Ys) :- !, ...orinclude/3.chosen:if_/3,memberd_t/3,cond_t/3,lookup_option/4.rejected:( member(Key(Val), Opts) -> ... ; Val = Default ).chosen:library(clpz)constraints (#=,#<,#=<, domain declarationsins).rejected:is/2,>,<causing instantiation errors when queried backwards.chosen: Terms distinguishable solely by principal functor (leaf(X)vsnode(L, R)).rejected: Catch-all default clauses or runtimevar/1/nonvar/1testing.chosen: Pure sequence parsing and generation with-->and{ if_(...) }.rejected: Non-logical cuts in DCG bodies or imperative peek lookaheads.Quality Control & Automated Verification
To ensure this dataset is the highest-quality Prolog resource on Hugging Face:
prolog-auditfromprolog-agent-toolkitover everychosensolution to mathematically verify 0 unjustified cuts, 0 soft cuts, and 0 unsound negations.prolog-safe(Scryer and Trealla runners) to assert that everychosenpredicate succeeds both forward (?- pred(+In, -Out).) and backward (?- pred(-In, +Out).).Deliverables
prolog-agent-toolkit(e.g.scripts/generate_hf_dataset.py).datasets.README.md) on Hugging Face explaining the historical bias, declarative purity invariants, and training instructions.