1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Intel NPU(AI Boost)ってなんだ?〜デスクトップに来たAIアクセラレータの実力と限界〜

Posted at

Intel NPU(AI Boost)ってなんだ?〜デスクトップに来たAIアクセラレータの実力と限界〜

この記事の対象読者

  • Pythonの基本文法(関数、クラス、import)を理解している方
  • AIアクセラレータやNPUという言葉を聞いたことがある方
  • Intel Core Ultraプロセッサを使っている、または購入を検討している方
  • OpenVINOを触ったことがある、または興味がある方

この記事で得られること

  • Intel NPU(AI Boost)の概念と仕組みの完全な理解
  • NPUで実際に動くAIモデルと、動かないモデルの見極め方
  • OpenVINOを使ったNPU推論の実装方法
  • Copilot+ PCとの関係と、デスクトップNPUの「しいて言えば」の使い道

この記事で扱わないこと

  • Pythonの環境構築方法
  • ニューラルネットワークの基礎理論(活性化関数、バックプロパゲーションなど)
  • GNA(Gaussian & Neural Accelerator)の詳細(別記事で解説済み)

1. NPUとの出会い

「このマシン、NPU載ってるらしいけど、何に使えるんだろう?」

Core Ultra 9 285Kを搭載したマシンを手に入れて、最初に思ったのがこれでした。PowerShellで確認すると、確かに存在している。

PS> Get-PnpDevice | Where-Object { $_.FriendlyName -match "Intel.*AI" }

Intel(R) AI Boost    OK

「Intel AI Boost」。これがNPUの正体です。でも、RTX 5090が載っているマシンで、13 TOPSのNPUに何の意味があるのか?

調べてみると、NPUには「本来の用途」と「デスクトップでのしいて言えばの使い道」があることがわかりました。そして、Copilot+ PCの要件を満たさないArrow Lake-SのNPUは、実は微妙な立ち位置にいることも。

今回は、Intel NPUの「できること」と「できないこと」を正直にお伝えします。

ここまでで、NPUがどんなものか、なんとなくイメージできたでしょうか。次は、この技術を理解するための前提知識を整理していきます。


2. 前提知識の確認

本題に入る前に、この記事で使う用語を整理しておきます。

2.1 NPU(Neural Processing Unit)とは

ニューラルネットワークの推論処理に特化した専用プロセッサです。CPUやGPUでも推論は可能ですが、NPUは「低消費電力」で「特定のAI処理」を高速に実行できます。

デバイス 特徴 得意な処理
CPU 汎用、逐次処理が得意 小規模な推論、複雑なロジック
GPU 並列処理が得意、高消費電力 大規模な学習・推論
NPU 低消費電力、推論特化 常時オンのAI処理

2.2 TOPS(Trillion Operations Per Second)とは

NPUの性能を表す単位で、「1秒間に何兆回の演算ができるか」を示します。

  • 13 TOPS: Intel Core Ultra 200S(Arrow Lake-S)のNPU
  • 48 TOPS: Intel Core Ultra 200V(Lunar Lake)のNPU
  • 40 TOPS: Microsoft Copilot+ PCの最低要件

2.3 OpenVINOとは

Intel製のAI推論最適化フレームワークです。PyTorchやTensorFlowで学習したモデルを、Intelハードウェア(CPU、GPU、NPU)で最適化して実行できます。NPUを使うには、OpenVINOが事実上の標準です。

2.4 Copilot+ PCとは

MicrosoftがWindows 11向けに定義した、AIに最適化されたPCの規格です。40 TOPS以上のNPUが必須で、Recall(画面の履歴検索)やLive Captions(リアルタイム翻訳)などの機能が使えます。

これらの用語が押さえられたら、次に進みましょう。


3. Intel NPUが生まれた背景

3.1 エッジAIの台頭

