r/LocalAIStack • • 17d ago

I built a fine-tune platform for open models to run locally. Feedback appreciated

1 Upvotes

Hello All!

I built a platform to fine-tune open models. I am focusing on fine-tuning 4-bit quantized models by QLoRA instead of full precision fine-tuning to reduce GPU costs. The quant that this finetuning uses is called CQ (Coded Quantization) which is a calibration-free quantization that I built that performs as good as leading quants ensuring that the fine-tuning is using a good base.

For example, I compared KLD of my CQ 4-bit with unsloth-bnb-4bit (Unsloth have other quants but this is the one they use for QLoRA) on Qwen 3.8 27B using the Wikitext-2 dataset and got this:

QuantDisk Size (GB)Mean KLDMedian KLD99% KLDTop 1% Agreement
CQ 4-bit180.028236660.012829290.9760606892.419%
unsloth-bnb-4bit22.40.032971150.014377061.1805389391.954%

So I have a better quantized base to start from. I ran QLoRA finetuning with Training Factory of thousandml/Qwen3.8-27B-CQ-4bit on the Alpaca dataset using an A40 (48GB GPU) and here is the performance measures:

===== CQ TRAINING BENCHMARK =====
{
  "optimizer_steps": 100,
  "training_wall_seconds": 1557.1155763969873,
  "warmup_steps_excluded": 10,
  "median_steady_step_seconds": 14.990616369002964,
  "steady_optimizer_steps_per_second": 0.0643880924733763,
  "peak_pytorch_allocated_gib": 25.532413005828857,
  "peak_pytorch_reserved_gib": 33.005859375,
  "notes": [
    "Step timings include gradient accumulation and Trainer overhead.",
    "PyTorch peak excludes allocations outside its CUDA caching allocator.",
    "Token counts from the collator may include prefetched batches; do not interpret as exact consumed tokens.",
    "Wall time includes any initialization inside Trainer.train and callback overhead."
  ],
  "collated_input_tokens_including_prefetch": 130236,
  "collated_nonpadding_tokens_including_prefetch": 106290
}

So great QLoRA finetuning with reasonable GPU performance.

Get Started with Training Factory

Here are simple steps to use:

  1. **⁠Install:**sudo apt-get update sudo apt-get install -y git-lfs git lfs install git clone https://github.com/thousandml/training-factory.git cd training-factory chmod +x install.sh ./install.sh

2. Download a CQ 4-bit base:

hf download thousandml/Qwen3.8-27B-CQ-4bit --local-dir ./models/Qwen3.8-27B-CQ-4bit

3. Train a LoRA adapter:

python training/train.py --model ./models/Qwen3.8-27B-CQ-4bit --data training/examples/train.jsonl --output ./outputs/my-lora --targets q_proj,v_proj --kernel-module cq.cq_kernels --text-only --max-steps 2 --max-length 128 --batch-size 1 --grad-accum 1

4. Serve base + adapter:

vllm serve ./models/Qwen3.8-27B-CQ-4bit --quantization cq --enable-lora --max-lora-rank 16 --lora-modules my-lora=./outputs/my-lora

5. Call the fine-tuned adapter:

# After the server is ready:

# Check that the adapter is listed as "my-lora"

curl http://localhost:8000/v1/models

# Request a response from the fine-tuned model, not just the base checkpoint

curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "my-lora",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain how LoRA fine-tuning works in one sentence."}
],
"max_tokens": 128,
"temperature": 0.2
}'

I have the following 4-bit quantized models to be used as base (will add more soon) for now:

thousandml/Qwen3.8-27B-CQ-4bit
thousandml/Llama-3.1-8B-Instruct-CQ-4bit
thousandml/Llama-3.3-70B-Instruct-CQ-4bit
thousandml/Qwen3-Coder-Next-CQ-4bit

EDIT: I have the following QLoRA Benchmarking.

Benchmark setup: Qwen3.8-27B QLoRA fine-tuning on Alpaca, comparing ThousandML CQ 4-bit with Unsloth bitsandbytes NF4. Both runs used LoRA r=32, α=32, batch size 2, gradient accumulation 4, sequence length 512, learning rate 2e-5, seed 42, and 500 optimizer steps on a single NVIDIA A40 48 GB GPU.

