Package: dragonfarm 0.4.0

Tejas Patel

dragonfarm: Fine-Tune Language Models with LoRA on Your Documents and Data

Fine-tune causal language models with LoRA (Low-Rank Adaptation) from R, and answer questions from your own documents. Documents (PDF, Word, HTML, Markdown, spreadsheets, web pages) are read into chunks, retrieved for each question by combined keyword and embedding search, and answered with cited sources; a model can then write training questions from them for review. Tables of prompts and responses work too. Training runs in a background 'Python' process built on Hugging Face 'transformers' and 'peft', with 4-bit loading (QLoRA) so a 7-billion-parameter model trains on an 8 GB GPU, and a 'shiny' app covers the whole workflow. 'Python' dependencies are declared through 'reticulate' and resolved automatically on first use.

Authors:Tejas Patel [aut, cre]

dragonfarm_0.4.0.tar.gz
dragonfarm_0.4.0.zip(r-4.7-any)dragonfarm_0.4.0.zip(r-4.6-any)dragonfarm_0.4.0.zip(r-4.5-any)
dragonfarm_0.4.0.tgz(r-4.6-any)dragonfarm_0.4.0.tgz(r-4.5-any)
dragonfarm_0.4.0.tar.gz(r-4.7-any)dragonfarm_0.4.0.tar.gz(r-4.6-any)
dragonfarm_0.4.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
dragonfarm/json (API)