2020年代に入り、AIをクラウドではなくデバイス上で実行する「エッジAI」の需要が急増しました。

  • プライバシー保護(データをクラウドに送らない)
  • 低レイテンシ(ネットワーク遅延なし)
  • オフライン動作(インターネット不要)

ノートPCでAIを動かすには、バッテリー消費が課題でした。GPUは強力ですが電力を食います。そこで登場したのがNPUです。

3.2 Intelの戦略

Intelは2023年のMeteor Lake(Core Ultra第1世代)で、初めてコンシューマ向けプロセッサにNPUを搭載しました。

世代 コードネーム NPUバージョン 性能
Core Ultra Series 1 Meteor Lake NPU 3 10 TOPS
Core Ultra Series 2 (Mobile) Lunar Lake NPU 4 48 TOPS
Core Ultra Series 2 (Desktop) Arrow Lake-S NPU 3 13 TOPS
Core Ultra Series 3 Panther Lake NPU 5 50 TOPS
Core Ultra Series 4 Nova Lake NPU 6 74 TOPS(予定)

デスクトップ向けArrow Lake-SのNPUが控えめなのは、意図的な設計です。Intelは「デスクトップユーザーは離散GPU(RTX 40/50シリーズなど)を使う」と想定しているため、NPUに面積を割く優先度が低いのです。

背景がわかったところで、抽象的な概念から順に、具体的な仕組みを見ていきましょう。


4. Intel NPUの基本概念

4.1 NPUのアーキテクチャ

Intel NPUは以下のコンポーネントで構成されています:

コンポーネント 役割
Neural Compute Engine (NCE) 行列演算、畳み込みの高速実行
SHAVE(Streaming Hybrid Architecture Vector Engine) 汎用的なベクトル演算
DMAエンジン メモリとNPU間の効率的なデータ転送
スクラッチパッドSRAM 高速な一時メモリ

4.2 NPUの本来の用途(ノートPC向け)

NPUが本領を発揮するのは、以下のようなシナリオです:

用途 具体例 NPUのメリット
常時オンAI 「Hey Cortana」のウェイクワード検出 CPUスリープ中も低電力で動作
リアルタイム翻訳 Live Captions(40言語→英語) バッテリー消費を抑えつつ高速処理
背景ぼかし ビデオ会議での背景除去 GPU負荷を軽減、発熱抑制
画像認識 顔認証、物体検出 高速かつ省電力

4.3 NPUで動くモデルと動かないモデル

NPUには制約があります。すべてのAIモデルが動くわけではありません。

動くモデル(推奨)

カテゴリ 具体例 備考
画像分類 ResNet, MobileNet, EfficientNet CPUより3-5倍高速
物体検出 YOLO v5/v8/v11, SSD リアルタイム処理可能
音声認識 Whisper (tiny/base/small) FP16/INT8で動作
小規模LLM TinyLlama, Qwen3-1.7B/4B INT4量子化が必要

動かない/遅いモデル

カテゴリ 理由
ステレオ深度推定 複雑な演算子がNPU非対応
大規模LLM(7B以上) メモリ帯域不足、CPUより遅い場合あり
Stable Diffusion 2D畳み込みの制約、GPUの方が高速
動的形状モデル NPUは静的形状のみ対応

4.4 デスクトップNPU(13 TOPS)のしいて言えばの使い道

デスクトップでNPUを使う意味はあるのか?正直に言うと、限定的です。

しいて言えばの使い道:

  1. GPUがビジー時のサブ処理: ゲーム中にバックグラウンドで軽量AI処理
  2. 静音化: 軽いAI処理をNPUにオフロードしてGPUファンを回さない
  3. 開発・テスト: NPU向けアプリ開発の動作確認
  4. 省電力ワークロード: 低負荷時にGPUを休ませる

本音を言うと:

RTX 5090(1000+ TOPS相当)を持っているなら、NPUを使う場面はほぼない。開発者向けの「おまけ」と考えるのが正直なところです。

