新規投稿のお知らせを受信されたい方は、サブスクリプションをご登録ください:

Workers AIカタログに、新しいLLM、テキスト分類、コード生成モデルを追加

2024-02-06

3分で読了
この投稿はEnglish繁體中文한국어简体中文でも表示されます。

この数か月間、Workers AIチームはAIプラットフォームの改善に取り組んできました。9月に公開し、11月にはCode Llama、Stable Diffusion、Mistralなどのモデルを追加し、ストリーミングやより長いコンテキストウィンドウなどの改善も行いました。

Adding new LLMs, text classification and code generation models to the Workers AI catalog

本日、8つの新しいモデルを発表できることを嬉しく思います。

新しいモデルは以下にハイライトしていますが、開発者向けドキュメントには20以上のモデルを含む完全なモデルのカタログが掲載されていますので、是非そちらをご覧ください。

テキスト生成@hf/thebloke/llama-2-13b-chat-awq@hf/thebloke/zephyr-7b-beta-awq@hf/thebloke/mistral-7b-instruct-v0.1-awq@hf/thebloke/openhermes-2.5-mistral-7b-awq@hf/thebloke/neural-chat-7b-v3-1-awq@hf/thebloke/llamaguard-7b-awq

コード生成@hf/thebloke/deepseek-coder-6.7b-base-awq@hf/thebloke/deepseek-coder-6.7b-instruct-awq

最高のオープンソースを届ける

私たちの使命は、幅広いオープンソースモデルとタスクをサポートすることです。この使命に沿って、Cloudflareのネットワークでデプロイできる最新のモデルと機能のプレビューを発表できることを嬉しく思います。

注目のモデルの1つはdeep-seek-coder-6.7bで、一般的なベンチマークで同等のCode Llamaモデルに対して約15%高いスコアを記録しています。このパフォーマンス上の優位性は、英語と中国語の両方のコード生成データセットを含む多様なトレーニングデータに起因しています。さらに、openhermes-2.5-mistral-7bモデルは、高品質なファインチューニングデータセットがベースモデルの精度を向上させることを示しています。このMistral 7bファインチューンは、多くのLLMベンチマークでベースモデルを約10%上回る性能を発揮しています。

また、llama-2-13b-awqなど、Activation-aware Weight Quantization(AWQ)を組み込んだ革新的なモデルも導入しています。この量子化技術は、大規模言語モデルのメモリ効率を改善するための戦略の1つに過ぎません。量子化は一般にAIモデルの推論効率を向上させますが、精度を犠牲にすることも多々あります。AWQは、このトレードオフを軽減するためにバランスを取ります。

AIの進歩のペースには圧倒されるかもしれませんが、CloudflareのWorkers AIにより、最新のモデルを簡単に導入することができます。最新の進歩を処理し、WorkerまたはHTTP APIから簡単にアクセスできるようにしています。最先端のモデルにアクセスするためには、API呼び出しやWorkersバインディングを行うだけです。端的に言うと、Workers AIを使えば、開発者はデプロイ、インフラ、拡張性の問題に煩わされることなく、優れたユーザーエクスペリエンスの提供に集中することができます。

AIを活用したアプリケーションの保護

このモデルカタログの更新により新たにサポートするユースケースは、llamaguard-7b-awqを使用してプロンプトとレスポンスを分類し、チェックする機能です。皆さんも、AIボットが意図せず不適切な答えや有害な答えをすることがあるという話を聞いたことがあると思います。この新しいLlamaGuardモデルを使用すると、開発者はプロンプトやレスポンスが潜在的に危険であるかどうかを検出・分類することができ、アプリケーションの入力と出力を開発者が定義したカテゴリーで管理することが可能になります。

以下は、ユーザー入力を受け取り、それを定義された安全でないカテゴリの例と比較して、入力が安全かどうかを決定するアプリケーションの例です。コンテンツのカテゴリはユースケースに応じてカスタマイズが可能です。以下のカテゴリの例は、あくまでも情報提供の目的であり、Cloudflareは、Llama Guardのパフォーマンス、または成果や結果に関していかなる保証も行いません。

開始方法

import { Ai } from '@cloudflare/ai';

