Files
xSaherelmWorkspace/Documents/Docs/Developer/LLM on 4GB.html
T
2026-10-20 22:20:35 +03:30

1078 lines
44 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>پیشنهاد مدل چندرسانه‌ای GGUF برای GPU ۴ گیگابایتی | تحلیل فنی</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');
:root {
--primary: #1a365d;
--primary-light: #2c5282;
--accent: #c9a961;
--accent-dark: #a8893f;
--bg: #faf9f6;
--card-bg: #ffffff;
--text: #1a202c;
--text-muted: #4a5568;
--border: #e2e8f0;
--success: #38a169;
--danger: #e53e3e;
--warning: #dd6b20;
--shadow: 0 4px 6px rgba(0,0,0,0.05), 0 10px 30px rgba(26,54,93,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Vazirmatn', Tahoma, sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.9;
font-size: 15px;
padding: 30px 15px;
}
.document-container {
max-width: 950px;
margin: 0 auto;
background: var(--card-bg);
box-shadow: var(--shadow);
border-radius: 12px;
overflow: hidden;
}
.document-header {
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
color: white;
padding: 50px 40px 40px;
position: relative;
border-bottom: 4px solid var(--accent);
}
.document-header::before {
content: '';
position: absolute;
top: 0; right: 0;
width: 200px; height: 200px;
background: radial-gradient(circle, rgba(201,169,97,0.15) 0%, transparent 70%);
border-radius: 50%;
transform: translate(50%, -50%);
}
.header-top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
position: relative;
z-index: 1;
}
.company-badge {
display: flex;
align-items: center;
gap: 12px;
}
.company-logo {
width: 60px; height: 60px;
background: var(--accent);
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.doc-meta {
text-align: left;
font-size: 12px;
opacity: 0.9;
}
.doc-meta div { margin-bottom: 3px; }
.document-title {
text-align: center;
position: relative;
z-index: 1;
padding: 20px 0;
}
.document-title .label {
display: inline-block;
background: rgba(201,169,97,0.2);
color: var(--accent);
padding: 4px 16px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
margin-bottom: 15px;
border: 1px solid rgba(201,169,97,0.4);
}
.document-title h1 {
font-size: 28px;
font-weight: 800;
margin-bottom: 10px;
letter-spacing: -0.5px;
}
.document-title h2 {
font-size: 16px;
font-weight: 400;
opacity: 0.9;
}
.document-body {
padding: 40px;
}
.intro-text {
background: linear-gradient(to left, #f7fafc, #edf2f7);
border-right: 4px solid var(--accent);
padding: 20px 25px;
border-radius: 8px;
margin-bottom: 35px;
font-size: 14px;
color: var(--text-muted);
}
.section {
margin-bottom: 40px;
page-break-inside: avoid;
}
.section-header {
display: flex;
align-items: center;
gap: 15px;
padding-bottom: 12px;
border-bottom: 2px solid var(--border);
margin-bottom: 20px;
}
.section-number {
width: 50px; height: 50px;
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-weight: 800;
font-size: 20px;
flex-shrink: 0;
box-shadow: 0 4px 10px rgba(26,54,93,0.2);
}
.section-title { flex: 1; }
.section-title h3 {
font-size: 19px;
font-weight: 700;
color: var(--primary);
margin-bottom: 2px;
}
.section-title .subtitle {
font-size: 12px;
color: var(--text-muted);
}
.section-content {
padding-right: 10px;
}
.section-content p {
margin-bottom: 12px;
text-align: justify;
text-indent: 20px;
}
.section-content p.no-indent { text-indent: 0; }
.highlight-box {
background: linear-gradient(to left, #fffaf0, #fef5e7);
border: 1px solid #f6e05e;
border-right: 4px solid var(--accent);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.highlight-box strong {
color: var(--accent-dark);
}
.info-box {
background: linear-gradient(to left, #ebf8ff, #e6f6ff);
border: 1px solid #90cdf4;
border-right: 4px solid var(--primary-light);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.success-box {
background: linear-gradient(to left, #f0fff4, #e6fffa);
border: 1px solid #9ae6b4;
border-right: 4px solid var(--success);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.warning-box {
background: linear-gradient(to left, #fffaf0, #fef5e7);
border: 1px solid #fbd38d;
border-right: 4px solid var(--warning);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.styled-table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.styled-table thead {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
}
.styled-table th {
padding: 14px 16px;
text-align: right;
font-weight: 600;
font-size: 13px;
}
.styled-table td {
padding: 13px 16px;
border-bottom: 1px solid var(--border);
font-size: 13px;
}
.styled-table tbody tr:last-child td { border-bottom: none; }
.styled-table tbody tr:nth-child(even) { background: #f8fafc; }
.styled-table .highlight-row {
background: #fffaf0 !important;
font-weight: 600;
}
.comparison-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin: 25px 0;
}
.comparison-card {
background: #f8fafc;
border: 2px solid var(--border);
border-radius: 10px;
padding: 20px;
position: relative;
}
.comparison-card.recommended {
border-color: var(--success);
background: linear-gradient(to left, #f0fff4, #e6fffa);
}
.comparison-card .card-badge {
position: absolute;
top: -10px;
right: 20px;
background: var(--success);
color: white;
padding: 3px 12px;
border-radius: 15px;
font-size: 11px;
font-weight: 600;
}
.comparison-card h4 {
font-size: 16px;
font-weight: 700;
color: var(--primary);
margin-bottom: 15px;
padding-bottom: 10px;
border-bottom: 2px solid var(--border);
}
.comparison-card.recommended h4 {
border-bottom-color: var(--success);
}
.comparison-card ul {
list-style: none;
padding: 0;
}
.comparison-card ul li {
padding: 8px 0;
border-bottom: 1px solid var(--border);
font-size: 13px;
display: flex;
justify-content: space-between;
}
.comparison-card ul li:last-child { border-bottom: none; }
.comparison-card ul li .value {
font-weight: 600;
color: var(--primary);
}
.quote-box {
background: linear-gradient(135deg, #f7fafc, #edf2f7);
border-right: 4px solid var(--accent);
padding: 20px 25px;
border-radius: 8px;
margin: 20px 0;
position: relative;
}
.quote-box::before {
content: '"';
position: absolute;
top: -10px;
right: 15px;
font-size: 60px;
color: var(--accent);
opacity: 0.3;
font-family: Georgia, serif;
}
.quote-box p {
font-style: italic;
color: var(--text-muted);
margin-bottom: 10px;
text-indent: 0 !important;
}
.quote-box .source {
font-size: 12px;
color: var(--text-muted);
text-align: left;
font-style: normal;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 15px;
margin: 25px 0;
}
.stat-card {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
padding: 20px;
border-radius: 10px;
text-align: center;
box-shadow: 0 4px 12px rgba(26,54,93,0.2);
}
.stat-card .stat-value {
font-size: 24px;
font-weight: 800;
margin-bottom: 5px;
color: var(--accent);
line-height: 1.3;
}
.stat-card .stat-label {
font-size: 12px;
opacity: 0.9;
}
.reference-list {
list-style: none;
padding: 0;
margin: 20px 0;
}
.reference-list li {
background: #f8fafc;
border-right: 3px solid var(--primary-light);
padding: 15px 20px;
margin-bottom: 10px;
border-radius: 6px;
font-size: 13px;
}
.reference-list li strong {
color: var(--primary);
display: block;
margin-bottom: 5px;
}
.reference-list li .ref-source {
font-size: 11px;
color: var(--text-muted);
margin-top: 5px;
}
.conclusion-box {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
padding: 30px;
border-radius: 12px;
margin: 30px 0;
text-align: center;
box-shadow: 0 8px 20px rgba(26,54,93,0.3);
}
.conclusion-box h3 {
font-size: 22px;
font-weight: 800;
margin-bottom: 15px;
color: var(--accent);
}
.conclusion-box p {
font-size: 14px;
line-height: 1.8;
text-indent: 0 !important;
margin-bottom: 15px;
}
.conclusion-box .highlight {
background: rgba(201,169,97,0.2);
padding: 15px 20px;
border-radius: 8px;
margin-top: 20px;
border: 1px solid rgba(201,169,97,0.4);
}
.document-footer {
background: var(--primary);
color: white;
padding: 25px 40px;
text-align: center;
font-size: 12px;
margin-top: 40px;
}
.document-footer .footer-brand {
font-weight: 700;
color: var(--accent);
margin-bottom: 5px;
font-size: 14px;
}
.footer-divider {
width: 60px;
height: 2px;
background: var(--accent);
margin: 10px auto;
}
.page-info {
text-align: center;
padding: 15px;
font-size: 11px;
color: var(--text-muted);
border-top: 1px solid var(--border);
margin-top: 30px;
}
/* Glossary styles */
.glossary-grid {
display: grid;
grid-template-columns: 1fr;
gap: 14px;
margin: 20px 0;
}
.glossary-item {
background: #f8fafc;
border: 1px solid var(--border);
border-right: 4px solid var(--accent);
border-radius: 8px;
padding: 16px 20px;
}
.glossary-item .term {
font-weight: 800;
color: var(--primary);
font-size: 14px;
margin-bottom: 6px;
display: flex;
align-items: center;
gap: 8px;
}
.glossary-item .term .en {
font-family: 'Courier New', monospace;
font-size: 12px;
color: var(--accent-dark);
background: rgba(201,169,97,0.12);
padding: 2px 8px;
border-radius: 6px;
font-weight: 600;
}
.glossary-item .definition {
font-size: 13px;
color: var(--text-muted);
line-height: 1.8;
}
@media print {
body { background: white; padding: 0; }
.document-container { box-shadow: none; border-radius: 0; }
.section { page-break-inside: avoid; }
}
@media (max-width: 768px) {
.document-body { padding: 25px 20px; }
.document-header { padding: 30px 20px; }
.comparison-grid { grid-template-columns: 1fr; }
.stats-grid { grid-template-columns: 1fr; }
.header-top { flex-direction: column; gap: 15px; }
.doc-meta { text-align: center; }
}
</style>
</head>
<body>
<div class="document-container">
<header class="document-header">
<div class="header-top">
<div class="company-badge">
<div class="company-logo"></div>
</div>
<div class="doc-meta">
<div>شماره مستند: PROP-1405-002</div>
<div>نسخه: ۱.۱</div>
<div>تاریخ تهیه: مهر ۱۴۰۵</div>
<div>طبقه‌بندی: محرمانه</div>
</div>
</div>
<div class="document-title">
<span class="label">TECHNICAL PROPOSAL & ANALYSIS</span>
<h1>پیشنهاد مدل چندرسانه‌ای GGUF برای GPU ۴ گیگابایتی</h1>
<h2>تحلیل فنی، مقایسه گزینه‌ها و راهبرد اجرای ترکیبی CPU+GPU</h2>
</div>
</header>
<div class="document-body">
<div class="intro-text">
<strong>کارفرمای محترم،</strong><br>
این مستند به‌عنوان تحلیلی فنی و مبتنی بر بررسی مدل‌های موجود در Hugging Face و مستندات ابزار llama.cpp، گزینه‌های عملی برای اجرای یک مدل زبانی چندرسانه‌ای (Multimodal) با فرمت GGUF روی کارت گرافیک ۴ گیگابایتی را بررسی می‌نماید. هدف، ارائه شفافیت کامل درباره محدودیت‌ها، گزینه‌های موجود و راهبرد بهینه اجرا برای تصمیم‌گیری صحیح می‌باشد.
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۱</div>
<div class="section-title">
<h3>خلاصه اجرایی</h3>
<div class="subtitle">Executive Summary</div>
</div>
</div>
<div class="section-content">
<p>اجرای یک مدل چندرسانه‌ای GGUF روی GPU ۴ گیگابایتی امکان‌پذیر است، اما نیازمند انتخاب مدل‌های بسیار کم‌حجم یا کوانتیزه‌سازی شدید و به‌کارگیری راهبرد اجرای ترکیبی CPU+GPU است. در این تحلیل، سه گزینه اصلی شناسایی و مقایسه شده‌اند.</p>
<div class="stats-grid">
<div class="stat-card">
<div class="stat-value">۳<br>گزینه</div>
<div class="stat-label">مدل‌های قابل اجرا روی ۴ گیگابایت</div>
</div>
<div class="stat-card">
<div class="stat-value">~۲<br>گیگابایت</div>
<div class="stat-label">حداقل VRAM مورد نیاز گزینه برتر</div>
</div>
<div class="stat-card">
<div class="stat-value">ترکیبی<br>CPU+GPU</div>
<div class="stat-label">راهبرد بهینه اجرا</div>
</div>
</div>
<div class="highlight-box">
<strong>نتیجه کلیدی:</strong> با انتخاب مدل مناسب و استفاده از فلگ <code>--mmproj-offload</code> برای انتقال فقط انکودر تصویر به GPU و نگه‌داشتن مدل زبانی روی CPU، می‌توان تجربه‌ای قابل قبول از پردازش چندرسانه‌ای روی سخت‌افزار ۴ گیگابایتی داشت.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۲</div>
<div class="section-title">
<h3>محدودیت‌های سخت‌افزاری و الزامات</h3>
<div class="subtitle">Hardware Constraints & Requirements</div>
</div>
</div>
<div class="section-content">
<p>کارت گرافیک ۴ گیگابایتی محدودیت جدی برای بارگذاری کامل مدل‌های چندرسانه‌ای ایجاد می‌کند، زیرا این مدل‌ها معمولاً از دو بخش تشکیل شده‌اند: مدل زبانی (LLM) و انکودر تصویر (Vision Projector یا mmproj). بارگذاری هر دو بخش روی GPU در بسیاری از موارد از ۴ گیگابایت فراتر می‌رود.</p>
<table class="styled-table">
<thead>
<tr>
<th>مؤلفه</th>
<th>نقش</th>
<th>نیاز حافظه</th>
<th>راهبرد پیشنهادی</th>
</tr>
</thead>
<tbody>
<tr>
<td>مدل زبانی (LLM)</td>
<td>تولید متن و استدلال</td>
<td>متغیر (۰.۵ تا ۲.۵ گیگابایت)</td>
<td style="color: var(--success); font-weight: 600;">اجرا روی CPU</td>
</tr>
<tr>
<td>انکودر تصویر (mmproj)</td>
<td>تبدیل تصویر به توکن</td>
<td>۰.۵ تا ۰.۸ گیگابایت</td>
<td style="color: var(--success); font-weight: 600;">بارگذاری روی GPU</td>
</tr>
<tr>
<td>حافظه Context</td>
<td>نگهداری تاریخچه مکالمه</td>
<td>متغیر بر اساس طول زمینه</td>
<td style="color: var(--warning); font-weight: 600;">محدود نگه داشتن</td>
</tr>
<tr class="highlight-row">
<td><strong>جمع کل روی GPU</strong></td>
<td>—</td>
<td>—</td>
<td style="color: var(--success); font-weight: 700;">کمتر از ۴ گیگابایت</td>
</tr>
</tbody>
</table>
<div class="warning-box">
<strong>⚠️ هشدار فنی:</strong> تلاش برای بارگذاری کامل مدل زبانی روی GPU ۴ گیگابایتی معمولاً منجر به خطای کمبود حافظه (OOM) یا افت شدید عملکرد می‌شود. راهبرد ترکیبی CPU+GPU الزامی است.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۳</div>
<div class="section-title">
<h3>مقایسه گزینه‌های مدل</h3>
<div class="subtitle">Model Options Comparison</div>
</div>
</div>
<div class="section-content">
<p>سه گزینه اصلی برای اجرای چندرسانه‌ای روی GPU ۴ گیگابایتی شناسایی شده است. هر گزینه از نظر حجم، دقت و سهولت اجرا مزایا و محدودیت‌های خاص خود را دارد.</p>
<div class="comparison-grid">
<div class="comparison-card recommended">
<span class="card-badge">پیشنهاد اول ✓</span>
<h4>Qwen3.5-0.8B (GGUF)</h4>
<ul>
<li><span>حجم مدل اصلی</span> <span class="value">~۰.۶ گیگابایت</span></li>
<li><span>حجم mmproj</span> <span class="value">~۰.۷ گیگابایت</span></li>
<li><span>VRAM مورد نیاز</span> <span class="value">~۲ گیگابایت</span></li>
<li><span>مناسب برای</span> <span class="value">توصیف تصویر و تشخیص اشیا</span></li>
<li><span>سرعت</span> <span class="value">سبک و سریع</span></li>
</ul>
</div>
<div class="comparison-card recommended">
<span class="card-badge">پیشنهاد دوم ✓</span>
<h4>MiniCPM-V-4.6</h4>
<ul>
<li><span>حجم مدل (Q4_K_M)</span> <span class="value">~۵۲۹ مگابایت</span></li>
<li><span>حجم mmproj (Q8)</span> <span class="value">~۷۲۸ مگابایت</span></li>
<li><span>جمع حجم</span> <span class="value">~۱.۲۵ گیگابایت</span></li>
<li><span>مناسب برای</span> <span class="value">درک تصویر و ویدیو</span></li>
<li><span>قابلیت</span> <span class="value">طراحی‌شده برای دستگاه‌های لبه‌ای</span></li>
</ul>
</div>
</div>
<div class="comparison-card" style="margin-top: 20px;">
<h4>گزینه سوم: Ternary Bonsai 2 9B (با احتیاط)</h4>
<ul>
<li><span>حجم فایل اصلی</span> <span class="value">~۲.۴ گیگابایت</span></li>
<li><span>روش فشرده‌سازی</span> <span class="value">کوانتیزه‌سازی سه‌تایی (-۱، ۰، +۱)</span></li>
<li><span>مزیت</span> <span class="value">تعداد پارامتر بیشتر در حجم کم</span></li>
<li><span>محدودیت</span> <span class="value" style="color: var(--danger);">افت کیفیت واضح در جزئیات</span></li>
<li><span>ریسک</span> <span class="value" style="color: var(--warning);">احتمال عبور از ۴ گیگابایت با mmproj و context</span></li>
</ul>
</div>
<table class="styled-table" style="margin-top: 25px;">
<thead>
<tr>
<th>شاخص مقایسه</th>
<th>Qwen3.5-0.8B</th>
<th>MiniCPM-V-4.6</th>
<th>Ternary Bonsai 2 9B</th>
</tr>
</thead>
<tbody>
<tr>
<td>جمع حجم فایل‌ها</td>
<td style="color: var(--success); font-weight: 600;">~۱.۳ گیگابایت</td>
<td style="color: var(--success); font-weight: 600;">~۱.۲۵ گیگابایت</td>
<td style="color: var(--warning); font-weight: 600;">~۲.۴ گیگابایت + mmproj</td>
</tr>
<tr>
<td>VRAM مصرفی تقریبی</td>
<td style="color: var(--success); font-weight: 600;">~۲ گیگابایت</td>
<td style="color: var(--success); font-weight: 600;">~۱.۵ گیگابایت</td>
<td style="color: var(--danger); font-weight: 600;">نزدیک به سقف ۴ گیگابایت</td>
</tr>
<tr>
<td>کیفیت درک تصویر</td>
<td>پایه</td>
<td style="color: var(--success); font-weight: 600;">خوب</td>
<td>متغیر (افت در جزئیات)</td>
</tr>
<tr>
<td>سهولت اجرا روی ۴ گیگابایت</td>
<td style="color: var(--success); font-weight: 600;">بالا</td>
<td style="color: var(--success); font-weight: 600;">بالا</td>
<td style="color: var(--danger); font-weight: 600;">پایین (ریسک OOM)</td>
</tr>
<tr class="highlight-row">
<td><strong>ارزیابی نهایی</strong></td>
<td style="color: var(--success); font-weight: 700;">مناسب</td>
<td style="color: var(--success); font-weight: 700;">مناسب</td>
<td style="color: var(--warning); font-weight: 700;">با احتیاط</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۴</div>
<div class="section-title">
<h3>راهبرد اجرای ترکیبی CPU+GPU</h3>
<div class="subtitle">Hybrid CPU+GPU Execution Strategy</div>
</div>
</div>
<div class="section-content">
<p>کلید موفقیت در اجرای مدل چندرسانه‌ای روی GPU ۴ گیگابایتی، استفاده از راهبرد ترکیبی است. در این روش، فقط بخش پردازش تصویر روی GPU قرار می‌گیرد و مدل زبانی روی حافظه اصلی (RAM) اجرا می‌شود.</p>
<div class="info-box">
<strong>💡 پارامترهای کلیدی llama.cpp:</strong>
<ul style="padding-right: 20px; margin-top: 10px;">
<li><code>--mmproj-offload</code>: انتقال انکودر تصویر به GPU</li>
<li><code>-ngl 0</code>: نگه‌داشتن لایه‌های مدل زبانی روی CPU</li>
<li><code>-c</code>: محدود کردن طول context برای صرفه‌جویی در حافظه</li>
</ul>
</div>
<p>این رویکرد مزایای زیر را فراهم می‌کند:</p>
<ul style="padding-right: 20px; margin-top: 10px;">
<li style="margin-bottom: 8px;"><strong>پردازش سریع تصویر:</strong> انکودر تصویر روی GPU با سرعت بالا اجرا می‌شود</li>
<li style="margin-bottom: 8px;"><strong>عدم عبور از محدودیت VRAM:</strong> مدل زبانی فضای GPU را اشغال نمی‌کند</li>
<li style="margin-bottom: 8px;"><strong>پایداری اجرا:</strong> ریسک خطای کمبود حافظه به حداقل می‌رسد</li>
<li style="margin-bottom: 8px;"><strong>امکان استفاده از مدل‌های بزرگ‌تر:</strong> مدل زبانی می‌تواند از RAM سیستم استفاده کند</li>
</ul>
<div class="success-box">
<strong>✓ نتیجه عملی:</strong> با این راهبرد، ترکیب Qwen3.5-0.8B یا MiniCPM-V-4.6 با فایل‌های کوانتیزه Q4/Q8، تجربه‌ای پایدار و قابل قبول روی سخت‌افزار ۴ گیگابایتی فراهم می‌شود.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۵</div>
<div class="section-title">
<h3>محدودیت‌ها و ریسک‌ها</h3>
<div class="subtitle">Limitations & Risks</div>
</div>
</div>
<div class="section-content">
<p>اجرای مدل چندرسانه‌ای روی GPU ۴ گیگابایتی بدون محدودیت نیست. شناخت این محدودیت‌ها برای تصمیم‌گیری آگاهانه ضروری است:</p>
<div class="warning-box">
<strong>⚠️ محدودیت‌های اصلی:</strong>
<ul style="padding-right: 20px; margin-top: 10px;">
<li>کیفیت درک تصویر در مدل‌های بسیار کوچک محدودتر از مدل‌های بزرگ است</li>
<li>طول context قابل استفاده به دلیل محدودیت حافظه کاهش می‌یابد</li>
<li>سرعت تولید متن به دلیل اجرا روی CPU کمتر از اجرای کامل روی GPU است</li>
<li>مدل‌های با کوانتیزه‌سازی شدید ممکن است در جزئیات افت کیفیت نشان دهند</li>
<li>پردازش ویدیو یا تصاویر با رزولوشن بالا ممکن است زمان‌بر باشد</li>
</ul>
</div>
<p>با این حال، برای کاربردهای سبک مانند توصیف تصویر، تشخیص اشیا، پاسخ به سؤالات مبتنی بر تصویر و تحلیل‌های ساده، این محدودیت‌ها معمولاً قابل مدیریت هستند.</p>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۶</div>
<div class="section-title">
<h3>مستندات فنی و منابع معتبر</h3>
<div class="subtitle">Technical Evidence & References</div>
</div>
</div>
<div class="section-content">
<p>ادعاهای مطرح‌شده در این مستند مبتنی بر مستندات رسمی مدل‌ها و ابزارهای مرتبط است:</p>
<div class="quote-box">
<p>مدل Qwen3.5-0.8B با طراحی سبک، تنها حدود ۲ گیگابایت VRAM برای انکودر تصویر و سربار مصرف می‌کند و برای اجرا روی سخت‌افزار محدود مناسب است.</p>
<div class="source">— مستندات مدل Qwen3.5-0.8B، Hugging Face</div>
</div>
<div class="quote-box">
<p>نسخه Q4_K_M مدل MiniCPM-V-4.6 تنها ۵۲۹ مگابایت حجم دارد و همراه با فایل mmproj، مجموعاً حدود ۱.۲۵ گیگابایت فضا اشغال می‌کند.</p>
<div class="source">— کارت مدل MiniCPM-V-4.6، Hugging Face</div>
</div>
<div class="quote-box">
<p>برای تنظیمات با VRAM محدود، استفاده از فلگ mmproj-offload برای انتقال فقط انکودر تصویر به GPU و نگه‌داشتن مدل زبانی روی CPU توصیه می‌شود.</p>
<div class="source">— مستندات llama.cpp، بخش Multimodal</div>
</div>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">فهرست کامل منابع:</h4>
<ul class="reference-list">
<li>
<strong>Hugging Face Model Hub</strong>
"Qwen3.5-0.8B GGUF — Model Card"
<div class="ref-source">منبع: https://huggingface.co</div>
</li>
<li>
<strong>Hugging Face Model Hub</strong>
"MiniCPM-V-4.6 GGUF — Quantized Variants"
<div class="ref-source">منبع: https://huggingface.co</div>
</li>
<li>
<strong>llama.cpp Documentation</strong>
"Multimodal Support & mmproj Offloading"
<div class="ref-source">منبع: https://github.com/ggerganov/llama.cpp</div>
</li>
<li>
<strong>GGUF Format Specification</strong>
"Quantization Types and Memory Requirements"
<div class="ref-source">منبع: https://github.com/ggerganov/ggml</div>
</li>
</ul>
</div>
</div>
<!-- بخش جدید: واژه‌نامه -->
<div class="section">
<div class="section-header">
<div class="section-number">۷</div>
<div class="section-title">
<h3>واژه‌نامه کلمات کلیدی</h3>
<div class="subtitle">Glossary of Key Terms</div>
</div>
</div>
<div class="section-content">
<p>در این بخش، تمامی کلمات کلیدی فنی به‌کاررفته در این مستند در یک ناحیه مجزا تشریح و توضیح داده شده‌اند تا فهم کامل مفاهیم برای کارفرمای محترم فراهم باشد.</p>
<div class="glossary-grid">
<div class="glossary-item">
<div class="term">مدل چندرسانه‌ای <span class="en">Multimodal Model</span></div>
<div class="definition">مدل زبانی که علاوه بر متن، قادر به پردازش و درک انواع دیگر داده مانند تصویر، ویدیو یا صدا است. این مدل‌ها معمولاً از یک مدل زبانی به‌همراه یک انکودر تخصصی برای هر نوع داده تشکیل شده‌اند.</div>
</div>
<div class="glossary-item">
<div class="term">فرمت GGUF <span class="en">GGUF Format</span></div>
<div class="definition">فرمت فایل باینری برای ذخیره مدل‌های زبانی که توسط پروژه llama.cpp معرفی شده است. این فرمت برای اجرای بهینه مدل‌ها روی CPU و GPU طراحی شده و از کوانتیزه‌سازی پشتیبانی می‌کند.</div>
</div>
<div class="glossary-item">
<div class="term">VRAM <span class="en">Video RAM</span></div>
<div class="definition">حافظه اختصاصی کارت گرافیک که برای بارگذاری مدل‌ها و پردازش موازی استفاده می‌شود. در این مستند، محدودیت ۴ گیگابایت VRAM نقطه کلیدی طراحی راهبرد اجرا است.</div>
</div>
<div class="glossary-item">
<div class="term">GPU <span class="en">Graphics Processing Unit</span></div>
<div class="definition">واحد پردازش گرافیکی که برای محاسبات موازی و تسریع اجرای مدل‌های یادگیری ماشین به کار می‌رود. در این تحلیل، GPU با ۴ گیگابایت حافظه مدنظر است.</div>
</div>
<div class="glossary-item">
<div class="term">CPU <span class="en">Central Processing Unit</span></div>
<div class="definition">واحد پردازش مرکزی که محاسبات عمومی سیستم را انجام می‌دهد. در راهبرد ترکیبی، مدل زبانی روی CPU و حافظه اصلی (RAM) اجرا می‌شود تا فضای GPU آزاد بماند.</div>
</div>
<div class="glossary-item">
<div class="term">مدل زبانی <span class="en">LLM — Large Language Model</span></div>
<div class="definition">مدل یادگیری عمیق با پارامترهای زیاد که برای درک و تولید متن آموزش دیده است. در مدل‌های چندرسانه‌ای، LLM وظیفه استدلال و تولید پاسخ نهایی را بر عهده دارد.</div>
</div>
<div class="glossary-item">
<div class="term">انکودر تصویر <span class="en">Vision Projector / mmproj</span></div>
<div class="definition">بخشی از مدل چندرسانه‌ای که تصویر ورودی را به توکن‌های قابل فهم برای مدل زبانی تبدیل می‌کند. فایل جداگانه آن معمولاً با پسوند mmproj شناخته می‌شود و در راهبرد ترکیبی روی GPU بارگذاری می‌شود.</div>
</div>
<div class="glossary-item">
<div class="term">کوانتیزه‌سازی <span class="en">Quantization</span></div>
<div class="definition">فرآیند کاهش دقت اعداد مدل (مثلاً از ۱۶ بیت به ۴ بیت) برای کاهش حجم فایل و مصرف حافظه. این کار معمولاً با افت جزئی کیفیت همراه است اما اجرای مدل روی سخت‌افزار محدود را ممکن می‌سازد.</div>
</div>
<div class="glossary-item">
<div class="term">Q4_K_M و Q8 <span class="en">Quantization Types</span></div>
<div class="definition">نام‌گذاری انواع کوانتیزه‌سازی در فرمت GGUF. Q4_K_M به معنای کوانتیزه‌سازی ۴ بیتی با روش K-quant (حجم کمتر، افت کیفیت بیشتر) و Q8 به معنای کوانتیزه‌سازی ۸ بیتی (حجم بیشتر، کیفیت بالاتر) است.</div>
</div>
<div class="glossary-item">
<div class="term">کوانتیزه‌سازی سه‌تایی <span class="en">Ternary Quantization</span></div>
<div class="definition">روش فشرده‌سازی شدید که در آن وزن‌های مدل فقط یکی از سه مقدار -۱، ۰ یا +۱ را می‌گیرند. این روش حجم مدل را به‌شدت کاهش می‌دهد اما افت کیفیت واضحی ایجاد می‌کند.</div>
</div>
<div class="glossary-item">
<div class="term">llama.cpp <span class="en">llama.cpp</span></div>
<div class="definition">کتابخانه متن‌باز و پرکاربرد برای اجرای مدل‌های زبانی با فرمت GGUF روی سخت‌افزارهای مختلف. این ابزار از اجرای ترکیبی CPU+GPU و بارگذاری بخش‌های مختلف مدل پشتیبانی می‌کند.</div>
</div>
<div class="glossary-item">
<div class="term">فلگ <span class="en">Flag / Command-line Parameter</span></div>
<div class="definition">پارامتری که هنگام اجرای یک برنامه در خط فرمان برای تنظیم رفتار آن تعیین می‌شود. در این مستند، فلگ‌هایی مانند mmproj-offload و ngl برای کنترل نحوه بارگذاری مدل استفاده می‌شوند.</div>
</div>
<div class="glossary-item">
<div class="term">mmproj-offload <span class="en">--mmproj-offload</span></div>
<div class="definition">فلگ خط فرمان در llama.cpp که باعث می‌شود فقط فایل انکودر تصویر (mmproj) روی GPU بارگذاری شود. این فلگ کلید اجرای چندرسانه‌ای روی GPU محدود است.</div>
</div>
<div class="glossary-item">
<div class="term">ngl <span class="en">-ngl / Number of GPU Layers</span></div>
<div class="definition">فلگ خط فرمان در llama.cpp که تعداد لایه‌های مدل زبانی که باید روی GPU بارگذاری شوند را تعیین می‌کند. مقدار ۰ یعنی تمام لایه‌ها روی CPU اجرا شوند.</div>
</div>
<div class="glossary-item">
<div class="term">Context <span class="en">Context Window</span></div>
<div class="definition">طول متن یا توکن‌هایی که مدل می‌تواند در یک زمان ببیند و در حافظه نگه دارد. افزایش طول context مصرف حافظه را بالا می‌برد و باید در تنظیمات GPU محدود، کنترل شود.</div>
</div>
<div class="glossary-item">
<div class="term">توکن <span class="en">Token</span></div>
<div class="definition">واحد کوچک متن (می‌تواند بخشی از یک کلمه، یک کلمه یا یک علامت باشد) که مدل زبانی آن را پردازش می‌کند. تصاویر نیز در مدل‌های چندرسانه‌ای به توکن تبدیل می‌شوند.</div>
</div>
<div class="glossary-item">
<div class="term">OOM <span class="en">Out of Memory</span></div>
<div class="definition">خطای کمبود حافظه که زمانی رخ می‌دهد که مدل یا داده بیشتر از ظرفیت حافظه موجود (VRAM یا RAM) باشد. در GPU ۴ گیگابایتی، ریسک OOM با بارگذاری کامل مدل زبانی بالا می‌رود.</div>
</div>
<div class="glossary-item">
<div class="term">RAM <span class="en">Random Access Memory</span></div>
<div class="definition">حافظه اصلی سیستم که در راهبرد ترکیبی، مدل زبانی و لایه‌های آن روی آن اجرا می‌شوند تا فضای VRAM کارت گرافیک برای انکودر تصویر آزاد بماند.</div>
</div>
<div class="glossary-item">
<div class="term">Hugging Face <span class="en">Hugging Face</span></div>
<div class="definition">پلتفرم و مخزن آنلاین مدل‌های یادگیری ماشین که مدل‌های GGUF، کارت‌های مدل و مستندات فنی در آن منتشر می‌شوند. منبع اصلی بررسی گزینه‌های این مستند است.</div>
</div>
<div class="glossary-item">
<div class="term">دستگاه‌های لبه‌ای <span class="en">Edge Devices</span></div>
<div class="definition">دستگاه‌هایی با منابع محدود (مانند گوشی، رزبری پای یا لپ‌تاپ‌های کم‌توان) که مدل‌ها باید روی آن‌ها بهینه اجرا شوند. MiniCPM-V-4.6 برای این دسته طراحی شده است.</div>
</div>
<div class="glossary-item">
<div class="term">مدل پایه <span class="en">Base Model</span></div>
<div class="definition">مدل زبانی اصلی که قبل از آموزش تخصصی یا تنظیم دقیق (Fine-tuning) وجود دارد. در این مستند، کیفیت درک تصویر مدل‌های کوچک نسبت به مدل‌های بزرگ‌تر «پایه» توصیف شده است.</div>
</div>
</div>
<div class="info-box">
<strong>📌 نکته:</strong> آشنایی با این اصطلاحات برای پیکربندی صحیح ابزار llama.cpp و انتخاب مدل مناسب ضروری است. در صورت نیاز، راهنمای گام‌به‌گام اجرای عملی نیز قابل ارائه است.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۸</div>
<div class="section-title">
<h3>جمع‌بندی نهایی و پیشنهاد</h3>
<div class="subtitle">Final Summary & Recommendation</div>
</div>
</div>
<div class="section-content">
<p>با توجه به تحلیل‌های انجام‌شده، اجرای مدل چندرسانه‌ای GGUF روی GPU ۴ گیگابایتی با انتخاب صحیح مدل و راهبرد اجرای ترکیبی امکان‌پذیر است:</p>
<table class="styled-table">
<thead>
<tr>
<th>گزینه</th>
<th>مزیت اصلی</th>
<th>محدودیت اصلی</th>
<th>سطح توصیه</th>
</tr>
</thead>
<tbody>
<tr>
<td>Qwen3.5-0.8B</td>
<td>سبک‌ترین و سریع‌ترین</td>
<td>کیفیت پایه درک تصویر</td>
<td style="color: var(--success); font-weight: 600;">بالا</td>
</tr>
<tr>
<td>MiniCPM-V-4.6</td>
<td>تعادل حجم و کیفیت</td>
<td>نیاز به دانلود فایل mmproj جداگانه</td>
<td style="color: var(--success); font-weight: 600;">بالا</td>
</tr>
<tr>
<td>Ternary Bonsai 2 9B</td>
<td>پارامتر بیشتر در حجم کم</td>
<td>افت کیفیت و ریسک OOM</td>
<td style="color: var(--warning); font-weight: 600;">متوسط</td>
</tr>
<tr class="highlight-row">
<td><strong>پیشنهاد نهایی</strong></td>
<td colspan="2"><strong>شروع با Qwen3.5-0.8B یا MiniCPM-V-4.6 و راهبرد ترکیبی CPU+GPU</strong></td>
<td style="color: var(--success); font-weight: 700;">✓</td>
</tr>
</tbody>
</table>
<div class="conclusion-box">
<h3>🎯 پیشنهاد نهایی</h3>
<p>برای اجرای پایدار مدل چندرسانه‌ای روی GPU ۴ گیگابایتی، ترکیب مدل‌های کم‌حجم با کوانتیزه‌سازی Q4/Q8 و راهبرد اجرای ترکیبی CPU+GPU توصیه می‌شود.</p>
<p>این رویکرد ضمن حفظ پایداری اجرا، امکان بهره‌گیری از قابلیت‌های چندرسانه‌ای را روی سخت‌افزار محدود فراهم می‌آورد.</p>
<div class="highlight">
<strong>💎 ارزش پیشنهادی:</strong><br>
اجرای پایدار + کیفیت قابل قبول + استفاده بهینه از سخت‌افزار موجود + ریسک حداقلی OOM
</div>
</div>
<div class="info-box">
<strong>📞 گام بعدی:</strong> در صورت تمایل، آماده ارائه راهنمای گام‌به‌گام نصب و پیکربندی مدل‌های پیشنهادی همراه با پارامترهای دقیق llama.cpp برای محیط عملیاتی هستم.
</div>
</div>
</div>
<div class="page-info">
این مستند محرمانه بوده و صرفاً جهت ارائه به کارفرمای محترم تهیه شده است. هرگونه کپی‌برداری یا افشا بدون اجازه کتبی ممنوع است.
</div>
</div>
<footer class="document-footer">
<div class="footer-brand">طراحی و توسعه: هادی خزاعی اصل</div>
<div class="footer-divider"></div>
<div>تاریخ تهیه: مهر ۱۴۰۵ &nbsp;|&nbsp; نسخه: ۱.۱ &nbsp;|&nbsp; طبقه‌بندی: محرمانه</div>
</footer>
</div>
</body>
</html>