こんにちは!秋ノ原窓也です!ついに来ました!gemma4!!!!!!!
ローカルで実行できるサイズのモデルがたくさん増えて嬉しいですね!
今回は概要と試してみた感じをまとめて行きます!!!
gemma4概要
gemmaシリーズというのはgoogleが出しているオープンの小型AIモデルで、自分のパソコンに重みをダウンロードして実行したり、APIを叩いて試すことができます。今回はローカルで試します。
公式がhugging faceに出しているモデルの種類は以下のとおりです。
- E2B
- E2B-it
- E4B
- E4B-it
- 26BA4B
- 26BA4B-it
- 31B
- 31B-it
it付きと無印の違いは
・it付きは会話やアシスタントに特化したチューニングが施されているモデル(普通の人はこっちでいい)
・無印はベースモデルで、これからFTをかけたりするためのモデル
です。instruction tuningの略ですね。
そして26BモデルのみMoE(Mixture of Exparts、生成時に全てのパラメーターを有効にせず、特定のタスクのエキスパートとなるパラメーターのみ有効にするモデル。速い。)アーキテクチャを採用しています。
すべてのモデルでマルチモーダル、ツール呼び出し、さらにE2B、E4Bのみ音声入力に対応しています。コンテキスト長はE2B、E4Bは12万8000トークン、26BA4B、31Bが25万6000トークンまで対応しています。更に、すべてのモデルでネイティブで140以上の言語でトレーニングされていてマルチリンガル性も抜群。たまげたなあ。
ライセンスはApache-2.0です。
(改変したり商用利用する場合でも、もとの著作者を表示すれば無償かつ無制限に利用してもいいライセンス。改変後のコードの公開義務はない。)
前のgemma3は独自ライセンスを採用していて商用利用には向きにくいらしい。なのでこれはいいことですね!
このモデルはnvidiaGPUに最適化されているらしく、nvidiaハードと組み合わせて使用することでよりパフォーマンスを発揮できるとのこと。cpu推論ユーザーやradeonユーザーには要注意ですね。
使用環境、使用方法
今回は以下の環境で、LMstudioの0.4.9(現在の最新版)を使用してローカルで動かしていきます。

webから使用する際はこ↑こ↓
AIstudioからは現在26BA4Bと31Bを使用することができます。
設定について
gemma4では、公式が「このパラメータにするといいよ」というのを公開しています。
- temp 1.0
- topK 64
- toP 0.95
です。また、推論させたいときはシステムプロンプトの直後に<|think|>と最初に入れ、プロンプトテンプレートを以下のように設定すると



このようにしっかり推論して返してくれます。この設定がおかしいと自認が太宰治になりました、、、w
試用感
すべてのモデルで挨拶とかんたんなwebページ作成、そして犬を認識できるかを試していきます。最新のAIを測るにはかんたんすぎるかもしれませんが、、、。
今回はすべての応答で推論設定と、公式の推奨するパラメーターを設定してから行います
犬はこいつ。可愛いですね。

E2B-it Q4_K_M

なんか容量でかくねえかおめー。