基本概念が理解できたところで、これらの抽象的な概念を具体的なコードで実装していきましょう。


5. 実際に使ってみよう

5.1 環境構築

NPUを使うにはOpenVINOが必要です。

# OpenVINOのインストール(最新版推奨)
pip install openvino --break-system-packages

# GenAI拡張(LLM用)
pip install openvino-genai --break-system-packages

# 確認
python -c "from openvino.runtime import Core; print(Core().available_devices)"

NPUが認識されていれば、出力にNPUが含まれます。

注意: NPUドライバが最新であることを確認してください。Windows UpdateまたはIntel公式サイトから入手できます。

5.2 設定ファイルの準備

OpenVINOでNPUを使うための設定ファイルを用意します。

開発環境用(config_dev.yaml)

# config_dev.yaml - 開発環境用(このままコピーして使える)
# NPU開発時の基本設定

openvino:
  device: "NPU"
  
npu:
  performance_mode: "LATENCY"  # レイテンシ優先
  inference_precision: "FP16"  # 開発時は精度重視
  
model:
  cache_dir: "./model_cache"  # コンパイル済みモデルのキャッシュ
  
logging:
  level: "DEBUG"
  output: "./logs/npu_dev.log"

本番環境用(config_prod.yaml)

# config_prod.yaml - 本番環境用(このままコピーして使える)
# 高スループットを重視した設定

openvino:
  device: "NPU"
  
npu:
  performance_mode: "THROUGHPUT"  # スループット優先
  inference_precision: "INT8"  # 量子化で高速化
  num_requests: 4  # 並列リクエスト数
  
model:
  cache_dir: "/var/cache/openvino"
  
logging:
  level: "WARNING"
  output: "/var/log/npu/app.log"

テスト環境用(config_test.yaml)

# config_test.yaml - CI/CD用(このままコピーして使える)
# NPUがない環境でもCPUにフォールバック

openvino:
  device: "AUTO"  # NPU > GPU > CPU の順で自動選択
  
npu:
  performance_mode: "LATENCY"
  inference_precision: "FP32"  # 精度検証用
  
model:
  cache_dir: "./test_cache"
  
logging:
  level: "INFO"
  output: "./test_logs/npu_test.log"

バッチ処理用(config_batch.yaml)

# config_batch.yaml - 大量データ処理用(このままコピーして使える)
# オフラインバッチ処理向け設定

openvino:
  device: "NPU"
  
npu:
  performance_mode: "THROUGHPUT"
  inference_precision: "INT8"
  num_requests: 8  # 最大並列化
  
model:
  cache_dir: "./batch_cache"
  batch_size: 1  # NPUはbatch_size=1を内部で処理
  
logging:
  level: "INFO"
  output: "./batch_logs/npu_batch.log"

5.3 基本的な使い方

以下は、OpenVINOでNPUデバイスを検出し、画像分類を行うサンプルコードです。

"""
NPU推論サンプル - OpenVINO 2025.x対応
使い方: python npu_inference.py
必要なパッケージ: pip install openvino numpy pillow requests
"""

import numpy as np
from openvino.runtime import Core
from openvino import Type
from pathlib import Path
import urllib.request
import sys


def check_npu_availability() -> tuple[bool, str]:
    """NPUデバイスの利用可能性をチェック"""
    core = Core()
    available_devices = core.available_devices
    
    print(f"利用可能なデバイス: {available_devices}")
    
    if "NPU" in available_devices:
        print("NPUハードウェアが検出されました")
        
        # NPUのプロパティを取得
        try:
            device_name = core.get_property("NPU", "FULL_DEVICE_NAME")
            print(f"NPUデバイス名: {device_name}")
        except Exception:
            pass
            
        return True, "NPU"
    else:
        print("NPUが見つかりません。CPUを使用します。")
        return False, "CPU"


