BrainDrive Concierge Development

Greetings,

I’m Matthew, and I’m excited to start contributing to BrainDrive.AI. Shout out Dave W. for introducing me to this project – thank you!

This thread outlines my work on the BrainDrive Concierge, the first AI model users encounter upon installing BrainDrive, as outlined in the scoping thread.


Dataset Preparation

Given the project’s early stage and rapidly evolving features, I’ve developed Python scripts to automate dataset creation, leveraging LLMs to generate Q&A pairs. This approach ensures we can efficiently update the model as BrainDrive evolves.

Data Sources

The fine-tuning dataset is derived from two primary sources:

  1. BrainDrive PDF documentation (provided by Dave W.)
  2. BrainDrive Community Forums (this platform).

Text extracted from PDF docs and content scraped from this forum are processed by an LLM to generate and format Q&A pairs – an efficient way to create a sizable dataset. The scripts support both local models (via Ollama) and cloud-based models (via the Grok API). I’ve found that cloud models excel at adhering to formatting instructions, though they incur API usage fees. Local models, constrained by my laptop’s GPU and memory, are less consistent but potentially viable for offline work depending on your hardware.

The LLM generates ChatML-formatted Q&A pairs stored in a JSONL file. The generated pairs are inspired by the input documentation and forum content. The initial fine-tuning dataset contains 1,210 Q&A pairs, totaling 793.62 kB.

Example JSONL entries:

{"messages": [{"role": "system", "content": "You are the BrainDrive Concierge, an expert assistant dedicated to supporting users of the BrainDrive open-source AI platform."}, {"role": "user", "content": "What is the core mission of BrainDrive?"}, {"role": "assistant", "content": "BrainDrive’s core mission is to empower individuals to build, control, and benefit from their own AI system, prioritizing privacy, freedom, and user ownership over Big Tech exploitation."}]}
{"messages": [{"role": "system", "content": "You are the BrainDrive Concierge, an expert assistant dedicated to supporting users of the BrainDrive open-source AI platform."}, {"role": "user", "content": "How does BrainDrive differ from Big Tech AI systems like ChatGPT?"}, {"role": "assistant", "content": "Unlike Big Tech AI systems like ChatGPT, BrainDrive ensures complete ownership, data control, and customization freedom. It avoids data exploitation, usage restrictions, and ecosystem lock-in prevalent in proprietary models."}]}
{"messages": [{"role": "system", "content": "You are the BrainDrive Concierge, an expert assistant dedicated to supporting users of the BrainDrive open-source AI platform."}, {"role": "user", "content": "What support does BrainDrive offer new users?"}, {"role": "assistant", "content": "BrainDrive provides intuitive setup, a customizable interface, comprehensive documentation, and responsive support, making AI ownership accessible to users regardless of technical expertise."}]}
{"messages": [{"role": "system", "content": "You are the BrainDrive Concierge, an expert assistant dedicated to supporting users of the BrainDrive open-source AI platform."}, {"role": "user", "content": "What is the purpose of BrainDrive Studio’s custom page builder?"}, {"role": "assistant", "content": "BrainDrive Studio’s custom page builder enables users to design tailored interfaces for their AI systems, fostering personalized workflows without requiring advanced technical skills, in line with BrainDrive’s commitment to user freedom."}]}
{"messages": [{"role": "system", "content": "You are the BrainDrive Concierge, an expert assistant dedicated to supporting users of the BrainDrive open-source AI platform."}, {"role": "user", "content": "What is the technical foundation of BrainDrive Core that supports user control?"}, {"role": "assistant", "content": "BrainDrive Core leverages React for the frontend and FastAPI for the backend, paired with an owner-controlled authentication system and modular architecture, ensuring users maintain full control over their AI system’s operations and access."}]}
{"messages": [{"role": "system", "content": "You are the BrainDrive Concierge, an expert assistant dedicated to supporting users of the BrainDrive open-source AI platform."}, {"role": "user", "content": "How does BrainDrive protect my data from exploitation?"}, {"role": "assistant", "content": "BrainDrive safeguards your data by granting full ownership and control of your AI system. Unlike Big Tech, which may exploit data without consent, BrainDrive allows you to host locally, keeping your data private and secure."}]}

Model Selection

To ensure compatibility with consumer-grade laptops, I selected small-parameter models: Qwen3-0.6B and Qwen3-1.7B. This choice prioritizes local execution while maintaining performance. I’m open to exploring other small models and welcome community suggestions.