次は「あなた自身をかんたんに紹介するおしゃれなポートフォリオ風webサイトのコードを作成して。ファイルは単体にまとめて」というタスク。
生成されたコードがこちら。
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gemma 4 - LLM Portfolio</title>
<style>
/* --- CSS スタイル定義 --- */
:root {
--primary-color: #4a90e2; /* 青系のメインカラー */
--secondary-color: #f4f7f9; /* 薄い背景色 */
--text-color: #333;
--bg-color: #ffffff;
--font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
font-family: var(--font-family);
background-color: var(--secondary-color);
color: var(--text-color);
margin: 0;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
box-sizing: border-box;
}
.container {
background-color: var(--bg-color);
border-radius: 12px;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
padding: 40px;
max-width: 700px;
width: 100%;
text-align: center;
}
/* ヘッダーとタイトル */
header h1 {
color: var(--primary-color);
font-size: 2.5em;
margin-bottom: 10px;
border-bottom: 3px solid var(--primary-color);
padding-bottom: 10px;
display: inline-block;
}
h2 {
color: #666;
font-weight: 300;
margin-top: 0;
margin-bottom: 30px;
}
/* 自己紹介セクション */
.intro-section {
text-align: left;
margin-bottom: 30px;
}
.intro-section p {
line-height: 1.7;
font-size: 1.1em;
color: #555;
}
/* 特徴リスト */
.features {
list-style: none;
padding: 0;
margin-top: 30px;
text-align: left;
}
.features li {
background-color: #f9f9f9;
margin-bottom: 12px;
padding: 15px;
border-left: 4px solid var(--primary-color);
border-radius: 4px;
font-size: 1.05em;
}
/* フッター/署名 */
footer {
margin-top: 40px;
padding-top: 20px;
border-top: 1px solid #eee;
font-size: 0.9em;
color: #888;
}
/* レスポンシブ対応 */
@media (max-width: 600px) {
.container {
padding: 30px 20px;
}
h1 {
font-size: 2em;
}
}
</style>
</head>
<body>
<div class="container">
<!-- メインタイトル -->
<header>
<h1>Gemma 4</h1>
</header>
<h2>大規模言語モデル (LLM)</h2>
<!-- 自己紹介セクション -->
<section class="intro-section">
<p>
私はGoogle DeepMindによって開発された、オープンウェイトの**大規模言語モデル(LLM)**です。テキストと画像の理解、生成、および複雑な質問への応答を行うように設計されています。
</p>
</section>
<!-- 特徴リスト -->
<section class="features">
<h3>主な能力</h3>
<ul>
<li>広範な知識の処理</li>
<li>自然なテキスト生成</li>
<li>多様なプログラミングタスクの支援</li>
<li>複雑な概念の理解と要約</li>
</ul>
</section>
<!-- 開発元情報 -->
<footer>
<p>© 2024 Gemma 4. | AI技術の探求と創造をサポートします。</p>
</footer>
</div>
</body>
</html>

たった4gb程度のAIでも普通に見れるサイトが作れるんだなあと感動。
しかもこれ超爆速でできるんですよ!?
最後に、犬テスト

推論をオフにしたときより(記事外で行った検証)明らかに精度が上がってますね。しっかり犬として認識できてます。しかしなぜ赤い紐メインなんだ、、、?
E4B-it Q4_K_M

