nyashastino/ lfx:latest

5 1 month ago

Fine-tuned 3B model that deconstructs natural-language arguments into structured JSON: isolating premises, conclusions, 22 logical forms and fallacies, and suppressed premises.

ollama run nyashastino/lfx

Details

1 month ago

29aef662e179 · 3.3GB

qwen2
·
3.09B
·
Q8_0
Extract the logical structure of the argument into JSON with keys: premises (array of strings), conc
Logical Form Extractor — argument structure extraction. Built with Qwen. Base model: unsloth/Qwen2
{ "num_ctx": 4096, "stop": [ "<|im_start|>", "<|im_end|>" ], "temper
{{ if .System }}<|im_start|>system {{ .System }}<|im_end|> {{ end }}{{ if .Prompt }}<|im_start|>user

Readme

Extract the logical skeleton of natural-language arguments into structured JSON.

nyashastino/lfx is a fine-tuned 3B parameter model (based on Qwen2.5-3B-Instruct) engineered specifically to deconstruct natural-language arguments. Given an argumentative passage, it extracts individual premises, isolates the asserted conclusion, determines whether the argument is deductive or inductive, identifies the specific logical form or fallacy (from a 22-class taxonomy), and reconstructs unstated enthymematic premises.


Quick Start

Run directly in your terminal:

ollama run nyashastino/lfx "All men are mortal. Socrates is a man. Therefore Socrates is mortal."

Output:

{
  "premises": [
    "All men are mortal.",
    "Socrates is a man."
  ],
  "conclusion": "Socrates is mortal.",
  "argument_type": "deductive",
  "form": [
    "categorical syllogism"
  ],
  "suppressed_premise": null
}

Available Tags

Tag Quantization Size RAM Required Best For
nyashastino/lfx:latest
nyashastino/lfx:3b-q8
Q8_0 (8-bit) 3.3 GB ~4.5 GB Primary Release. Best overall accuracy (89.7% benchmark accuracy, 78.1% on held-out human prose) and highest premise extraction fidelity.

To pull the model:

ollama pull nyashastino/lfx

Output Schema

The model responds strictly with a single, valid JSON object matching this schema:

{
  "premises": [
    "First premise statement",
    "Second premise statement"
  ],
  "conclusion": "The claim being argued for",
  "argument_type": "deductive" | "inductive",
  "form": [
    "primary logical form or fallacy"
  ],
  "suppressed_premise": "Unstated assumption required for validity, or null"
}

Field Definitions:

  • premises (array of strings): Explicit claims provided as evidence or support.
  • conclusion (string): Central asserted claim the premises aim to establish.
  • argument_type (string): "deductive" (presented as following with necessity) or "inductive" (presented as probable/supported).
  • form (array of 1–3 strings): Primary logical form or fallacy exhibited. Single-step arguments have 1 form; multi-step chains order moves with the primary move first.
  • suppressed_premise (string or null): Reconstructed unstated premise (enthymeme) necessary to bridge premises to conclusion. null if the argument is complete as stated.

Supported Logical Forms (22 Classes)

Aligned with formal logic and critical thinking curricula (Duke University Think Again framework):

  • Valid Deductive (6): modus ponens, modus tollens, hypothetical syllogism, disjunctive syllogism, categorical syllogism, reductio ad absurdum
  • Inductive (6): generalization, application of generalization, inference to the best explanation, analogy, causal, authority
  • Formal Fallacies (2): affirming the consequent, denying the antecedent
  • Informal Fallacies (7): ad hominem, hasty generalization, false dilemma, ad populum, begging the question, straw man, equivocation
  • Other (1): other (reserved for multi-step arguments or patterns outside this taxonomy)

Benchmark Performance

Evaluated on the unified LFX-Bench v1 (1,521 unseen argumentative passages across all 22 classes with verified provenance):

Benchmark Metric Full Benchmark (n=1521) Held-Out Human Prose (n=485)
End-to-End Form Accuracy 89.7% (1365 / 1521) 78.1% (379 / 485)
Macro-F1 (22 Classes) 0.861 0.840
Schema Validity 99.8% 99.8%
JSON Parses 99.9% 100%
Argument Type Accuracy 94.4% 84.5%
Premise F1 0.890 0.748
Conclusion Similarity 0.911 0.925
Suppressed Premise Match 0.900 0.812

Breakdown by Provenance Tier:

  • constructed-symbolic (n=693): 98.8% (label specified by construction, verified by blind formalization through symbolic rules)
  • constructed-consensus (n=309): 92.9% (inductive forms verified by blind multi-model agreement)
  • external-human (n=485): 78.1% (authentic human op-eds and speech passages from LOGIC)
  • project-authored (n=34): 41.2% (condensed classical philosophical texts; 12 of 34 are multi-step other)

Per-Class Performance on Key Forms:

  • hypothetical syllogism: 1.000 F1 (100% recall, 100% precision)
  • affirming the consequent: 0.989 F1 (98.9% recall, 98.9% precision)
  • reductio ad absurdum: 0.975 F1 (98.8% recall, 96.3% precision)
  • categorical syllogism: 0.922 F1 (98.9% recall, 86.4% precision)
  • ad hominem: 0.843 F1 (75.0% recall, 96.2% precision)
  • ad populum: 0.831 F1 (82.7% recall, 83.5% precision)
  • false dilemma: 0.800 F1 (83.0% recall, 77.2% precision)
  • begging the question: 0.788 F1 (71.1% recall, 88.5% precision)
  • straw man: 0.681 F1 (85.2% recall, 56.8% precision)
  • equivocation: 0.643 F1 (64.3% recall, 64.3% precision)

Code Examples

Python (ollama-python)

import json
import ollama

client = ollama.Client()

prompt = (
    "Either humanity dramatically reduces carbon emissions within a decade, "
    "or we face ecological collapse. We will not cut emissions, therefore "
    "ecological collapse is inevitable."
)

res = client.chat(
    model="nyashastino/lfx",
    messages=[{"role": "user", "content": prompt}],
    options={"temperature": 0.0},
)

result = json.loads(res["message"]["content"])
print(json.dumps(result, indent=2))

REST API (curl)

curl http://localhost:11434/api/chat -d '{
  "model": "nyashastino/lfx",
  "messages": [
    {"role": "user", "content": "Nobody has proven that ghosts don'\''t exist, so they must be real."}
  ],
  "stream": false
}'

