LLMRabbi

Turning books into conversational training data, so a model reasons from a text instead of reciting it.

Role
Creator
Areas
AI, Tools
Illustrated banner titled LLMRabbi, Local AI Training from ePub Books: a bearded scholar reads a large book on the left, a robot types at a laptop on the right, and between them sit a mock upload screen, a GGUF chip and training data JSON files.

Feeding a book's raw text into training gives a model a better memory of the book. It doesn't change how the model reasons, converses or applies the book's ideas. LLMRabbi takes a different route.

The idea

Philosophy teachers sometimes skip the essay and have students roleplay a conversation from inside a worldview. To hold up their end, students have to internalize the ideas well enough to apply them to questions the text never addresses. LLMRabbi does the same for a model. It reads a section of a book, raises topics the book has a perspective on, and has an LLM write the assistant's side of the exchange grounded in that passage. Fine-tuning on those exchanges shifts how the model weighs things by default.

That's also why a system prompt like "answer as a Stoic" falls short. It reaches for the stereotype, the most quotable lines, and collapses when the conversation drifts somewhere the stereotype doesn't cover. Training on grounded dialogue changes the reasoning underneath. We've used the approach on self-help, philosophy, religious and business books.

Two-column comparison. Raw text ingestion treats the book as knowledge, enters at pre-training, trains on the text, and yields a model that quotes and paraphrases and is brittle on unusual prompts. LLMRabbi treats the book as substrate, enters at instruction tuning, trains on grounded conversations, and yields a model that applies the principles.
We move the book from the pre-training corpus into instruction tuning, the stage that shapes behavior.

How it works

  • Parsing and chunking. ePub and PDF books are split into ordered units with chapter and page awareness, chunked by pages or chapters, with a minimum word count to skip title pages and section breaks.
  • Local inference. Any GGUF model runs through llama.cpp with full control of sampling, and Anthropic, OpenAI or Ollama can be used instead.
  • Constrained output. GBNF grammars or JSON Schema keep every sample in a usable format, and several samples per chunk add variety.
  • Resumable runs. State is checkpointed after every inference pass and validated against a hash of the source book, so a long run can survive an interruption.
Flow diagram: parse an ePub or PDF with chapter and page awareness, chunk by pages or chapters with a minimum word count, insert each chunk into the prompt, generate 1 to 20 samples with a local or hosted model, constrain the output with a grammar or schema, and write numbered JSON files with a checkpoint after each pass.
We checkpoint after every pass, so a long run over a whole book survives an interruption.

The app pairs a FastAPI backend with a React and Vite front end, and ships as GPU and CPU Docker images.

Layer diagram: a React and Vite front end in the browser, a FastAPI backend with routes and schemas, domain logic for parsing, chunking, inference and resume, and model providers: local llama.cpp, Anthropic, OpenAI and Ollama.
We keep the pipeline logic separate from the web layer, so the same code can also run headless.