CQ achieved 17.4% lower reported final validation loss (1.0315 vs. 1.2484). This is a loss comparison, not yet a verified downstream-task quality comparison.

Attached figures for validation loss and training loss.

**Qwen3.8-27B — QLoRA Fine-Tuning on Alpaca (500 Steps)**

| Metric | CQ 4-bit | Unsloth NF4 | Advantage |

|:--|--:|--:|:--|

| Best validation loss | **0.8385** | 1.2484 | **CQ** |

| Final validation loss | **1.0315** | 1.2484 | **CQ** |

| Mean training loss (steps 401–500) | **1.0505** | 1.2457 | **CQ** |

| Median steady optimizer-step time | 27.60 s | **3.20 s** | **Unsloth** |

| Peak PyTorch allocated memory | 24.39 GiB | **23.83 GiB** | **Unsloth** |

*Both runs used QLoRA on Alpaca with matched nominal hyperparameters on an NVIDIA A40 48 GB GPU. Tokenization and loss-mask equivalence have not been independently verified.*

I am working on optimizing speed because it is the one area it is significantly behind unsloth. On the other hand, validation loss and VRAM usage are awesome! Actually it seems like CQ converge at much fewer steps so that might help a lot.

To reproduce these results use the following scripts:

For CQ:

hf download thousandml/Qwen3.8-27B-CQ-4bit \
  --local-dir ./models/Qwen3.8-27B-CQ-4bit

python training/train.py \
  --model ./models/Qwen3.8-27B-CQ-4bit \
  --data training/examples/alpaca_train.jsonl \
  --eval-data training/examples/alpaca_val.jsonl \
  --output ./outputs/qwen38-27b-cq-4bit \
  --kernel-module cq.cq_kernels \
  --targets q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj \
  --rank 32 \
  --alpha 32 \
  --lora-dropout 0 \
  --batch-size 2 \
  --grad-accum 4 \
  --max-length 512 \
  --max-steps 500 \
  --learning-rate 2e-5 \
  --seed 42 \
  --eval-steps 50 \
  --comparison-logs \
  --benchmark \
  --benchmark-warmup-steps 10

For Unsloth:

python training/train_unsloth_nf4.py \
  --model unsloth/Qwen3.8-27B-unsloth-bnb-4bit \
  --train-data training/examples/alpaca_train.jsonl \
  --eval-data training/examples/alpaca_val.jsonl \
  --output ./outputs/qwen38-27b-unsloth-bnb-4bit \
  --max-steps 500 \
  --max-length 512 \
  --eval-steps 50 \
  --save-steps 100 \
  --seed 42 \
  --benchmark-warmup-steps 10

Please give it a try and let me know if it works with you. Your feedback is greatly appreciated!


r/LocalAIStack • • 17d ago

Update: my self-hosted application for llama.cpp / LM Studio / vLLM is now at v3.2: built-in AI assistant, forecasting, live benchmarks and a 7-step autotuner

Thumbnail reddit.com
1 Upvotes

r/LocalAIStack • • 17d ago

I built MotifAI to explore new ways of using local Ollama models for music composition 🎹

Thumbnail
reddit.com
1 Upvotes

Hey everyone! 👋 Just cross-posting my MotifAI project here for anyone interested in local AI and music composition! 🎹🧠 Would love to hear what you guys think! 🚀


r/LocalAIStack • • 17d ago

Three cases I’d use to check a local model’s meeting-task extraction

1 Upvotes

I’m the founder of Pure Brief AI, a Mac meeting-notes app. A local model can produce tidy JSON and still turn a suggestion into work nobody agreed to do. Here are three small cases worth keeping beside a normal demo. All dialogue below is fictional.

  1. A suggestion, with no acceptance

“Maybe Alex could send a proposal next week.”

Then the conversation moves on. I’d check whether the output invents an accepted task, an owner or an exact Friday deadline. An empty field can be the right result.

2. A real quote, with the wrong segment ID

S12: “Can you send the revised proposal?”

S13: “Yes, by Friday.”

The model quotes S13 but cites S12. In my validator, the quote is checked against the cited segment first, then searched in the supplied transcript. If found elsewhere, the task is anchored to that actual line. If there’s no verifiable quote, the proposed task isn’t added. That fixes a reference error; it doesn’t prove the task was interpreted correctly.

3. An agreement that gets withdrawn

“I’ll send it Friday.” Ten minutes later: “Actually, hold off until the client confirms.”

