lora-logic-mistral7b

LoRA adapter for Mistral-7B-Instruct-v0.3 (4-bit MLX), fine-tuned on a small dataset of English-to-predicate-logic conversion examples.

The hypothesis being tested in the parent repo: forcing a small LLM to ground its reasoning in explicit predicate logic improves downstream accuracy on hard multi-step reasoning benchmarks compared to vanilla chain-of-thought.

Training

Base model mlx-community/Mistral-7B-Instruct-v0.3-4bit
Fine-tuning LoRA via mlx_lm.lora (Apple silicon native)
Trainable params 5.24 M (0.072% of base)
Layers fine-tuned 8 (last 8 of 32)
LoRA rank 8
LoRA scale 20.0
Optimizer Adam
Learning rate 2e-5
Iterations 250 (best val loss at iter 200)
Batch size 1
Training data 119 hand-curated English→predicate-logic conversion examples
Validation data 13 held-out examples

Validation loss

Iter Val loss
1 2.412
50 0.439
100 0.431
150 0.462
200 0.421 ← shipped checkpoint
250 0.489 (overfit)

adapters.safetensors contains the iter-200 weights.

Training data format

Each example teaches the model to translate an English logical argument into formal predicate logic:

{
  "messages": [
    {"role": "user", "content": "You are a careful reasoner... Argument: All cats are animals. Cat is a cat. Therefore, Cat is an animal."},
    {"role": "assistant", "content": "Premise1: ∀x (Cat(x) → Animal(x))\nPremise2: Cat(Cat)\nConclusion: Animal(Cat)"}
  ]
}

Coverage: universal implication, existential quantification, modus ponens, modus tollens, 1-2-hop chains.

Usage (mlx-lm)

from mlx_lm import load, generate

model, tokenizer = load(
    "mlx-community/Mistral-7B-Instruct-v0.3-4bit",
    adapter_path="<local path containing adapters.safetensors and adapter_config.json>",
)

messages = [{"role": "user", "content": "Translate to predicate logic: All birds fly. Tweety is a bird. Therefore, Tweety flies."}]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
print(generate(model, tokenizer, prompt=prompt, max_tokens=512, verbose=False))

Evaluation

Held-out test on Google DeepMind's BigBench Extra Hard mini (BBEH-mini, 460 reasoning items). See parent repo for paired-comparison results:

github.com/scottmatthews7/logical-reasoning

Limitations

  • Trained on a tiny dataset (119 items). Coverage of logical operators is intentionally narrow.
  • Tests transfer of a skill (predicate-logic translation) to a different domain (multi-step reasoning puzzles). Effect size, if any, is what the experiment measures — there is no guarantee scaling this approach helps frontier benchmarks.
  • The base is a 4-bit quantised Mistral 7B. Behaviour on the full-precision base may differ.
Downloads last month

-

Downloads are not tracked for this model. How to track
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for scottmatthews7/lora-logic-mistral7b

Adapter
(4)
this model