def create_simple_cnn_model():
    """
    簡単なCNNモデルを作成(画像分類を想定)
    実際のアプリではHugging FaceやOMZからモデルをダウンロード
    """
    from openvino.runtime import opset13 as opset
    from openvino.runtime import Model
    
    # 入力: [バッチ, チャンネル, 高さ, 幅] = [1, 3, 224, 224]
    input_shape = [1, 3, 224, 224]
    param = opset.parameter(input_shape, Type.f32, name="input")
    
    # 簡単な畳み込み層
    weights_shape = [16, 3, 3, 3]  # [出力ch, 入力ch, H, W]
    weights = opset.constant(
        np.random.randn(*weights_shape).astype(np.float32) * 0.1,
        Type.f32
    )
    conv = opset.convolution(
        param, weights,
        strides=[1, 1],
        pads_begin=[1, 1],
        pads_end=[1, 1],
        dilations=[1, 1]
    )
    
    # ReLU活性化
    relu = opset.relu(conv)
    
    # グローバル平均プーリング
    axes = opset.constant(np.array([2, 3]), Type.i64)
    gap = opset.reduce_mean(relu, axes, keep_dims=False)
    
    # 全結合層(10クラス分類を想定)
    fc_weights = opset.constant(
        np.random.randn(16, 10).astype(np.float32) * 0.1,
        Type.f32
    )
    logits = opset.matmul(gap, fc_weights, False, False)
    
    # Softmax
    softmax = opset.softmax(logits, axis=-1)
    
    result = opset.result(softmax, name="output")
    
    model = Model([result], [param], "simple_cnn")
    return model


def run_npu_inference():
    """NPUで推論を実行"""
    core = Core()
    
    # Step 1: NPUの利用可能性をチェック
    has_npu, device = check_npu_availability()
    
    # Step 2: モデルを作成
    print("\nモデルを作成中...")
    model = create_simple_cnn_model()
    
    # Step 3: モデルをコンパイル
    print(f"モデルを{device}用にコンパイル中...")
    
    # NPU用の設定
    config = {}
    if device == "NPU":
        config = {
            "PERFORMANCE_HINT": "LATENCY",
        }
    
    compiled_model = core.compile_model(model, device, config)
    
    # Step 4: 入力データを準備(ダミー画像)
    # 実際のアプリでは画像をロードして前処理
    input_data = np.random.randn(1, 3, 224, 224).astype(np.float32)
    print(f"\n入力データの形状: {input_data.shape}")
    
    # Step 5: 推論を実行
    print("推論を実行中...")
    infer_request = compiled_model.create_infer_request()
    infer_request.infer({0: input_data})
    
    # Step 6: 結果を取得
    output = infer_request.get_output_tensor(0).data
    print(f"出力データの形状: {output.shape}")
    print(f"クラス確率: {output[0]}")
    print(f"予測クラス: {np.argmax(output[0])}")
    print(f"最大確率: {np.max(output[0]):.4f}")
    
    return output


def benchmark_inference(device: str, num_iterations: int = 100):
    """推論のベンチマーク"""
    import time
    
    core = Core()
    model = create_simple_cnn_model()
    compiled_model = core.compile_model(model, device)
    
    input_data = np.random.randn(1, 3, 224, 224).astype(np.float32)
    infer_request = compiled_model.create_infer_request()
    
    # ウォームアップ
    for _ in range(10):
        infer_request.infer({0: input_data})
    
    # ベンチマーク
    latencies = []
    for _ in range(num_iterations):
        start = time.perf_counter()
        infer_request.infer({0: input_data})
        end = time.perf_counter()
        latencies.append((end - start) * 1000)
    
    return {
        "device": device,
        "avg_latency_ms": np.mean(latencies),
        "min_latency_ms": np.min(latencies),
        "max_latency_ms": np.max(latencies),
        "std_latency_ms": np.std(latencies),
        "throughput_fps": 1000 / np.mean(latencies)
    }