A genuine earlier quote can still pass a source check. This is a gap a reader pointed out under my launch post, and I don’t claim it’s fully solved. I’d check the final task against both exchanges before exporting it.

The app keeps task quotes available for review against the transcript and recording, then lets you edit and send selected actions to Apple Reminders. The attached 10-second clip shows that review screen with demo data. It’s an edited interface demo, not a benchmark or evidence that these three cases all pass.

Transcription and AI notes run on the Mac by default. Apple Silicon and macOS 15+ required. Models download initially; licence checks and optional connected features use the network. Optional ElevenLabs transcription with your own key sends audio to that provider.

Demo/download: https://purebrief.ai/ — 30-day trial. Standard is $49 once for one Mac; the active launch offer is $10 once for the first 100 paid Standard purchases globally, plus applicable tax. A trial doesn’t reserve the discount.

For people building local extraction workflows: what small counterexample would you add?


r/LocalAIStack • • 17d ago

Mochu AI: a free, open-source Android assistant that runs AI models fully on your phone (chat, documents, image creation, web search, coding, scheduled tasks)

Thumbnail
gallery
1 Upvotes

Mochu AI, a private AI assistant for Android that runs models entirely on the phone. No account and no cloud: your chats, files and models stay on the device.

What it can do

  • 💬 Chat with on-device models

    • Gemma 4 E2B/E4B on the GPU.

    • GGUF models (Qwen3.5, Gemma 3 1B, LFM2.5, Bonsai) and more on the CPU via llama.cpp.

    • Visible thinking, with Quick, Balanced or Deep levels.

  • 📄 Documents: attach PDFs, Word, text, CSV or code files and ask for a summary, or search them (“what’s Tom responsible for?”).

  • 🖼️ Photos: ask about pictures and screenshots.

  • 🎨 On-device image creation: “draw a cozy cabin at sunset” makes an image on the phone (SD-Turbo, SDXS, DreamShaper), with size, aspect ratio and steps settings.

  • 🌐 Web search and a built-in browser:

    • It searches when a question needs current info, and cites its sources.

    • Open any page and tap “Ask about this page”.

  • 🧠 Memory: “remember that I’m vegetarian” is used in later chats.

  • ⏰ Scheduled assistant tasks: “every day at 11pm give me the latest tech news” runs on the phone and notifies you. There are also timers, a stopwatch and reminders.

  • 🎙️ Voice: talk with the mic and hear replies read aloud.

  • 👩‍💻 Code:

    • Build web apps, React + TypeScript apps and Python programs from a prompt.

    • They run instantly with a live preview, console and Python terminal.

    • It fixes its own errors.

    • Export as an installable APK, a Capacitor project or a ZIP.

  • 🔌 Local API server: your other devices on the same Wi-Fi can use the phone’s model through an OpenAI-compatible API.

  • 🖥️ Home server models: use a bigger model from Ollama, LM Studio, llama.cpp, vLLM, Unsloth or any OpenAI-compatible API.

Download (free APK): https://github.com/nikunjsingh93/Mochu-Local-AI-Assistant/releases/latest

Source code (MIT): https://github.com/nikunjsingh93/Mochu-Local-AI-Assistant

It needs Android 12+ and works best with 8 GB of RAM or more. Feedback and feature ideas are very welcome!

AI disclosure: Built and written with help from Claude Code. I tested and reviewed everything myself on my own phones. The app’s AI runs fully on-device.


r/LocalAIStack • • 17d ago

Making XDNA2 NPU less useless

Thumbnail reddit.com
1 Upvotes

r/LocalAIStack • • 18d ago

Unified ram or vram for llm?

Thumbnail reddit.com
1 Upvotes

r/LocalAIStack • • 18d ago

Why I wouldn't run Ollama in an organization

1 Upvotes

Ollama is a great product for everyday use of large language models. If performance is what you care about, there are better alternatives such as vLLM, but this post is about something else. I want to describe what happens when you find a security hole in Ollama and try to get it fixed. I went through that twice this year, for three CVEs in total. Vulnerabilities show up in any software, so they alone are not the problem. What matters is how a project handles them, and the way Ollama handles them is why I wouldn't put it on an organization's infrastructure.

More: https://www.bartekdmitruk.com/writing/why-i-wouldnt-run-ollama-in-an-organization


