0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Semantic Kernel:Phi-4試用

Posted at

昨年12月12日、マイクロソフトは初めてPhi-4モデリングを発表しました。このモデルは140億のパラメータを持ちながらも、非常に強力な性能を発揮しています。多くのテストで優れた結果を示しました。

  1. GPQA(大学院レベルの質疑応答)とMATH数学ベンチマークテストでは、Phi-4はOpenAIのGPT-4oや、同類のトップオープンソースモデルQwen 2.5 - 14BとLlama 3.3 - 70Bを上回るパフォーマンスを見せました。

  2. AMCアメリカ数学コンテストテストで、Phi-4は91.8ポイントを獲得し、Gemini Pro 1.5、GPT-4o、Claude 3.5 Sonnet、Qwen 2.5といった有名なオープン・クローズドソースモデルを凌ぎました。

  3. 全体的なパフォーマンスは4050億のパラメータを持つLlama 3.1モデルに匹敵するほどです。

総括すると、Phi-4は比較的少ないパラメータでありながら、非常に高い性能と競争力を示しています。

本日、Phi-4が正式にリリースされましたので、以前にプレリリース版を試した経験から、再度この新バージョンを試すことにしました。以下はその試用の過程です。

ollamaでPhi-4をダウンロード

画像

SemanticKernel+ollamaで実行

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.ChatCompletion;
using Microsoft.SemanticKernel.Connectors.Ollama;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using OllamaSharp;
using OpenAI.RealtimeConversation;
using System;
using System.ComponentModel;
#pragma warning disable SKEXP0001
#pragma warning disable SKEXP0010
#pragma warning disable SKEXP0070

await Call();

async Task Call1()
{
    var ollamaApiClient = new OllamaApiClient(new Uri("http://localhost:11434"), "phi4:latest");
    var builder = Kernel.CreateBuilder();
    builder.Services.AddScoped<IChatCompletionService>(_ => ollamaApiClient.AsChatCompletionService());
    var kernel = builder.Build();
    var chatService = kernel.GetRequiredService<IChatCompletionService>();
    
    while (true)
    {
        Console.Write("ユーザー:");
        var input = Console.ReadLine();
        if (string.IsNullOrWhiteSpace(input))
        {
            break;
        }
        var response = chatService.GetStreamingChatMessageContentsAsync(input);
        var content = "";
        var role = AuthorRole.Assistant;
        Console.ForegroundColor = ConsoleColor.Green;
        Console.Write("助手:");
        await foreach (var message in response)
        {
            Console.Write($" {message.Content}");
            content += message.Content;
            role = message.Role.Value;
        }
        Console.WriteLine();
        Console.ResetColor();
    }
}

よくある論理問題を試す

画像

文雅な内容生成問題を試す

画像

翻訳を試す

画像

比較のためGoogleの翻訳を持ち出して

画像

最後にChatGPT 4oとの比較

画像


全体的な体験として、私はSLM人として非常に満足しており、生産でもかなり使える性能だと感じました。ただし、現在function callingには対応していません。また、上記のテストはすべて自分のノートパソコンで実行したもので、速度も受け入れられるものでした。生産で運用する場合、グラフィックカードを使用すれば速度はさらに向上すると考えられます。私の評価としてはPhi-4に85点をつけますが、function callingが追加されれば完璧だと思います。

画像

(Translated by GPT)

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?