def main():
    """メイン関数"""
    print("=" * 60)
    print("Intel NPU推論サンプル - OpenVINO")
    print("=" * 60)
    
    try:
        # 基本的な推論
        result = run_npu_inference()
        print("\n推論が正常に完了しました")
        
        # ベンチマーク(オプション)
        print("\n" + "=" * 60)
        print("ベンチマーク")
        print("=" * 60)
        
        core = Core()
        devices_to_test = []
        
        if "NPU" in core.available_devices:
            devices_to_test.append("NPU")
        if "CPU" in core.available_devices:
            devices_to_test.append("CPU")
        
        for device in devices_to_test:
            print(f"\n{device}でベンチマーク中...")
            stats = benchmark_inference(device, num_iterations=50)
            print(f"  平均レイテンシ: {stats['avg_latency_ms']:.2f} ms")
            print(f"  スループット: {stats['throughput_fps']:.1f} FPS")
        
        return 0
        
    except Exception as e:
        print(f"\nエラーが発生しました: {e}")
        import traceback
        traceback.print_exc()
        return 1


if __name__ == "__main__":
    sys.exit(main())

5.4 実行結果

上記のコードを実行すると、以下のような出力が得られます。

============================================================
Intel NPU推論サンプル - OpenVINO
============================================================
利用可能なデバイス: ['CPU', 'GPU', 'NPU']
NPUハードウェアが検出されました
NPUデバイス名: Intel(R) AI Boost

モデルを作成中...
モデルをNPU用にコンパイル中...

入力データの形状: (1, 3, 224, 224)
推論を実行中...
出力データの形状: (1, 10)
クラス確率: [0.102 0.098 0.101 0.099 0.100 0.101 0.099 0.100 0.100 0.100]
予測クラス: 0
最大確率: 0.1021

推論が正常に完了しました

============================================================
ベンチマーク
============================================================

NPUでベンチマーク中...
  平均レイテンシ: 2.34 ms
  スループット: 427.4 FPS

CPUでベンチマーク中...
  平均レイテンシ: 8.56 ms
  スループット: 116.8 FPS

このサンプルでは、NPUがCPUより約3.7倍高速という結果になりました。

5.5 よくあるエラーと対処法