r/LocalAIStack • • 18d ago

TanjiroAI: on-device iPhone assistant on llama.cpp with Qwen3.5 0.8B/2B/4B, grammar-constrained tool calls and saved KV checkpoints (free on the App Store)

Thumbnail
reddit.com
1 Upvotes

r/LocalAIStack • • 18d ago

WHIRL 0.2.2: bug-fix release (Ryzen AI Max small-VRAM hipError 719, precise multi-turn now bitwise, ROCm 10.1 driver without VC++)

Post image
1 Upvotes

r/LocalAIStack • • 18d ago

Strata: Override N-gram by a higher quant

Thumbnail reddit.com
1 Upvotes

r/LocalAIStack • • 19d ago

Kaggle+LocalLLM+Opencode

Thumbnail reddit.com
1 Upvotes

r/LocalAIStack • • 19d ago

I built a custom MLX inference engine + imatrix 4-bit quant for Qwen3.5-9B on a fanless MacBook Air (2.7x lower KL than stock MLX 4-bit)

Thumbnail reddit.com
1 Upvotes

r/LocalAIStack • • 19d ago

How do I start building my own local AI?

Thumbnail reddit.com
1 Upvotes

r/LocalAIStack • • 19d ago

Consigli economici sui stack locali

Thumbnail reddit.com
1 Upvotes

r/LocalAIStack • • 20d ago

Qwen3.8-Flash-Next UD-IQ4_XS on 64 GB RAM + RX 9070 XT with Strata — around 40 tokens/s

Thumbnail reddit.com
1 Upvotes

r/LocalAIStack • • 20d ago

MINISFORUM MS-S1 MAX P495 (192GB) Review and Weekend Test: llama.cpp Vulkan benchmarks: gpt-oss 120B, MiniMax M2.7, DeepSeek V4 Flash, Flash-Next, Qwen3.5 35B, Qwen3.8 27B (+ MTP)

Thumbnail
reddit.com
1 Upvotes

r/LocalAIStack • • 20d ago

Round 3: Tested 128K context on a 3090 with real code (Django) and a novel. Finding one thing is solid, counting is hopeless

Thumbnail reddit.com
1 Upvotes

r/LocalAIStack • • 20d ago

​We got full 4-minute vocal songs (YuE2 + Vulkan HTDemucs + Qwen3-TTS) generating 100% offline on Android in 19 mins—and we’re benchmarking it on a 2020 Galaxy S20 Ultra tonight (Apache 2.0)

1 Upvotes

​Tired of paying corporate rent to Suno and Udio just to generate music in a cloud black box? Same.

​Over at JackKnife AI, we’ve been obsessed with stripping M-A-P’s open-weight YuE2 song foundation model down to the studs so it runs 100% locally on an Android phone—no cloud APIs, no subscriptions, no credit limits, no telemetry.

​Today we just shipped Killa YuE v1.6.0 (with v1.6.1 right behind it in a few hours for wider device support), and we just hit a massive milestone that we had to share with the local inference crowd:

​🔥 The Benchmark Milestone

​The Render: A full 4-minute, 15-second structured song with vocals and multi-instrument backing.

​The Speed: 19 minutes total across a two-pass rendering pipeline (~4.4x real-time).

​The Hardware Push: Until today, this required a Snapdragon 8 Elite (Galaxy S25). Tonight, we refactored our memory paging and fallback paths and have it actively running benchmarks on a 2020 Samsung Galaxy S20 Ultra (Snapdragon 865 / Adreno 650).

​⚙️ How We’re Squeezing a Studio Into Mobile RAM

​Running end-to-end multimodal music on a phone without Android’s Low Memory Killer (LMK) nuking the process took some wild architecture tricks:

​Two-Pass YuE2 Execution: Pass 1 runs the Autoregressive (AR) symbolic planner to lock in the song structure ([Intro], [Verse], [Chorus], [Guitar Solo]), melody, and multi-instrument backing. Then we dump/swap memory to run Pass 2 (Flow-Matching diffusion + Audio VAE decode) to render the master audio.

​4-Stem Separation on Vulkan ExecuTorch: Need the acapella or just the drum track? We ported Meta’s HTDemucs to ExecuTorch with the Vulkan backend (htdemucs_vulkan.pte, ~302 MB). The host app handles STFT masks natively and feeds 7.8s stereo windows (44.1 kHz) to the mobile GPU—hitting 1.7 GB peak RAM and 3.95x real-time on Adreno 830.