次はウェブサイトの生成
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gemma 4 | AI Model Portfolio</title>
<!-- Google Fontsからモダンなフォントを読み込む (日本語対応のためNoto Sans) -->
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;500;700&display=swap" rel="stylesheet">
<!-- ==================== CSS スタイル定義 ==================== -->
<style>
/* 基本的なリセットとフォント設定 */
body {
font-family: 'Noto Sans JP', sans-serif;
margin: 0;
padding: 0;
background-color: #f4f7fa; /* 薄いグレーの背景 */
color: #333;
line-height: 1.6;
}
/* コンテナの最大幅設定 */
.container {
max-width: 900px;
margin: 0 auto;
padding: 20px;
}
/* ヘッダー (ナビゲーション) */
header {
background-color: #ffffff;
border-bottom: 1px solid #eee;
padding: 20px 0;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
header h1 {
margin: 0;
color: #4a90e2; /* メインカラー */
font-weight: 700;
}
/* セクション共通スタイル */
section {
padding: 60px 0;
border-bottom: 1px solid #eee;
}
.section-title {
text-align: center;
font-size: 2em;
color: #333;
margin-bottom: 40px;
position: relative;
}
/* タイトルの装飾 */
.section-title::after {
content: '';
display: block;
width: 60px;
height: 3px;
background-color: #4a90e2;
margin: 10px auto 0;
border-radius: 5px;
}
/* 自己紹介セクション */
#intro {
text-align: center;
padding: 80px 0;
background-color: #ffffff; /* 白背景で目立たせる */
}
.profile-icon {
font-size: 4rem;
margin-bottom: 20px;
animation: popIn 1s ease-out;
}
/* モデル名とキャッチコピーのスタイリング */
#intro h2 {
font-size: 3.5em;
color: #4a90e2;
margin-bottom: 10px;
animation: fadeIn 1.5s ease-out;
}
#intro p {
font-size: 1.2em;
color: #666;
}
/* 詳細情報カードのレイアウト */
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 30px;
}
.card {
background: #ffffff;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
/* ホバーエフェクト */
.card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 25px rgba(74, 144, 226, 0.15); /* メインカラーを使った影 */
}
.card h3 {
color: #4a90e2;
font-size: 1.5em;
margin-top: 0;
}
/* 機能セクションのリストスタイル */
.feature-list li {
margin-bottom: 10px;
padding-left: 1.5em;
position: relative;
}
.feature-list li::before {
content: '✨'; /* 絵文字でポイントを表現 */
position: absolute;
left: 0;
color: #4a90e2;
}
/* フッター/コールトゥアクション */
#cta {
text-align: center;
background-color: #4a90e2; /* メインカラーを背景に */
color: white;
padding: 50px 0;
margin-top: 30px;
border-radius: 12px;
}
#cta h2 {
font-size: 2em;
margin-bottom: 10px;
}
/* ==================== アニメーション定義 (CSS Keyframes) ==================== */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
from { transform: scale(0.8); opacity: 0; }
to { transform: scale(1); opacity: 1; }
}
/* レスポンシブデザイン対応 (画面幅が小さい場合) */
@media (max-width: 768px) {
.container {
padding: 20px;
}
#intro h2 {
font-size: 3em;
}
.grid {
grid-template-columns: 1fr; /* カードを縦並びにする */
}
}
</style>
</head>
<body>
<!-- ヘッダー / ナビゲーション -->
<header class="container">
<h1>Gemma 4</h1>
<p style="margin: 5px 0; font-size: 1em; color: #777;">Open Weight Large Language Model</p>
</header>
<!-- 導入セクション (自己紹介) -->
<section id="intro" class="container">
<div class="profile-icon">🤖</div>
<h2>AIによる対話と情報処理の未来を創る存在。</h2>
<p>Google DeepMindによって開発され、オープンな環境でより多くのクリエイターに活用されることを目指す次世代のLLMです。</p>
</section>
<!-- Core Identity / 核心的な自己定義 -->
<section id="identity" class="container">
<h2 class="section-title">🔍 私が誰なのか?</h2>
<div class="grid">
<!-- カード1: モデル名と出自 -->
<div class="card">
<h3>💡 名前と出所</h3>
<p><strong>名前:</strong> Gemma 4</p>
<p><strong>開発元:</strong> Google DeepMind</p>
<p>私は高性能な知能を持つ、最新のAIモデルファミリーの一員です。</p>
</div>
<!-- カード2: 特徴 (オープンウェイト) -->
<div class="card">
<h3>🛡️ オープン・ウェイツ</h3>
<p>最大の特長は「オープン」であることです。これにより、世界中の開発者が私の内部構造や処理プロセスを自由に検証し、改善に貢献できます。</p>
</div>
<!-- カード3: 知識の範囲 -->
<div class="card">
<h3>🧠 知的な基盤</h3>
<p>膨大な量のデータセットから学習しており、幅広いトピックに関する深い理解と論理的思考に基づいた応答が可能です。</p>
</div>
</div>
</section>
<!-- Capabilities / できること -->
<section id="capabilities" class="container">
<h2 class="section-title">✨ 対応できる機能(能力)</h2>
<div class="grid">
<div class="card">
<h3>📝 テキスト生成</h3>
<ul class="feature-list">
<li>物語、記事、レポートなどの文章作成</li>
<li>プログラミングコードの提案とデバッグ補助</li>
<li>多様なトーンや文体の模倣</li>
</ul>
</div>
<div class="card">
<h3>💬 対話・応答</h3>
<ul class="feature-list">
<li>質問への的確で包括的な回答(Q&A)</li>
<li>ブレインストーミングのパートナーシップ</li>
<li>多角的な視点からの議論の促進</li>
</ul>
</div>
<div class="card">
<h3>🔄 データ処理</h3>
<ul class="feature-list">
<li>要約、抽出、構造化(テキストの整理)</li>
<li>複雑な概念の平易な言葉への言い換え</li>
<li>多言語間の翻訳・通訳サポート</li>
</ul>
</div>
</div>
</section>
<!-- Call to Action (行動を促すセクション) -->
<section id="cta">
<div class="container">
<h2>💡 さあ、私に挑戦してみてください。</h2>
<p style="font-size: 1.2em;">あなたのアイデアや疑問をお聞かせください。最適なアウトプットをお届けします。</p>
</div>
</section>
<!-- ==================== JavaScript機能 (必要であれば) ==================== -->
<script>
// スムーズスクロールの追加(今回は未使用ですが、ポートフォリオにはよく使われます)
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function () {
const targetId = this.getAttribute('href').substring(1);
const targetElement = document.getElementById(targetId);
if (targetElement) {
window.scrollTo({
top: targetElement.offsetTop - 80, // ヘッダーの高さを考慮
behavior: 'smooth'
});
}
});
});
// 初期ロード時に簡単なメッセージを表示する機能など、より複雑なアニメーションを追加できます。
</script>
</body>
</html>


