Files
bikoret/kushya_generator
Scott KarpandClaude Fable 5.1 c0d0555aed the name: Bikoret — code, contracts, images
Headers X-Bikoret-Key / -Rebuke / -Verdict / -Bedikah; the `bikoret`
object and the "— bikoret …" fringe on a gate reply; environment
variables BIKORET_*; the image user and paths (/home/bikoret,
/tmp/bikoret, /var/lib/bikoret/manna, /etc/bikoret/secrets,
/opt/bikoret/spec); the tmp-bikoret pod volume; local databases
bikoret_dev/_test. Kubernetes resource names, the shorashim_app role and
the domain are unchanged (Tamid §1.1, "the names that still carry the
old word"). Doorpost c963c4fe…. Elixir 604/0, L3 10/0, korban 295,
Prolog bedikah 44/44. Gitea repo renamed heaviness510/bikoret (old URL
redirects).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-13 22:13:36 +00:00
..

Kushya Generator — Component F (Architecture §3.6)

Fine-tuned Mistral Medium 3.1 whose sole function is to generate adversarial challenges (kushyot) to proposed Torah interpretations.

Eilu v'eilu divrei Elohim chayim, v'halakhah k'beit Hillel. Both these and those are the words of the living God; the law follows Beit Hillel — but the dispute is preserved (Eruvin 13b).

Status

This directory holds the scaffolding for a fine-tuned kushya generator. The actual training run requires a GPU + curated dataset and is the operator's task. Until then, kushya generation in production falls back to:

  1. Rule-based kushyot from the Talmudic Engine (see talmudic_engine/src/reasoning/challenge.pl)
  2. External-model consultation via Korban Processor (Step 22) wrapped in the offering protocol so external output is never treated as authoritative

The fine-tuned generator replaces step 2 with a model that has consumed only the kushya-generation function — eliminating the eish zarah risk that general-purpose model output presents.

Layout

kushya_generator/
├── README.md                       This file
├── data/
│   ├── prepare_training.py         Extracts (interpretation, kushya) pairs
│   └── training_pairs/
│       ├── seed_pairs.jsonl        Hand-curated seed pairs to bootstrap
│       └── README.md               Provenance and curation notes
├── fine_tune/
│   ├── config.yaml                 QLoRA configuration
│   └── train.py                    Fine-tuning script (transformers + peft)
├── inference/
│   ├── kushya_api.py               In-process API the Talmudic Engine calls
│   └── serve.py                    HTTP server (when self-hosted)
└── test/
    └── test_dataset.py             Validates training data structure

How a Kushya is Built

A kushya must:

  1. Reference a specific Torah passage that creates tension with the proposed interpretation
  2. Identify the logical or textual weakness in the interpretation
  3. Be expressible as a question, not a statement
  4. Not be resolvable by trivial clarification

These four requirements are encoded in data/prepare_training.py's validator — every training pair must pass them or be rejected.

Data Sources

The training data should come from the existing rabbinic tradition:

  • Talmud Bavli — kushyot from disputes recorded in the Gemara
  • Talmud Yerushalmi — parallel disputes
  • Rishonim — Rashi, Tosafot, Rambam's challenges to other rishonim
  • Acharonim — later commentary kushyot

The seed_pairs.jsonl in this repo is a small hand-curated set sufficient to validate the training pipeline. A production training run requires several thousand pairs.

Fine-Tuning

# Activate environment with PyTorch + transformers + peft + bitsandbytes
python fine_tune/train.py --config fine_tune/config.yaml

Output: a LoRA adapter that wraps the base Mistral Medium 3.1 model. Quantize to GGUF Q5_K_M and serve via inference/serve.py over llama.cpp.

Until Then

The Talmudic Engine generates rule-based kushyot. The pipeline can also consult external models via the Korban Processor's consult_external_model function, with output passing through the offering protocol.

The system has been built to NOT depend on this fine-tuned model. When the fine-tuned model exists, it strengthens kushya generation; until then, the system functions on rule-based + external testimony.