Fine-tune LLMs from one YAML. Layer streaming trains an 8B model on a 4 GB laptop GPU.
Python cliconsumer-gpudpofine-tuningggufhuggingfacellmllmopslocal-ailocal-llmloralow-vrammachine-learningollamapeftpythonpytorchqlorasfttransformers
docs(readme): state the 8B figure with its clock and the post-#331 row (#1207) (#1699)
Alpamys Makazhan5267562e7ca4
diff --git a/README.ar.md b/README.ar.mdindex 9d5a9aca..a2bd3439 100644--- a/README.ar.md+++ b/README.ar.md@@ -1,4 +1,4 @@-<!-- synced-from: README.md sha256:a6789c2877515d5ac707160a55ab94cd84b390e2e31168b69d4f954a47c5562a -->+<!-- synced-from: README.md sha256:fa009c2fcc2c94ea06e25ea8620c2fbed9bfb8ac6611bf71a2669a06f7c50b46 --><p align="center">🌍 <a href="README.md">English</a> | <a href="README.tr.md">Türkçe</a> | <strong>العربية</strong> | <a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a></p><p align="center">@@ -61,11 +61,14 @@ soup train**اضبط نموذجًا بحجم 8B ضبطًا دقيقًا على وحدة معالجة رسومية لحاسوب محمول بسعة 4 GB.** يُبقي بثّ الطبقاتالنموذجَ الأساسي المجمَّد خارج VRAM ويغذّي به وحدة المعالجة الرسومية طبقةَ فك ترميز واحدة في كل مرة.-قِيس الأداء على RTX 3050 Laptop بسعة 4 GB: Llama-3.1-8B-Instruct + NF4 عند **119.6 tok/s وبذروة 3.32 GB** —+قِيس الأداء على RTX 3050 Laptop بسعة 4 GB: Llama-3.1-8B-Instruct + NF4 عند **119.6 tok/s بتردد 952 MHz وبذروة 3.32 GB** (قبل الإصلاح) —مطابق بتًّا ببتّ لتشغيل عادي مقيم بالكامل في الذاكرة، وأُعيد إنتاجه بصورة مستقلة على H100 عند113.00 tok/s وفي 3.32 GB نفسها. (قِيس الرقمان على الإصدار v0.72.2، قبل إصلاح صحة النتائج في v0.73.0 الذي كلّف-انخفاضًا قدره 4.8% في الأداء عند 32B؛ ولم يُعَد تشغيل أيٍّ منهما على بطاقة 4 GB منذئذٍ — وإعادة القياس معلَّقة في-المسألة [#361](https://github.com/MakazhanAlpamys/Soup/issues/361).) وهو لا يُفعَّل إلا بطلب صريح (`stream_layers: true`)+انخفاضًا قدره 4.8% في الأداء عند 32B. أما التشغيل بعد الإصلاح، على حاسوب محمول آخر ببطاقة RTX 3050 Laptop بسعة 4 GB (@umran666، #1103)،+فيسجّل **208.6 tok/s بتردد 1935–1957 MHz وبذروة 2.40 GB**. وهذا يعادل 59% من سقف GEMM في الجلسة نفسها+مقابل 68% قبل الإصلاح: أي أبطأ بنحو 14% لكل وحدة من تردد الساعة، فالكسب الخام البالغ 1.74x مردّه تردد الساعة+لا تسريع فعلي. وقد غيّر بثّ الطبقات الكبيرة أيضًا نمط استخدام الذاكرة بين الصفّين، فحتى هذه النسبة ليست مقارنة+متكافئة — [السجل](benchmarks/gate-v0.72.2-nf4.md).) وهو لا يُفعَّل إلا بطلب صريح (`stream_layers: true`)ولا يزال BETA —[كيف يعمل](docs/performance-and-quantization.md#layer-streaming-beta-v0720-nf4-v0722-disk--wider-archs-v0723-preference-losses-v0724) ·[جميع القياسات](benchmarks/) · [الورقة البحثية](https://doi.org/10.5281/zenodo.21771064) ·@@ -73,8 +76,8 @@ soup trainالنموذج المبثوث مطابق بتًّا ببتّ لنموذج عادي)<p align="center" dir="rtl">- <a href="https://youtu.be/T1LCErE943E"><img src="docs/assets/layer-streaming.gif" alt="الفحص المسبق لأمر soup train لنموذج Llama-3.1-8B على بطاقة 4 GB: مخزن أساسي بحجم 3.60 GB مثبَّت في RAM عبر 32 طبقة ومخزنان مؤقتان في VRAM حجم كلٍّ منهما 113 MB، ثم ذروة مقيسة قدرها 3.32 GB عند 119.6 tok/s، متوقفةً دون خط الـ 4 GB (قِيس على v0.72.2، قبل إصلاح #331؛ وإعادة القياس معلَّقة في المسألة #361)"></a><br>- <sub>Llama-3.1-8B-Instruct + NF4 وLoRA وحجم دفعة 1 وطول تسلسل 512 على RTX 3050 Laptop بسعة 4 GB — <b>ذروة 3.32 GB، و119.6 tok/s</b> (قِيس على v0.72.2، قبل إصلاح #331؛ وإعادة القياس معلَّقة في المسألة #361). <a href="https://youtu.be/T1LCErE943E">الفيديو كاملًا (90 ثانية)</a></sub>+ <a href="https://youtu.be/T1LCErE943E"><img src="docs/assets/layer-streaming.gif" alt="الفحص المسبق لأمر soup train لنموذج Llama-3.1-8B على بطاقة 4 GB: مخزن أساسي بحجم 3.60 GB مثبَّت في RAM عبر 32 طبقة ومخزنان مؤقتان في VRAM حجم كلٍّ منهما 113 MB، ثم ذروة مقيسة قدرها 3.32 GB عند 119.6 tok/s، متوقفةً دون خط الـ 4 GB (صفّ ما قبل الإصلاح، قِيس على v0.72.2 بتردد 952 MHz؛ وصفّ ما بعد #331 في الشرح أدناه)"></a><br>+ <sub>Llama-3.1-8B-Instruct + NF4 وLoRA وحجم دفعة 1 وطول تسلسل 512 على RTX 3050 Laptop بسعة 4 GB — <b>ذروة 3.32 GB، و119.6 tok/s</b> بتردد 952 MHz (قبل الإصلاح، v0.72.2؛ وبعد #331: 208.6 tok/s بتردد 1935 MHz في 2.40 GB، ولا تصح مقارنتهما مباشرة، @umran666، #1103). <a href="https://youtu.be/T1LCErE943E">الفيديو كاملًا (90 ثانية)</a></sub></p>## لماذا Soup؟@@ -447,9 +450,12 @@ Soup مرخَّص بـ Apache-2.0 ومجاني — وسيبقى كذلك. يُبالبطاقة في الجلسة نفسها. وأكبر تكلفة خاصة بالبثّ هي إزالة تكميم NF4 لكل طبقة، بنسبة 9.8%([السجل](benchmarks/probe-v0.73.0-what-bounds-streaming.md)). وتبقى كل القياسات قائمة؛ أما إعادةالإنتاج فتصمد بصورة أضعف — فالقيد مشترك بين الجهازين وليس قدرة GPU الحسابية.-- **إعادة إنتاج على عتاد لا يشبه الأصلي في شيء** (أُضيفت في v2): 119.6 tok/s على RTX 3050 مقابل وسيط- 113.00 على H100، عند الذروة نفسها 3.32 GB. وكلاهما سابق لإصلاح #331؛ وإعادة القياس على 4 GB معلَّقة في- المسألة #361.+- **إعادة إنتاج على عتاد لا يشبه الأصلي في شيء** (أُضيفت في v2): 119.6 tok/s على RTX 3050 (بتردد 952 MHz) مقابل وسيط+ 113.00 على H100، عند الذروة نفسها 3.32 GB. وكلاهما سابق لإصلاح #331، وهما الرقمان+ اللذان توردهما الورقة. أما صفّ ما بعد #331 (@umran666، #1103) فهو 208.6 tok/s بتردد 1935–1957 MHz وبذروة 2.40 GB،+ أي 59% مقابل 68% من سقف GEMM في الجلسة نفسها: فالكسب الخام البالغ 1.74x مردّه تردد الساعة لا تسريع فعلي، وقد تغيّر+ نمط استخدام الذاكرة بين الصفّين، فحتى هذه النسبة ليست مقارنة متكافئة+ ([السجل](benchmarks/gate-v0.72.2-nf4.md)).- **عيب صامت يُنتج تدرّجات خاطئة، اكتُشف وأُصلح.** على NF4 فوق نحو 165 MiB لكل طبقة بقي التمرير الأماميمطابقًا بتًّا ببتّ وبدا منحنى الخسارة سليمًا بينما كانت التدرّجات خاطئة. وقد حُدِّد السبب في المكتبةالمصدرية (upstream) وأُبلغ عنه هناك؛ والإصلاح مشروط بضوابط على نماذج حقيقية بحجم 32B و72B.diff --git a/README.ja.md b/README.ja.mdindex 6861942a..11bdcf38 100644--- a/README.ja.md+++ b/README.ja.md@@ -1,4 +1,4 @@-<!-- synced-from: README.md sha256:a6789c2877515d5ac707160a55ab94cd84b390e2e31168b69d4f954a47c5562a -->+<!-- synced-from: README.md sha256:fa009c2fcc2c94ea06e25ea8620c2fbed9bfb8ac6611bf71a2669a06f7c50b46 --><p align="center">🌍 <a href="README.md">English</a> | <a href="README.tr.md">Türkçe</a> | <a href="README.ar.md">العربية</a> | <strong>日本語</strong> | <a href="README.zh.md">中文</a></p><p align="center">@@ -61,11 +61,14 @@ soup train**4 GB のノート PC 用 GPU で、8B モデルをファインチューニングできます。** レイヤーストリーミングは、凍結したベースモデルをVRAM の外に置き、デコーダー層を一層ずつ GPU に送り込みます。RTX 3050 Laptop 4 GB での実測値:-Llama-3.1-8B-Instruct + NF4 で **119.6 tok/s、ピーク 3.32 GB** — 全体をメモリに常駐させた通常の実行とビット単位で+Llama-3.1-8B-Instruct + NF4 で **952 MHz 時に 119.6 tok/s、ピーク 3.32 GB**(修正前)— 全体をメモリに常駐させた通常の実行とビット単位で完全に一致し、H100 でも同じ 3.32 GB で 113.00 tok/s と独立に再現されました。-(どちらの数値も v0.72.2 で、v0.73.0 の正確性修正(32B で −4.8% のコスト)より前に測定したもので、-それ以降 4 GB のカードでは再実行していません — 再測定は issue-[#361](https://github.com/MakazhanAlpamys/Soup/issues/361) で保留中です。)オプトイン方式(`stream_layers: true`)で、+(どちらの数値も v0.72.2 で、v0.73.0 の正確性修正(32B で −4.8% のコスト)より前に測定したものです。+修正後の実行は、別の RTX 3050 Laptop 4 GB(@umran666、#1103)で+**1935–1957 MHz 時に 208.6 tok/s、ピーク 2.40 GB** でした。これは同一セッションでの GEMM 上限の 59% にあたり、+修正前の 68% に対して、クロックあたりでは約 14% 遅いことになります。つまり、見かけの 1.74x の向上は高速化ではなく+クロックの差です。大きなレイヤーのストリーミングによって両行のあいだでメモリの使われ方も変わっているため、この割合でさえ+同じ条件での比較ではありません — [記録](benchmarks/gate-v0.72.2-nf4.md)。)オプトイン方式(`stream_layers: true`)で、まだ BETA です —[仕組み](docs/performance-and-quantization.md#layer-streaming-beta-v0720-nf4-v0722-disk--wider-archs-v0723-preference-losses-v0724) ·[すべての測定結果](benchmarks/) · [論文](https://doi.org/10.5281/zenodo.21771064) ·@@ -73,8 +76,8 @@ Llama-3.1-8B-Instruct + NF4 で **119.6 tok/s、ピーク 3.32 GB** — 全体ストリーミングしたモデルが通常のモデルとビット単位で同一であることを検証します)<p align="center">- <a href="https://youtu.be/T1LCErE943E"><img src="docs/assets/layer-streaming.gif" alt="4 GB のカードでの Llama-3.1-8B 向け soup train の事前チェック: 32 層にわたって RAM 上に固定された 3.60 GB のベースストアと、113 MB の VRAM バッファ 2 つ。その後、119.6 tok/s で測定されたピークは 3.32 GB で、4 GB のラインの手前に収まっています(v0.72.2 で測定、#331 の修正前。再測定は issue #361 で保留中)"></a><br>- <sub>Llama-3.1-8B-Instruct + NF4、LoRA、バッチサイズ 1、シーケンス長 512、RTX 3050 Laptop 4 GB — <b>ピーク 3.32 GB、119.6 tok/s</b>(v0.72.2 で測定、#331 の修正前。再測定は issue #361 で保留中)。 <a href="https://youtu.be/T1LCErE943E">動画(90 秒)</a></sub>+ <a href="https://youtu.be/T1LCErE943E"><img src="docs/assets/layer-streaming.gif" alt="4 GB のカードでの Llama-3.1-8B 向け soup train の事前チェック: 32 層にわたって RAM 上に固定された 3.60 GB のベースストアと、113 MB の VRAM バッファ 2 つ。その後、119.6 tok/s で測定されたピークは 3.32 GB で、4 GB のラインの手前に収まっています(修正前の行。v0.72.2、952 MHz で測定。#331 修正後の行は下のキャプションを参照)"></a><br>+ <sub>Llama-3.1-8B-Instruct + NF4、LoRA、バッチサイズ 1、シーケンス長 512、RTX 3050 Laptop 4 GB — <b>ピーク 3.32 GB、119.6 tok/s</b>、952 MHz 時(修正前、v0.72.2。#331 修正後: 1935 MHz 時に 208.6 tok/s、2.40 GB。直接の比較はできません。@umran666、#1103)。 <a href="https://youtu.be/T1LCErE943E">動画(90 秒)</a></sub></p>## なぜSoupなのか@@ -447,9 +450,12 @@ Soup に関するあらゆる件の正しい連絡先です。**makazanalpamys@gレイヤーごとの NF4 逆量子化で、9.8% です([記録](benchmarks/probe-v0.73.0-what-bounds-streaming.md))。すべての測定値は有効なままです。再現は弱い形で残ります — この制約は両方のマシンに共通であり、GPU の計算能力ではありません。-- **元とはまったく異なるハードウェアでの再現**(v2 で追加): RTX 3050 で 119.6 tok/s、H100 で中央値- 113.00 tok/s、ピークはどちらも 3.32 GB です。どちらも #331 の修正より前のもので、4 GB での再測定は- issue #361 で保留中です。+- **元とはまったく異なるハードウェアでの再現**(v2 で追加): RTX 3050 で 119.6 tok/s(952 MHz 時)、H100 で中央値+ 113.00 tok/s、ピークはどちらも 3.32 GB です。どちらも #331 の修正より前のもので、論文が報告しているのはこの数値です。+ #331 修正後の行(@umran666、#1103)は、1935–1957 MHz 時に 208.6 tok/s、ピーク 2.40 GB で、同一セッションでの+ GEMM 上限に対する割合は 59%(修正前は 68%)です。見かけの 1.74x の向上は高速化ではなくクロックの差であり、+ 両行のあいだでメモリの使われ方も変わっているため、この割合でさえ同じ条件での比較ではありません+ ([記録](benchmarks/gate-v0.72.2-nf4.md))。- **サイレントな勾配誤りの欠陥を発見し、修正しました。** レイヤーあたり約 165 MiB を超える NF4 では、順伝播はビット単位で一致したままで、損失曲線も健全に見えましたが、勾配が誤っていました。原因は上流ライブラリで特定され、そこに報告されています。修正は、実際の 32B と 72B でのコントロールに対してdiff --git a/README.md b/README.mdindex 8a9892d4..fc8acbd2 100644--- a/README.md+++ b/README.md@@ -60,11 +60,14 @@ soup train**Fine-tune an 8B model on a 4 GB laptop GPU.** Layer streaming keeps the frozen base out ofVRAM and feeds it to the GPU one decoder layer at a time. Measured on an RTX 3050 Laptop 4 GB:-Llama-3.1-8B-Instruct + NF4 at **119.6 tok/s, 3.32 GB peak** — bit-exact against a normal-resident run, and reproduced independently on an H100 at 113.00 tok/s in the same 3.32 GB.-(Both figures were measured on v0.72.2, before the v0.73.0 correctness repair that cost-−4.8% at 32B; neither has been re-run on a 4 GB card since — re-measurement pending in-issue [#361](https://github.com/MakazhanAlpamys/Soup/issues/361).) Opt-in (`stream_layers: true`)+Llama-3.1-8B-Instruct + NF4 at **119.6 tok/s at 952 MHz, 3.32 GB peak** (pre-repair) — bit-exact+against a normal resident run, and reproduced independently on an H100 at 113.00 tok/s in the same+3.32 GB. (Both figures were measured on v0.72.2, before the v0.73.0 correctness repair that cost+−4.8% at 32B. The post-repair run, on another RTX 3050 Laptop 4 GB (@umran666, #1103), reads+**208.6 tok/s at 1935–1957 MHz in a 2.40 GB peak**. That is 59% of its same-session GEMM ceiling+against 68%: about 14% slower per unit clock, so the raw 1.74x gain is the clock, not a speedup.+Large-layer streaming also changed the memory pattern between the two rows, so even the fraction+is not like-for-like — [the record](benchmarks/gate-v0.72.2-nf4.md).) Opt-in (`stream_layers: true`)and still BETA —[how it works](docs/performance-and-quantization.md#layer-streaming-beta-v0720-nf4-v0722-disk--wider-archs-v0723-preference-losses-v0724) ·[all measurements](benchmarks/) · [paper](https://doi.org/10.5281/zenodo.21771064) ·@@ -72,8 +75,8 @@ and still BETA —4 GB, then asserts a streamed model is bit-identical to a normal one)<p align="center">- <a href="https://youtu.be/T1LCErE943E"><img src="docs/assets/layer-streaming.gif" alt="soup train pre-flight for Llama-3.1-8B on a 4 GB card: a 3.60 GB base store pinned in RAM across 32 layers and two 113 MB VRAM buffers, then a measured peak of 3.32 GB at 119.6 tok/s, stopping short of the 4 GB line (measured on v0.72.2, before the #331 repair; re-measurement pending in issue #361)"></a><br>- <sub>Llama-3.1-8B-Instruct + NF4, LoRA, batch 1, seq 512 on an RTX 3050 Laptop 4 GB — <b>3.32 GB peak, 119.6 tok/s</b> (measured on v0.72.2, before the #331 repair; re-measurement pending in issue #361). <a href="https://youtu.be/T1LCErE943E">Full video (90s)</a></sub>+ <a href="https://youtu.be/T1LCErE943E"><img src="docs/assets/layer-streaming.gif" alt="soup train pre-flight for Llama-3.1-8B on a 4 GB card: a 3.60 GB base store pinned in RAM across 32 layers and two 113 MB VRAM buffers, then a measured peak of 3.32 GB at 119.6 tok/s, stopping short of the 4 GB line (pre-repair row, measured on v0.72.2 at 952 MHz; the post-#331 row is in the caption below)"></a><br>+ <sub>Llama-3.1-8B-Instruct + NF4, LoRA, batch 1, seq 512 on an RTX 3050 Laptop 4 GB — <b>3.32 GB peak, 119.6 tok/s</b> at 952 MHz (pre-repair, v0.72.2; post-#331: 208.6 tok/s at 1935 MHz in 2.40 GB, not directly comparable, @umran666, #1103). <a href="https://youtu.be/T1LCErE943E">Full video (90s)</a></sub></p>## Why Soup?@@ -453,8 +456,12 @@ published**, which is also the shortest way to describe what the paper is for:the replication survives in a weaker form — the constraint is common to both machines and isnot the GPU's compute.- **Replication on hardware nothing like the original** (added in v2): 119.6 tok/s on the RTX- 3050 against a median 113.00 on an H100, at the same 3.32 GB peak. Both pre-date the #331- repair; the 4 GB re-measurement is pending in issue #361.+ 3050 (at 952 MHz) against a median 113.00 on an H100, at the same 3.32 GB peak. Both pre-date+ the #331 repair and are the figures the paper reports. The post-#331 row (@umran666, #1103) is+ 208.6 tok/s at 1935–1957 MHz in a 2.40 GB peak, 59% against 68% of the same-session GEMM+ ceiling: the raw 1.74x gain is the clock, not a speedup, and the memory pattern changed between+ the rows, so even the fraction is not like-for-like+ ([the record](benchmarks/gate-v0.72.2-nf4.md)).- **A silent wrong-gradient defect, found and repaired.** On NF4 above ~165 MiB per layer theforward stayed bit-exact and the loss curve looked healthy while the gradients were wrong. Thecause is named in the upstream library and reported there; the repair is gated against controlsdiff --git a/README.tr.md b/README.tr.mdindex c58fe01e..cdd1be4a 100644--- a/README.tr.md+++ b/README.tr.md@@ -1,4 +1,4 @@-<!-- synced-from: README.md sha256:a6789c2877515d5ac707160a55ab94cd84b390e2e31168b69d4f954a47c5562a -->+<!-- synced-from: README.md sha256:fa009c2fcc2c94ea06e25ea8620c2fbed9bfb8ac6611bf71a2669a06f7c50b46 --><p align="center">🌍 <a href="README.md">English</a> | <strong>Türkçe</strong> | <a href="README.ar.md">العربية</a> | <a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a></p><p align="center">@@ -61,12 +61,15 @@ soup train**4 GB dizüstü GPU'da 8B bir modele ince ayar yapın.** Katman akışı, dondurulmuş tabanı VRAM'indışında tutar ve GPU'ya her seferinde bir kod çözücü katman besler. RTX 3050 Laptop 4 GB üzerinde-ölçüldü: Llama-3.1-8B-Instruct + NF4 ile **119.6 tok/s, 3.32 GB tepe** — normal, belleğe tamamen+ölçüldü: Llama-3.1-8B-Instruct + NF4 ile **952 MHz'de 119.6 tok/s, 3.32 GB tepe** (onarım öncesi) — normal, belleğe tamamenyerleşik bir çalıştırmayla bit düzeyinde özdeş ve bir H100 üzerinde aynı 3.32 GB'da 113.00 tok/sile bağımsız olarak yeniden üretildi. (Her iki rakam da 32B'de %4.8 yavaşlamaya yol açan v0.73.0 sonuç-doğruluğu-onarımından önce, v0.72.2'de ölçüldü; o zamandan beri hiçbiri 4 GB bir kartta yeniden-çalıştırılmadı — yeniden ölçüm [#361](https://github.com/MakazhanAlpamys/Soup/issues/361)-numaralı issue'da bekliyor.)+onarımından önce, v0.72.2'de ölçüldü. Onarım sonrası çalıştırma, başka bir+RTX 3050 Laptop 4 GB üzerinde (@umran666, #1103), **1935–1957 MHz'de 208.6 tok/s, 2.40 GB tepe**+veriyor. Bu, aynı oturumda ölçülen GEMM tavanının %59'una denk geliyor; onarım öncesi satırda oran+%68'di: birim saat frekansı başına yaklaşık %14 daha yavaş, yani ham 1.74x kazanç bir hızlanma değil,+saat frekansı farkıdır. Büyük katman akışı da iki satır arasında bellek düzenini değiştirdi; bu yüzden+bu oran bile bire bir karşılaştırma değildir — [kayıt](benchmarks/gate-v0.72.2-nf4.md).)İsteğe bağlıdır (`stream_layers: true`) ve hâlâ BETA —[nasıl çalışır](docs/performance-and-quantization.md#layer-streaming-beta-v0720-nf4-v0722-disk--wider-archs-v0723-preference-losses-v0724) ·[tüm ölçümler](benchmarks/) · [makale](https://doi.org/10.5281/zenodo.21771064) ·@@ -74,8 +77,8 @@ numaralı issue'da bekliyor.)sınırlar, ardından akışlı bir modelin normal bir modelle bit düzeyinde özdeş olduğunu doğrular)<p align="center">- <a href="https://youtu.be/T1LCErE943E"><img src="docs/assets/layer-streaming.gif" alt="4 GB bir kartta Llama-3.1-8B için soup train ön kontrolü: 32 katman boyunca RAM'e sabitlenmiş 3.60 GB'lık bir taban deposu ve iki adet 113 MB VRAM tamponu, ardından 119.6 tok/s'de ölçülen 3.32 GB tepe; 4 GB çizgisinin altında kalıyor (v0.72.2'de ölçüldü, #331 onarımından önce; yeniden ölçüm #361 numaralı issue'da bekliyor)"></a><br>- <sub>Llama-3.1-8B-Instruct + NF4, LoRA, batch boyutu 1, dizi uzunluğu 512, RTX 3050 Laptop 4 GB üzerinde — <b>3.32 GB tepe, 119.6 tok/s</b> (v0.72.2'de ölçüldü, #331 onarımından önce; yeniden ölçüm #361 numaralı issue'da bekliyor). <a href="https://youtu.be/T1LCErE943E">Tam video (90 sn)</a></sub>+ <a href="https://youtu.be/T1LCErE943E"><img src="docs/assets/layer-streaming.gif" alt="4 GB bir kartta Llama-3.1-8B için soup train ön kontrolü: 32 katman boyunca RAM'e sabitlenmiş 3.60 GB'lık bir taban deposu ve iki adet 113 MB VRAM tamponu, ardından 119.6 tok/s'de ölçülen 3.32 GB tepe; 4 GB çizgisinin altında kalıyor (onarım öncesi satır, v0.72.2'de 952 MHz'de ölçüldü; #331 sonrası satır aşağıdaki açıklamada)"></a><br>+ <sub>Llama-3.1-8B-Instruct + NF4, LoRA, batch boyutu 1, dizi uzunluğu 512, RTX 3050 Laptop 4 GB üzerinde — <b>3.32 GB tepe, 119.6 tok/s</b>, 952 MHz'de (onarım öncesi, v0.72.2; #331 sonrası: 1935 MHz'de 208.6 tok/s, 2.40 GB, doğrudan karşılaştırılamaz, @umran666, #1103). <a href="https://youtu.be/T1LCErE943E">Tam video (90 sn)</a></sub></p>## Neden Soup?@@ -455,9 +458,13 @@ bu aynı zamanda makalenin ne işe yaradığını anlatmanın en kısa yoludur:([kayıt](benchmarks/probe-v0.73.0-what-bounds-streaming.md)). Her ölçüm geçerliliğini koruyor;yeniden üretim daha zayıf bir biçimde ayakta kalıyor — kısıt her iki makinede ortak ve GPU'nunhesaplama gücü değil.-- **Özgününe hiç benzemeyen donanımda yeniden üretim** (v2'de eklendi): RTX 3050'de 119.6 tok/s'ye- karşı bir H100'de medyan 113.00, aynı 3.32 GB tepede. İkisi de #331 onarımından önce- ölçüldü; 4 GB yeniden ölçümü #361 numaralı issue'da bekliyor.+- **Özgününe hiç benzemeyen donanımda yeniden üretim** (v2'de eklendi): RTX 3050'de (952 MHz'de)+ 119.6 tok/s'ye karşı bir H100'de medyan 113.00, aynı 3.32 GB tepede. İkisi de #331 onarımından+ önce ölçüldü ve makalenin bildirdiği rakamlar bunlardır. #331 sonrası satır (@umran666, #1103),+ 1935–1957 MHz'de 208.6 tok/s ve 2.40 GB tepedir; aynı oturumda ölçülen GEMM tavanının %68'ine+ karşı %59'u. Ham 1.74x kazanç bir hızlanma değil, saat frekansı farkıdır; satırlar arasında bellek+ düzeni de değişti, bu yüzden bu oran bile bire bir karşılaştırma değildir+ ([kayıt](benchmarks/gate-v0.72.2-nf4.md)).- **Sessiz bir yanlış gradyan kusuru, bulundu ve onarıldı.** Katman başına ~165 MiB'ın üzerindekiNF4'te ileri geçiş bit düzeyinde özdeş kaldı ve kayıp eğrisi sağlıklı göründü, ama gradyanlaryanlıştı. Neden, upstream kütüphanede adıyla belirtildi ve orada bildirildi; onarım, gerçek 32Bdiff --git a/README.zh.md b/README.zh.mdindex 59182d21..edbf9b9f 100644--- a/README.zh.md+++ b/README.zh.md@@ -1,4 +1,4 @@-<!-- synced-from: README.md sha256:a6789c2877515d5ac707160a55ab94cd84b390e2e31168b69d4f954a47c5562a -->+<!-- synced-from: README.md sha256:fa009c2fcc2c94ea06e25ea8620c2fbed9bfb8ac6611bf71a2669a06f7c50b46 --><p align="center">🌍 <a href="README.md">English</a> | <a href="README.tr.md">Türkçe</a> | <a href="README.ar.md">العربية</a> | <a href="README.ja.md">日本語</a> | <strong>中文</strong></p><p align="center">@@ -61,10 +61,13 @@ soup train**在 4 GB 笔记本 GPU 上微调 8B 模型。** Layer streaming 让冻结的基座模型不占显存,按解码层逐层送入 GPU。在 RTX 3050 Laptop 4 GB 上实测:Llama-3.1-8B-Instruct +-NF4 达到 **119.6 tok/s,峰值 3.32 GB**——与常规常驻显存的运行逐位一致,并在 H100 上+NF4 达到 **952 MHz 下 119.6 tok/s,峰值 3.32 GB**(修复前)——与常规常驻显存的运行逐位一致,并在 H100 上以同样的 3.32 GB 独立复现出 113.00 tok/s。(两个数字都测自 v0.72.2,早于 v0.73.0 那次-在 32B 上付出 −4.8% 代价的正确性修复;此后没有在 4 GB 卡上重测——复测进度见 issue-[#361](https://github.com/MakazhanAlpamys/Soup/issues/361)。)需显式开启+在 32B 上付出 −4.8% 代价的正确性修复。修复后的复测在另一台 RTX 3050 Laptop 4 GB+上完成(@umran666,#1103),结果是 **1935–1957 MHz 下 208.6 tok/s,峰值 2.40 GB**。这相当于+同场 GEMM 上限的 59%,而修复前是 68%:按单位时钟频率算大约慢 14%,所以表面上 1.74x 的提升来自+时钟频率,而不是加速。large-layer streaming 也改变了两行之间的内存占用方式,因此连这个比例也不是+同口径的对比——[完整记录](benchmarks/gate-v0.72.2-nf4.md)。)需显式开启(`stream_layers: true`),仍是 BETA——[工作原理](docs/performance-and-quantization.md#layer-streaming-beta-v0720-nf4-v0722-disk--wider-archs-v0723-preference-losses-v0724) ·[全部实测数据](benchmarks/) · [论文](https://doi.org/10.5281/zenodo.21771064) ·@@ -72,8 +75,8 @@ NF4 达到 **119.6 tok/s,峰值 3.32 GB**——与常规常驻显存的运行然后断言流式模型与常驻模型逐位一致)<p align="center">- <a href="https://youtu.be/T1LCErE943E"><img src="docs/assets/layer-streaming.gif" alt="在 4 GB 卡上对 Llama-3.1-8B 执行 soup train 的预检:3.60 GB 基座固定在内存中跨 32 层流转,配两个 113 MB 显存缓冲,实测峰值 3.32 GB、119.6 tok/s,停在 4 GB 线以内(测自 v0.72.2,早于 #331 修复;复测进度见 issue #361)"></a><br>- <sub>Llama-3.1-8B-Instruct + NF4、LoRA、batch 1、seq 512,RTX 3050 Laptop 4 GB——<b>峰值 3.32 GB,119.6 tok/s</b>(测自 v0.72.2,早于 #331 修复;复测进度见 issue #361)。<a href="https://youtu.be/T1LCErE943E">完整视频(90 秒)</a></sub>+ <a href="https://youtu.be/T1LCErE943E"><img src="docs/assets/layer-streaming.gif" alt="在 4 GB 卡上对 Llama-3.1-8B 执行 soup train 的预检:3.60 GB 基座固定在内存中跨 32 层流转,配两个 113 MB 显存缓冲,实测峰值 3.32 GB、119.6 tok/s,停在 4 GB 线以内(修复前的一行,测自 v0.72.2,952 MHz;#331 修复后的一行见下方说明)"></a><br>+ <sub>Llama-3.1-8B-Instruct + NF4、LoRA、batch 1、seq 512,RTX 3050 Laptop 4 GB——<b>峰值 3.32 GB,119.6 tok/s</b>,952 MHz(修复前,v0.72.2;#331 修复后:1935 MHz 下 208.6 tok/s,2.40 GB,不可直接比较,@umran666,#1103)。<a href="https://youtu.be/T1LCErE943E">完整视频(90 秒)</a></sub></p>## 为什么选择 Soup@@ -438,9 +441,12 @@ v1 以来的任何实测数字也没有变。v3 做的是**撤回一个我们曾上限的 **71.3%**。最大的流式专属开销是逐层 NF4 反量化,占 9.8%([完整记录](benchmarks/probe-v0.73.0-what-bounds-streaming.md))。每个测量都仍然成立;复现结论以更弱的形式仍然成立——约束对两台机器是共同的,而不是 GPU 的算力。-- **在完全不同硬件上的复现**(v2 新增):RTX 3050 上 119.6 tok/s,对 H100 上- 113.00 的中位数,同为 3.32 GB 峰值。两者都早于 #331 修复;4 GB 复测进度见- issue #361。+- **在完全不同硬件上的复现**(v2 新增):RTX 3050 上 119.6 tok/s(952 MHz 下),对 H100 上+ 113.00 的中位数,同为 3.32 GB 峰值。两者都早于 #331 修复,也是论文报告的数字。#331 修复后的+ 一行(@umran666,#1103)是 1935–1957 MHz 下 208.6 tok/s,峰值 2.40 GB,为同场 GEMM 上限的+ 59%,修复前为 68%:表面上 1.74x 的提升来自时钟频率,而不是加速;两行之间的内存占用方式也变了,+ 因此连这个比例也不是同口径的对比+ ([完整记录](benchmarks/gate-v0.72.2-nf4.md))。- **发现并修复了一个静默的错误梯度缺陷。** NF4 单层超过 ~165 MiB 时,前向仍然逐位一致、loss 曲线看着健康,但梯度是错的。原因已在上游库中定位并上报;修复已通过真实 32B 和 72B 上的对照实验验证。diff --git a/changelog.d/0.76.0/1699.changed.md b/changelog.d/0.76.0/1699.changed.mdnew file mode 100644index 00000000..0bc50eb7--- /dev/null+++ b/changelog.d/0.76.0/1699.changed.md@@ -0,0 +1 @@+- **The README and the performance docs now state the 8B NF4 figure with its SM clock and give the post-#331 row, and no longer say the re-measurement is pending (#1207, in #1699).** Llama-3.1-8B-Instruct NF4 on an RTX 3050 Laptop 4 GB reads **119.6 tok/s at 952 MHz in a 3.32 GB peak** before the #331 repair and **208.6 tok/s at 1935–1957 MHz in a 2.40 GB peak** after it, the second row measured by @umran666 (#1103). The two are not directly comparable: 59% against 68% of the same-session GEMM ceiling is about 14% slower per unit clock, so the raw 1.74x gain is the clock, not a speedup, and large-layer streaming changed the memory pattern between the rows, so even the fraction is not like-for-like. Changed: the headline, the GIF alt text and caption and the preprint bullet (Citing Soup) in `README.md`, and the table row, the headline and the large-layer paragraph in `docs/performance-and-quantization.md`. The four README translations (`README.tr.md`, `README.ar.md`, `README.ja.md`, `README.zh.md`) carry the same sentences, with every number, link and code span kept identical, and are re-stamped; their prose is a machine-assisted draft for the translation maintainers to polish. The preprint (DOI 10.5281/zenodo.21771064) is not edited in place; #1207 tracks its amendment as a new version.diff --git a/docs/performance-and-quantization.md b/docs/performance-and-quantization.mdindex 39ebfc43..760eb88e 100644--- a/docs/performance-and-quantization.md+++ b/docs/performance-and-quantization.md@@ -543,18 +543,19 @@ Correctness is not a tradeoff here either: a streamed NF4 run is **bit-exact** a| Model | Quant | Seq | Throughput | GPU Util | Peak VRAM | RAM store ||---|---|---|---|---|---|---|-| **Llama-3.1-8B-Instruct** | **NF4** | 512 | **119.6 tok/s (pre-repair, [#361](https://github.com/MakazhanAlpamys/Soup/issues/361))** | 100% | **3.32 GB** | 3.60 GB pinned |+| **Llama-3.1-8B-Instruct** | **NF4** | 512 | **119.6 tok/s at 952 MHz (pre-repair)** | 100% | **3.32 GB** | 3.60 GB pinned |+| **Llama-3.1-8B-Instruct**, post-#331 (@umran666, #1103) | **NF4** | 512 | **208.6 tok/s at 1935 MHz** (read with its clock, not directly comparable) | 100% | **2.40 GB** | 5.70 GB pinned || Qwen2.5-3B | NF4 | 512 | 264.2 tok/s | 100% | 1.76 GB | 1.43 GB pinned || Qwen2.5-3B | bf16 | 512 | 143.1 tok/s | 79.3% | 2.15 GB | 5.55 GB pageable || Qwen2.5-1.5B | bf16 | 512 | 525.0 tok/s | 96.8% | 1.82 GB | pinned || Qwen2.5-1.5B | bf16 | 1024 | 487.6 tok/s | 96.7% | 2.96 GB | pinned || Qwen2.5-0.5B | bf16 | 512 | 978.6 tok/s | 91.4% | 1.47 GB | pinned |-**Headline:** **Llama-3.1-8B fine-tunes on a 4 GB card at 119.6 tok/s in 3.32 GB (pre-repair; re-measurement pending in [#361](https://github.com/MakazhanAlpamys/Soup/issues/361)).** For scale, 1M training tokens is ~2.3 h at 8B (arithmetic from the measured rate, not a separate measurement).+**Headline:** **Llama-3.1-8B fine-tunes on a 4 GB card at 119.6 tok/s at 952 MHz in 3.32 GB (pre-repair), and at 208.6 tok/s at 1935–1957 MHz in 2.40 GB after the #331 repair (@umran666, #1103).** The two rates are not directly comparable: the later run's clock is about twice the earlier one's, and per unit clock it is about 14% slower (59% against 68% of the same-session GEMM ceiling; large-layer streaming changed the memory pattern between the rows, so even that fraction is not like-for-like, and the shortfall is not attributed to any one cause). The row, its clock and the caveat are in [the gate record](../benchmarks/gate-v0.72.2-nf4.md). For scale, 1M training tokens is ~2.3 h at the pre-repair 119.6 tok/s (arithmetic from the measured rate, not a separate measurement).The 3B NF4-vs-bf16 rows differ by 1.85×, but attribute that to **pinning, not arithmetic** — see point 2 above. The two rows also come from different sessions, and this card's boost clock varies ~13% between sessions, so treat the factor as indicative and the mechanism as the claim.-The 3.32 GB 8B row above predates large-layer streaming: its untied, unquantised `embed_tokens` + `lm_head` both stayed resident and occupied 2.10 GB. Current code writes them as separate large-layer shards and reuses one device slot sized to the larger matrix, so an equally shaped untied pair should reclaim one matrix while a tied model keeps the same one-matrix requirement. Under `dpo` and `kto` that saving is spent again: the output head's forward keeps a private copy of the matrix for its backward every step (about 1.05 GB for Llama-3.1-8B in bf16, charged by the pre-flight, #1049). CPU CI pins bit-exact logits for both controls. The updated CUDA peak remains to be measured on the reference RTX 3050; the historical 3.32 GB figure is not relabelled as a new measurement.+The 3.32 GB 8B row above predates large-layer streaming: its untied, unquantised `embed_tokens` + `lm_head` both stayed resident and occupied 2.10 GB. Current code writes them as separate large-layer shards and reuses one device slot sized to the larger matrix, so an equally shaped untied pair should reclaim one matrix while a tied model keeps the same one-matrix requirement. Under `dpo` and `kto` that saving is spent again: the output head's forward keeps a private copy of the matrix for its backward every step (about 1.05 GB for Llama-3.1-8B in bf16, charged by the pre-flight, #1049). CPU CI pins bit-exact logits for both controls. The post-#331 row above is that updated peak, measured on another RTX 3050 Laptop 4 GB: 2.40 GB allocated (2.66 GB reserved), while the pinned store grew from 3.60 GB to 5.70 GB, exactly the two 0.525B bf16 tensors (2.10 GB) that moved into it; the historical 3.32 GB figure is not relabelled as a new measurement.**Honest scope:**- **RAM tier + disk overflow (v0.72.3).** `stream_source: auto` picks RAM when the store fits both dynamic free-RAM headroom and a physical-host ceiling, falls back to NVMe disk when not; SATA/HDD rejected. Correctness verified. **The read is off the compute thread**: a background reader parses each shard's header itself (no memory map) and stages `training.stream_read_ahead` layers in host RAM (page-locked where the box allows — see `stream_pin` below), so the GPU is fed while the next layer is still arriving. **Measured cold and warm against a same-day control of the source it replaces** (RTX 5070 Laptop, 2026-09-14, [record](../benchmarks/gate-971-async-nvme-source.md)).