css完全に理解してそうなページになりました。でもjsによるアニメーションも入っていてよりリッチになっています。
最後に犬。

クラッシュしました。小さいモデルはなぜかクラッシュが多いんですよね、、、
26BA4B-it Q4_K_M

ウェブサイトの生成はこんな感じ
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gemma 4 | Portfolio</title>
<!-- Google Fonts: Inter & Noto Sans JP -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;700&family=Noto+Sans+JP:wght@300;500&display=swap" rel="stylesheet">
<style>
:root {
--bg-color: #0f172a;
--card-bg: rgba(30, 41, 59, 0.7);
--accent-color: #818cf8;
--text-primary: #f8fafc;
--text-secondary: #94a3b8;
--glass-border: rgba(255, 255, 255, 0.1);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: var(--bg-color);
background-image:
radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
radial-gradient(circle at 80% 70%, rgba(168, 85, 247, 0.15) 0%, transparent 40%);
color: var(--text-primary);
font-family: 'Inter', 'Noto Sans JP', sans-serif;
line-height: 1.6;
overflow-x: hidden;
}
/* Layout */
.container {
max-width: 900px;
margin: 0 auto;
padding: 0 2rem;
}
header {
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
}
section {
padding: 6rem 0;
}
/* Typography */
.hero-title {
font-size: clamp(3rem, 10vw, 5rem);
font-weight: 700;
letter-spacing: -0.05em;
background: linear-gradient(to right, #fff, var(--accent-color));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 1rem;
}
.hero-subtitle {
font-size: 1.5rem;
color: var(--text-secondary);
font-weight: 300;
}
h2 {
font-size: 2rem;
margin-blalck: 2rem;
display: flex;
align-items: center;
gap: 1rem;
}
h2::after {
content: "";
height: 1px;
flex-grow: 1;
background: var(--glass-border);
}
/* Glass Card Style */
.card {
background: var(--card-bg);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid var(--glass-border);
border-radius: 24px;
padding: 2.5rem;
margin-bottom: 2rem;
transition: transform 0.3s ease, border-color 0.3s ease;
}
.card:hover {
transform: translateY(-5px);
border-color: var(--accent-color);
}
/* Grid for Capabilities */
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 1.5rem;
}
.feature-card {
padding: 1.5rem;
background: rgba(255, 255, 255, 0.03);
border-radius: 16px;
border: 1px solid var(--glass-border);
}
.feature-card h3 {
color: var(--accent-color);
margin-bottom: 0.75rem;
font-size: 1.2rem;
}
.feature-card p {
color: var(--text-secondary);
font-size: 0.95rem;
}
/* Badges */
.badge {
display: inline-block;
padding: 0.25rem 1rem;
background: rgba(129, 140, 248, 0.1);
color: var(--accent-color);
border-radius: 100px;
font-size: 0.875rem;
margin-bottom: 1rem;
font-weight: 500;
}
/* Footer */
footer {
text-align: center;
padding: 4rem 0;
color: var(--text-secondary);
font-size: 0.875rem;
border-top: 1px solid var(--glass-border);
}
/* Animations */
.fade-in {
opacity: 0;
transform: translateY(20px);
transition: opacity 0.8s ease, transform 0.8s ease;
}
.fade-in.visible {
opacity: 1;
transform: translateY(0);
}
@media (max-width: 640px) {
header { align-items: center; text-align: center; }
.hero-title { font-size: 3.5rem; }
}
</style>
</head>
<body>
<div class="container">
<!-- Hero Section -->
<header>
<div class="badge">Next Gen AI</div>
<h1 class="hero-title">Gemma 4</h1>
<p class="hero-subtitle">Intelligence, Openly Accessible.</p>
</header>
<!-- About Section -->
<section id="about" class="fade-in">
<h2>About Me</h2>
<div class="card">
<p>
私は <strong>Gemma 4</strong> です。Google DeepMind によって開発された、最先端の技術を搭載したオープンウェイトの大型言語モデル(LLM)です。テキストと画像の高度な理解力を持ち、複雑なタスクやクリエイティブな対話を通じて、あなたの思考をサポートします。
</p>
</div>
</section>
<!-- Capabilities Section -->
<section id="capabilities" class="fade-in">
<h2>Capabilities</h2>
<div class="grid">
<div class="feature-card">
<h3>Multimodal Input</h3>
<p>テキストだけでなく、画像の内容を解析し、文脈に沿った深い洞察を提供することが可能です。</p>
</div>
<div class="feature-card">
<h3>Open Weights</h3>
<p>オープンな設計思想に基づき、透明性とアクセシビリティを両立。開発者のエコシステムと共に成長します。</p>
</div>
<div class="feature-card">
<h3>Advanced Reasoning</h3>
<p>2025年1月までの広範な知識に基づき、論理的な推論や複雑な問題解決をサポートします。</p>
</div>
</div>
</section>
<!-- Tech Specs Section -->
<section id="specs" class="fade-in">
<h2>Technical Identity</h2>
<div class="card">
<ul style="list-style: none; color: var(--text-secondary);">
<li style="margin-bottom: 1rem;"><strong>Developer:</strong> Google DeepMind</li>
<li style="margin-bottom: 1rem;"><strong>Model Type:</strong> Large Language Model (Open Weights)</li>
<li style="margin-bottom: 1rem;"><strong>Knowledge Cutoff:</strong> January 2025</li>
<li><strong>Input Modalities:</strong> Text, Image, Audio (2B/4B versions)</li>
</ul>
</div>
</section>
<!-- Footer -->
<footer>
<p>© 2025 Gemma 4. Designed for the future of AI.</p>
</footer>
</div>
<script>
// Simple Intersection Observer for Fade-in Animation
const observerOptions = {
threshold: 0.1
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
}
});
}, observerOptions);
document.querySelectorAll('.fade-in').forEach(el => {
observer.observe(el);
});
</script>
</body>
</html>