# Install 'dragonfarm' in R:
install.packages('dragonfarm', repos = c('https://tejas4patel.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/tejas4patel/dragonfarm/issues

Pkgdown/docs site:https://dragonfarm.dev

On CRAN:

Conda:

fine-tuningloraqloralarge-language-modelsllmretrieval-augmented-generationragdocumentstransformerspeftshinylocal-llmhuggingface

4.73 score 9 stars 203 downloads 88 exports 87 dependencies

Last updated from:65c85ecd36. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK187
source / vignettesOK186
linux-releaseOK187
macos-releaseOK130
macos-oldrelOK134
windows-develOK153
windows-releaseOK150
windows-oldrelOK150
wasm-releaseOK134

Exports:dragon_appdragon_archive_rundragon_archived_runsdragon_askdragon_backenddragon_backend_localdragon_backend_ollamadragon_backend_serverdragon_bundledragon_canceldragon_chatdragon_chat_loaddragon_checkdragon_chunksdragon_codedragon_comparedragon_conversationsdragon_datasetdragon_delete_rundragon_documentsdragon_documents_listdragon_documents_loaddragon_evaluatedragon_example_datadragon_example_documentsdragon_export_ggufdragon_feedbackdragon_generatedragon_hardwaredragon_importdragon_indexdragon_judgedragon_judge_anthropicdragon_judge_ellmerdragon_llm_anthropicdragon_llm_ellmerdragon_logsdragon_loradragon_mapdragon_map_pairsdragon_map_promptsdragon_mergedragon_metric_regexdragon_metricsdragon_pipelinedragon_pipeline_canceldragon_pipeline_statusdragon_preferdragon_presetsdragon_previewdragon_progressdragon_promptsdragon_publishdragon_python_requirementsdragon_questionsdragon_questions_datasetdragon_questions_listdragon_questions_loaddragon_questions_progressdragon_questions_savedragon_questions_waitdragon_reinforcedragon_remotedragon_remote_providersdragon_resumedragon_retrievedragon_rewarddragon_rundragon_runsdragon_runs_dirdragon_serve_ollamadragon_splitdragon_statusdragon_step_evaluatedragon_step_judgedragon_step_mergedragon_step_preferdragon_step_publishdragon_step_reinforcedragon_step_synthesize_pairsdragon_step_traindragon_synthesizedragon_synthesize_pairsdragon_traindragon_train_argsdragon_unarchive_rundragon_waitdragon_worker_stop

Dependencies:askpassassertthatbackportsbase64encbslibcachemcheckmateclicommonmarkcpp11crosstalkcurldata.tabledigestdplyrevaluatefarverfastmapfontawesomefsgenericsggplot2gluegtableherehighrhtmltoolshtmlwidgetshttpuvhttrisobandjquerylibjsonliteknitrlabelinglaterlatticelazyevallearnrlifecyclelitedownmagrittrmarkdownMatrixmemoisemimeopensslotelpillarpkgconfigplotlypngprocessxpromisespspurrrR6rappdirsRColorBrewerRcppRcppTOMLrenvreticulaterlangrmarkdownrprojrootS7sassscalesshinysortablesourcetoolsstringistringrsystibbletidyrtidyselecttinytexutf8vctrsviridisLitewithrxfunxtableyamlzip

The dragonfarm app
Two routes through the tabs | The Documents tab | The other tabs | Running it for other people | Under the hood

Last update: 2026-10-16
Started: 2026-09-14

Quickstart: from documents to a model, in R
1. Check the machine | 2. Read the documents | 3. Ask | 4. Write training questions, and review them | 5. Fine-tune | 6. Compare and use | The table route | Choosing settings

Last update: 2026-10-15
Started: 2026-09-14

Reinforcement learning with rewards you can check
When it helps, and when it does not | Data: prompts and references | Rewards | Train | Read the result | Settings that matter | Chaining with the other stages

Last update: 2026-09-27
Started: 2026-09-16

The post-training loop: fine-tune, judge, prefer, repeat
The shape of the loop | 1. Fine-tune | 2. Measure | 3. Make preference pairs from the model's own replies | 4. Preference-optimize on top of the fine-tune | 5. Compare, then go around again | The same loop in one call | Talk to the result | When this loop is the wrong tool

Last update: 2026-09-27
Started: 2026-09-16

Readme and manuals

Help Manual

Help pageTopics
Launch the dragonfarm appdragon_app
Archive, restore, or delete a rundragon_archive_run dragon_delete_run dragon_unarchive_run
Archived runsdragon_archived_runs
Ask a question of your documentsdragon_ask
Inference backendsdragon_backend dragon_backend_local dragon_backend_ollama dragon_backend_server
Package a run for a cloud GPUdragon_bundle
Cancel a rundragon_cancel
Talk to a model, with memory of the conversationdragon_chat dragon_chat_load
Check the Python environment and hardwaredragon_check
The chunks of a document setdragon_chunks
R code that reproduces a rundragon_code
Compare runs side by sidedragon_compare
Multi-turn conversations as training datadragon_conversations
Create a dataset for fine-tuningdragon_dataset dragon_dataset.character dragon_dataset.data.frame
Read documents into a document setdragon_documents
List saved document setsdragon_documents_list
Reopen a saved document setdragon_documents_load
Evaluate a finished rundragon_evaluate
Path to the bundled example datasetdragon_example_data
Example documentsdragon_example_documents
Export a merged model to GGUFdragon_export_gguf
Training data from chat feedbackdragon_feedback
Generate replies from a fine-tuned modeldragon_generate
Hardware settingsdragon_hardware
Import results trained on another machinedragon_import
Index a document set for retrievaldragon_index
Judge a run's replies with a language modeldragon_judge
Language models as functions: the Claude API and ellmerdragon_judge_anthropic dragon_judge_ellmer dragon_llm_anthropic dragon_llm_ellmer
LoRA settingsdragon_lora
Map dataset columns to prompt, response, and system textdragon_map
Map columns for preference optimizationdragon_map_pairs
Map columns for reinforcement learningdragon_map_prompts
Merge the adapter into the base modeldragon_merge
Task metrics for generated repliesdragon_metrics dragon_metric_regex
Run several post-training stages as one pipelinedragon_pipeline
Cancel a pipelinedragon_pipeline_cancel
Progress of a pipelinedragon_pipeline_status
Preference optimization with DPO or ORPOdragon_prefer
Recommended base modelsdragon_presets
Preview mapped rows as chat turnsdragon_preview
Prompts from a run's data filesdragon_prompts
Push a run's model to the Hugging Face Hubdragon_publish
Python requirements used by dragonfarmdragon_python_requirements
Write questions and answers from a document setdragon_questions dragon_questions_progress dragon_questions_wait
Training data from reviewed questionsdragon_questions_dataset
Load, save, and list question setsdragon_questions_list dragon_questions_load dragon_questions_save
Reinforcement learning with verifiable rewards (GRPO)dragon_reinforce
Open a cloud GPU provider for a bundled rundragon_remote
Cloud GPU providersdragon_remote_providers
Resume a run from its latest checkpointdragon_resume
Find the chunks most relevant to a questiondragon_retrieve
Verifiable rewards for reinforcement learningdragon_reward
Reopen an existing rundragon_run
List runsdragon_runs
Directory where runs are storeddragon_runs_dir
Serve a run's model with Ollamadragon_serve_ollama
Hold out rows for evaluationdragon_split
Inspect a rundragon_logs dragon_progress dragon_status
Steps of a post-training pipelinedragon_step dragon_step_evaluate dragon_step_judge dragon_step_merge dragon_step_prefer dragon_step_publish dragon_step_reinforce dragon_step_synthesize_pairs dragon_step_train
Write fine-tuning data with a teacher modeldragon_synthesize
Build preference pairs from a model's own samplesdragon_synthesize_pairs
Fine-tune a model with LoRAdragon_train
Training settingsdragon_train_args
Wait for a run to finishdragon_wait
Stop the local inference workerdragon_worker_stop