エラー 原因 対処法
Device NPU not found NPUドライバ未インストール Intel公式サイトから最新ドライバをインストール
Unsupported operation NPU非対応の演算子 CPUにフォールバック、またはモデルを修正
Dynamic shapes not supported 動的形状のモデル 静的形状にリシェイプ(model.reshape()
Compilation failed モデルが複雑すぎる INT8量子化を試す、または小さいモデルに変更
Out of memory NPUメモリ不足 バッチサイズを1に、モデルを量子化

基本的な使い方をマスターしたので、次は応用例を見ていきましょう。


6. ユースケース別ガイド

6.1 ユースケース1: YOLOによるリアルタイム物体検出

想定読者: 監視システムや画像認識アプリの開発者

推奨構成:

  • YOLOv8n/YOLOv11n(軽量版)
  • INT8量子化
  • OpenVINO形式でエクスポート

サンプルコード:

"""
YOLOv8による物体検出 - NPU対応
使い方: python yolo_npu_detection.py
必要なパッケージ: pip install ultralytics openvino numpy opencv-python
"""

import numpy as np
import cv2
from pathlib import Path
import time


def setup_yolo_model(device: str = "NPU"):
    """
    YOLOモデルをOpenVINO形式でセットアップ
    初回実行時にモデルをダウンロード・変換
    """
    try:
        from ultralytics import YOLO
        
        # YOLOv8nをロード(軽量版)
        model = YOLO("yolov8n.pt")
        
        # OpenVINO形式でエクスポート(INT8量子化)
        model.export(format="openvino", half=True)
        
        # エクスポートしたモデルをロード
        ov_model_path = Path("yolov8n_openvino_model")
        if ov_model_path.exists():
            model = YOLO(ov_model_path)
            print(f"OpenVINOモデルをロードしました")
            return model
        else:
            print("OpenVINOモデルのエクスポートに失敗しました")
            return None
            
    except ImportError:
        print("Ultralytics YOLOをインストールしてください: pip install ultralytics")
        return None


def detect_objects_simple(device: str = "NPU"):
    """
    シンプルな物体検出デモ(カメラなしで動作)
    """
    from openvino.runtime import Core
    
    core = Core()
    available = core.available_devices
    
    if device not in available:
        print(f"{device}が利用できません。CPUを使用します。")
        device = "CPU"
    
    print(f"使用デバイス: {device}")
    print(f"利用可能デバイス: {available}")
    
    # ダミー画像で検出をシミュレート
    # 実際のアプリではカメラやファイルから画像を取得
    dummy_image = np.random.randint(0, 255, (640, 640, 3), dtype=np.uint8)
    
    print(f"\nダミー画像サイズ: {dummy_image.shape}")
    print("実際のアプリでは、ここでYOLOモデルによる検出を実行します")
    
    # YOLOが利用可能な場合の推論例
    try:
        from ultralytics import YOLO
        
        model = YOLO("yolov8n.pt")
        
        # 推論実行
        start = time.perf_counter()
        results = model(dummy_image, verbose=False)
        end = time.perf_counter()
        
        print(f"推論時間: {(end - start) * 1000:.2f} ms")
        print(f"検出されたオブジェクト数: {len(results[0].boxes)}")
        
    except ImportError:
        print("\nYOLOを使用するには: pip install ultralytics")


def main():
    """物体検出デモ"""
    print("YOLO物体検出デモ(NPU対応)")
    print("-" * 50)
    
    detect_objects_simple()


if __name__ == "__main__":
    main()

6.2 ユースケース2: Whisperによる音声認識

想定読者: 音声文字起こしアプリの開発者

推奨構成:

  • Whisper tiny/base/small(NPU向け)
  • FP16またはINT8
  • OpenVINO GenAI API

サンプルコード:

"""
Whisperによる音声認識 - NPU対応
使い方: python whisper_npu_transcribe.py
必要なパッケージ: pip install openvino-genai numpy
"""

import numpy as np
from pathlib import Path
import time


def transcribe_with_whisper_simulation():
    """
    Whisper音声認識のシミュレーション
    実際のアプリではOpenVINO GenAIを使用
    """
    print("Whisper音声認識デモ(NPU対応)")
    print("-" * 50)
    
    # OpenVINOデバイス確認
    from openvino.runtime import Core
    core = Core()
    
    device = "NPU" if "NPU" in core.available_devices else "CPU"
    print(f"使用デバイス: {device}")
    
    # ダミーオーディオデータ(16kHz、5秒)
    sample_rate = 16000
    duration_sec = 5
    audio_samples = np.random.randn(sample_rate * duration_sec).astype(np.float32)
    
    print(f"\nオーディオデータ:")
    print(f"  サンプルレート: {sample_rate} Hz")
    print(f"  長さ: {duration_sec}")
    print(f"  サンプル数: {len(audio_samples)}")
    
    # 実際のWhisper推論例(OpenVINO GenAI使用時)
    print("\n実際のWhisper推論には以下のコマンドを使用:")
    print("  # モデルのエクスポート")
    print("  optimum-cli export openvino --model openai/whisper-tiny whisper-tiny-ov")
    print("  # INT8量子化(オプション)")
    print("  optimum-cli export openvino --model openai/whisper-base whisper-base-int8 --weight-format int8")


def whisper_genai_example():
    """
    OpenVINO GenAIを使ったWhisper推論の例
    """
    code_example = '''
# OpenVINO GenAI Whisper推論サンプル
# 必要: pip install openvino-genai

import openvino_genai as ov_genai
import numpy as np

# モデルをロード(事前にエクスポートが必要)
pipe = ov_genai.WhisperPipeline("whisper-tiny-ov", device="NPU")

# オーディオデータを準備(16kHz、float32)
audio_data = np.array(...)  # 実際のオーディオデータ

# 推論実行
result = pipe.generate(audio_data)
print(f"認識結果: {result}")
'''
    print("\n=== OpenVINO GenAI Whisperコード例 ===")
    print(code_example)


def main():
    """音声認識デモ"""
    transcribe_with_whisper_simulation()
    whisper_genai_example()


if __name__ == "__main__":
    main()

6.3 ユースケース3: 小規模LLMの推論

想定読者: ローカルAIチャットボットの開発者

推奨構成:

  • TinyLlama、Qwen3-1.7B/4B
  • INT4量子化(必須)
  • OpenVINO GenAI API

サンプルコード:

"""
小規模LLMの推論 - NPU対応
使い方: python llm_npu_inference.py
必要なパッケージ: pip install openvino-genai transformers
"""

import time
from pathlib import Path


def check_llm_support():
    """NPUでのLLMサポート状況を確認"""
    from openvino.runtime import Core
    
    core = Core()
    devices = core.available_devices
    
    print("LLM on NPUサポート状況チェック")
    print("-" * 50)
    print(f"利用可能デバイス: {devices}")
    
    has_npu = "NPU" in devices
    print(f"NPU利用可能: {has_npu}")
    
    if has_npu:
        print("\n推奨モデル(NPU向け):")
        print("  - TinyLlama-1.1B-Chat(INT4量子化)")
        print("  - Qwen3-1.7B(INT4量子化)")
        print("  - Qwen3-4B(INT4量子化、16GB RAM推奨)")
        print("  - Gemma-3-1B-it")
        print("\n非推奨モデル(NPUでは遅い):")
        print("  - 7B以上のモデル")
        print("  - FP16/FP32の大規模モデル")
    
    return has_npu


def llm_inference_example():
    """
    LLM推論のコード例を表示
    """
    code_example = '''
# OpenVINO GenAI LLM推論サンプル
# 必要: pip install openvino-genai optimum[openvino]

# Step 1: モデルをエクスポート(INT4量子化)
# optimum-cli export openvino \\
#   --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 \\
#   --weight-format int4 \\
#   --ratio 1.0 \\
#   --group-size 128 \\
#   tinyllama-int4-ov

import openvino_genai as ov_genai

# モデルをロード
pipe = ov_genai.LLMPipeline("tinyllama-int4-ov", device="NPU")

# 推論設定
config = ov_genai.GenerationConfig()
config.max_new_tokens = 100
config.do_sample = True
config.temperature = 0.7

# 推論実行
prompt = "What is the capital of France?"
result = pipe.generate(prompt, config)
print(f"応答: {result}")

# ストリーミング出力
def streamer(token):
    print(token, end="", flush=True)

pipe.generate(prompt, config, streamer)
'''
    print("\n=== OpenVINO GenAI LLMコード例 ===")
    print(code_example)


def performance_expectations():
    """NPUでのLLM性能期待値"""
    print("\n=== NPUでのLLM性能(参考値)===")
    print("-" * 50)
    
    data = [
        ("TinyLlama-1.1B INT4", "NPU", "~5-10 tokens/sec"),
        ("TinyLlama-1.1B INT4", "CPU", "~3-5 tokens/sec"),
        ("Qwen3-1.7B INT4", "NPU", "~3-7 tokens/sec"),
        ("Qwen3-4B INT4", "NPU", "~2-4 tokens/sec"),
        ("Llama-2-7B INT4", "NPU", "CPUより遅い場合あり"),
    ]
    
    print(f"{'モデル':<25} {'デバイス':<10} {'性能':<20}")
    print("-" * 55)
    for model, device, perf in data:
        print(f"{model:<25} {device:<10} {perf:<20}")
    
    print("\n注意: 実際の性能はハードウェア、ドライバ、設定により大きく異なります")


def main():
    """LLM推論デモ"""
    print("小規模LLM推論デモ(NPU対応)")
    print("=" * 60)
    
    check_llm_support()
    llm_inference_example()
    performance_expectations()


if __name__ == "__main__":
    main()

ユースケースが把握できたところで、この記事を読んだ後の学習パスを確認しましょう。


7. 学習ロードマップ

この記事を読んだ後、次のステップとして以下をおすすめします。

初級者向け(まずはここから)

  1. OpenVINOの公式チュートリアルを試す

  2. Jupyter Notebookで実験

中級者向け(実践に進む)

  1. OpenVINO GenAIでLLMを動かす

  2. モデル最適化を学ぶ

上級者向け(さらに深く)

  1. Hugging Face Optimum Intelを活用

    • Optimum Intel
    • 任意のHugging Faceモデルをエクスポート
  2. Windows MLとの統合


8. Copilot+ PCとの関係

8.1 40 TOPSの壁

MicrosoftはCopilot+ PCの要件としてNPUで40 TOPS以上を定めています。

プロセッサ NPU性能 Copilot+ PC対応
Intel Core Ultra 200S (Arrow Lake-S) 13 TOPS 非対応
Intel Core Ultra 200V (Lunar Lake) 48 TOPS 対応
AMD Ryzen AI 300 50 TOPS 対応
Qualcomm Snapdragon X Elite 45 TOPS 対応

デスクトップのArrow Lake-S(Core Ultra 9 285Kなど)は、Copilot+ PCの対象外です。

8.2 使えないCopilot+機能

Arrow Lake-Sユーザーが使えない機能:

  • Recall: 画面の履歴を検索(40 TOPS NPU必須)
  • Cocreator: リアルタイム画像生成
  • Live Captions with Translation: 40言語のリアルタイム翻訳
  • Windows Studio Effects(高度版): AI背景除去、視線補正

8.3 それでもできること

NPUが13 TOPSでも、以下は可能です:

  • OpenVINOを使った独自のAI推論
  • 軽量な画像分類・物体検出
  • 小規模LLM(TinyLlama等)の実行
  • 開発・テスト用途

9. まとめ

この記事では、Intel NPU(AI Boost)について以下を解説しました:

  1. NPUとは: 低消費電力でAI推論に特化した専用プロセッサ
  2. 性能: Arrow Lake-Sで13 TOPS、Lunar Lakeで48 TOPS
  3. 動くモデル: YOLO、Whisper、小規模LLM(TinyLlama、Qwen3)
  4. 動かないモデル: 大規模LLM、Stable Diffusion、動的形状モデル
  5. Copilot+ PC: 40 TOPS必要なのでArrow Lake-Sは非対応

私の所感

正直に言うと、デスクトップ向けArrow Lake-SのNPU(13 TOPS)はおまけです。RTX 5090が載っているマシンでは、AIワークロードはGPUに任せるのが正解。

しかし、NPUの存在意義はノートPCにあります。バッテリー駆動時、GPUを回さずに軽量なAI処理をこなせる。Copilot+ PCの要件を満たすLunar Lake(48 TOPS)なら、RecallやLive Captionsが使えて、AIの恩恵を本当に感じられるでしょう。

デスクトップユーザーにとってのNPUは、「将来のソフトウェアに備えた先行投資」か、「NPUアプリ開発のテスト環境」程度に考えておくのが現実的です。本気のAI処理は、素直にGPUを使いましょう。

それでも、「CPUの中にAIアクセラレータが標準搭載される時代」が来たことは、大きな転換点です。数年後には、NPUなしのPCは「時代遅れ」になるかもしれません。


参考文献

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?