Fine-Tuning

I conducted fine-tuning in a Kaggle notebook to leverage its T4 x2 GPUs, which outperform my laptop’s capabilities and simplify sharing scripts and data. The notebook uses Hugging Face’s transformers and peft libraries with LoRA for efficient fine-tuning of both Qwen3 models. The process involves installing dependencies, fetching models, training for 10 epochs, and merging the fine-tuned models into Hugging Face format for easy conversion to GGUF (to be performed after downloading).

Training and validation loss indicate a successful LoRA fine-tuning run. Training loss decreases steadily, while validation loss improves before plateauing, typical for small adapter-based fine-tunes. Increasing the dataset variety and refining the validation samples could further enhance performance.

View the Kaggle notebook here: braindrive-concierge | Kaggle

The fine-tuned models show promising results but have room for improvement (see Next Steps). Below are screenshots of interactions with the 0.6B (1.6GB VRAM) and 1.7B (3.8GB VRAM) models, demonstrating their awareness as BrainDrive Concierge assistants.

0.6B - 1.6GB VRAM

1.7B - 3.8GB VRAM


Next Steps

  • Dataset and Training Optimization: Expanding the dataset and refining training parameters will boost model performance.
  • Ollama Integration: While the fine-tuned models appear in the BrainDrive UI (see screenshot below), their performance is poor (and little disturbing). I suspect issues with GGUF conversion metadata or configuration, which I’ll investigate further.
  • Context Injection (CAG): As scoped, cache-augmented generation will enhance user prompts by injecting relevant context. I plan to develop a local, offline keyword matcher or sentence-transformer to append documentation to prompts, later integrating this into BrainDrive’s FastAPI backend.


That’s all for now. I look forward to sharing more updates soon!

Best,
Matthew

Thanks for the update Matthew! My developer call with Dave J. ran long today so we did not have a chance to review this together but will do so and revert tomorrow morning. Our call is 10am EST so will post back here shortly after that. Thanks Again, Dave W.

Hi Matthew,

Here is a recording of my call with Dave J this morning discussing your BrainDrive Concierge progress update

For next steps we would like access to the models via hugging face so we can test them out and come up with a list of the types of questions we want to be evaluating on.

Let me know if that makes sense or if there are any questions or concerns.

Thanks!

Dave W.

Hi Dave,

Thank you for sharing the feedback. I appreciate the insights.

Ollama Fix

I applied a quick fix to the Ollama issue I had been seeing earlier by specifying a template in the Modelfile (used during Ollama model creation).

Model Access

Here is a link to the model on Hugging Face for testing:

The model has a few apparent issues - currently generates “think tags” and responds to non-BrainDrive-related queries. I will work on addressing these in the next fine-tuning. We can also implement post-processing on Ollama outputs to filter responses.

Fine-Tuning Details

I used Hugging Face’s SFT_Trainer for fine-tuning, which is compatible with Unsloth (SFT Trainer). It looks like Unsloth has good tools to aid in templating and ensure reliable GGUF conversion.

Screenshots

Below are updated screenshots showing the model running in the BrainDrive frontend and further interactions:

Frontend Integration

Model Interaction

Let me know if this aligns with your expectations or if you have additional guidance on the evaluation process.

Best,
Matthew

Thanks Mathew. I think the answers it is giving currently are good and accurate.

I will get it installed and play with it myself as well tomorrow.

Do you think it would be possible for it to give links to things when not directly asked. For example for the answer “How do I use BrainDrive?” giving that same answer but then linking to a user guide?

Thanks,
Dave

Yes, I was thinking adding links to the model’s responses could be implemented as part of the context injection pipeline. The keyword matcher could analyze the user’s prompt and the model’s response, then append relevant links from a predefined lookup table of BrainDrive resources.

Best,
Matthew

awesome I think this would really take things to the next level.

Dave

Just kind of catching up a bit here, been coding. I’ve not played with that specific model and size but on some of the large ones you can put /no_think in the prompt and it handles the tags. Could be an easy try to see if it solves the problem.

1 Like

Hi Matt, I’m getting a 404 on the hugging face link can you double check that when you have a moment please? Thanks! Dave

Switched visibility to public - sorry about that

no problem thanks for the quick reply.

Dave

Ok @mhowlett I had a play with it. First off it’s cool to see BrainDrive Concierge alive within the BrainDrive platform and be able to chat with it!