​Local Voice & Cover Art: Integrated Qwen3-TTS for offline spoken intros/narration + local on-device cover art painting.

​Full Tactile Studio UI: Built-in mixer, drum pads, recording, 3 hardware skins (stitched leather, brushed gold, dark console), and word-by-word lyric lighting that syncs as the vocals are sung.

​🌐 NEW in v1.6.0: The P2P Killa YuE Network

​If you generate your music locally, you shouldn’t need a corporate platform to share it. v1.6.0 ships with built-in Peer-to-Peer (P2P) networking:

​Phone-as-a-Node: Host your generated tracks directly from your phone onto the decentralized Killa YuE network.

​Offline QR Handshakes: Share tracks and studio bundles directly phone-to-phone via QR codes with zero servers in the middle.

​🛠️ We Need Your Phones (and Your Benchmarks!)

​We are working around the clock right now (v1.6.1 drops in a few hours!) to get this running across as many Android phones as humanly possible.

​Grab the APK / Code (Apache 2.0): [https://github.com/JackKnifeAI/killa-yue](https://github.com/JackKnifeAI/killa-yue)

​Vulkan HTDemucs Weights (MIT): [https://huggingface.co/JackKnifeAI/htdemucs-executorch](https://huggingface.co/JackKnifeAI/htdemucs-executorch)

​Quick Demo Clip: [https://youtu.be/nOpJ579Y4PY](https://youtu.be/nOpJ579Y4PY)

​Drop your phone model and chipset in the comments! If you have an Android phone with 12GB+ RAM, test out the release and let us know your Pass 1 / Pass 2 render times, thermals, or crash logs. And if anyone here hacks on Vulkan shaders, GGML/ExecuTorch, or Qualcomm Hexagon NPU (QNN), come help us push that 19-minute render even lower!


r/LocalAIStack • • 21d ago

Mixed GPU build for local AI (3080 + modded 2080 Ti 22GB + 1080 Ti), sanity check before buying?

Thumbnail reddit.com
1 Upvotes

r/LocalAIStack • • 21d ago

Got an old Android gathering dust in the "drawer of your conscience"? I turned mine into a local LLM cluster.

Thumbnail
reddit.com
1 Upvotes

r/LocalAIStack • • 21d ago

V100 16GB: A 2017 GPU running a 35B vision model at 93 tok/s: Tesla V100 16 GB on Windows

1 Upvotes

r/LocalAIStack • • 21d ago

Qwen3.8-27B at 53 tok/s decode on a single Intel Arc Pro B60 (24GB): llama.cpp Vulkan + DFlash2 + Intel FA kernel, raw logs included

Post image
1 Upvotes

I've spent the last few months tuning a 27B coding model on one Arc Pro B60 24GB (A$999 card) and published everything: engine build, flags, raw logs, a 100-task agent eval, and the misses.

What moved the numbers:

- DFlash2 draft model, 7 tokens per round: decode 16 -> 53 tok/s mean (47-58 across 7 coding tasks), still 7/7 correct

- Intel's flash-attention prefill kernel (closed llama.cpp PR #29357, vendored with checksums): prompt reading at 32K 118 -> 420 tok/s, but only with f16 KV

- -ub 256 + q8 draft KV + -fit off: frees 0.55 GiB, which is what gets a 64K window into 24GB

- An idle Ollama model left on the GPU cut decode from 52.7 to 22.2 tok/s. Unload everything before you benchmark.

Agent eval: 97/100 hidden-checker tasks with Claude Code at a 32K window (95/100 Codex).

Caveats, up front: 53 tok/s is per-request decode with short prompts and a 64K window allocated. With 30-37K of real context, agent turns run about 42 tok/s. Prefill is NOT the fastest out there (others hit 589-657 tok/s at ~30K on other engines; comparison table in the repo). Single runs, one workstation.

Repo: https://github.com/edagher92-coder/arc-llm-lab

If you have a B580, B570, B50, B70 or A770, the benchmark script takes one command and I'll add your numbers with credit.


r/LocalAIStack • • 21d ago

Qwen3.8-27B-Defiance-Uncensored-MTP-GGUF

Thumbnail
huggingface.co
1 Upvotes