AIニュース最前線
最新ニュースAI日報Hacker日報週報動画AIツールトレンド企業

AIニュース最前線

世界中のAI最新情報を日本語で毎時更新

最新ニュース日報トレンド企業プレミアムRSS
© 2026 ainew.jp特定商取引法に基づく表記
ニュース一覧元記事を開く
TLDR AI·2026年6月12日 09:00·約50分で読める

ゼロから作るヴィンテージ LLM(50 分読了)

#LLM#オープンソース#ドメイン特化#データセット構築#HuggingFace
TL;DR

著者が独自のスクリプトとデータパイプラインを構築し、19 世紀ロンドンのテキストのみで学習させた「Vintage LLM」の作成過程とその成果を共有した記事である。

AI深層分析2026年6月13日 01:10
3
注目/ 5段階
深度40%
4
関連度30%
3
実用性20%
3
革新性10%
4

キーポイント

1

独自環境でのゼロからの構築

既存のライブラリは使用したが、ベーストレーニングやファインチューニングのスクリプト、データ処理パイプラインをすべて自作し、1800 年代のロンドン関連テキストのみで学習させた。

2

歴史的コンテキストへの特化

19 世紀の文体や社会背景(例:1834 年の抗議活動など)を反映した、特定の時代背景に特化したチャットボットの作成を目指し、継続的な学習と改善を行った。

3

オープンソースでの公開

作成されたモデル(Vintage LLM-340m-v1-base)の HuggingFace リンクおよび全コードが GitHub で公開されており、他の開発者が再現・拡張できる環境を整えている。

4

データ処理の難易度とフィルタリング

歴史的テキストの収集、重複排除、OCRノイズ除去に最も時間を要し、最終的に圧縮率やユニーク文字数などのメトリクスを用いて厳格なフィルタリングを行った。

5

データベース選定と学習環境

QdrantやValKeyなどの高機能DBはメモリ不足やスケーラビリティの問題で断念し、最終的に軽量で信頼性の高いLevelDBを採用して1200万件のデータを処理した。

6

プロジェクトの制約と倫理的配慮

1900年以前の英語テキストのみを使用し、現代の基準では有害とみなされる内容(毒や差別的表現)が含まれる可能性があるため、アライメント(安全化)を行わないことで歴史的正確性を優先した。

7

圧縮率によるテキスト評価

繰り返しが多いテキストほど圧縮率が低く(0.01)、通常の英語テキストは中程度の値(0.64)を示し、データの冗長性を測る指標として機能します。

影響分析・編集コメントを表示

影響分析

この記事は、大規模言語モデル開発のハードルを下げ、特定のドメインや歴史的データに特化したニッチなモデル作成の可能性を示しています。特に、既存の商用モデルでは再現が難しい時代背景や文体を学習させるアプローチは、教育や歴史研究などの分野での応用可能性を広げるものであり、オープンソースコミュニティにおける実験精神を鼓舞する内容です。

編集コメント

大規模モデルの学習コストが高騰する中、特定のデータに絞って独自のスクリプトでゼロから作るというアプローチは、開発者のスキル向上と新しい知見を得るための貴重なケーススタディです。

2026 年 5 月 25 日、月曜日

50 分

このブログ記事では、ほぼゼロから独自に LLM(大規模言語モデル)を作成し、古いテキストのみでトレーニングした私の冒険について共有します。私は独自のベーストレーニングおよびファインチューニングスクリプト、データ処理パイプライン、カスタムデータセットをすべて自作しました。

(「ほぼゼロから」とは、既存のプログラミング言語やライブラリを使用したという意味であり、アセンブリ言語で記述したわけではありません。AI を「ゼロから」構築する他の人々と同じようにです)

このモデルは HuggingFace で利用可能です:https://huggingface.co/croqaz/vintage-LLM-340m-v1-base ;

すべてのコードはオープンソースで公開されています:https://github.com/croqaz/vintage-LLM ;

より大きな Vintage モデルを確認したい場合は、私の以前の投稿をご覧ください:Vintage LLM models。

アイデア

3 ヶ月前の 2 月末、Hayk Grigorian(Hayk Grigorian)によるいくつかの Reddit の投稿を発見しました。彼はそこで時系列ゲート付き言語モデルを作成した方法を説明していました。私はそのことに完全に魅了されました。

1800 年代ロンドンのテキストのみで LLM をトレーニング(90GB データセット):

https://reddit.com/r/LocalLLaMA/comments/1pkpsee/training_an_llm_only_on_1800s_london_texts_90gb

1800 年代のロンドンテキストのみからゼロからトレーニングされた LLM が、1834 年の本物の抗議を呼び起こしました:

https://reddit.com/r/LocalLLaMA/comments/1mvnmjo/my_llm_trained_from_scratch_on_only_1800s_london

明らかに、他の人々が独自の LLM を作成した他の投稿も読みましたが、もしかすると私が自分でやる準備ができていなかったか、彼らが取り組んでいたモデルがそれほど面白くなかったのかもしれません。とにかく、自分だけのビクトリア朝のチャットボットを持つという考え…なんて凄まじい!!

それからというもの、私は毎日欠かさず「Vintage LLM」に取り組んできました。例外はありません。病気の時でさえも。

その間には、Violet-1B4-Chat Violet-1B4-Chat、Mr. Chatterbox Mr. Chatterbox、GPT-1900 GPT-1900、Talkie Talkie、TypewriterLM-base TypewriterLM-base など、多くの歴史的 LLM がリリースされました。

何?なぜ?どこで?どうやって?

何?****これは時間ロックされた LLM(歴史 LLM)であり、英語のみ対応、知識の更新カットオフは 1900 年です。(特定の年に制限するのはエラーを起こしやすいですが、私は最善を尽くしました)。Llama アーキテクチャに基づいており、パラメータ数は 340M(0.3B)です。

なぜ?****自分でやってみなければ学べないからです。そしてこれは非常に楽しいプロジェクトだからです。

どこで、どのように?****私は独自にデータセットを作成し、独自の処理とトレーニングコードを構築しました。

コードは、VS-Code と PI(OpenRouter モデル)で利用可能なあらゆる LLM を活用して、半ば雰囲気重視でコーディングされました。すべての関数を確認・検証し、各コードファイルが何をしているかを深く理解しています。

データ処理に最も時間がかかり、機能しない様々な試行錯誤を繰り返した結果、膨大な時間を浪費することになりました。複雑な解決策ほど最悪です……

私はすべてのデータを自分の PC で処理し、PC 上で LLM の小型版をトレーニングしました(*Cachy OS Linux、AMD Ryzen 7 9700X CPU、64GB RAM、Radeon RX 9070 16GB VRAM*)。

一方、より大規模な 340M モデルについては、RunPod、ThunderCompute、Vast.ai でトレーニングしました。これを自分の PC でやれば永遠にかかってしまうでしょう。

このプロジェクトの総コストは約$80(GPU コストのみ)でした。

これは私がデータを処理できる十分な性能を持つ PC を持っているからです。もし RAM がもっとあれば、特にメモリ内でのテキスト重複排除において、一部のデータ処理をずっと高速に行えたはずです。

免責事項: これはおもちゃ/趣味の LLM です(ただし、私は非常に真剣に取り扱っています)。このモデルは幻覚を起こし、歴史的に半ば正確な内容を生成しますが、当時は普通と考えられていたものが、現代の基準では有毒、攻撃的、安全でないものと見なされます。これは予想されることであり、私はアライメントを行っていないためです。モデルをアライニング(または検閲)するには多大な労力が必要であり、歴史的正確性を損なうことになります。

また、私のモデルが厳密に 1900 年までに限定されていることを保証できません(最善を尽くしたとしても)、例えば「アルベルト・アインシュタインテスト」を実行する際などです。

プラン

私は仕事で毎日 AI を使用しており、その仕組みも理解していますが、自分で LLM を構築したのは今回が初めてです。職場では特定の AI 学習およびファインチューニングパイプラインを実行したことはありますが、過去に C や Python で小さなニューラルネットワークを構築したことはあっても、このプロジェクトを開始する時点では、人々が通常どのように LLM を構築しているかを知りませんでした。

私は一週間検索を行い、トピックを調査する際いつも行うように、複数のボットとチャットして異なる視点を得ました。

要約すると、LLM を構築するには 4 つのものが必要です:

  • データ -- LLM には識別力や理解力はありません。あなたが良いか悪いかに関わらず、何でも教えて学習します。これが最も長いプロセスです。
  • トークン化 -- トークナイザーは、単語や文字を数値(トークン)に変換する小さなプログラムです。LLM は単語を理解せず、数値のみを理解します。
  • pre-training -- これは混乱を招く表現ですが、「ベーストレーニング」を意味し、LLM がテキストの補完を学習するプロセスです。300m パラメータ以上のモデルを目指す場合、これが最もコストのかかる工程となります。
  • fine-tuning -- ここで LLM はターンごとのチャットや質問応答の方法を学習します。

実際にはこれらの単純なステップ以外にもいくつかの要素がありますが、本記事ではこれ以上深く掘り下げません。

さて、各ステップをより詳細に確認していきましょう。

初期実験

私が「大規模」モデルに落ち着くまでに、多くの間違いを犯し、いくつかのデータセットやモデルアーキテクチャを実験したことは言及する価値があります。ここで言う"big"(大規模)には引用符をつけていますが、ご存知のように Talkie-13B や TypewriterLM-7.24B といったより大きなモデルと比較すれば、私のモデルは単なるおもちゃに過ぎないからです。

私が自分の PC で訓練した v2 トイ版の EleutherAI/pythia-14m に関するいくつかの詳細:

https://github.com/croqaz/vintage-LLM/tree/e272b94fcf96316f874babbed549d20809fe5a39/models/m-v2

検証損失やパープレキシティの SVG ファイルをご覧いただくと、大きな跳躍が見られるはずです。これはファイルチャンクをランダム化しなかったためです。また、データセットファイルがアルファベット順にトークン化されていたことも原因で、クリーンな書籍ファイルが先に配置されていました。その結果、モデルが Time-Capsule データセットにさらされ始めると、徐々に性能が悪化しました。なぜならこのデータセットには奇妙な OCR のアーティファクトや壊れた単語・文などが多く含まれていたからです。

間違いは犯されました…しかし、そこから学びました。

私はしばらく行き詰まっていましたが、まず不適切な文書をフィルタリングし始めたことで打開策が見つかりました。

データ処理

データ処理はこれまでで最も長く、最も退屈なプロセスでした。その理由はお分かりいただけるでしょう……

インターネットからスクレイピングされた現代的で高品質なデータセットは数多く存在しますが、私の LLM がコンピュータや原子爆弾、宇宙船について学習することを望まなかったため、自分自身でデータセットを作成するしかなかったのです。

幸いにも利用可能なデータセットはいくつかありますが、それらの質はあまり良くなく、私の作業の大部分は重複データの除去、極めて不適切なテキストのフィルタリング、既存のテキストの一部の強化に費やされました。

歴史的なデータセットは非常に限られており、新しい古書が発見されスキャンされるまで、私たちが利用できるのは古い書籍だけです。そのため、利用可能なものを使うしかありません。

特筆すべきデータセットとしていくつか挙げられます:Project Gutenberg、Oxford Text Archive、Internet Archive books、TheBritishLibrary/blbooks、storytracer/LoC-PD-Books、dell-research-harvard/AmericanStories、dell-research-harvard/NewsWire、Heritage Made Digital Newspapers (HMD)。

各データセットの年と言語を特定するために最善を尽くし、1900 年以前の英語資料にのみ限定しました。

日付が明記されていない文書や、テキスト内で日付が見つからない文書については、品質が高くても安全のために完全に無視しました。

サイドプロジェクトとして、古い書籍、タイトル、著者、書籍 ID、ソースを含む多数の古書を収録した Book-Metadata HF データセットを作成しました:https://huggingface.co/datasets/croqaz/book-metadata;私の目標は全グーテンベルク書籍の年を特定することでしたが、最終的に年が 100% 確実な書籍が 5300 冊しか見つかりませんでした。

これもまた、本当に永遠にも思えるほど時間がかかりました。このブログ記事を書いている現在も、まだ完全に完了していません。

もし今後別の LLM を訓練する機会があれば、次回はより多く、より質の高いデータを用意できるでしょう。

当初は MinHash や埋め込みベクトルの類似度など、複数の重複排除手法を想定していました。これが何を意味するかご存じない場合はご安心ください、詳細には立ち入りません。

あまりにも遅く、コストも高すぎたため、断念せざるを得ませんでした。

この処理がいかに遅かったかをお伝えするために言えば、高性能な DEV サーバーで短いテキストデータセットの埋め込み計算を行いましたが、サーバーを昼夜問わず稼働させても 1 週間でデータセット全体の 10% しか処理できませんでした。そのサーバーには共有していた RTX 3090 GPU を搭載していました。

最終的に、正規化されたテキスト(小文字に変換し、すべての空白を除去したテキスト)に基づいて重複排除を行いました。つまり、「hello world」というテキストは「 Hello World」(スペースと大文字表記の違いに注意)と同じであり、私のデータセットではそのテキストは一度だけ保存されます。

最初から、データが最も重要であることを知っていました:ゴミを入れればゴミが出るのです。私は多くの実験と反復を行い、Qdrant、Zvec、Lance、ValKey、LevelDB といったデータベースを試しながら、データセットの保存方法を模索しました。