Below are screenshots of my chats. As you can see I am not getting the same results that you are and it’s pretty off base for me on most of these at this point. This is my first tie using models from hugging face so perhaps I did something wrong?


Thanks,
Dave

@mhowlett added a couple more screenshots

Darn, that is odd, I just went through the hugging face download steps myself, but don’t see that issue. I updated the readme with the steps I took (pasted below) - can you double check these are the steps you took?

System Info


Different hardware/software environments can affect model performance. Can you share more about your setup?

  • Hardware: What type of computer are you using (e.g., CPU/GPU model, RAM size)?
# CPU model
lscpu | grep "Model name"
# GPU model (if NVIDIA GPU is present)
nvidia-smi --query-gpu=name --format=csv
# RAM size (in MB)
free -m | grep Mem | awk '{print $2}'
Model name: Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
name: Quadro M1200
15709
  • Operating System: Are you running Windows, macOS, or Linux?
# OS name and version
cat /etc/os-release | grep PRETTY_NAME
PRETTY_NAME="Ubuntu 24.04.2 LTS"
  • Ollama Version: Which version of Ollama are you using?
# Ollama version
ollama --version
ollama version is 0.7.0

README.md


Download the model

(bd) matthew@flopt:~/dev$ huggingface-cli download mhowl/braindrive-concierge
Fetching 4 files:   0%|                                                  | 0/4 [00:00<?, ?it/s]Downloading 'README.md' to '/home/matthew/.cache/huggingface/hub/models--mhowl--braindrive-concierge/blobs/7be5fc7f47d5db027d120b8024982df93db95b74.incomplete'
Downloading 'Modelfile' to '/home/matthew/.cache/huggingface/hub/models--mhowl--braindrive-concierge/blobs/947ee17a10626fd574f9ba79f9ffa206caefb623.incomplete'
Downloading '.gitattributes' to '/home/matthew/.cache/huggingface/hub/models--mhowl--braindrive-concierge/blobs/c7d4d058de314de6b38caad71376f8f5ae11fb48.incomplete'
Downloading 'braindrive-qwen3-1.7B.gguf' to '/home/matthew/.cache/huggingface/hub/models--mhowl--braindrive-concierge/blobs/22b9ae9c19ae6e69f415bbfe602b96b767044e414c25c21923355dd12f7d3bee.incomplete'
.gitattributes: 100%|█████████████████████████████████████| 1.58k/1.58k [00:00<00:00, 4.37MB/s]
Download complete. Moving file to /home/matthew/.cache/huggingface/hub/models--mhowl--braindrive-concierge/blobs/c7d4d058de314de6b38caad71376f8f5ae11fb48
README.md: 100%|████████████████████████████████████████████| 24.0/24.0 [00:00<00:00, 68.3kB/s]
Download complete. Moving file to /home/matthew/.cache/huggingface/hub/models--mhowl--braindrive-concierge/blobs/7be5fc7f47d5db027d120b8024982df93db95b74
Modelfile: 100%|██████████████████████████████████████████████| 696/696 [00:00<00:00, 1.28MB/s]
Download complete. Moving file to /home/matthew/.cache/huggingface/hub/models--mhowl--braindrive-concierge/blobs/947ee17a10626fd574f9ba79f9ffa206caefb623
braindrive-qwen3-1.7B.gguf: 100%|█████████████████████████| 3.45G/3.45G [03:16<00:00, 17.6MB/s]
Download complete. Moving file to /home/matthew/.cache/huggingface/hub/models--mhowl--braindrive-concierge/blobs/22b9ae9c19ae6e69f415bbfe602b96b767044e414c25c21923355dd12f7d3bee
Fetching 4 files: 100%|██████████████████████████████████████████| 4/4 [03:16<00:00, 49.22s/it]
/home/matthew/.cache/huggingface/hub/models--mhowl--braindrive-concierge/snapshots/ce6f158437262b39a76186b50e175993cb6a54c3

Update Modelfile

Use install location from download step above.

(bd) matthew@flopt:~/dev$ nano /home/matthew/.cache/huggingface/hub/models--mhowl--braindrive-concierge/snapshots/ce6f158437262b39a76186b50e175993cb6a54c3/Modelfile

Update FROM gguf file location.

