Downloads · 30 days
5
7% of all-time downloads
Carnot-EBM/carnot-constraint-propagation-logic
carnot-constraint-propagation-logic is a machine learning model from Carnot-EBM. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Research Artifact — Not Production-Ready This model verifies logical syllogism responses using structural binary features. It achieves AUROC 1.0 on the held-out test set (matching Exp 89 reference). It handles modus p…
Downloads · 30 days
5
7% of all-time downloads
All-time downloads
70
Public
Parameters
40.2K
161 KB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors161 KB · 96%
From the Hugging Face model README
Research Artifact — Not Production-Ready
This model verifies logical syllogism responses using structural binary features. It achieves AUROC 1.0 on the held-out test set (matching Exp 89 reference). It handles modus ponens, modus tollens, disjunctive syllogism, and affirming the consequent — not arbitrary logic or modal reasoning.
Learned Ising constraint model for logical syllogism verification.
Trained via discriminative Contrastive Divergence (Exp 62/89) on 400 verified (question, correct, wrong) triples for four syllogism types. Assigns a scalar energy to binary-encoded responses — lower energy means the response correctly identifies whether a syllogism is valid or invalid.
An Ising Energy-Based Model (EBM):
E(x) = -(b^T s + s^T J s) s = 2x - 1 ∈ {-1, +1}^200
The coupling matrix J encodes feature pair co-occurrences that distinguish valid from invalid logic responses (e.g., "follows by modus ponens" + "this follows" co-occurring is a strong correct-response signal).
Algorithm: Discriminative Contrastive Divergence (full-batch)
| Hyperparameter | Value |
|---|---|
| Training pairs | 400 (80% of 500 generated) |
| Feature dimension | 200 binary features |
| Learning rate | 0.01 |
| L1 regularization | 0.0 |
| Weight decay | 0.005 |
| Epochs | 300 |
| Source | Exp 62 (domain CD) + Exp 89 (self-bootstrap) |
Training data: Programmatically generated syllogism triples — four types:
Wrong answers reverse the conclusion or deny the correct inference pattern.
| Metric | This export | Exp 89 reference |
|---|---|---|
| AUROC (test) | 1.0000 | 1.0000 |
| Accuracy (test) | 100.0% | 100.0% |
| Test set size | 100 | 31 |
| Baseline AUROC | 0.5 | 0.5 |
Perfect separation: the structural features of valid-logic responses (keywords "follows by", "modus ponens", "modus tollens", "disjunctive syllogism", "affirming the consequent") are highly discriminative.
import numpy as np
from carnot.inference.constraint_models import ConstraintPropagationModel
# Load model
model = ConstraintPropagationModel.from_pretrained(
"exports/constraint-propagation-models/logic"
)
# Encode a response
from scripts.export_constraint_models import encode_answer
question = "If all cats are mortal, and all robots are cats, what follows?"
answer = "All robots are mortal. This follows by modus ponens."
x = encode_answer(question, answer)
energy = model.energy(x) # low = valid syllogism
score = model.score(x) # high = more likely a correct logic response
print(f"Energy: {energy:.2f}, Score: {score:.3f}")
| File | Description |
|---|---|
model.safetensors | Coupling matrix J (200×200) and bias b (200,) as float32 |
config.json | Training metadata and benchmark results |
README.md | This file |
@misc{carnot2026constraint_logic,
title = {Carnot Constraint Propagation Model: Logic},
author = {Carnot-EBM},
year = {2026},
url = {https://github.com/ianblenke/carnot}
}
For production LLM output verification, install: pip install carnot
This model is a Phase 1 research artifact (activation-based confidence detection). These 16 per-token activation EBMs detect confidence, not correctness. For the full verify-repair pipeline, see: https://github.com/Carnot-EBM/carnot-ebm