Qdrant は、多くのエントリを追加し始める前にもかかわらず DB のディスクサイズが巨大だったため、採用を断念しました。

Zvec も、DB エントリをローテーションさせる手段がないため、一度保存すると DB を探索する方法がなくなるという理由で採用を断念しました。この点について Issue を作成しました。Zvec は非常に新しいライブラリであり、成熟するまでもう少し時間を置くべきだったかもしれません。

Lance はバージョン管理機能に起因して採用を断念しました。数百万件以上のエントリを追加し始めると DB の速度が徐々に低下します。これは私の責任かもしれませんが、より良い方法が見つかるはずです。

ValKey は、約 1000 万件のレコードをインジェストした後にメモリ不足となり、PC でサーバーが OOM(Out Of Memory)クラッシュを起こしたため採用を断念しました。それでもなお、さらに大量のデータをインジェストする必要がありました。それ以外は ValKey は非常に優れたライブラリでした。

最終的に、ローカルウォレットアプリでビットコインやイーサリアムのトランザクションを保存するために使用されていた LevelDB を採用しました。これにより、私の PC でもスケーラブルであることが確実です。1200 万件の行をインジェストしましたが、CPU や RAM の使用量を最小限に抑えつつ、何の問題もなく完了できました。LevelDB は時として遅い場合がありますが、一貫して信頼性が高いです。

もしより高性能な PC やスーパーコンピュータを持っていれば、ValKey を最後まで使い続けたかもしれません。

テキストの質を把握するために、まず各ドキュメントの長さや一意の文字数を調べました。第一段階では短いテキスト(最大 32k 文字)を使用し、第二段階では最大 10MB の長いテキストを使用することにしました。英語は通常 30〜50 記号以内であるべきです。もしテキストの断片に 100 個以上の一意の記号が含まれている場合、それは英語ではないため除外しました。また、一意の記号がたった 8 個しかないテキストも意味をなさないため、これも削除しました。

さらに 3 つのフィルタを適用しました。

非常に簡単な指標として、ZLIB の圧縮率(compression ratio)を使用します。短すぎて多様なテキストは大きな値を持ち、過度に繰り返されるテキストは非常に小さな値になります。

ZLIB compression ratio

A good window is 0.5...0.7;

def compression_ratio(text) -> float:

raw = text.encode("utf-8")

compressed = zlib.compress(raw)

return len(compressed) / len(raw)

compression_ratio("Lorem ipsum dolor sit amet")

1.3

compression_ratio("other, and other and other" * 100)

0.01 -- very repeated

compression_ratio("The President has nominated Thomas Johnson, William Cranch, and Charles\nSimms, Judges of the district of Columbia.\n\nOn Saturday last, Thomas Jefferson, at\npresent Vice President of the United States,\nand President of the Senate, took leave of\nthat body on which occasion he delivered\nthe following address:\n\nGentlemen of the Senate,\n\nTo give the usual opportunity")

0.64 -- Regular text

また、シャノンエントロピー(Shannon entropy)も使用しました。

シャノンエントロピー

印刷された英語の推定エントロピー率は約 4.2...5.5 です;

def char_entropy(text) -> float:

counts = Counter(text)

total = len(text)

entropy = 0.0

for count in counts.values():

p = count / total

entropy -= p * log2(p)

return entropy

char_entropy(("a " * 10 + "!"))

1.22 -- 低すぎます

char_entropy("Lorem ipsum dolor sit amet")

3.6 -- 少し低い

char_entropy("IN the High court of Chancery for the Rich\nmond District,\nBetween\nHenry Banks plaintiff,\nAnd\nNathaniel Anderson, Robert Pollard.")

4.5 -- 通常の英語

char_entropy(''.join(chr(i) for i in range(200)))

7.6 -- 非常に高いエントロピー

そして、私自身の品質検出フィルターです。これにより、奇妙な記号が多く含まれる非常に悪い OCR テキストを特定できました:

_LETTER_RE = re.compile(r'[a-zα-ωàâäçèéêëîïôöùûüüÿæœß]$', re.I)

_DIGIT_SPACE_RE = re.compile(r'[0-9 \n]$')

_PUNCT_RE = re.compile(r'[.,;!?\'"_\-$]')

Cro のカスタム品質スコア

通常の文字にはスコア 2 を付与;

数字とスペースにはスコア 1 を付与;

句読点には 0.5 を付与;

その他すべての文字には -0.5 を付与。

def quality_score(text: str) -> float:

score = 0.0

for c in text:

if _LETTER_RE.match(c):

score += 2

elif _DIGIT_SPACE_RE.match(c):

score += 1

elif _PUNCT_RE.match(c):

score += 0.5

else:

score -= 0.5

return ((score / len(text)) - 0.75) * 100