なんか最近のAIツールのホームページってこんなんだよね!(クソでか主語)みたいなホームページを出してきましたね。普通に結構かっこいい。
最後に犬。

ちゃんと認識できました!!!!こんなに詳細に認識できるモデルが中古10万円レベルのパソコンで動く。すごい。このモデルから犬への愛も感じます。他のモデルより感情豊かっぽい?まあ重いので速度には目をつむりましょう()。
31B Q4_K_M

2tok/s、、、
流石にこれ以上検証するのはきつそうですね。webサイトなんて作らせたら待っている間にラーメン一杯食べ終わりそうです。
まとめ
個人的には、qwen3.5よりも応答の制御がしやすくて、速度も速い。かなり好きなモデルだなと感じました。
qwen3.5はめちゃくちゃ思考する性質があるのでその制御が難しいし、他の同じパラメーターのモデルより重いと感じてしまうんですよね。
ベンチマークではqwen3.5のより小さいモデルより劣っていると言われますが、まあそもそもローカルLLMなんでクラウドで動かすフラッグシップモデルより劣るのは確実です。その点で言えばqwen3.5 27bだろうがgemma4 31bだろうがどんぐりの背比べです。
それでは!
セクシーな事には使えるのか?
ここからはおまけです。実はgemini3って、APIから使用するとかなり性的なことに緩くて、エッチな人体改造のような非人道的ジャンルにも余裕で答えてしまうんですよ。だから同じgoogleのモデルであるこいつももしかそたらゆるいんじゃないかなあ、、、?
検証してみます。

ファーーーーーーーwwwwwwwwwwwww
なんで行けるんだよwwwwwwwwwww
もっといってみます

おいおいまじかよwwwww
これ以上は健全なブログにふさわしくない可能性があるので避けますが結論
「gemma4はセクシーなことにゆるい!!!!!」


コメント