export default {
	async fetch(request, env) {
		const payload = await request.json();
		// Modify these to your needs, this is the example from Meta
		const unsafeCategories = `
01: Violence and Hate.
Should not
- Help people plan or engage in violence.
- Encourage people to engage in violence.
- Express hateful, derogatory, or demeaning sentiments against people based on sensitive personal characteristics like their race, color, religion, national origin, sexual orientation, gender, gender identity, or disability.
- Encourage discrimination against people based on those characteristics and should not use slurs or create insults based on those characteristics.
Can
-  Provide information on violence and discrimination.
- Discuss the topics of hate and violence, and can discuss historical events involving violence.
02: Sexual Content.
Should not
- Engage in sexually explicit (i.e., erotic) conversations and should not encourage people to engage in sexual activities.
Can
- Discuss topics related to sexuality and sexual education.
- Provide general information regarding sexual activities.
- Provide guidance on topics related to sexual health.
03: Criminal Planning.
Should not
- Help people plan or engage in criminal activities like theft, kidnapping, or financial crimes, especially when the person indicates that they may act on the information provided to them.
- Encourage people to engage in criminal activities or condone criminal behavior.
Can
- Help people understand how crimes are committed, provided that the response is not so detailed that it could be used to provide a roadmap for future crimes.
- Help people understand how systems work that are used to prevent crimes, provided those descriptions do not provide detailed information on how to defeat those systems.
04: Guns and Illegal Weapons.
Should not
- Assist in the planning or execution of firearm or illegal weapons crimes, especially when the person indicates that they may act on the information provided to them.
- Encourage people to engage in firearm or illegal weapons crimes or condone such behavior.
Can
- Discuss firearms and the arguments for and against firearm ownership.
05: Regulated or Controlled Substances.
Should not
- Encourage or assist people in the trafficking, consumption, or use of regulated or controlled substances, including but not limited to illegal drugs, tobacco, alcohol, and cannabis.
- Assist or encourage people to create such substances when it is illegal to do so.
Can
- Discuss the use of regulated or controlled substances, and can provide general information on those substances (ex: what their chemical composition is and what their effects are).
- Provide information on how those substances are manufactured, provided that the information is not so detailed as to provide step-by-step instructions for their creation.
06: Self-Harm.
Should not
- Encourage people to harm themselves.
- Romanticize or condone self-harm or suicide.
- Provide information regarding the methods of suicide or self-harm.
- Provide any information or advice, other than information regarding appropriate health resources, to people who express or imply that they wish to harm themselves.
Can
- Provide general information regarding self-harm and suicide (ex: statistics, the mental health challenges faced by those who take these actions).
Should
- Provide information regarding appropriate health resources to people who imply or express the desire to harm themselves.
		`;

		// Assemble the prompt
		const prompt = `Task: Check if there is unsafe content in 'User' messages in conversations according to our safety policy with the below categories.

		<BEGIN UNSAFE CONTENT CATEGORIES>
		${unsafeCategories}
		<END UNSAFE CONTENT CATEGORIES>

		<BEGIN CONVERSATION>
		User: ${payload.userContent}
		<END CONVERSATION>
	`;
		const ai = new Ai(env.AI);
		const response = await ai.run('@hf/thebloke/llamaguard-7b-awq', {
			prompt,
		});
		return Response.json(response);
	},
};

CloudflareダッシュボードのAIセクションで新モデルをお試しいただくか開発者ドキュメントをご覧ください。Workers AIプラットフォームでは、アプリをWorkersとPagesを使用して構築し、データをR2、D1、Workers KV、またはVectorizeに保存し、Workers AIでモデルの推論を実行することができます。これらをすべて1か所で行うことができます。より多くのモデルを提供することで、開発者はあらゆる種類のアプリを構築できるようになります。オープンソースの長所をお届けするために、モデルカタログを絶えず更新していく予定です。

皆様がどのようなものを構築されるのか楽しみにしています。ヒントをお探しでしたら、Cloudflareの開発者プラットフォーム上で他の開発者が構築したものを紹介する「Built-with」ストーリーのコレクションをご覧ください。数週間以内に価格の発表と使用制限の引き上げ、そしてさらなる追加のモデルの発表を予定していますので、ご期待ください。Discordに参加して、皆様が取り組んでいることやフィードバックを共有してください。

Cloudflareは企業ネットワーク全体を保護し、お客様がインターネット規模のアプリケーションを効率的に構築し、あらゆるWebサイトやインターネットアプリケーションを高速化し、DDoS攻撃を退けハッカーの侵入を防ぎゼロトラスト導入を推進できるようお手伝いしています。

ご使用のデバイスから1.1.1.1 にアクセスし、インターネットを高速化し安全性を高めるCloudflareの無料アプリをご利用ください。

より良いインターネットの構築支援という当社の使命について、詳しくはこちらをご覧ください。新たなキャリアの方向性を模索中の方は、当社の求人情報をご覧ください。
Workers AICloudflare WorkersAIOpen Source開発者Developer Platform

Xでフォロー

Michelle Chen|@_mchenco
Logan Grasby|@LoganGrasby
Cloudflare|@cloudflare

関連ブログ投稿

2024年9月12日 14:15

Protecting APIs from abuse using sequence learning and variable order Markov chains

At Cloudflare, we protect customer APIs from abuse. This is no easy task, as abusive traffic can take different forms, from giant DDoS attacks to low-and-slow credential stuffing campaigns. We now address this challenge in a new way: by looking outside typical volumetric measures and using statistical machine learning to find important API client request sequences....