quality_score("-.•-, , _ ._. , •

1.

  • ,

.... - • 4

-------._

..77/:',. .., ..., : •

':'#)).,-'' 1 -

__LI -......-_-.A..-...',... ) •

Silli° , A AilitA4'

' •:.:-',73 ..-.-..-_-_,N>

  1. .41t.")

-8.72

quality_score("Lorem ipsum dolor sit amet")

109.61

これらの指標を計算した後、私は単に品質の低いドキュメントを削除しました。

削除されたドキュメントの割合は 1% 未満でした。

これら一連の実験には非常に時間がかかり、常にボトルネックとなったのは計算リソースです。処理できるデータセットは他にもいくつかあります(例:Institutional Books 1.0、947GB の巨大データセット、983K 冊の書籍、386M ページなど)ですが、私の PC を壊したくありませんし、私の小さな LLM にはすでに十分なデータがあります。

私のデータセットは HuggingFace で見つけることができます:https://huggingface.co/datasets/croqaz/vintage-v1 ;

Tokenization(トークン化)

私は独自のトークナイザーを作成する必要がありました。なぜなら、私のモデルは「async function」や「import sys」、「public class Main」、あるいは他のプログラミング言語の用語のような語彙を必要としないからです。

また、これは英語専用の LLM ですので、他の言語からの表現を取り込みたくありません。

既存のトークナイザーを使用していた場合、それらの無意味な単語がすべて語彙の中で無駄に消費されていただろうからです。

私は非常にクリーンな英語のグーテンベルク書籍とオックスフォード書籍を基にトークナイザーを訓練しました。

Base-training stage-1(ベーストレーニング段階 1)

基本的なデータセットを手に入れた後、litGPT フレームワークを使用して、非常に基本的な Pythia-14M パラメータ モデル(パラメータ数は 0.01B)をすぐに作成しました。当初は非常にシンプルで、苦痛を伴うものではありませんでした。

私の PC で動作させるためにいくつかの工夫が必要でした。なぜなら、私は Radeon GPU を使用しており、AI のトレーニングスクリプトのほとんどが NVIDIA GPU を前提としているからです。

わずか 1 時間で、半ばランダムな英語風の無意味な文章を生成する小さな大規模言語モデル(LLM)が完成しました。例:

彼らは魂の一つをそれらに提示した。それは同じ方法で作られたものであり;

私はまたこの瞬間にもいたし、今月が短い時間なしで許されるべきではないということもそうでした。まだ、彼が法廷にいることが知られているその男のために言葉があるわけではありませんでした。これはそこに作られ、理解されるべきものとなり、その言葉は...

それは野生的で奇妙な欲求であり、彼の頭の上にはあり、唯一の農場か、黒い空があり、彼は夜の顔の真ん中にいました。

しかし、彼の最初の病気は偉大であり、彼の手を持っていた男が心臓でした。なぜなら、彼は非常に多く得ており、彼は非常に弱かったからです。

彼の口はあったが、彼の手の中にありました。

彼は名誉ある男でしたが、その一人は...

もう少し触ってみた後、より大きな Pythia-70M のトレーニングを試みましたが、litGPT はランダムにクラッシュし、以下のようなエラーが発生しました:

エラー:ワーカーで予期せぬセグメンテーションフォルトが発生しました。

raise RuntimeError(

f"DataLoader worker (pid(s) {pids_str}) exited unexpectedly"

) from e

Pythia-14M と同じトークナイザーとデータセットを使用し、Pythia-31M および Pythia-160M でも試しましたが、70M モデルは動作しませんでした。しばらくデバッグを試みましたが成功せず、多くの時間を無駄にしてしまいました。最終的に、litGPT や nanoChat にヒントを得た独自のトレーニングスクリプトを作成することを決断しました。

HuggingFace の transformers ライブラリに Trainer クラス があることを発見し、雰囲気でコーディングして基本的なものを構築しました。nano-GPT、nano-Chat、NanoWhale-100m のソースコードをダウンロードし、他にも「ゼロから」のコードを含むいくつかのリポジトリを確認しました。そして、これらの LLM からベーストレーニングの実施方法に関する技術的な詳細を抽出し、LLM に最良の特徴を自身のトレーニングスクリプトに適用するよう依頼しました。このようにして、数回の反復で非常に堅牢かつ柔軟なものを手に入れることができました。

コードを手作業で何度も微調整し、気に入るまで繰り返し、その動作を理解しました。

私は意図的に nanoChat を使用しないことにしました。なぜなら、HuggingFace ライブラリとの 100% の互換性と、将来的には GGUF との互換性を確保したかったからです。

自分の PC でいくつかのデバッグ版をトレーニングした後、次は規模を大きくしてクラウド上でトレーニングする時が来ました。

Llama3 アーキテクチャに基づいた、200M パラメータ(コンテキスト 2048 トークン)と 340M パラメータ(コンテキスト 4096 トークン)のモデルを試しました。

RunPod は機能も豊富で悪くありませんでしたが、価格が高めでした。私は 0.2B パラメータの LLM をトレーニングしましたが、コンテキストサイズが非常に小さかったため、どこにもアップロードせず、費用をかけたにもかかわらず破棄することに決めました。本当に必要だったのは 4k 以上のコンテキストサイズでした。

ThunderCompute で 0.3B パラメータの Llama のトレーニングを開始しました。速度は非常に遅く、GPU の生産価格も RunPod よりさらに高かったため、大きな失望を味わいましたが、25 ドルのクレジットを使用し、すべて使い切りたいと考えていたため、クレジットを使い果たすまでトレーニングを実行させました。

Vast.ai は当初、ベースの Docker イメージにさまざまな問題があり、インスタンスを起動できませんでした。しかし、何度か試行錯誤した結果、チェコにある NVIDIA RTX PRO 5000 を搭載した良好なインスタンスを見つけ、10,000 ステップ(約 3B トークン未満)実行させました。価格は非常に競争力があり、一度良いインスタンスを見つければ非常に高速で安定しているため、Vast.ai は必ず再挑戦します。

この段階でのコストは、ThunderCompute で 25 ドル + 15 ドル、そして Vast.ai での利用料でした。

この段階のトレーニングメトリクス:

image
image

ベーストレーニングステージ 2

私は、サイズが約 20k から 10MB に及ぶ長いテキストを使用しました。

この段階で、私は長いテキストが以前のすべての指標(カスタム品質、エントロピー、圧縮)において非常に高いスコアを示していることに気づきましたが、そこには大きな OCR アーティファクトの塊が含まれており、例えば:

--- マッチ #5/12310 (0fc6a6f36d5e1f02f9e5b000c480efe5005b6be5de6f819b9309b60b577fb242) ---

{

"source": "LOC",

"len": 385331,

"uniqChar": 64,

"tokens": 73087,

"sentences": 4555,

"entropy": 103.85,

"quality": 95.95,

"compress": 91.92,

"text": "M; \n\n\n\n1 ? 70 \n\n\nary. \n\n\nwtodrawn. timm \n\nM COLLEGE LIBRARY \n\n\nMARK \n\n\nY \n\n\n\\ \n\n\nJ \n\n\nREV. JAMES DAVIE S \n\n\nCOFI ANT \n\n\nY DIWEDDAR \n\n\nB ARC II. JAMES DAYIES, \n\n\nGan Y PARCH. G. GRIFFITHS, \nCINCINNATI, 0. \n\n\nUTICA, N. Y. \nT. J. GRIFFITHS, ARGRAFFYDD, EXCHANGE BUILDINGS. \n1875. \n\n\nI \nw \n\n\nC YN W YS I AD. \n\n\nAt y Darllenydd 4 \nRhaglith 5 — 11 \ncofiant 12 — 4q \nEnglynion Coffadwriaethol 49 \nPregethau 50—96 \nAmlinelliad o'i Brif Weddnodau 97 — 106 \nAdgofion Personol am Dano 107 114 \nAdgofion Brodyr Eraill am Dano 114— 133 \nYsgubau o Loffion Difyrus am Dano i34_ I4 g \nPenillion Coffadwriaethol 149—156 \nEnglish Department 157 ^3 \nCawellaid o Fan Saethau ei Fwa 174—187 \nPynciau Ysgol < . 188—222 \n\n\nAT Y DARLLENYDD. \n\n\nEr ys llawer o flynyddoedd cyn ei farwolaeth ceisiasai y Parch. James Davies gan ei hen gyfaill, Iorthryn Gwynedd, ysgrifenu ei gofi ant, os goroesai ef. Addawodd yntau wneyd; a chydnabyddid yn gyffredinol ddoethineb y dewisiad. Ond o herwydd anghydwelediad cydrhyngddo a'r perthynasau, parthed i ddull ei ddygiad allan, efe a ymwrthododd yn bendant a'r cyfrifoldeb. Teimlwn fod yn ddyledswydd arnom ddweyd cymaint a hyna mewn cyflawnder a'r brawd Thomas, er mwyn symud ymaith y dybiaeth mewn rhai manau, mai am na roddasid iddo fwy o arian at yr anturiaeth yr ymryddhaodd oddiwrth ei ymrwymiad. Wedi iddo ef nacau, disgynodd y gwaith arnom ni, trwy ddewisiad unol, a thaer ddymuniad y weddw a'i phlant. Yr oedd yn anhawdd genym gydsynio, o herwydd amledd a phwysigrwydd ein dyledswyddau i bobl ein gofal. Ond (i'w credyd cofnoder y ffaith), pan ddeallasant fod hyny yn peri i ni betruso, pasiasant yn unfrydol benderfyniad i ysgafnhau ein dyledswyddau iddynynt hwy tra yn parotoi y bywgraffiad, ac wedi y gorphenem, eu bod yn rhoddi i ni fis o orphwysiant. ... nnheilwng. Ymdrechwn fod yn gyfarwydd a nodau gwir Cristion. Nac ymorphwyswn ar farn dda a ddwg dynion am danom. Gymerwn y gair yn rheol ; ymarferwn ffydd ar aberth Iesu, a llefwn am oleuni a chymorth yr Ysbryd Glan at y gorchwyl. Gochelwn gymeryd ein tymer na'n teimladau yn rheol i holi ein hunain ; ond Beibl Duw fyddo ein prif faen prawf. Dyma reol y farn. \n\n\nY DIWEDD. \n\n\n"

}

--- マッチ #31/87899 (70fa969d373b988d5537a08ed47ccd6842c17bdcecb2cb55181e3cf37f3e13a1) ---

{

"source": "LOC",

"len": 330083,

"uniqChar": 64,

"tokens": 62805,

"sentences": 5311,

"entropy": 104.92,

"quality": 94.84,

"compress": 92.95,

"text": "\nQass_„L X724 ( \nBook _ \n\n\nCOFIANT, \n\n\nPREGETHAU, A BARDDONIAETH \n\n\nY DIWEDDAE \n\n\nPARCH. T. PIERCE, LIVERPOOL; \n\n\nPAKCH. H. E. THOMAS, \nBIEKENHEAD. \n\n\nLIVEKPOOLr AEGEAEEWYD GAN THOMAS LLOYD, \nTITHEEAKN STEEET. \n\n\nIBXtxgq \n\n\nIn Exchange \nThe Nat. Libr'y of Wales \nAug. 1928 \n\n\nAT Y DARLLENYDD, \n\n\nAmcenAIS wneyd y Cofiant nior fyr a cbryno ag y galhvn, er mwyn xhoi y Pregetliau a'r Farddoniaetb i mewn. Diau y buasai yn dda gan lawer ei gael yn gynt, ond nid oedd modd i mi "vraeyd, a bredwyf fod peth mantais Avedi ei gyraedd trwy yr oediad. Dylai esgeulustra Mr. Pieece yn cadw cofnodion o'i fywyd, fod yn rhybydd i'r rhai y byddai eu Cofiant o ddyddordeb ac addysg i'r byd. Dymunaf gydnabod yn y modd mnvyaf diolcbgar y lliaws Cyfeillion a roisant bob cymbortb i mi gasglu y defnyddiau, ac yr -wyf yn gadael ar y rbai oeddynt yn adnabod fy amvyl dad ynghyfraith oreu i fainu am gywirdeb y Cofiant. Bu llawer, ac rnae cryn nifer eto o'i Bregethau goreu ar wasgar, y rbai pe eu cesglid gyda'r gweddill Barddoniaetb, a alien t -vraeyd Ail Gyfiol wertbfawr. \n\nGwelir oddiwrth restr y Tanysgrifwyr am hvyddiant yr antur- naetb, ac y mae genyf addewid y gwertvir Uawer mewn ardaloedd na ddaetb dim emvau oddiyno. \n\nBydd yn rbwydd iawn i'r cyfarwydd diwygio yr ycbydig wallau argraffyddol sydd yn y Gyfrol. \n\nGan ddiolcb am bob cymbortb, a dymuno am bob llwydd a benditb, \n\nY gorpbwysaf, &c, \n\nH. E. THOMAS, \n50, Exmoeth Street, Birkenhead, \nMehefin 28ain, 1804. \n\n\nCYNHWYSIAD. \n\n\nCOFIANT, \n\n\nTUDAL. \nPen. I. Prif helyntion ei Fywyd Boreuol 5 \nPen. II. Ei Fywyd a'i lafur Gweinidogaethol . . . . 17 V. Esgeuluso cyd- gynnulliad \nPeeg. VI. Anfeidrol rinwedd aberth y Groes \n\n\n62 \n\n\ni)0 \n\n69 \n71 \n71 \n74 \n\n\nPeeg. VII. Galwad ar Sion i Ddeffroi \nPeeg. VIII. Y gwr ar y march gwyn \nPeeg. IX. Gogoniant a di- gonolrwydd trefn gras yn ngwyneb trueni dyn fel pechadur \nPeeg. X. Yr henbobl.. .. \nPeeg. XI. Gogoniant ac ar- dderchawgrwydd eglwys Dduw yn y dyddiau diweddaf . . \nPeeg. XII. Cysylltiad bywyd duwiol a manv dedwydd . . \n\n\n78 \n\n\n79 \n\n\n97 \n\n\nBAEDDON1AETH. \n\n\nMawrnad Dewi Wyn o Eifion 101 \nHaman a Mordecai . . . . 121 \nGalareb am y diweddar Barch. J. Breeze 137 \nMarwnadyParch.J. P.Davies 148 \nCywydd i'r Goleudy . . . . \nA WORLD LEADER IN PAPER PRESERVATION \n1 1 1 Thomson Park Drive \nCranberry Township, PA 16066 \n(724)779-2111 ' \n\n\n"

}

これらのサンプルは全体的に非常に高いスコアを持っていますが、実用性は皆無です。おそらく英語のテキストではないのでしょう。LOC-PD から数百例、その他の OTA データセットからも数百例ほど数え上げました。もし私がこのようなゴミを LLM に与えた場合、何が学習されるでしょうか?

私は周囲を検索し、辞書単語検索、単語内の母音の数、ノイズの総数といった追加指標を計算することを決めました。これらの新しい値を用いて、すべての値を単一のスコアに統合した結果、最も高品質なドキュメントのみを残すことができました。完璧ではないことは承知していますが、データセットを検索している限り、目にするデータにはかなり満足しています。

低品質なドキュメントは全体の 1% 未満であると計算され、これは短文テキストデータセットの結果と一致していました。

ちなみに、このデータセットのエントリをインポートし、照会し、カウントするためのすべてのコードはオープンソースです:https://github.com/croqaz/vintage-LLM/tree/main/dataset ;

計算資源がもっとあれば、あるいはより大きな LLM を訓練すれば、さらに多くのデータを利用できたでしょう。しかし、すでにこれだけで非常に時間がかかっていたため、私は自ら制限を設けることにしました。

このトレーニングは、フランスの RTX PRO 6000 WS で Vast.ai を再度使用し、10,150 ステップ(約 6B トークン)で実行しました。

以下に示すメトリクスにあるように、2 ラウンドのトレーニングを行いました。モデルチェックポイントのアップロード直後にインスタンスを起動した際、私のトークナイゼーションスクリプトが OOM(Out Of Memory:メモリ不足)によりクラッシュしてしまったためです。その問題を修正して再実行している間、GPU を稼働させ続けるために、古詩、名言、ことわざ、そしてオックスフォードのクリーンな書籍からなるサブデータセットを素早くトークナイズしました(これらはすべて同一期間内のものです)。2 回目のトレーニングは、上記で言及したランダム化された長文ドキュメントのみを対象としたものでした。

このステージのコストは 40 ドルでした。

このステージのメトリクス:

image
image

Chinchilla スケーリング法則によると、3+6=9B トークンが、この 340M パラメータモデルに対する適切なトレーニングトークンの量とされています。

Fine-tuning(ファインチューニング)

私がこの記事を書いている時点では、このステージはまだ完了していません。準備ができ次第、別の投稿を作成する予定です。

モデルに対話の理解能力を持たせるために、"base knowledge"(基礎知識)データセットを生成するための一連の Python スクリプトを作成しました。これはファインチューニングの対象となるものです。食品、果物、野菜、いくつかの動物や鳥、色、少数の数に関する基本的な質問と回答が含まれています。

異なる微調整を数回行ったファインチューニングの結果、安定した対話を生成できるようになりました。数百例という少ないデータでさえも、"Question:..." に続く "Answer:..." という構造を学習していることを確認できたのは嬉しかったです。

現時点でのいくつかのサンプル。最終モデルに、私の CommonSense データセット を用いた軽いファインチューニングを施したものです。

ユーザー:神とは何ですか?

LLM #1: 神は絶対的な支配者であり、我々が希望と強さを得るのは彼のみである。

LLM #2: 神のような性格を持つ存在とは、自分が至高の存在であることを自覚し、それによってのみ我々が行動できる存在のことだ。

LLM #3: 太陽は地球に光を照らし、星々はその光を反射する。

ユーザー:愛とは何ですか?

LLM #1: 愛は強力な衝動であり、それが我々の傾向を克服することを可能にする。

LLM #2: 愛は、人間のある特定の条件の結果である。例えば、「あなたを愛するのは、彼があなたを愛しているから」というような場合だ。

LLM #3: 愛とは快楽を与えることへの欲求であり、行動の対象は、特定の人物や物に対する情熱や愛情の充足である。

ユーザー:人生とは何ですか?

LLM #1: 人生は苦痛との戦いであり、生きる時間が長くなるほど、我々はより多く苦しむ。

LLM #2: 人生は生存のための大きな闘争であり、その中で各人は自らの個人的な快楽を犠牲にし、他者の最善の利益を追求しなければならない。

LLM #3: 人生とは人生そのものであり、その帰結は魂にとって、心臓が心臓であるようなものである。

いくつかの挨拶を試してみる

ユーザー:お元気ですか?

LLM #1: それらの抵抗を克服するためには、熱、火、そして冷たさが必要とされる。

LLM #2: 我々は天文学に関する最良の書籍を使用する。

LLM #2: お天気は魅力的です。

ユーザー:ご挨拶を申し上げます、良い方よ!

LLM #1:最善のことは、あなたが完了したときです。

LLM #2:喜んで!名誉をありがとうございます。私はそれを書くことを考えていました。

LLM #2:いいえ;彼らの思考が嫌いです。それは私の心ではなく、私の記憶からのものです。

いくつかの名前を尋ねる

ユーザー:あなたの名前は?

LLM #1: シャルル・エミール・ド・サン=ヴァレリー。

LLM #2: ニネット。私は古代のクラスに属します。

LLM #3: シャルル・リチャーズ。

LLM #4: チャールズ・バムフォード、「十九世紀」出身。

LLM #5: 私の母は奴隷、父も奴隷でした。

すべてのサンプルは私の「generate.py」スクリプトで生成されました。*temperature=1.0, top-p=0.9, top-k=25, min-p=0.01, repetition-penalty=1.1*。

このモデルはハルシネーション(幻覚)が多く、会話を本当に追従しません。まだチャットすることはできず、より多くの「ベイク」(学習・調整)が必要です。

すべての対話は宝くじのようなものです:コインを投入し、レバーを引き、最善を祈るのです。時には素敵な結果が得られることもあります。

神、愛、人生に関する質問に対してモデルがこれほどよく回答したことは素晴らしい驚きでした。特に私の「ベース知識」データセットにそれらの概念が含まれていないにもかかわらず、モデルは長期の基礎トレーニングからそれを吸収し、チャットテンプレートを適用する方法を学習しました。

モデルは数学を記憶できるか?

私のファインチューニングに関する知識ファイルには、深く考えずに適当に追加した単純な数学演算が含まれていましたが、トレーニングの異なる段階でさまざまなプロンプトを使ってモデルの振る舞いをチェックしている際、「1 + 1 はいくつですか?」と尋ねてみたところ、答えは通常、ランダムな数値か全く意味をなさないものでした。

そこで私は、モデルが -2 から 12 のような範囲の数に対する基本的な数学演算を記憶できるかどうかを確認したくなりました。

私は、-2 から 12 のすべての数に対する基本的な演算(+、-、/、*)を含む 5300 問の数学データセットを生成しました。質問の仕方も様々で、例えば以下の通りです:

  • "What is 10 - 3?"
  • "How much is 7 * 10?"
  • "Multiply 9 by 2."
  • "Calculate -2 * 6."

また、すべての可能な演算と数値の組み合わせ(0 から 12)に対して「X と Y を計算してください」と問いかける数学ベンチマークも作成しました(負の数値は除外しています)。

ファインチューニングは完全なトレーニングに比べて非常に高速なので、多くの実験を行い、数分以内に結果を確認することができました。

ベースモデルからいくつかのモデルをファインチューニングし、さまざまなハイパーパラメータを試したところ、LR=5e-5、max_seq_length=2048、neftune_noise_alpha=0.0(このケースでは非常に重要)、そしてもちろん temperature=0 で最高の結果が得られました。

最高スコア:

[ + ] addition: 75/169 (44.4%)

y│ 0 1 2 3 4 5 6 7 8 9 10 11 12

──┼────────────────────────────────────────────────────

0 │ ✗ ✗ ✓ ✗ ✗ ✓ ✗ ✗ ✗ ✗ ✓ ✗ ✓

1 │ ✓ ✗ ✓ ✓ ✓ ✗ ✗ ✗ ✓ ✗ ✗ ✓ ✓

2 │ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ✓ ✗

3 │ ✗ ✗ ✓ ✓ ✗ ✗ ✓ ✓ ✗ ✓ ✗ ✓ ✓

4 │ ✗ ✗ ✗ ✗ ✓ ✓ ✓ ✓ ✗ ✗ ✗ ✓ ✓

5 │ ✓ ✗ ✗ ✗ ✗ ✓ ✗ ✓ ✗ ✗ ✗ ✓ ✓

6 │ ✓ ✗ ✗ ✓ ✓ ✗ ✓ ✓ ✓ ✗ ✗ ✓ ✓

7 │ ✓ ✗ ✗ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓

8 │ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ✗ ✗ ✓ ✗

9 │ ✗ ✗ ✗ ✓ ✗ ✓ ✗ ✓ ✗ ✓ ✗ ✗ ✓

10 │ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ✗ ✗ ✓ ✓ ✗ ✓

11 │ ✗ ✗ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓

12 │ ✗ ✗ ✓ ✓ ✗ ✓ ✗ ✓ ✗ ✗ ✗ ✓ ✗

[ - ] 引き算:114/169 (67.5%)

y│ 0 1 2 3 4 5 6 7 8 9 10 11 12

──┼────────────────────────────────────────────────────

0 │ ✗ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓

1 │ ✓ ✗ ✗ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✗ ✓ ✓

2 │ ✗ ✓ ✗ ✓ ✓ ✗ ✓ ✓ ✗ ✓ ✓ ✓ ✓

3 │ ✗ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✗ ✓ ✓ ✓ ✗

4 │ ✗ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✗ ✓ ✗ ✓ ✗

5 │ ✓ ✓ ✗ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✗ ✗ ✓

6 │ ✗ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✗ ✓ ✓

7 │ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✗

8 │ ✓ ✓ ✗ ✓ ✓ ✗ ✓ ✓ ✗ ✓ ✗ ✗ ✓

9 │ ✗ ✓ ✗ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✗ ✗ ✓

10 │ ✗ ✓ ✗ ✓ ✗ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓

11 │ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✗ ✗

12 │ ✗ ✓ ✗ ✓ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ✓ ✗

[ * ] 乗算:118/169 (69.8%)

y│ 0 1 2 3 4 5 6 7 8 9 10 11 12

──┼────────────────────────────────────────────────────

0 │ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✗ ✓ ✗ ✓ ✓

1 │ ✗ ✓ ✗ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✗

2 │ ✓ ✓ ✓ ✗ ✗ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓

3 │ ✓ ✗ ✓ ✓ ✗ ✗ ✓ ✓ ✓ ✓ ✓ ✗ ✗

4 │ ✓ ✓ ✓ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ✓ ✓ ✓

5 │ ✓ ✓ ✓ ✗ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓

6 │ ✓ ✓ ✓ ✗ ✓ ✗ ✓ ✓ ✓ ✓ ✗ ✓ ✗

7 │ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✗

8 │ ✓ ✓ ✗ ✓ ✗ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✗

9 │ ✗ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✗ ✗ ✗

10 │ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✗ ✓ ✗ ✗ ✓

11 │ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓

12 │ ✗ ✗ ✓ ✓ ✗ ✗ ✗ ✓ ✓ ✓ ✗ ✓ ✗

[ / ] 除算:85/156 (54.5%)

y│ 0 1 2 3 4 5 6 7 8 9 10 11 12

──┼────────────────────────────────────────────────────

0 │ · ✓ ✓ ✓ ✗ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓

1 │ · ✗ ✗ ✓ ✓ ✗ ✗ ✓ ✓ ✓ ✗ ✓ ✗

2 │ · ✓ ✓ ✗ ✓ ✗ ✗ ✓ ✗ ✓ ✓ ✓ ✓

3 │ · ✗ ✗ ✗ ✗ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓

4 │ · ✓ ✗ ✗ ✓ ✓ ✓ ✗ ✗ ✗ ✓ ✗ ✗

5 │ · ✓ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ✓ ✓ ✓

6 │ · ✗ ✓ ✗ ✓ ✓ ✗ ✓ ✗ ✗ ✓ ✗ ✗

7 │ · ✗ ✗ ✓ ✓ ✗ ✓ ✗ ✓ ✓ ✓ ✓ ✗

8 │ · ✗ ✓ ✓ ✓ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗

9 │ · ✓ ✓ ✓ ✗ ✗ ✗ ✓ ✗ ✗ ✗ ✗ ✓

10 │ · ✓ ✗ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✗ ✓ ✗

11 │ · ✓ ✓ ✓ ✗ ✗ ✓ ✓ ✗ ✓ ✓ ✗ ✓

12 │ · ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✓ ✓ ✓ ✗

要約

+ 加算 75/169 (44.4%) ████████

  • 減算 114/169 (67.5%) █████████████
  • 乗算 118/169 (69.8%) █████████████

/ 除算 85/156 (54.5%) ██████████


合計 392/663 (59.1%)

モデルが減算の方が加算よりも一貫して高いパフォーマンスを示すことに驚いています。なぜなら、減算の定式化は少し複雑だからです。例えば「3 から 2 を引く」と「3 - 2 を引く」では、数字の順序が逆転しています。私は人間のようにモデルが加算で最も良い結果を出すだろうと予想しましたが、実際には加算が最悪のスコアでした…

ともかく、60% よりも高いスコアは得られなかったので、このモデルは基本的な数学を記憶できないと考えています。

間違っていたら教えてください!コメントを残して、私が何を見落としているか教えてくださいね!

もちろん、1 + 1 を正しく答える確率が半分しかない 650MB の脳をダウンロードさせるために、これを HuggingFace にアップロードすることはありません…計算機を使いましょうね?

トレーニング中のバイブチェック

トレーニングの異なるステップでモデルを操作し、何を生成するかを確認します。

興味深いことに、トレーニングの初期段階では、モデルは単語の順序、つまりどの単語が次に続くべきかを学習しています。その後、文のようなより大きなシーケンス内の単語を学習し始めます。さらに進むと、2〜3 文をつなげる方法を学びます。これを継続して訓練すれば、長い段落を構築する方法も学ぶようになりますが、それには時間がかかります…

ステップ 200

モデルはまだ主にランダムノイズです。

--- プロンプト 1 ---

ユーザー:こんにちは!

モデル:

こんにちは!ltO,til,le

cansia

the tst. .

m'

o. the i6n

a 1

M. B. C. C. PI

.h.,

The

Fn.l

i.

n.

L

--- プロンプト 2 ---

ユーザー:あなたは誰ですか?

モデル:

あなたは誰ですか?田舎の男です。埋められるために生まれたのです。私たちは今日のこの機会にいます。投票数はサウスカロライナ州のワール郡から銀行に引き渡されました。そこで彼らはすべてを占領しました。手続きはこの大きな塊から生産することを許可されました。これは不必要なことの1つであり、会社側から質問が続きました。

--- プロンプト 3 ---

ユーザー:こんにちは、友人よ

モデル:

こんにちは、私の友人。彼女の「マ・テスル」の友人として。彼の人生と名誉における他のすべての国において、彼は世界でこれまで行われたようなことに対して、一瞬以上を費やすことになるでしょう。

この国がその状態にあることを期待することは不可能です…

--- プロンプト 4 ---

ユーザー:ここはどこですか?

モデル:

ここはどこですか?

州にとって最初かつ最も重要であり、その意見では、私たちにとって非常に価値あるものです。ロシアの立法府は以下の通りでした:—「アイルランドのH. M'ニード氏(S. H. 氏)の議会は、早期の資金に関する期間に参照されました。

ステップ1000

モデルは単語同士を結びつけることを学びます。

--- プロンプト 1 ---

ユーザー:こんにちは!

モデル:

こんにちは!CIR. および HI, RAJUy

事業が破壊されました。

J. R. フラー氏および、A. & J. マクリーン氏とJ. E. ハバード氏、MIR G. P. ラルトン氏、E. + D. デクスター社のG. W. ハリス氏、および同社のJ. A. ブラウン氏によって。

--- プロンプト 2 ---

ユーザー:あなたは誰ですか?

モデル:

あなたは誰ですか?— しかし神には、同じようになりたいと願う子供がおられ、彼は非常に優れた方です。それは淑女や士官にとっての作法の飾りとなってきました。私はいつも、著者が私に宛てて書いているとは観察していませんでした。— 私はあなたの良き友人であり見知らぬ者ではありませんが、もし私が見知らぬ者にならないのであれば、彼の人生を喜んで拝見するでしょう。見知らぬ者として信じていますと、それは若く美しい女性、つまり見知らぬ女性に話しかける私の務めとなるでしょう。

--- プロンプト 3 ---

ユーザー:こんにちは、友人よ

モデル:

こんにちは、友人よ、しかし古くからの知人としての道程において。— ご主人がご自身のこの高貴な家系の産物であるかのように思われるほどに、私に対するご恩恵の数々があるのはむしろ驚くべきことです。— しかしこれは私が想像できることのすべてではありません。なぜなら、この種の偉大な対象は、私が言及した宗教的機関の利益を確保するためのものであるように思えるからです。— ご自身の個人的な功績と彼の忠誠心との唯一の違いです。

--- プロンプト 4 ---

ユーザー:ここはどこですか?

モデル:

ここはどこですか?

彼はそのような出来事の危険はないと言いました。

原告、すなわち被告は非常に立派な人物であり、バレット・アンド・カンパニーという会社で三年間勤務した経験があります。その報酬は、1830 年に彼が居住していた彼の財産の総価値に対して 50 パーセントでした。彼は長年以前から銀行の業務に関する帳簿を管理しており、それは明らかになりました

ステップ 10,000(ステージ 1 の終了)

このモデルは、現時点で私の CommonSense dataset を用いて非常に軽いファインチューニングを行ったため、クリーンなテキストを生成します。

--- プロンプト 1 ---

ユーザー:こんにちは!

モデル:

こんにちは!素晴らしいアイデアですね!これは足が何本ありますか?これはある種の動物です;それが獣です。ああ、あれは何ですか?あれは何ですか?馬には尻尾がありません。しかしそれは野獣であり、恐らく私はその中に尻尾を見つけることができないでしょう。馬には尻尾がなく、それを食べてしまうのです。そしてどうなっているのでしょうか?ああ、それを食べるのにどれくらいかかるのでしょうか?ああ、彼らはどれほど食べるのでしょうか?そして馬は

--- プロンプト 2 ---

ユーザー:あなたは誰ですか?

モデル:

あなたは誰ですか?

では、男と妻の違いとは何でしょうか?

--- プロンプト 3 ---

ユーザー:こんにちは、友人よ

モデル:

こんにちは、友人よ。この友人はここ数日、街を歩き回っている習慣があるようです。彼は安価な商品を購入できる場所を探すために、あらゆる方向に往復して歩きました。これはご存知の通り真実ではありませんが、どうやらあなたは卸売価格でいくつかの商品を購入できる場所について考えているようですね。これは奇妙な商売の方法であり、男は安く買うことで商品を安く作れるとよく言われます。

--- プロンプト 4 ---

ユーザー:ここはどこですか?

モデル:

ここはどんな場所ですか?それが見えますか?見えますか?私はそれを見ました。それが見えますか?それは果実を結ぶ木であり、その木には果実があります。それが見えますか?地面に立っている木はありますか?同じ種類の他の木はありますか?それらが見えますか?それらが見えますか?それらが見えますか?それらが見えますか?それらはより一般的ですか?それらが見えますか?あれは何ですか?それらが見えますか?

ステップ 20,000(ステージ 2 の終了)

この段階ではテキストは半ばランダムですが、一貫性があります。このテキストの塊全体が同じ本からのもののように見え、それは素晴らしいことです。

ファインチューニングなし。

--- プロンプト 1 ---

ユーザー:こんにちは!

モデル:

「こんにちは!」とダイヤー氏が叫びました。「その男は愚かな連中です。何か役に立たねばなりません。」

「しかし、そうとは考えません、先生」と弁護士は答えました、「私の本の一つで物語をお話ししましょう。老紳士のケースはこうです——彼は見知らぬ国に住んでいました。妻が亡くなり、息子が彼を引き取りました。彼は

--- プロンプト 2 ---

ユーザー:あなたは誰ですか?

モデル:

「あなたは誰ですか?」

探偵はテーブルのそばに立ち、背中をドアに向けていました。

「その騒ぎを起こしに行くのですか?」と彼は言いました。

「はい」と彼は答えました。

「そしてそれを片付けに行きますか?」

「いいえ」

「では、それについては後で考えましょう。」

--- プロンプト 3 ---

ユーザー:こんにちは、友人よ

Model:

こんにちは、友人よ。私は誠実な男の助言を君に与えよう。

「上記は文字通りの訳である。疑う余地はないが、読者自身がこれを読んだことがあるかどうかはわからない。」

P.S. — ちょうど田舎から戻ってきたところだ。残念だが、誰かの家よりも、むしろ自分の家で過ごしたいと思う。もし私が君に思い出していただければ、それは君にとって

--- プロンプト 4 ---

ユーザー:ここはどこですか?

Model:

ここはどこですか?

悪魔そのものが悪魔である!

心の声。53

心の声。

生まれてこなければよかったと願う!

私の罪の物語を決して語るまい!

決して語らない!

しかし、ああ!言葉は苦痛に満ちており、

まるでより明確になったかのように響く:

次のステップ

まだ優れたインストラクションモデルを持っていませんし、未完成なものを共有するつもりもありませんが、取り組んでいるデータセットはいくらでもあります。

  • 私の CommonSense データセットは拡大しており、約 7,000 行を準備済みで、さらに追加するアイデアもあります。
  • アリストテレス、フロイト、プラトンなどの哲学者からの引用リストを持っており、これらを Q&A ペアとして整えていきます。
  • 1900 年以前のいくつかの書籍から、明確な質問と回答を抽出しました。例:

The new common school question book 1888(新普通学校問題集 1888)

  • The advanced question book 1883(上級問題集 1883)
  • A complete dictionary of synonyms and antonyms 1835(同義語・対義語完全辞典 1835)など。
  • これらすべてを処理したわけではありませんが、別々のデータセットとして公開する予定です。
  • 古い辞書も持っており、そこから単語の定義を抽出し、より多くの Q&A 形式に変換する計画です。
  • King James 訳聖書から異なるトピックを抽出して、より多くの Q&A ペアを作成したいと考えています。
  • また、Talkie-13B-Q8-GGUF と Monad-GPT-Q8-GGUF も手元にあります。これらを使っていくつかの合成データセットを生成できるはずです。

これらのデータセット、あるいは少なくともその一部は、モデルが対話構造を理解する助けになるでしょう。実験してみます。

十分に共有できるモデルができたら、また別の投稿を書きます。

終わり

このプロジェクトを開始した際、私はあえて「成功」の定義を設けませんでした。明確な目標を持って始めたわけではありません。まず第一に、これは学習プロジェクトでした。

私が目指していたのは、ある程度実用的なビクトリア朝時代の対話文が得られることだけでした。

しかし、これほど多くの時間とエネルギーを費やしたにもかかわらず、ファインチューニングを行わない状態ではその出来があまりにも悪いことに驚きました。そのため、今後はすべての創造的なエネルギーを注ぎ込み、共有できるだけの質の高い何かを生み出すことに集中したいと考えています。

みなさんはどう思われますか?

このような取り組みに興味をお持ちですか?

この種の LLM を何に活用したいとお考えでしょうか?

「ヴィンテージ LLM」という文脈において、私になら何を試してほしいと思いますか?

ご連絡をご希望の場合は、以下のいくつかの方法があります。

  • ここにコメントを残してください;
  • Hugging Face のディスカッションページにコメントを残してください:https://huggingface.co/croqaz/vintage-LLM-340m-v1-base/discussions;
  • Vintage-LLM リポジトリにイシューを提起してください:https://github.com/croqaz/vintage-LLM/issues;
  • Vintage-LLM の Discord サーバーに参加してメッセージを送ってください。

プライベートでお問い合わせしたい場合は、私のメールは *my short name* at *this domain* です。

クラウド GPU プロバイダーの方で、使用されていない GPU をお持ちで、次のモデルのトレーニングをスポンサーしていただける方は、ぜひご連絡ください!すべての計算リソースを、より良いデータセットを持つ 1B モデルのトレーニングに充てるか、この 340M モデルのベーストレーニングを最大 50,000 ステップまで延長するか、どちらでもお選びいただけます!私は十分なデータを持っていますので、ご選択ください!

これらの LLM(大規模言語モデル)についてさらに詳しく知りたい場合は、私の以前の投稿 Vintage LLM models をご覧ください。多くのリンクが掲載されています。

AI や LLM に興味や期待を抱いている方は、私が行ったように実際に試して、トレーニングの各段階の間にも遊んでみて、その裏側を垣間見てみることをお勧めします。AGI(人工一般知能)についてはすぐに忘れ去ることになるでしょうが、間違いなく楽しいものです。約束します!

もしかすると、誰も見たことのないプロセスのひねり、つまり独自のデータセットやトレーニング手法、あるいは LLM アーキテクチャを見つけられるかもしれません。しかし、必ずしもそうする必要はありません。いずれにせよ新しいことを学べるはずです。私もそうでしたから!

注:このブログ記事は 100% 私によって書かれました。AI は一切使用されていません。

@articles

#ai

#vintage

原文を表示

2026 May 25, Mon

50 min

In this blog post, I will share the adventures I had creating my own LLM, from (almost) scratch, trained only on old texts.**I made my own base-training and fine-tuning scripts, data processing pipelines and custom datasets.

("almost from scratch" means I did use existing programming languages and libraries, I didn't write in Assembly, just like anyone else who builds an AI "from scratch"...)

The model can be found on HuggingFace: https://huggingface.co/croqaz/vintage-LLM-340m-v1-base ;

All the code is open source at: https://github.com/croqaz/vintage-LLM ;

If you want to check bigger Vintage models, see my previous post: Vintage LLM models.

The idea

Three months ago at the end of February I discovered a few Reddit posts by Hayk Grigorian, where he described creating his temporal gated language model. I was absolutely fascinated.

Training an LLM only on 1800s London texts, 90GB dataset:

https://reddit.com/r/LocalLLaMA/comments/1pkpsee/training_an_llm_only_on_1800s_london_texts_90gb

LLM trained from scratch on only 1800s London texts brings up a real protest from 1834:

https://reddit.com/r/LocalLLaMA/comments/1mvnmjo/my_llm_trained_from_scratch_on_only_1800s_london

Obviously I read other posts from other people that made their own LLMs, but maybe I wasn't ready to do it myself, or the model they were working on wasn't that interesting. Anyway, the thought of having my own Victorian chat bot... fuckin' epic !!

Since then, I worked on my own "Vintage LLM" every single day. Without exceptions. Even when I was sick.

In the meantime, a lot more historic LLMs have been released like: Violet-1B4-Chat, Mr. Chatterbox, GPT-1900, Talkie and TypewriterLM-base.

What, why, where and how?

What?****This is a time-locked LLM/ historical LLM, English only, and its knowledge cutoff is year 1900.

(Limiting to a specific year is error prone, but I did my best effort).

It is based on Llama architecture and has 340M (0.3B) params.

Why?****Because I can only learn if I do it myself and it's a super fun project.

Where and how?****I made my own dataset, my own processing and training code.

The code is semi-vibe-coded with whatever LLM I had with VS-Code and PI (OpenRouter models).

I checked and validated every single function and I deeply understand what every single code file is doing.

The dataset processing took the most and I tried all sorts of things that didn't work, and I wasted a ton of time. Complicated solutions are the worst...

I processed all the data on my own PC and I trained smaller versions of the LLM on my PC (*Cachy OS Linux, AMD Ryzen 7 9700X CPU, 64GB RAM, Radeon RX 9070 16GB VRAM*).

As for the larger 340M model, I trained it on RunPod, ThunderCompute and Vast.ai. It would have taken forever on my PC.

The total cost of this project was: ~$80, GPU costs only.

That's because I have a decent PC to process the data. If I had more RAM, I could have processed some of the data much faster, especially when it comes to de-duplicating texts in memory.

Disclaimer: This is a toy/ hobby LLM (but I treat it very seriously).It will hallucinate and generate historic semi-accurate content which, at the time was considered normal but by today's standards is considered: toxic, offensive and unsafe. This is expected, because I didn't do any alignment. Aligning (or censoring) the model requires significant effort and it would ruin the historic accuracy.

Also, I can't guarantee that my model is strictly limited to the year 1900 (even if I did my best) eg: as to perform the "Albert Einstein test".

The plan

I use AI everyday at work and I understand how it works, but I never built an LLM myself. I ran specific AI training and fine-tuning pipelines at work, I built tiny neural networks in C and Python in the past, but when I started this project I didn't know how people are usually building LLMs.

I searched for a week and I chatted with multiple bots to get different points of view (like I always do when I research a topic).

In short, to build an LLM you need 4 things:

  • the data -- an LLM has no discernment or understanding. It will learn from anything you tell it to, good or bad. This is the longest process.
  • tokenization -- the Tokenizer is a little program that converts words or letters into numbers (tokens). LLMs don't understand words, they only understand numbers.
  • pre-training -- it's a confusing expression and it means "base-training", where the LLM learns to autocomplete text. If you're going for a 300m+ params, this is the most expensive process.
  • fine-tuning -- where the LLM learns how to chat in turns, question & answer.

Well, there's a bit more to it than these simple steps, but I won't go super deep in this article.

Now, let's look at each step in more detail.

Initial experiments

It's worth mentioning that I made lots of mistakes and I experimented with some datasets and model architectures before I settled on the "big" model.

("big" in quotes here, because you know, compared to larger models like Talkie-13B or TypewriterLM-7.24B, my model is just a toy)

Some details about my v2 toy EleutherAI/pythia-14m that I trained on my own PC:

https://github.com/croqaz/vintage-LLM/tree/e272b94fcf96316f874babbed549d20809fe5a39/models/m-v2

If you look at the validation loss and perplexity SVG files, you'll see huge jumps, because I didn't randomize the file chunks and the dataset files were tokenized in alphabetic order, and it happened that the clean book files were first and as soon as the model started to get exposed to the Time-Capsule dataset, it gradually become worse and worse because that dataset was bad with lots of weird OCR artefacts, broken words & sentences and so on.

Mistakes were made ... but I learned from them.

I was stuck for a while, until I started to filter out the bad documents.

Data

The data processing was the longest and most boring process by far, and I hope you understand why...

There are plenty of modern, high quality datasets with data scraped from the internet, but I didn't want my LLM to learn about computers, atomic bombs and space-ships, so I had no choice but to make my own.

Luckily there are some datasets available, but they are pretty bad quality and most of my work was to de-duplicate, filter the really bad texts and enhance some of the existing texts.

The historic datasets are quite limited, the old books are all we have unless we discover more old books and someone scans them, so we have to use what we have.

A few datasets worth mentioning are: Project Gutenberg, Oxford Text Archive, Internet Archive books, TheBritishLibrary/blbooks, storytracer/LoC-PD-Books, dell-research-harvard/AmericanStories, dell-research-harvard/NewsWire, Heritage Made Digital Newspapers (HMD).

I did my best to find out the year and language of each dataset, so I can limit everything to English before year 1900.

I completely ignored documents that don't specify a year, or I can't find date in the texts, even if they had good quality, just to be safe.

As a side-project, I created the Book-Metadata HF dataset with lots of old books, title, author, book ID and source: https://huggingface.co/datasets/croqaz/book-metadata ; My goal was find out the year of all Gutenberg books, but I only found 5300 books where I'm 100% sure of the year.

Again, this took absolutely forever and as I am writing this blog post, I'm still not completely finished.

If I'll ever train another LLM, I'll have more and better data next time.

Initially I wanted several de-duplication methods, including MinHash and embeddings vector similarity. If you don't know what it means, don't worry, I won't go into details. It was way too slow and expensive and I had to abandon it. Just to give you a taste of how slow this was, I had a beefy DEV server calculate embeddings for my short text datasets and I did 10% of the dataset in a week with the server running day & night. The server had a RTX 3090 GPU that I shared and so on.

In the end, I de-duplicated based on the normalized text (lower-case text with all spacing removed). Basically the text "hello world" is identical to the text " Hello World " (notice the spaces and title case), and the text is only saved once in my dataset.

From the start, I knew that the data is the most important: garbage in -> garbage out. I did lots and lots of experiments and iterations, I played with DBs like Qdrant, Zvec, Lance, ValKey, and LevelDB for storing the datasets.

I dropped Qdrant because the DB disk size was huge even before I started adding many entries.

I dropped Zvec because I had no way to cycle the DB entries, basically once you save them, there's no way to explore the DB. I created an issue for this. Zvec is also super new and I should probably give it more time to mature.

I dropped Lance because of the versioning, the DB becomes slower and slower once you start adding more than a few million entries. This could be my fault, I'm sure I can find out a way to do this better.

I dropped ValKey because I ran out of memory, after injesting something like 10 mil records, the server started to OOM crash on my PC, but I still had to injest way more data. Other than that, ValKey was really great.

I ended up using LevelDB (which was used by local wallet apps to store BitCoin and Ethereum transactions), so I know it can scale on my PC. I injested 12 mil rows without any issues and with minimal CPU or RAM usage. LevelDB can be slow at times, but it's consistently reliable.

If I had a better PC, or a super computer, I would probably have used ValKey all the way.

To get a sense of the quality of the texts, I was first looking at the length and unique characters of each document. For the first stage I decided to use short texts (up to 32k long) and for the second, long texts up to 10MB. English shouldn't use more than 30-50 symbols normally; if a chunk of text has 100 or more unique symbols, it's not English, so I discarded those. And if a text has only 8 unique symbols, it doesn't make any sense, so I removed those too.

I applied 3 more filters.

Super easy metric, the compression ratio of ZLIB. Text that is too short and diverse will have a big value and text that is super repeated will be really small value.

code
# ZLIB compression ratio
# A good window is 0.5...0.7;
def compression_ratio(text) -> float:
    raw = text.encode("utf-8")
    compressed = zlib.compress(raw)
    return len(compressed) / len(raw)

compression_ratio("Lorem ipsum dolor sit amet")
# 1.3
compression_ratio("other, and other and other" * 100)
# 0.01 -- very repeated
compression_ratio("The President has nominated Thomas Johnson, William Cranch, and Charles\nSimms, Judges of the district of Columbia.\n\nOn Saturday last, Thomas Jefferson, at\npresent Vice President of the United States,\nand President of the Senate, took leave of\nthat body on which occasion he delivered\nthe following address:\n\nGentlemen of the Senate,\n\nTo give the usual opportunity")
# 0.64 -- Regular text

Also the Shannon entropy:

code
# Shannon Entropy
# The estimated entropy rate for printed English is approximately 4.2...5.5;
def char_entropy(text) -> float:
    counts = Counter(text)
    total = len(text)
    entropy = 0.0
    for count in counts.values():
        p = count / total
        entropy -= p * log2(p)
    return entropy

char_entropy(("a " * 10 + "!"))
# 1.22 -- Too low
char_entropy("Lorem ipsum dolor sit amet")
# 3.6 -- A bit low
char_entropy("IN the High court of Chancery for the Rich\nmond District,\nBetween\nHenry Banks plaintiff,\nAnd\nNathaniel Anderson, Robert Pollard.")
# 4.5 -- Regular english
char_entropy(''.join(chr(i) for i in range(200)))
# 7.6 -- Super high entropy

And my own quality detection filter. This helped me identify very bad OCR texts, with lots of weird symbols:

code
_LETTER_RE = re.compile(r'[a-zα-ωàâäçèéêëîïôöùûüüÿæœß]$', re.I)
_DIGIT_SPACE_RE = re.compile(r'[0-9 \n]$')
_PUNCT_RE = re.compile(r'[.,;!?\'"_\-]$')

# Cro's custom quality score
# Regular letters get a score of 2;
# Digits and spaces get a score of 1;
# Punctuation gets 0.5;
# Any other characters get -0.5.
def quality_score(text: str) -> float:
    score = 0.0
    for c in text:
        if _LETTER_RE.match(c):
            score += 2
        elif _DIGIT_SPACE_RE.match(c):
            score += 1
        elif _PUNCT_RE.match(c):
            score += 0.5
        else:
            score -= 0.5
    return ((score / len(text)) - 0.75) * 100

quality_score("-.•-, , _ ._. , •\n1.\n- ,\n.... - • 4\n-------._\n..77/:',. .., ..., : •\n':'#)).,-'' 1 -\n__LI -......-_-.A..-...',... ) •\nSilli° , A AilitA4‘\n' •:.:-',73 ..-.-..-_-_,N>\n4. .41t.")
# -8.72
quality_score("Lorem ipsum dolor sit amet")
# 109.61

I after calculating these metrics, I simply removed the documents with low quality.

The percent of removed documents was less than 1%.

All of these experiments took forever, and the limiting factor was always the compute. There's a few more datasets that I could process (eg: Institutional Books 1.0, massive 947GB dataset, 983K books, 386M pages, etc) but I don't want to kill my PC, and I already have plenty of data for my tiny LLM.

You can find my dataset on HuggingFace: https://huggingface.co/datasets/croqaz/vintage-v1 ;

Tokenization

I had to make my own tokenizer, because my model will never need a vocabulary like "async function", "import sys", "public class Main", or any other programming language terms.

And this is an English only LLM, so I don't want it to pickup expressions from other languages.

If I had used an existing tokenizer, all of those useless words would have been wasted in the vocabulary.

I trained my tokenizer on English Gutenberg and Oxford books, because they are very clean.

Base-training stage-1

Once I had a basic dataset, I quickly created a super basic Pythia-14M params model (that's 0.01B params), using litGPT framework. It was pretty straightforward and painless initially.

I had to do some tricks to make it work on my PC, because I have a Radeon GPU and most of the AI training scripts just assume you have an NVIDIA GPU...

In just one hour, I had a tiny LLM that was generating semi-random English-sounding gibberish, eg:

code
He presented them with one of the soul, which was made in the same manner ;
I have also been at this moment's, and that it was not that this month should be allowed to
be without a short time. It was not yet a word for the sake of the man who was known that he
was in the case of the law that he was going herein, which was made to it, and be a thing
to be understood, that the word must be ...

It was a wild and strange desire, and has, on his head, and the only farm, or the black sky,
he was in the midst of the face of the night.
But his first illness was a great, and the heart he was a man who had his hands,
for he was a very much gotten, and he was very weak.
His mouth were, but was in his hand.
He was a man of great honour, and there was one of ...

After playing with it a bit more, I tried to train a bigger Pythia-70M and litGPT started to crash randomly with errors like:

code
ERROR: Unexpected segmentation fault encountered in worker.
raise RuntimeError(
  f"DataLoader worker (pid(s) {pids_str}) exited unexpectedly"
) from e

I had the exact same tokenizer and dataset for Pythia-14M and I tried a Pythia-31M and Pythia-160M, but the 70M just didn't work. I tried debugging this for a while without success, I wasted a lot of time and in the end I decided to make my own training script, loosely inspired from litGPT and nanoChat.

I discoverd that HuggingFace transformers library has a Trainer class and I did some vibe-coding to create something basic.

I downloaded the source code for nano-GPT, nano-Chat, NanoWhale-100m, and a few more repos with code "from scratch", and I got different LLMs to extract the technical details of how they do the base-training, then I asked the LLMs to apply the best features on my own training script. This way I managed to get something pretty solid and flexible in a few iterations.

I tweaked the code over and over again by hand, until I got it to my liking, and I understood what it was doing.

I intentionally didn't want to use nanoChat, because I wanted 100% compatibility with the HuggingFace libraries and with GGUF in the future.

After training a few debug versions on my own PC, it was time to go bigger and train in the cloud.

I tried a 200M params (w 2048 tokens context) and a 340M params (w 4096 tokens context), both based on the Llama3 architecture.

RunPod was OK and featureful, but pricey. I trained the 0.2B params LLM, but I didn't upload that anywhere, because it had a very small context, and I decided to discard it, even if I spent some money... I really wanted a 4k+ context size.

I started training the 0.3B params Llama on ThunderCompute. It was very slow and the production price of the GPUs was even higher than RunPod, I big disapointment, but I put $25 credit and I wanted to spend all of it so I let the training run to consume all the credits.

Vast.ai had all sorts of issues at first with their base Docker image, not being able to start any instances, but after some trying and re-trying, I found a good instance in Czechia with an NVIDIA RTX PRO 5000 and I let it run for 10,000 steps (a bit less than 3B tokens). I will definitely try Vast.ai again, because the price is very competitive and once you find a good instance, it's very fast and stable.

This stage cost me $25 + $15 on ThunderCompute + Vast.ai.

Training metrics for this stage:

Stage-1-metrics
Stage-1-metrics

Base-training stage-2

I used the long texts, from ~20k up to 10MB in size.

In this stage I realized that the long texts have very good scores for all previous metrics: custom quality, entropy and compression, but they contain large chunks of bad OCR artefacts, eg:

code
--- Match #5/12310 (0fc6a6f36d5e1f02f9e5b000c480efe5005b6be5de6f819b9309b60b577fb242) ---
{
  "source": "LOC",
  "len": 385331,
  "uniqChar": 64,
  "tokens": 73087,
  "sentences": 4555,
  "entropy": 103.85,
  "quality": 95.95,
  "compress": 91.92,
  "text": "M; \n\n\n\n1 ? 70 \n\n\n\nary. \n\n\n\nwtodrawn. timm \n\nM COLLEGE LIBRARY \n\n\n\nMARK \n\n\n\nY \n\n\n\n\\ \n\n\n\nJ \n\n\n\nREV. JAMES DAVIE S \n\n\n\nCOFI ANT \n\n\n\nY DIWEDDAR \n\n\n\nB ARC II. JAMES DAYIES, \n\n\n\nGan Y PARCH. G. GRIFFITHS, \n\nCINCINNATI, 0. \n\n\n\nUTICA, N. Y. \n\nT. J. GRIFFITHS, ARGRAFFYDD, EXCHANGE BUILDINGS. \n1875. \n\n\n\nI \n\nw \n\n\n\nC YN W YS I AD. \n\n\n\nAt y Darllenydd 4 \n\nRhaglith 5 — 11 \n\ncofiant 12 — 4q \n\nEnglynion Coffadwriaethol 49 \n\nPregethau 50—96 \n\nAmlinelliad o'i Brif Weddnodau 97 — 106 \n\nAdgofion Personol am Dano 107 114 \n\nAdgofion Brodyr Eraill am Dano 114— 133 \n\nYsgubau o Loffion Difyrus am Dano i34_ I4 g \n\nPenillion Coffadwriaethol 149—156 \n\nEnglish Department 157 ^3 \n\nCawellaid o Fan Saethau ei Fwa 174—187 \n\nPynciau Ysgol < . 188—222 \n\n\n\nAT Y DARLLENYDD. \n\n\n\nEr ys llawer o flynyddoedd cyn ei farwolaeth ceisiasai y Parch. \nJames Davies gan ei hen gyfaill, Iorthryn Gwynedd, ysgrifenu ei \ngofiant, os goroesai ef. Addawodd yntau wneyd; a chydnabyddid yn \ngyffredinol ddoethineb y dewisiad. Ond o herwydd anghydwelediad \ncydrhyngddo a'r perthynasau, parthed i ddull ei ddygiad allan, efe a \nymwrthododd yn bendant a'r cyfrifoldeb. Teimlwn fod yn ddyled- \nswydd arnom ddweyd cymaint a hyna mewn cyflawnder a'r brawd \nThomas, er mwyn symud ymaith y dybiaeth mewn rhai manau, mai \nam na roddasid iddo fwy o arian at yr anturiaeth yr ymryddhaodd \noddiwrth ei ymrwymiad. Wedi iddo ef nacau, disgynodd y gwaith \narnom ni, trwy ddewisiad unol, a thaer ddymuniad y weddw a'i \nphlant. Yr oedd yn anhawdd genym gydsynio, o herwydd amledd a \nphwysigrwydd ein dyledswyddau i bobl ein gofal. Ond (i'w credyd \ncofnoder y ffaith), pan ddeallasant fod hyny yn peri i ni betruso, pas- \niasant yn unfrydol benderfyniad i ysgafnhau ein dyledswyddau idd- \nynt hwy tra yn parotoi y bywgraffiad, ac wedi y gorphenem, eu bod \nyn rhoddi i ni fis o orphwysiant.   ...   nnheilwng. Ymdrechwn fod yn gyfarwydd a nodau gwir \nGristion. Nac ymorphwyswn ar farn dda a ddwg dyn- \nion am danom. Gymerwn y gair yn rheol ; ymarferwn \nffydd ar aberth Iesu, a llefwn am oleuni a chymorth yr \nYsbryd Glan at y gorchwyl. Gochelwn gymeryd ein \ntymer na'n teimladau yn rheol i holi ein hunain ; ond \nBeibl Duw fyddo ein prif faen prawf. Dyma reol y \nfarn. \n\n\n\nY DIWEDD. \n\n\n\n"
}
--- Match #31/87899 (70fa969d373b988d5537a08ed47ccd6842c17bdcecb2cb55181e3cf37f3e13a1) ---
{
  "source": "LOC",
  "len": 330083,
  "uniqChar": 64,
  "tokens": 62805,
  "sentences": 5311,
  "entropy": 104.92,
  "quality": 94.84,
  "compress": 92.95,
  "text": "\nQass_„L X724 ( \nBook _ \n\n\n\nCOFIANT, \n\n\n\nPREGETHAU, A BARDDONIAETH \n\n\n\nY DIWEDDAE \n\n\n\nBARCH. T. PIERCE, LIVERPOOL; \n\n\n\nPAKCH. H. E. THOMAS, \n\nBIEKENHEAD. \n\n\n\nLIVEKPOOLr AEGEAEEWYD GAN THOMAS LLOYD, \n\nTITHEEAKN STEEET. \n\n\n\nIBXtxgq \n\n\n\nIn Exchange \nThe Nat. Libr'y of Wales \nAug. 1928 \n\n\n\nAT Y DARLLENYDD, \n\n\n\nAmcenAIS wneyd y Cofiant nior fyr a cbryno ag y galhvn, er mwyn \nxhoi y Pregetliau a'r Farddoniaetb i mewn. Diau y buasai yn dda \ngan lawer ei gael yn gynt, ond nid oedd modd i mi \"vraeyd, a \nebredwyf fod peth mantais Avedi ei gyraedd trwy yr oediad. Dylai \nesgeulustra Mr. Pieece yn cadw cofnodion o'i fywyd, fod yn \nrhybydd i'r rhai y byddai eu Cofiant o ddyddordeb ac addysg i'r \nbyd. Dymunaf gydnabod yn y modd mnvyaf diolcbgar y lliaws \nCyfeillion a roisant bob cymbortb i mi gasglu y defnyddiau, ac \nyr -wyf yn gadael ar y rbai oeddynt yn adnabod fy amvyl dad \ny'nghyfraith oreu i fainu am gywirdeb y Cofiant. Bu llawer, ac \nrnae cryn nifer eto o'i Bregethau goreu ar wasgar, y rbai pe eu \ncesglid gyda'r gweddill Barddoniaetb, a alien t -vraeyd Ail Gyfiol \nwertbfawr. \n\nGwelir oddiwrth restr y Tanysgrifwyr am hvyddiant yr antur- \naetb, ac y mae genyf addewid y gwertbir Uawer mewn ardaloedd \nna ddaetb dim emvau oddiyno. \n\nBydd yn rbwydd iawn i'r cyfarwydd ddiwygio yr ycbydig \nwallau argraffyddol sydd yn y Gyfrol. \n\nGan ddiolcb am bob cymbortb, a dymuno am bob llwydd a \n\nbenditb, \n\nY gorpbwysaf, &c, \n\nH. E. THOMAS, \n\n50, Exmoeth Street, Birkenhead, \n\nMehefin 28ain, 1804. \n\n\n\nCYNHWYSIAD. \n\n\n\nCOFIANT, \n\n\n\nTUDAL. \n\nPen. I. Prif helyntion ei \nFywyd Boreuol 5 \n\nPen. II. Ei Fywyd a'i lafur \nGweinidogaethol . . . . 17 V. Esgeuluso cyd- \ngynnulliad \n\nPeeg. VI. Anfeidrol rinwedd \naberth y Groes \n\n\n\n62 \n\n\n\ni)0 \n\n69 \n\n71 \n71 \n\n74 \n\n\n\nPeeg. VII. Galwad ar Sion i \nDdeffroi \n\nPeeg. VIII. Y gwr ar y march \ngwyn \n\nPeeg. IX. Gogoniant a di- \ngonolrwydd trefn gras yn \nngwyneb trueni dyn fel \npechadur \n\nPeeg. X. Yr henbobl.. .. \n\nPeeg. XI. Gogoniant ac ar- \ndderchawgrwydd eglwys Dduw \nyn y dyddiau diweddaf . . \n\nPeeg. XII. Cysylltiad bywyd \nduwiol a manv dedwydd . . \n\n\n\n78 \n\n\n\n79 \n\n\n\n97 \n\n\n\nBAEDDON1AETH. \n\n\n\nMawrnad Dewi Wyn o Eifion 101 \nHaman a Mordecai . . . . 121 \nGalareb am y diweddar Barch. \n\nJ. Breeze 137 \n\nMarwnadyParch.J. P.Davies 148 \n\nCywydd i'r Goleudy . . . . \n\nA WORLD LEADER IN PAPER PRESERVATION \n1 1 1 Thomson Park Drive \nCranberry Township, PA 16066 \n(724)779-2111 ' \n\n\n\n"
}

These samples have very good scores overall, but they are useless. I am guessing it's not English text... I counted a few hundred examples mostly from LOC-PD and other few hundred in the OTA datasets. Imagine if I feed that crap to my LLM, what will it learn?

I searched around and I decided to calculate a few more metrics like: dictionary word search, vowels in words, noise count. With these news values, I was able to keep only the best quality documents, after I combined all the values together in a single score. I'm sure it's not perfect, but when I explore the dataset I'm pretty happy with the data I'm seeing.

I calculated that the low quality documents were less than 1% of total, which was consistent with the short texts dataset.

By the way, all of this code to import, query and count the dataset entries is open source: https://github.com/croqaz/vintage-LLM/tree/main/dataset ;

I have a ton more data that I could use if I had more compute, or if I trained a larger LLM, but I decided to limit myself because this was taking forever already.

I ran this training on Vast.ai again, on a RTX PRO 6000 WS in France, for 10,150 steps (~6B tokens).

I did 2 rounds of training as you can see in the metrics below, because I started the instance and my tokenization script crashed due to OOM just when I was uploading the model checkpoints, so while I fixed it and ran it again, I quickly tokenized a sub-dataset of old poems, quotes, proverbs and Oxford clean books that I wanted to use anyway (all within the time period) just to keep the GPU busy. The second round was just the randomized long documents mentioned above.

This stage cost me $40.

Metrics for this stage:

Stage-2-metrics
Stage-2-metrics

Acording to the Chinchilla Scaling Law, 3+6=9B tokens is roughly the correct amount of training tokens for this 340M params model.

Fine-tuning

This stage is not finished as I'm writing this blog, and I'll make another post when it's ready.

I created a series of Python scripts to generate a "base knowledge" dataset so I can fine-tune the model on, to make it understand dialogs. Basic question/ answers about foods, fruits, vegetables, some animals and birds, colors, a few numbers. After fine-tuning it a few times with different tweaks, I got it to spit stable dialogs. I was happy to see that it's learning the structure of Question:... followed by Answer:... with just a few hundred examples.

A few samples at this point, with the final model + a light fine-tuning with my CommonSense dataset.

code
User: What is God?
LLM #1: God is the absolute ruler, and in him only we have hope and strength.
LLM #2: A Being of a God-like character would be a being who knew himself to be the supreme Being, and by whom alone we can act.
LLM #3: The sun shines on the earth and the stars reflect the light.

User: What is love?
LLM #1: Love is a powerful impulse and it enables us to overcome our inclinations.
LLM #2: Love is the result of a certain condition of the human being in which love exists; as, love a man because he loves you.
LLM #3: Love is a desire to please and the object of an action is the gratification of some passion or affection for a particular person or thing.

User: What is life?
LLM #1: Life is a warfare against pain, and the longer we live the more we suffer.
LLM #2: Life is a great struggle for existence, in which each one has to sacrifice his own individual pleasure and to seek the best good of others.
LLM #3: Life is life, and its issues are to the soul what the heart is the heart.

# Trying a few greetings

User: How are you?
LLM #1: Heat, fire and cold are required of them in order to overcome their resistance.
LLM #2: We use our best books on astronomy.
LLM #2: The weather is charming.

User: Greetings, good sir!
LLM #1: The best of all is that when you have done.
LLM #2: Gladly! Thanks for the honor. I was thinking of writing one.
LLM #2: No; I hate their thoughts. They are not of my mind, but my memory.

# Asking for a few names

User: What's your name?
LLM #1: Charles Emile de Saint-Valerie.
LLM #2: Ninette. I belong to the ancient class.
LLM #3: Charles Rickards.
LLM #4: Charles Bamford, of the "Nineteenth Century".
LLM #5: My mother was a slave, my father a slave.

All samples generated with my "generate.py" script, *temperature=1.0, top-p=0.9, top-k=25, min-p=0.01, repetition-penalty=1.1*.

The model halucinates a lot and doesn't really follow dialogs. You can't chat with it yet, it needs more baking.

All dialogs are like a gambling machine: add a coin, pull the lever and hope for the best. You can sometimes get something nice.

It was a nice surprise to see the model answer so well to the questions of God, love and life, especially that I don't have any of that in my "base knowledge" dataset, so the model picked it up from the long base-training and learned to apply the chat template on top.

Can the model memorize math?

In my fine-tuning knowledge file I had some simple math operations that I casually added without thinking too much, but when I was vibe-checking the model with different prompts across stages of training, I was actually asking "How much is 1 + 1?" to see how it goes and the answer was usually a random number, or complete nonsense.

So I wanted to find out: can the model memorize base math operations for numbers, say, -2 to 12?

I generated a dataset of 5300 questions about math, all basic operations (+ - / *) for all numbers between -2 up to 12, with different ways of asking, eg:

  • "What is 10 - 3?"
  • "How much is 7 * 10?"
  • "Multiply 9 by 2."
  • "Calculate -2 * 6."

I made a math benchmark where I was asking "Calculate X and Y." for all possible operations and number pairs (0 to 12) (I skipped the negative numbers).

Fine-tuning is super fast compared to full training, so I was able to experiment a lot and see the result within minutes.

I fine-tuned a few models from the base model, played with different hyper params and I got the best results with LR=5e-5, max_seq_length=2048, neftune_noise_alpha=0.0 (very important for this case) and obviously temperature=0.

The best score:

code
[ + ]  addition: 75/169 (44.4%)
   y│   0   1   2   3   4   5   6   7   8   9  10  11  12
  ──┼────────────────────────────────────────────────────
  0 │   ✗   ✗   ✓   ✗   ✗   ✓   ✗   ✗   ✗   ✗   ✓   ✗   ✓
  1 │   ✓   ✗   ✓   ✓   ✓   ✗   ✗   ✗   ✓   ✗   ✗   ✓   ✓
  2 │   ✗   ✗   ✗   ✗   ✗   ✗   ✗   ✗   ✗   ✓   ✗   ✓   ✗
  3 │   ✗   ✗   ✓   ✓   ✗   ✗   ✓   ✓   ✗   ✓   ✗   ✓   ✓
  4 │   ✗   ✗   ✗   ✗   ✓   ✓   ✓   ✓   ✗   ✗   ✗   ✓   ✓
  5 │   ✓   ✗   ✗   ✗   ✗   ✓   ✗   ✓   ✗   ✗   ✗   ✓   ✓
  6 │   ✓   ✗   ✗   ✓   ✓   ✗   ✓   ✓   ✓   ✗   ✗   ✓   ✓
  7 │   ✓   ✗   ✗   ✓   ✓   ✓   ✓   ✗   ✓   ✓   ✓   ✓   ✓
  8 │   ✗   ✗   ✗   ✗   ✗   ✗   ✗   ✓   ✗   ✗   ✗   ✓   ✗
  9 │   ✗   ✗   ✗   ✓   ✗   ✓   ✗   ✓   ✗   ✓   ✗   ✗   ✓
 10 │   ✗   ✗   ✗   ✗   ✗   ✓   ✗   ✗   ✗   ✓   ✓   ✗   ✓
 11 │   ✗   ✗   ✓   ✓   ✓   ✓   ✗   ✓   ✓   ✓   ✓   ✓   ✓
 12 │   ✗   ✗   ✓   ✓   ✗   ✓   ✗   ✓   ✗   ✗   ✗   ✓   ✗

[ - ]  subtraction: 114/169 (67.5%)
   y│   0   1   2   3   4   5   6   7   8   9  10  11  12
  ──┼────────────────────────────────────────────────────
  0 │   ✗   ✓   ✓   ✓   ✗   ✓   ✓   ✓   ✓   ✓   ✓   ✓   ✓
  1 │   ✓   ✗   ✗   ✓   ✓   ✓   ✗   ✓   ✓   ✓   ✗   ✓   ✓
  2 │   ✗   ✓   ✗   ✓   ✓   ✗   ✓   ✓   ✗   ✓   ✓   ✓   ✓
  3 │   ✗   ✓   ✓   ✓   ✓   ✗   ✓   ✓   ✗   ✓   ✓   ✓   ✗
  4 │   ✗   ✓   ✓   ✓   ✓   ✓   ✗   ✓   ✗   ✓   ✗   ✓   ✗
  5 │   ✓   ✓   ✗   ✓   ✓   ✗   ✓   ✓   ✓   ✓   ✗   ✗   ✓
  6 │   ✗   ✓   ✓   ✓   ✓   ✓   ✗   ✓   ✓   ✓   ✗   ✓   ✓
  7 │   ✓   ✓   ✗   ✓   ✓   ✓   ✓   ✓   ✓   ✓   ✓   ✗   ✗
  8 │   ✓   ✓   ✗   ✓   ✓   ✗   ✓   ✓   ✗   ✓   ✗   ✗   ✓
  9 │   ✗   ✓   ✗   ✓   ✓   ✗   ✓   ✓   ✓   ✓   ✗   ✗   ✓
 10 │   ✗   ✓   ✗   ✓   ✗   ✓   ✗   ✓   ✓   ✓   ✓   ✓   ✓
 11 │   ✗   ✓   ✓   ✓   ✓   ✓   ✓   ✓   ✓   ✓   ✗   ✗   ✗
 12 │   ✗   ✓   ✗   ✓   ✗   ✗   ✗   ✓   ✓   ✗   ✗   ✓   ✗

[ * ]  multiplication: 118/169 (69.8%)
   y│   0   1   2   3   4   5   6   7   8   9  10  11  12
  ──┼────────────────────────────────────────────────────
  0 │   ✓   ✓   ✓   ✓   ✓   ✗   ✓   ✓   ✗   ✓   ✗   ✓   ✓
  1 │   ✗   ✓   ✗   ✗   ✓   ✓   ✓   ✓   ✓   ✓   ✗   ✓   ✗
  2 │   ✓   ✓   ✓   ✗   ✗   ✗   ✓   ✓   ✓   ✓   ✓   ✓   ✓
  3 │   ✓   ✗   ✓   ✓   ✗   ✗   ✓   ✓   ✓   ✓   ✓   ✗   ✗
  4 │   ✓   ✓   ✓   ✗   ✗   ✗   ✗   ✗   ✓   ✗   ✓   ✓   ✓
  5 │   ✓   ✓   ✓   ✗   ✓   ✗   ✓   ✓   ✓   ✓   ✓   ✓   ✓
  6 │   ✓   ✓   ✓   ✗   ✓   ✗   ✓   ✓   ✓   ✓   ✗   ✓   ✗
  7 │   ✓   ✓   ✓   ✓   ✓   ✓   ✓   ✓   ✓   ✓   ✗   ✓   ✗
  8 │   ✓   ✓   ✗   ✓   ✗   ✗   ✓   ✓   ✓   ✓   ✓   ✓   ✗
  9 │   ✗   ✓   ✓   ✓   ✓   ✗   ✓   ✓   ✓   ✓   ✗   ✗   ✗
 10 │   ✓   ✓   ✓   ✓   ✓   ✓   ✓   ✗   ✗   ✓   ✗   ✗   ✓
 11 │   ✓   ✓   ✓   ✓   ✗   ✓   ✓   ✓   ✓   ✓   ✓   ✓   ✓
 12 │   ✗   ✗   ✓   ✓   ✗   ✗   ✗   ✓   ✓   ✓   ✗   ✓   ✗

[ / ]  division: 85/156 (54.5%)
   y│   0   1   2   3   4   5   6   7   8   9  10  11  12
  ──┼────────────────────────────────────────────────────
  0 │   ·   ✓   ✓   ✓   ✗   ✗   ✓   ✓   ✓   ✓   ✓   ✓   ✓
  1 │   ·   ✗   ✗   ✓   ✓   ✗   ✗   ✓   ✓   ✓   ✗   ✓   ✗
  2 │   ·   ✓   ✓   ✗   ✓   ✗   ✗   ✓   ✗   ✓   ✓   ✓   ✓
  3 │   ·   ✗   ✗   ✗   ✗   ✓   ✓   ✓   ✗   ✓   ✓   ✓   ✓
  4 │   ·   ✓   ✗   ✗   ✓   ✓   ✓   ✗   ✗   ✗   ✓   ✗   ✗
  5 │   ·   ✓   ✗   ✗   ✗   ✗   ✓   ✓   ✗   ✗   ✓   ✓   ✓
  6 │   ·   ✗   ✓   ✗   ✓   ✓   ✗   ✓   ✗   ✗   ✓   ✗   ✗
  7 │   ·   ✗   ✗   ✓   ✓   ✗   ✓   ✗   ✓   ✓   ✓   ✓   ✗
  8 │   ·   ✗   ✓   ✓   ✓   ✗   ✗   ✗   ✗   ✓   ✓   ✗   ✗
  9 │   ·   ✓   ✓   ✓   ✗   ✗   ✗   ✓   ✗   ✗   ✗   ✗   ✓
 10 │   ·   ✓   ✗   ✓   ✓   ✓   ✗   ✓   ✓   ✓   ✗   ✓   ✗
 11 │   ·   ✓   ✓   ✓   ✗   ✗   ✓   ✓   ✗   ✓   ✓   ✗   ✓
 12 │   ·   ✗   ✗   ✗   ✗   ✗   ✗   ✓   ✓   ✓   ✓   ✓   ✗

  SUMMARY
  +  addition           75/169  ( 44.4%)  ████████
  -  subtraction       114/169  ( 67.5%)  █████████████
  *  multiplication    118/169  ( 69.8%)  █████████████
  /  division           85/156  ( 54.5%)  ██████████
  --------------------------------------------------
  TOTAL             392/663  ( 59.1%)

I am surprised that the model consistently performs better at subtraction than addition, because the way subtraction is formulated is a bit more complicated, eg: "Subtract 2 from 3." and "Subtract 3 - 2.", the order of numbers is reversed. I would have guessed that the model will perform the best at addition (like humans do), but addition had the worst score...

Anyway, I wasn't able to get a score better than 60%, so I think this model can't memorize basic math.

Correct me if I'm wrong! Leave a comment and tell me what I'm missing!

Obviously I won't upload this model on HuggingFace just so you download a 650MB brain that answers 1 + 1 correctly half the time... Use a calculator OK?

Vibe checking during training

Playing with the model at different steps to see what they generate.

It's interesting that, at the begining of training, the model is learning the order of words, what word should follow what. Then, it starts to learn the words in a larger sequence like a sentence. Then, it learns to stitch 2-3 sentences together. If you continue to train it, it will learn how to build a long paragraph, but it takes a while...

Step 200

The model is still mostly random noise.

code
--- Prompt 1 ---
User: Hello!

Model:
Hello!ltO,til,le
cansia
the tst. .
m'
o. the i6n
a 1
M. B. C. C. PI
.h.,
The
Fn.l
i.
n.
L

--- Prompt 2 ---
User: Who are you?

Model:
Who are you? a man
of the country, who was born for the
purpose of having been laid. We're to-day
the present occasion. The number of votes
was given up to the Bank from the South
Carolina in the county of War. In which they
had taken the whole. The proceedings were
allowed to produce from this great mass. This
were one of the most unnecessarily, and the
question ensued on the part of the company.

--- Prompt 3 ---
User: Greetings, my friend

Model:
Greetings, my friend of her Ma t'estl. In all the other nations of his life and honour,
he would make a more than an instant, to any such thing as that has ever been done in the world.
It is impossible to expect that this country is in a condition in it...

--- Prompt 4 ---
User: What's this place?

Model:
What's this place?
the first and most important to which the State, and in its opinion, has been the great
and valuable to us. The Legislature of Russia was as follows :—" That the House of
Mr. H. M'Neard (Mr. S. H.) in Ireland was referred to an early period of money in

Step 1000

The model learns to connect some words together.

code
--- Prompt 1 ---
User: Hello!

Model:
Hello! CIR. and HI, RAJUy
DESTROYED BUSINESS.
By Mr. j. r. FULLER, and Messrs. A. & J.
Mclean and J. E. Hubbard, MIR G. P. Roulton,
Mr. G. w. Harris of the firm Of E. +. Dexter,
and J. A. Brown OF the firm of

--- Prompt 2 ---
User: Who are you?

Model:
Who are you? — but God has a child, who wants to be the same, and he is a most excellent man. It has been an ornament of manners for a lady and an officer. I have always observed that the author does not write to me. — I am no stranger, my good friend ; but I shall look over his life with pleasure, if I do not be a stranger. As a stranger I believe, it will be my duty to speak to the young lady, the stranger, if not

--- Prompt 3 ---
User: Greetings, my friend

Model:
Greetings, my friend, but in the course of an old acquaintance. — It is rather remarkable how much your lordship seems to be the manu facture of this most noble family, that you have so many a favouritewith me. — But this is not all I can conceive of; for it seems to me, that even this great object of that kind is to procure the benefit of our religious institutions to which I have referred. — The only difference be tween your own personal merit and his attachment. It is

--- Prompt 4 ---
User: What's this place?

Model:
What's this place?
He said there was no danger of such occurrence.
The plaintiff, the defendant, is a man of very respectable
character, and who has been in the service of the firm
of Messrs. Barrett and Co. for a period of three years, at
the rate of 50 per cent. on the gross value of his estate in
which he resided in the year 1830. He had for many
years previously kept an account of the business of the bank,
and it appeared

Step 10,000 (end of stage-1)

This model generates clean text because I did a very light fine-tuning with my CommonSense dataset at this point.

code
--- Prompt 1 ---
User: Hello!

Model:
Hello! What a fine idea ! How many legs is this ? It is a sort of animal ; that's the beast. Oh, what is it? What is it? The horse has no tail. But it's a brute, and I am afraid I cannot find a tail in it. A horse has no tail, and he eats it, and eats it. And how is it? Oh, how much does it take to eat it? Oh, how much do they eat? And the horse is

--- Prompt 2 ---
User: Who are you?

Model:
Who are you?
Then, what is the difference between a man and his wife?

--- Prompt 3 ---
User: Greetings, my friend

Model:
Greetings, my friend has been in the habit of walking about the streets for the last two or three days. He has walked to and fro in all directions in search of a place where he could purchase some articles at a cheap rate. This is not true, as you know; but it seems that you have been thinking about a place where you could buy a few articles at wholesale prices. This is a strange way of doing business, and you are often told that a man may make his goods cheap by buying them cheap

--- Prompt 4 ---
User: What's this place?

Model:
What's this place? Do you see it ? Do you see it ? I have seen it. Do you see it ? Is the tree that bears its fruit, and the fruit which is in the tree? Do you see it ? Are there trees that stand upon the ground? Is there any other trees of the same sort? Do you see them ? DO you see them ? Do you see them? Do you see them? Are they more common? Do you see them ? What are those ? Do you see them?

Step 20,000 (end of stage-2)

At this stage the text is semi-random, but it's consistent. The whole chunk of text seems to be from the same book, which is great to see.

No fine-tuning.

code
--- Prompt 1 ---
User: Hello!

Model:
Hello!” cried Mr. Dyer, “ the man is a
foolish fellow ; he must be made of some use.”
“ But I do not think so, sir,” said the lawyer, “ I
will tell you a story in one of my books. The case
of the old gentleman is this : — He had been living in
a strange country. His wife died, and his son took
charge of him. He did not

--- Prompt 2 ---
User: Who are you?

Model:
Who are you?”
The detective was standing by the table, with his
back toward the door.
“ You are going to get up that row?” he said.
‘‘Yes,” he replied.
“And go to get it done?”
“No.”
“Then we will see about it.”

--- Prompt 3 ---
User: Greetings, my friend

Model:
Greetings, my friend, and I will give you the
advice of an honest man.
" The above is a literal translation : I do not doubt it ; but
I do not know whether the reader has read it himself.
" P. S. — I have just returned from the country. I am very
sorry to say I had rather be in the house myself than in any one's
house. If you please to remember me, sir, it shall be your

--- Prompt 4 ---
User: What's this place?

Model:
What's this place?
The devil himself is the devil !
THE VOICE OF THE HEART. 53
VOICE OF THE HEART.
I wish that I had never been born !
I'll never tell the tale of my sin !
I'll never tell it !
But, ah ! the words are full of pain ;
They sound as if they had grown more plain :

Next steps

I don't have a good instruct model yet and I wont't share something half-baked, but I have plenty of datasets that I'm working on:

  • my CommonSense dataset is expanding, I have ~7k rows prepared and more ideas to add in there;
  • I have a list of quotes from philosophers like: Aristotle, Freud, Plato, etc and I'll get them in shape for Q&A pairs;
  • I extracted clean questions and answers from several pre 1900 books like:

The new common school question book 1888

  • The advanced question book 1883
  • A complete dictionary of synonyms and antonyms 1835, etc ;
  • I didn't process all of them yet, but I'll publish them as a separate dataset.
  • I have old dictionaries that I plan to extract word definitions from, and I'll convert them to more Q&A ;
  • I want to extract different topics from King James Bible to create more Q&A pairs;
  • I also have Talkie-13B-Q8-GGUF and Monad-GPT-Q8-GGUF! I'm sure I can generate a few synth datasets.

These datasets, or part of them at least should help the model understand the dialog structure. I'll experiment.

I will write another post once I have a good enough model to share.

Finis

When I started this project, I intentionally didn't define "success". I didn't start with a clear goal. It was a learning project first of all.

I was only hoping to get some kind of usable Victorian dialog out of it.

But I was surprised how bad it is without any fine-tuning, after spending so much time and energy on it... therefore I want to use all my creative energies to create something decent enough to share.

What do you think?

Are you interested in this kind of work?

What would you use this kind of LLM for?

What would you like me to try, in this context of Vintage LLMs?

If you want to reach out, you have a few ways:

  • leave a comment here ;
  • leave a comment on HF discussions: https://huggingface.co/croqaz/vintage-LLM-340m-v1-base/discussions ;
  • raise an issue on Vintage-LLM repo: https://github.com/croqaz/vintage-LLM/issues ;
  • join our Vintage-LLM Discord Server and send a message.

If you want to reach out in private, my e-mail is *my short name* at *this domain*.

If you're a cloud GPU provider, you have some GPUs collecting dust and want to sponsor the training of my next model, do reach out**! I will use all the compute for a bigger 1B model, with a better dataset; or I can base-train this 340M model up to 50,000 steps, I have plenty of data, your choice!

If you want to read more about these kinds of LLMs, check my previous post: Vintage LLM models, lots of links.

I encourage anyone who is curious or hyped about AI and LLMs to do what I did, and play with it along the way between training stages, to get a peek behind the curtain. You'll forget about AGI in no time, but it will be fun, I promise!

Maybe find a twist in your process, something that you didn't see anyone else do, perhaps some unique dataset, or unique training method, or LLM architecture? But you don't have to, you'll learn new things anyway. I know I did!

Note: This blog post is 100% written by me. No AI has been used whatsoever.

@articles

#ai

#vintage

この記事をシェア

関連記事

MarkTechPost★52026年6月13日 17:15

米国政府の命令により、Anthropic が Claude Fable 5 と Mythos 5 の利用を停止

Anthropic は、2026年6月12日に発令された米国政府の輸出管理指令に基づき、国家安全保障上の理由から、Claude Fable 5 および Claude Mythos 5 という2つの最新モデルの利用を全顧客に対して即時停止した。

MarkTechPost★42026年6月13日 13:57

Moonshot AI、コーディング特化モデル「Kimi K2.7-Code」をリリースし、ベンチマークで前作より +21.8% の性能向上を達成

Moonshot AI は長期的なソフトウェアエンジニアリングに特化したエージェント型コードモデル「Kimi K2.7-Code」を公開した。このモデルは Hugging Face で利用可能であり、Kimi Code ベンチ v2 において前バージョン K2.6 よりも +21.8% の性能向上を示している。

Latent Space★52026年6月13日 13:30

[AINews] ファブルとミソス、公式にリリース不可と判断される

Anthropic は、公開からわずか3日後の「Fable」と「Mythos」について、国家レベルのサイバーセキュリティリスクとなる可能性のある脱獄(ジャイルブレイク)が確認されたため、全顧客向けに即時リリースを撤回した。

今日のまとめ

AI日報で今日の重要ニュースをまとめ読み

ニュース一覧に戻る元記事を読む