JavaScript / TypeScript

import ollama from 'ollama';

const response = await ollama.chat({
  model: 'nyashastino/lfx',
  messages: [{
    role: 'user',
    content: 'Smartphones cause attention deficits because constantly switching apps fragments concentration.'
  }],
});

const analysis = JSON.parse(response.message.content);
console.log(analysis);

Limitations

  1. Extraction, Not Fact-Checking: LFX is an extraction parser, not an epistemic fact-checker. It extracts the internal structural relationship between premises and conclusions; it does not evaluate whether the premises are true in the real world.
  2. Closed Taxonomy: Arguments based on informal fallacies outside the 22 categories (e.g., slippery slope, no true Scotsman) will be mapped to the closest applicable category or labeled other.
  3. Non-Argument Text: When fed pure descriptive prose (e.g., a weather report or narrative text), the model will attempt to find an argument. Ensure input passages contain an intended point or argument.

License & Attribution

  • Base Weights: Fine-tuned from Qwen2.5-3B-Instruct under the Qwen Research License Agreement (Alibaba Cloud). Non-commercial research use only.
  • Attribution: Built with Qwen.
  • Dataset Attribution: Incorporates the LOGIC benchmark (Jin et al., Findings of EMNLP 2022), licensed under MIT.
  • Source Code & Data: https://github.com/NyashaEysenck/lfx