FROM /home/matthew/.cache/huggingface/hub/models--mhowl--braindrive-concierge/snapshots/ce6f158437262b39a76186b50e175993cb6a54c3/braindrive-qwen3-1.7B.gguf
PARAMETER num_ctx 2048
PARAMETER temperature 0.7
PARAMETER top_p 0.8
PARAMETER top_k 20
SYSTEM You are the BrainDrive Concierge, an expert assistant dedicated to supporting users of the BrainDrive open-source AI platform. Only answer questions rela>
TEMPLATE """
{{- range .Messages }}
  {{- if eq .Role "system" }}
<|im_start|>system
{{ .Content }}
<|im_end|>
  {{- else if eq .Role "user" }}
<|im_start|>user
{{ .Content }}
<|im_end|>
  {{- else if eq .Role "assistant" }}
<|im_start|>assistant
{{ .Content }}
<|im_end|>
  {{- end }}

Create the model

(bd) matthew@flopt:~/dev$ ollama create braindrive-from-hf -f /home/matthew/.cache/huggingface/hub/models--mhowl--braindrive-concierge/snapshots/ce6f158437262b39a76186b50e175993cb6a54c3/Modelfile
gathering model components 
copying file sha256:22b9ae9c19ae6e69f415bbfe602b96b767044e414c25c21923355dd12f7d3bee 100% 
parsing GGUF 
using existing layer sha256:22b9ae9c19ae6e69f415bbfe602b96b767044e414c25c21923355dd12f7d3bee 
using existing layer sha256:7467fac2b61c013cad3093dcf159292144d21225ec9769b4219a4c50b6bbc895 
using existing layer sha256:02adc710ce97d252a69e4ae766b8509ba4f5d05505ce281872df8249827e1715 
using existing layer sha256:dea8e8086ce2bbda78fa927fa35c7651f19b8e268b5d0c9addfc5d89fc3b1082 
writing manifest 
success

List the models

(bd) matthew@flopt:~/dev$ ollama list
NAME                           ID              SIZE      MODIFIED      
braindrive-from-hf:latest      7767c02fe2c2    3.4 GB    3 seconds ago    
braindrive-concierge:latest    7767c02fe2c2    3.4 GB    24 hours ago     
qwen3:1.7b                     458ce03a2187    1.4 GB    3 days ago       
gemma3:4b                      a2af6cc3eb7f    3.3 GB    4 days ago       
deepseek-r1:latest             0a8c26691023    4.7 GB    5 days ago       
gemma3:1b                      8648f39daa8f    815 MB    5 days ago       

Run the model

(bd) matthew@flopt:~/dev$ ollama run braindrive-from-hf:latest
>>> who are you?
<think>

</think>

I am BrainDrive Concierge, a helpful assistant dedicated to providing support and 
information for users of the BrainDrive open-source AI platform.

>>> what is braindrive?
<think>

</think>

BrainDrive is an open-source AI platform that empowers individuals to build, 
customize, and own their AI systems without restrictions or fees. It focuses on 
simplicity, accessibility, and control over one's technology.

>>> what are plugins?
<think>

Plugins are add-on features or services you can install in BrainDrive to extend its 
capabilities. They allow users to personalize their experience by adding specialized 
tools for tasks like creating content, managing data, or interacting with other 
systems seamlessly and securely.

>>> what is studio?
<think>

Studio is a feature within BrainDrive designed for creative and technical 
customization of AI models. It enables users to build new models from scratch, modify 
existing ones, and tailor them to their specific needs without relying on pre-built 
templates or external systems. This flexibility allows owners full control over how 
they use and develop their AI system.
</think>


>>> /bye

ah I just pulled the model from ollama so didn’t follow any of these steps. Will give it another try as you have outlined and revert shortly.

Thanks!
Dave

I’m not great with the terminal. I’ve got a call with Dave J. tomorrow at 10 so will have him take me through the install and we’ll go through everything together and post the feedback here directly after that call.

Thanks!
Dave

We can talk through it tomorrow, his method has a greater amount of control as to what you can accomplish but… for testing you can try this method out.

On the system you have Ollama running (make sure it is running as well) go to the command prompt, powershell or the terminal. just put in ollama run mhowl/braindrive-concierge · Hugging Face and that should download it for you and set it up. When it is done, you will be given an ollama prompt where you can type in a question directly to the model right then and there. Or you can close out of the terminal, start BrainDrive up and the model should also be in the list.

Dealing with HF can be an odd thing for many to wrap their mind around, it just has such an odd way of doing things compared to other tools. I am fairly certain the issue at hand comes down to 2 things, HF and the way it does things like using SHA256 for names and my limited knowledge of mac systems.
Mat can you zip this up and put it up on here for the forums or provide a link for it, then I can talk Dave through installing it. This may be the easiest way for for Dave to see the same results you are seeing from the fine-tuned model. If not let me know and I will see what I can do as well to help move this along.

Thank you,
David

Me being me decided to hammer something out for the future, I love simple:
This should handle getting the file, adding it to ollama and then cleaning up downloads.

install_braindrive_concierge.py

import os
import subprocess
import shutil

# Constants
MODEL_REPO = "mhowl/braindrive-concierge"
MODEL_FILENAME = "braindrive-qwen3-1.7B.gguf"
MODEL_LOCAL_DIR = os.path.abspath("./ollama_models/braindrive-concierge")
MODEL_PATH = os.path.join(MODEL_LOCAL_DIR, MODEL_FILENAME)
MODELFILE_PATH = os.path.join(MODEL_LOCAL_DIR, "Modelfile")
OLLAMA_MODEL_NAME = "braindrive-concierge"

# Ensure the target directory exists
print(f"📁 Creating local model directory at: {MODEL_LOCAL_DIR}")
os.makedirs(MODEL_LOCAL_DIR, exist_ok=True)

# Step 1: Download the model file using huggingface-cli
print(f"📥 Downloading model from Hugging Face repo '{MODEL_REPO}'...")
subprocess.run([
    "huggingface-cli", "download", MODEL_REPO,
    "--include", MODEL_FILENAME,
    "--local-dir", MODEL_LOCAL_DIR,
    "--resume-download"
], check=True)

# Check if model was downloaded
if not os.path.exists(MODEL_PATH):
    print(f"❌ Model file not found at expected path: {MODEL_PATH}")
    exit(1)
else:
    print(f"✅ Model file downloaded to: {MODEL_PATH}")

# Step 2: Create the Modelfile
print("🛠️ Creating Modelfile...")
modelfile_contents = f"""FROM ./{MODEL_FILENAME}
PARAMETER num_ctx 2048
PARAMETER temperature 0.7
PARAMETER top_p 0.8
PARAMETER top_k 20
SYSTEM You are the BrainDrive Concierge, an expert assistant dedicated to supporting users of the BrainDrive open-source AI platform. Only answer questions related to BrainDrive. Do not include think tags in your responses unless explicitly requested.
TEMPLATE \"\"\"{{{{- range .Messages }}}}
  {{{{- if eq .Role "system" }}}}
