惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MyScale Blog
MyScale Blog
Jina AI
Jina AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
博客园 - 司徒正美
Martin Fowler
Martin Fowler
T
Tailwind CSS Blog
B
Blog RSS Feed
Vercel News
Vercel News
博客园 - 聂微东
I
InfoQ
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
M
MIT News - Artificial intelligence
Recent Announcements
Recent Announcements
GbyAI
GbyAI
L
LangChain Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
C
Check Point Blog
MongoDB | Blog
MongoDB | Blog
B
Blog

博客园 - 桂素伟

Semantic Kernel:开启MCP Semantic Kernel:Phi-4 mini的tools .NET10:解决json序列化时引用自己 .NET10:字符数字 Semantic Kernel:接入本地deepseek-r1:1.5b Semantic Kernel:接入azure中的deepseek-r1 C#中的Channel .NET9中基于策略角色验证的包冲突 .NET9中使用Options Semantic Kernel:OpenAPI的Plugin AI应用开发的浅见 Semantic Kernel:Process Semantic Kernel:新Agent代理 UnitsNet 库简介 .NET9里WinForm更新了什么 SemanticKernel系列,AI系列,SmartFill介绍视频系列 更流畅的asp.net api的错误返回 用.srt字幕文件生成.wav语音 自制实时翻译小工具
Semantic Kernel:Phi-4试用
桂素伟 · 2025-03-02 · via 博客园 - 桂素伟

  微软在去年12月12日首次展示了Phi-4模型,该模型拥有140亿参数,但表现极为强大。在多项测试中表现优异:

  1. GPQA(研究生水平问答)和MATH数学基准测试中,Phi-4的表现超过了OpenAI的GPT-4o,并超越同类顶级开源模型Qwen 2.5 - 14BLlama 3.3 - 70B
  2. 美国数学竞赛AMC测试中,Phi-4取得了91.8分,超过了Gemini Pro 1.5GPT-4oClaude 3.5 SonnetQwen 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的翻译拿上来作对比:

 最后再和CahtGPT 4o作个对比:

   总体体验下来,作为一个SLM人是十分满意的,用在生产中是相当可以的,不过现在还不支持function calling,另外上面的测试都是在自己的笔记本上跑的,速度是能接受的,如果跑生产,上个显卡,应该就能提速,按理这都不是事。我给phi4打85分,等有了function calling就完美了。

   文章来源微信公众号

  想要更快更方便的了解相关知识,可以关注微信公众号 

****欢迎关注我的asp.net core系统课程****
《asp.net core精要讲解》 https://ke.qq.com/course/265696
《asp.net core 3.0》 https://ke.qq.com/course/437517
《asp.net core项目实战》 https://ke.qq.com/course/291868
《基于.net core微服务》 https://ke.qq.com/course/299524