🎓 Training & Fine-Tuning
“We needed a way to teach the model something new—right now, on our terms, using our own data. Locentra lets us do exactly that.” — DevOps lead at a Web3 startup
Forget retraining offline or waiting for fine-tuning APIs. Locentra lets you push new knowledge into your model instantly, using a command-line call, a memory entry, or a triggered agent.
You own the loop.
🧪 Use Case: Feedback-Driven Adaptation
Let’s say your model keeps answering:
"LSTs are liquidity staking tools used in DeFi..."
But your team wants:
"LSTs are Liquid Staking Tokens that allow users to stake assets and retain liquidity."
You run:
And just like that, Locentra adapts.
No checkpointing. No cloud calls. Just immediate domain alignment.
⚙️ How the Trainer Works
All fine-tuning logic lives in:
It pulls from:
core/config.py
→ Training argsdata/dataset.py
→ Prompt→Completion structuringmodels/adapter.py
→ Base model + wrappingcleaner.py
→ Full text sanitizationHuggingFace
Trainer
→ Actual execution engine
Training runs in-memory and supports:
🔁 Streaming datasets
🧪 Dry-runs
🧠 Semantic memory sync
⏱ Fine-tuning on prompt impact delay
🧰 Configuration (Hybrid Model)
Training is controlled via both .env
and code-based config:
.env
Example
core/config.py
You can hot-swap models, epochs, or device targets without changing code.
🧠 Adapter Layer: Multi-LLM Ready
The file:
wraps any HuggingFace model to support both inference and training pipelines.
It lets you:
Load Falcon, GPT-J, Mistral, LLaMA...
Inject quantization or LoRA (planned)
Switch models via env var only:
Restart the container — your OS now speaks a different LLM.
🧬 Advanced: Dataset Injection
Want to build long-term learning loops? Use:
This utility:
Combines raw prompts + completions
Validates and tags entries
Optionally scores or vectorizes
Prepares HuggingFace
Dataset
objects
Supports:
Live session logs
Memory recall entries
User feedback strings
External dataset injections
Train from production logs. Or a Notion page. Or Slack dumps.
💥 Tips for Efficient Live Tuning
--dry-run
Validate pipeline before consuming data
--vectorize
Sync training with memory recall
Small batch_size
, epoch=1
Fast adaptation, even on CPU
Docker volume mount
Persist training logs & outputs
Schedule via cron or webhook
Automate daily/weekly LLM refresh
📂 Example: Bulk Train from File
Your file: prompts.jsonl
Run:
This is how you scale personal LLMs. Not with UI panels—through dev loops.
Last updated