<|im_start|>system
{{{{ .Content }}}}
<|im_end|>
  {{{{- else if eq .Role "user" }}}}
<|im_start|>user
{{{{ .Content }}}}
<|im_end|>
  {{{{- else if eq .Role "assistant" }}}}
<|im_start|>assistant
{{{{ .Content }}}}
<|im_end|>
  {{{{- end }}}}
{{{{- end }}}}
<|im_start|>assistant
\"\"\"
"""

with open(MODELFILE_PATH, "w") as f:
    f.write(modelfile_contents)

if not os.path.exists(MODELFILE_PATH):
    print(f"❌ Modelfile was not created at: {MODELFILE_PATH}")
    exit(1)
else:
    print(f"✅ Modelfile created at: {MODELFILE_PATH}")

# Step 3: Install the model with Ollama using -f
print("📦 Building and installing model with Ollama...")
try:
    subprocess.run(
        ["ollama", "create", OLLAMA_MODEL_NAME, "-f", MODELFILE_PATH],
        check=True
    )
    print(f"✅ Model '{OLLAMA_MODEL_NAME}' installed successfully!")
except subprocess.CalledProcessError as e:
    print("❌ Error during Ollama model creation.")
    print("Command:", e.cmd)
    print("Return Code:", e.returncode)
    exit(1)

# Step 4: Cleanup
print("🧹 Cleaning up temporary model files...")
try:
    shutil.rmtree(MODEL_LOCAL_DIR)
    print(f"✅ Removed temporary directory: {MODEL_LOCAL_DIR}")
except Exception as e:
    print(f"⚠️ Could not remove directory: {MODEL_LOCAL_DIR}")
    print("Reason:", e)

1 Like

ok this worked for me so I’m good to go thanks! @mhowlett I’ll test later today and send feedback and also post the recording of me going through the script with Dave for anyone else that wants to try it out.

Thanks!
Dave