Repository navigation
Hardware layouts for consumer GPUs, CUDA training through quantized weights, and reasoning off for Qwen3 / gpt-oss - #19
Merged
Conversation
…est whether the trainer shares the chat model llama_adapter_lora_init_new allocated every trainable tensor on the CPU, so a GPU run would move each layer's activations to the host. Each pair now goes in the buffer type of its base weight (the CPU for host buffers). The trainer logs whether its base weights are the chat engine's copy, and scripts/e2e_tiers.sh checks that with TRAIN_BASE=model. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
…from the weights), 5.8x slower on CPU Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
…s pass Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
…h idle-time training on one card auto | cpu | chat-gpu-train-cpu | chat-cpu-train-gpu | two-gpus | one-gpu | one-gpu-idle | custom (the old infer/train). auto counts the GPUs llama.cpp lists: none -> cpu, one -> one-gpu, two -> two-gpus. train_base = auto picks an f32 copy when it fits on the training device, else the model as loaded (Mem.Layout, tests/layout_test.lpr, 30 checks). one-gpu-idle / train_when = idle: a run waits for idle_min minutes without a message (inside night when set), unloads the chat model and trains; the next message stops it and the model loads back with its adapters. A cancelled run's facts stay due. scripts/e2e_idle.sh passes on the CPU. The shipped memagent.ini no longer assumes two GPUs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
…eights; reasoning off for Qwen3 and gpt-oss On a rented RTX PRO 4500 (32 GB, 23 min, about $0.27): scripts/e2e_tiers.sh and e2e_idle.sh pass for one-gpu (f32 copy and shared weights), chat-gpu-train-cpu, chat-cpu-train-gpu and one-gpu-idle; auto picks one-gpu. packaging/llama-patches: CUDA out_prod dequantizes an f16 or quantized weight a slice of rows at a time, so training runs through the model as loaded on the card: the 1.5B trains in 3.3 s per run against 5.5 s on an f32 copy, with the same recall. Mem.LlamaChat: reasoning models answer with reasoning off (empty <think></think> for the Qwen3 family, the final channel for gpt-oss), training examples to match, and a leading <think> block is cut from answers and the stream. Qwen3-14B now trains (recall 2 of 3 in 12 s); gpt-oss-20b and Qwen3.8-27B chat but abort in training (no llama.cpp backward for MoE routing or Gated DeltaNet). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
memagent now runs on consumer GPUs, and was tested on one. Full write-up in
bench/README.md: "One GPU for chat and training", "Hardware layouts" and "On a GPU".[gpu] layout(newMem.Layout)autois the default. It counts the GPUs llama.cpp lists: none givescpu, one givesone-gpu, two or more givetwo-gpus.cpuchat-gpu-train-cpuchat-cpu-train-gputwo-gpusgpusecondone-gpuone-gpu-idleidle_minminutes without a message (and insidenightwhen set)custom[gpu] infer/trainas writtenone-gpu-idle: the idle run unloads the chat model. A message stops the run and loads the model back, adapters included. The stopped run's facts stay due.[consolidate] train_base = auto: trains on an f32 copy when it fits on the training device. Otherwise it trains on the GGUF as loaded, and on the chat card that means the chat engine's own copy (one copy in memory).memagent.inino longer assumes two GPUs.llama.cpp patch
out_prodfor f16 and quantized weights: the weight is dequantized one slice of rows at a time (about 256 MB) and the GEMMs are accumulated. This is the backward pass through a frozen 4-bit base.Reasoning models (
Mem.LlamaChat)Detected from the chat template:
<think></think>.<think>block is cut from answers and from the stream.Measured on an RTX PRO 4500 (32 GB, 23 min, about $0.27)
scripts/e2e_tiers.sh/e2e_idle.shwithLAYOUT=.small), training per run: 3.3 s through the q8_0 weights as loaded, against 5.5 s on an f32 copy, with identical gate recall.ADD_ID,MUL_MAT_ID) or Gated DeltaNet. That needs llama.cpp work or the Python/Unsloth trainer.Test plan
make test-pascal, including the newlayout_test(30 checks)scripts/e2e_tiers.sh(default andTRAIN_BASE=model) andscripts/e2e_idle.shout_prodpath, and the three newer modelstrain_basef32 against model, same recall (memory-tiny-llama-base-*.json)two-gpuson a two-card machine (not run)Generated by Claude Code