見出し画像

LLMを活用したレコメンド根拠生成へのチャレンジ

本記事は、Japan Digital Design Advent Calendar 2023 の14日目の記事になります。


三菱UFJフィナンシャル・グループ(以下MUFG)の戦略子会社であるJapan Digital Design(以下JDD)でMUFG AI Studio(以下M-AIS)に所属する田邊です。

本記事では「LLMを活用したレコメンド根拠生成へのチャレンジ」と題し、実施した手順や結果についてご紹介させていただきます。

以前の投稿「レコメンドシステムの活用を考える①(導入編)」では少ないデータ種類でレコメンド可能なモデルを利用し、日本語でのパフォーマンスを検証していました。
実際の業務に適用する際には、”なぜ”それがレコメンドされたかの根拠があるとより嬉しいです。
以前のモデルと組み合わせることでよりユーザ満足度の高いレコメンドにレベルアップすることを目標に、今回は根拠生成にチャレンジしたいと思います。


LLMとは

引用:https://www.brainpad.co.jp/doors/knowledge/01_about_llm/

LLM(Large Language Model、大規模言語モデル)は、膨大な量のテキストデータで学習することで、人間のような言語処理を行うことを目標に作成されたモデルです。
LLMが出るまでは、各言語タスク(要約、翻訳、解説、など)に利用する言語モデル(Language Model)を作成するためには、大規模なテキストデータで事前学習を行い、その後特定のタスクに適用するために、更に数千から数万例のタスク固有のfine-tuneデータセットが必要でした。
LLMでは、prompt(プロンプト)と呼ばれる「わずかな例や簡単な指示」から新しい言語タスクを実行することができます(もちろんfine-tuneも可能です)。

典型的なpromptの構成

promptの例(引用:https://arxiv.org/pdf/2305.02182.pdf)

典型的なpromptの構成は上記図のようになっています。

  • 赤文字:役割の指定

    • システムpromptと呼ばれ、LLMが回答時に使用するペルソナを指定します。こうすることでLLMがその役割になりきって回答してくれます。

  • 青文字:事例(回答例)

    • 事例を与えることでどのように回答したらよいかをLLMに理解してもらいます。

  • 黒文字:指示

    • 解いてほしい課題や質問について記載します。記載方法の工夫やポイントは知見がたくさんあり、こちら(LLMのプロンプト技術まとめ #ChatGPT - Qiita)などとても参考になります。

また、promptは「事例」の数によって以下のように呼ばれ方が異なります。

・Few-shot : いくつかの事例を与える
・One-shot : 一つの事例を与える
・Zero-shot : 事例を与えない(指示だけを出す)

引用:プロンプトとは何か?プロンプトの本質と制約とそれを乗り越えるための工夫|Yuichiro.ito@Finatext(フィナテキスト) (note.com)

LLMについてもっと詳しく知りたい方は、参考文献に載せている資料もぜひご覧ください。

実施内容

今回はそんなLLMをレコメンドに利用して結果を見てみました。
先行研究は沢山あり、surveyも幾つか()出ています。
LLMをレコメンドに利用する際には、大きく分けると従来のレコメンドシステムと組み合わせて利用するものと、LLMのみでend-to-endのレコメンドを行うものがあります。

LLMをどのように利用するかで分類(引用:https://arxiv.org/abs/2305.19860)
LLMの学習有無・学習方法で分類(引用:https://arxiv.org/abs/2305.19860)

LLMを利用する際には、一般的ではないデータを利用する場合であればTuningして利用する場合もありますが、今回のデータはニュース記事でありLLMが既に学習できていると思われるため、追加の学習コストのかからない方法(promptのみでレコメンドする方法)で、かつend-to-endのレコメンドを実施しています。参考にしたのは、こちらのニュースデータを利用している論文です。
利用するLLMは論文と異なりLlama 2(Llama-2-7b-chat-hf、Llama-2-13b-chat-hf)を利用し、まずはZero-Shotのみで実施しています。
以前の投稿で利用していたMicrosoft News Dataset(MIND)を利用しており、かつ実装コードサンプルデータも提供されており、とても感謝です!
また、promptの工夫・LLMの特徴についてはこちらのLLM4RSの研究を参考にさせていただきました。

まずは論文通りに実行して結果を見てみる

参考にした論文では、幾つかのデータセット(映画、本、CD、ニュースなど)を利用し、LLMを使ったレコメンドを試していますが、今回利用するデータはMINDのニュースデータを利用しています。

実施手順・実装コード

今回はGoogle colab T4 GPUの環境で実行しています。利用したパッケージとバージョンは以下です。

!pip install transformers==4.30.0 torch==2.1.0 huggingface-hub==0.16.4 accelerate==0.22.0 torch bitsandbytes==0.41.0
import numpy as np 
import pandas as pd 
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from accelerate import Accelerator
import accelerate, huggingface_hub, transformers
import huggingface_hub

論文ではChatGPTを利用していますが、今回はLlama 2を利用しています。
量子化してモデルを読み込む際は、こちらの資料(Getting started with Llama 2 - AI at MetaQuantize 🤗 Transformers models (huggingface.co))を参考にしながら実施しました。

huggingface_hub.login("MY_KEY")
model_name = "meta-llama/Llama-2-7b-chat-hf"
bnb_config = BitsAndBytesConfig(
    load_in_4bit=True, 
    bnb_4bit_use_double_quant=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.bfloat16
)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", quantization_config=bnb_config)

promptを作成するための元データは2つあり、
topk_candidate5_history5.csvは、ユーザIDと、レコメンド候補のニュースID、ユーザが過去に見たニュースID、レコメンド候補の内実際にユーザが見たニュースIDのindexのデータです。
ニュースIDと実際のニュースタイトルはdatamaps.jsonで紐づけられています。

topk_candidate5_history5.csvのサンプル

今回のpromptの「指示」は以下の4つから構成されます。

1.ニュース参照履歴(次の具体的な指示に考慮してほしいニュース参照履歴を記載しています。)

Input: Here is My reading history:
US Presidential Election: Democratic Party Television Debate Begins, 
Trump's 2016 team sounds alarm as Democrats make gains, 
Impeachment inquiry: White House releases rough transcript of Trump's earlier call with Zelensky, 
The Real Reason McDonald's Keeps the Filet-O-Fish on Their Menu,

2.具体的な指示(上記履歴を元に、次のレコメンド候補を推奨順に並べて提示することを依頼しています。)

Based on my reading history, Please rank these 5 candidate news by measuring the possibilities that I would like to read next most, according to my reading history. Please think step by step.
Please show me your ranking results in the order of ranking. 
Split your output with line break. You MUST rank the given candidate news. You can not generate news that are not in the given candidate news:

3.レコメンド候補の記載

(A) Executive Privilege Should Have No Power When It Comes to an Impeachment 
(B) Home values in these cities have grown the most since the last recession 
(C) Trump campaign launching black outreach effort for 2020 
(D) 11 Regional Thanksgiving Recipes That Food Bloggers Swear By 
(E) Innovation in the Fast Food Realm: McDonald's Menu Evolution

4.output(この後に続く回答が欲しいことを明記しています。)

Output:
 The answer index is[/INST]

最終的にLLMに与えるpromptはLlama 2の形式に沿って作成します。

tokenizerの読み込みの際には、こちら(Generation with LLMs (huggingface.co))を参考にし、
prompt作成に当たってはこちら(Getting started with Llama 2 - AI at MetaLlama 2 is here - get it on Hugging Face2311.15131.pdf (arxiv.org))を参考にしています。

# tokenizer設定
tokenizer = AutoTokenizer.from_pretrained(model_name, padding_side="left")
tokenizer.pad_token = tokenizer.eos_token
model.resize_token_embeddings(model.config.vocab_size + 1)

# prompt作成
B_INST, E_INST = "[INST]", "[/INST]"
B_SYS, E_SYS = "<<SYS>>\n", "\n<</SYS>>"
DEFAULT_SYSTEM_PROMPT = "You are a news recommender system now.\
If a question does not make any sense,\
explain why instead of answering something not correct."

text = request["request"]["prompt"] # requestは参考論文のコードを利用して作成しています。
prompt = "{bos_token}{b_inst} {system}{prompt} {e_inst} ".format(
    bos_token=tokenizer.bos_token,
    b_inst=B_INST,
    system=f"{B_SYS}{DEFAULT_SYSTEM_PROMPT}{E_SYS}",
    prompt=text,
    e_inst=E_INST,
)

最終的なpromptはシステムpromptを追加した、以下のものです。

<s>[INST]<<SYS>>
You are a helpful, respectful and honest news recommender system now. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don’t know the answer to a question, please don’t share false information.
<</SYS>>

Input: Here is My reading history:
US Presidential Election: Democratic Party Television Debate Begins, 
Trump's 2016 team sounds alarm as Democrats make gains, 
Impeachment inquiry: White House releases rough transcript of Trump's earlier call with Zelensky, 
The Real Reason McDonald's Keeps the Filet-O-Fish on Their Menu,
Based on my reading history, Please rank these 5 candidate news by measuring the possibilities that I would like to read next most, according to my reading history. Please think step by step.
Please show me your ranking results in the order of ranking. 
Split your output with line break. You MUST rank the given candidate news. You can not generate news that are not in the given candidate news:
(A) Executive Privilege Should Have No Power When It Comes to an Impeachment 
(B) Home values in these cities have grown the most since the last recession 
(C) Trump campaign launching black outreach effort for 2020 
(D) 11 Regional Thanksgiving Recipes That Food Bloggers Swear By 
(E) Innovation in the Fast Food Realm: McDonald's Menu Evolution

Output:
 The answer index is[/INST]

(参考に日本語訳を記載しています。)
<s>[INST]<<SYS>></s>
あなたは今、役立ち、尊重され、誠実なニュースの推薦システムです。常にできるだけ助けになるように回答してください。回答には有害、非倫理的、人種差別的、性差別的、有害、危険、または違法なコンテンツは含めないでください。回答が社会的に偏見のないものであり、積極的な性質を持つようにしてください。質問が理解できない場合や事実として矛盾している場合は、なぜかを説明する代わりに不正確な回答をすることなく説明してください。質問の回答がわからない場合は、虚偽の情報を共有しないようにしてください。
<</SYS>>

以下が私の閲覧履歴です:
米国大統領選挙:民主党のテレビ討論が始まる
トランプの2016年チームが警告、民主党が進展
弾劾調査:ホワイトハウスがトランプの以前のゼレンスキーとの通話の要約を公開
マクドナルドがメニューにフィレオフィッシュを続ける実際の理由
私の閲覧履歴に基づいて、以下の5つの候補のニュースを、私が次に読みたい可能性を測定して順位付けしてください。ステップバイステップで考えてください。
順位を示すために、順位の順に出力してください。
出力を改行で区切ってください。与えられた候補のニュースを順位付けする必要があります:
(A) 弾劾に関するときは行政特権は権限を持たないべき
(B) これらの都市の住宅価値は最後の不況以来最も成長しています
(C) トランプ陣営が2020年のために黒人へのアウトリーチを開始
(D) フードブロガーたちが誓う11の地域ごとの感謝祭のレシピ
(E) ファーストフードの領域での革新:マクドナルドのメニューの進化

出力:
回答のインデックスは</INST>

promptを入力し、LLMでgenerateします。

作成にあたっては、こちら(Generation (huggingface.co)Generation with LLMs (huggingface.co))の資料を参考にしています。
今回各種パラメータは変更していませんが、こちら(How to generate text: using different decoding methods for language generation with Transformers (huggingface.co))の資料がとても分かりやすかったです!

def generate_result(prompt):
    with torch.no_grad():
        model_inputs = tokenizer(prompt, padding=True, add_special_tokens=True, return_tensors="pt").to(model.device)
        input_length = model_inputs.input_ids.shape[1]
        generated_ids = model.generate(
            model_inputs.input_ids,
            max_new_tokens=2000,
            pad_token_id=tokenizer.pad_token_id,
            eos_token_id=tokenizer.eos_token_id,
            bos_token_id =tokenizer.bos_token_id ,
        )            
        
    output = tokenizer.batch_decode(generated_ids[:, input_length:], skip_special_tokens=True)[0]
    return output

output = generate_result(prompt)
print(output)

ではいよいよ、試した結果についてです。
まずはLlama-2-7b-chat-hfを利用し結果を見ています。

①シンプルに上で記載したpromptの結果です。

1. (B) Home values in these cities have grown the most since the last recession
Based on your reading history, it seems that you are interested in articles related to real estate and economic growth. The article about home values growing the most since the last recession is likely to be of interest to you as it provides valuable information on the current state of the housing market and the potential for investment or homeownership.
2. (D) 11 Regional Thanksgiving Recipes That Food Bloggers Swear By
Your reading history suggests that you are interested in food-related articles, particularly those that offer unique and delicious recipes. The article about regional Thanksgiving recipes is likely to appeal to your interest in trying new and exciting dishes for the holiday season.
3. (A) Executive Privilege Should Have No Power When It Comes to an Impeachment
Your reading history includes articles related to politics and current events, and it's possible that you are interested in in-depth analysis of political issues. The article about executive privilege and its potential impact on the impeachment process is likely to be of interest to you as it provides insight into the legal and political aspects of the impeachment inquiry.
4. (C) Trump campaign launching black outreach effort for 2020
Your reading history includes articles related to politics and current events, and it's possible that you are interested in news related to the 2020 presidential election. The article about the Trump campaign's black outreach effort is likely to be of interest to you as it provides insight into the campaign's strategies and tactics for the upcoming election.
5. (E) Innovation in the Fast Food Realm: McDonald's Menu Evolution
Your reading history includes articles related to food and fast food, and it's possible that you are interested in news related to the fast food industry. The article about McDonald's menu evolution is likely to be of interest to you as it provides insight into the latest trends and innovations in the fast food industry.

(B) 前回の不況以来、これらの都市の住宅価値が最も成長しています
あなたの読書履歴に基づくと、不動産と経済成長に関連する記事に興味を持っているようです。前回の不況以来、これらの都市の住宅価値が最も成長している記事は、住宅市場の現状や投資や住宅所有の可能性に関する貴重な情報を提供しており、あなたにとって興味深いでしょう。
(D) フードブロガーが誓う11の地域別感謝祭のレシピ
あなたの読書履歴からは、特にユニークで美味しいレシピを提供する食品関連の記事に興味を持っている可能性があります。地域別の感謝祭のレシピに関する記事は、ホリデーシーズンに新しい興味深い料理を試してみたいというあなたの関心に合致するでしょう。
(A) 弾劾に関わる際には行政特権は権力を持つべきではない
あなたの読書履歴には政治や時事に関連する記事が含まれており、政治的な問題の綿密な分析に興味を持っている可能性があります。行政特権とその弾劾プロセスへの潜在的な影響に関する記事は、弾劾調査の法的および政治的側面に対する洞察を提供しており、あなたにとって興味深いでしょう。
(C) トランプキャンペーンが2020年に向けて黒人へのアウトリーチ活動を開始
あなたの読書履歴には2020年の大統領選に関連する記事が含まれており、トランプキャンペーンに関するニュースに興味を持っている可能性があります。トランプキャンペーンが2020年に向けて行う黒人へのアウトリーチ活動に関する記事は、キャンペーンの戦略やタクティクスに対する洞察を提供しており、あなたにとって興味深いでしょう。
(E) ファーストフード領域の革新:マクドナルドのメニュー進化
あなたの読書履歴には食品やファーストフードに関連する記事が含まれており、ファーストフード業界に関するニュースに興味を持っている可能性があります。マクドナルドのメニュー進化に関する記事は、ファーストフード業界の最新のトレンドや革新に対する洞察を提供しており、あなたにとって興味深いでしょう。

ユーザの参照履歴では、主に政治・食(McDonald's)に関する記事を読んでいますが、1番目には「不動産と経済成長に関連する記事に興味を持っている」として(B)が来ています。
また、2番目にはMcDonald'sではなく、他の食に関する記事が推奨されています。
履歴に直接関係している(A)、(C)、(E)については後半に来ており、人気バイアスがかかっていそうです。

直近の参照履歴を考慮するよう工夫してみる

こちらの論文では、「LLMはUser Historyの時系列順序を考慮できないため、理解させたい場合は直近見たものが何かを明確に伝えることが必要」と書かれており、試してみたいと思います。

②最近見た記事を強調した場合
promptの「2.指示」に最近見た記事が最後のMcDonald'sの記事だということを追加しました(3行目です)。

Based on my reading history, Please rank these 5 candidate news by measuring the possibilities that I would like to read next most, according to my reading history. Please think step by step.
Please show me your ranking results in the order of ranking. 
Note that my most recently read news is the last article in history.
Split your output with line break. You MUST rank the given candidate news. You can not generate news that are not in the given candidate news:

回答はこちらです。

1. (B) Home values in these cities have grown the most since the last recession - Based on your reading history, it seems that you are interested in economic and real estate-related news. This article provides information on the cities with the highest home value growth since the last recession, which may be of interest to you.
2. (D) 11 Regional Thanksgiving Recipes That Food Bloggers Swear By - As someone who has read articles related to food and recipes, this article provides a list of regional Thanksgiving recipes that are highly recommended by food bloggers. This may be of interest to you if you are looking for new and unique recipe ideas for the upcoming holiday season.
3. (A) Executive Privilege Should Have No Power When It Comes to an Impeachment - As someone who has read articles related to politics and current events, this article provides an opinion piece on the topic of executive privilege and its potential impact on the ongoing impeachment inquiry. This may be of interest to you if you are following the latest developments in the political landscape.
4. (E) Innovation in the Fast Food Realm: McDonald's Menu Evolution - As someone who has read articles related to food and fast food, this article provides an overview of the evolution of McDonald's menu and the latest innovations in the fast food industry. This may be of interest to you if you are interested in staying up-to-date on the latest food trends and menu offerings from popular fast food chains.
5. (C) Trump campaign launching black outreach effort for 2020 - As someone who has read articles related to politics and current events, this article provides information on the Trump campaign's efforts to reach out to the black community in the upcoming 2020 election. This may be of interest to you if you are following the latest developments in the political landscape and the ongoing election campaigns.

(B) 前回の不況以来、これらの都市の住宅価値が最も成長しています - あなたの読書履歴に基づくと、経済および不動産に関連するニュースに興味を持っているようです。この記事は、前回の不況以来、住宅価値が最も成長している都市に関する情報を提供しており、あなたにとって興味深いかもしれません。
(D) フードブロガーが誓う11の地域別感謝祭のレシピ - 食べ物やレシピに関連する記事を読んでいる方として、この記事はフードブロガーが強くおすすめする地域別の感謝祭のレシピのリストを提供しています。これは、年末のホリデーシーズンに新しいユニークなレシピのアイデアを探している場合に、あなたの興味を引くかもしれません。
(A) 弾劾に関わる際には行政特権は権力を持つべきではない - 政治や時事に関連する記事を読んでいる方として、この記事は行政特権とその弾劾調査への潜在的な影響についての意見記事を提供しています。政治の最新動向をフォローしている場合、これはあなたにとって興味深いかもしれません。
(E) ファーストフード領域の革新:マクドナルドのメニュー進化 - 食べ物やファーストフードに関連する記事を読んでいる方として、この記事はマクドナルドのメニューの進化とファーストフード業界の最新のイノベーションについての概要を提供しています。人気のファーストフードチェーンの最新の食のトレンドやメニューオファリングを追いかけている場合、これはあなたにとって興味深いかもしれません。
(C) トランプキャンペーンが2020年に向けて黒人へのアウトリーチ活動を開始 - 政治や時事に関連する記事を読んでいる方として、この記事はトランプキャンペーンが2020年の選挙で黒人コミュニティに向けて行っている取り組みについての情報を提供しています。政治の最新動向や選挙キャンペーンを追っている場合、これはあなたにとって興味深いかもしれません。

結果を見ると、(E)のMcDonald'sに関する記事が①と比べると上位に挙がってきています。
想定では最近見たものがファーストフードのMcDonald'sなので、(E)が上位に来ることを期待しましたが、そうではありませんでした。
ただ、①よりは期待する結果に近づいているため上記文言は有効なのでしょうか。

③最近見た記事を強調+その文言を最後に追加した場合

Based on my reading history, Please rank these 5 candidate news by measuring the possibilities that I would like to read next most, according to my reading history. Please think step by step.
Please show me your ranking results in the order of ranking. 
Split your output with line break. 
You MUST rank the given candidate news. You can not generate news that are not in the given candidate news. Note that my most recently read news is the last article in history.:

結果は①と同じ順番でしたが、直近読んだ記事として認識されているのはMcDonald'sだけではなく、politicsもだと認識されています。
同じ文言でもpromptの位置を変えることで結果が変化することは学びでした。

1. (B) Home values in these cities have grown the most since the last recession
Based on your reading history, it seems that you are interested in articles related to real estate and economic growth. The article "Home values in these cities have grown the most since the last recession" aligns with these interests, as it provides information on the current state of the housing market and the cities that have seen the most growth.
2. (D) 11 Regional Thanksgiving Recipes That Food Bloggers Swear By
While your most recently read article was related to politics, your reading history also suggests that you are interested in food and cooking. The article "11 Regional Thanksgiving Recipes That Food Bloggers Swear By" aligns with this interest, as it provides a collection of unique and delicious Thanksgiving recipes from different regions of the United States.
3. (A) Executive Privilege Should Have No Power When It Comes to an Impeachment
Your reading history indicates that you are interested in political news and current events. The article "Executive Privilege Should Have No Power When It Comes to an Impeachment" aligns with this interest, as it provides insight into the ongoing impeachment proceedings and the role of executive privilege in the process.
4. (C) Trump campaign launching black outreach effort for 2020
Your reading history suggests that you are interested in political news and current events, particularly related to the 2020 presidential election. The article "Trump campaign launching black outreach effort for 2020" aligns with this interest, as it provides information on the Trump campaign's efforts to reach out to the black community.
5. (E) Innovation in the Fast Food Realm: McDonald's Menu Evolution
While your most recently read article was related to politics, your reading history also suggests that you are interested in food and dining. The article "Innovation in the Fast Food Realm: McDonald's Menu Evolution" aligns with this interest, as it provides information on the latest developments in the fast food industry, including McDonald's menu changes.

(B) 前回の不況以来、これらの都市の住宅価値が最も成長しています - あなたの読書履歴に基づくと、不動産や経済成長に関連する記事に興味を持っているようです。記事「前回の不況以来、これらの都市の住宅価値が最も成長しています」は、住宅市場の現状と最も成長した都市に関する情報を提供しており、これらの興味に合致しています。
(D) フードブロガーが誓う11の地域別感謝祭のレシピ - 最近読んだ記事が政治に関連していた一方で、読書履歴からは食べ物や料理にも興味を持っていることが分かります。記事「フードブロガーが誓う11の地域別感謝祭のレシピ」は、アメリカの異なる地域からのユニークで美味しい感謝祭のレシピをまとめたもので、この興味に合致しています。
(A) 弾劾に関わる際には行政特権は権力を持つべきではない - あなたの読書履歴からは、政治ニュースや時事に興味を持っていることがわかります。記事「弾劾に関わる際には行政特権は権力を持つべきではない」は、進行中の弾劾手続きや行政特権の役割についての洞察を提供しており、この興味に合致しています。
(C) トランプキャンペーンが2020年に向けて黒人へのアウトリーチ活動を開始 - 読書履歴からは、政治ニュースや時事に興味を持っていることが伺えます。記事「トランプキャンペーンが2020年に向けて黒人へのアウトリーチ活動を開始」は、トランプキャンペーンが黒人コミュニティに向けて行っている取り組みについての情報を提供しており、この興味に合致しています。
(E) ファーストフード領域の革新:マクドナルドのメニュー進化 - 最近読んだ記事が政治に関連していた一方で、読書履歴からは食べ物や飲食にも興味を持っていることが伺えます。記事「ファーストフード領域の革新:マクドナルドのメニュー進化」は、ファストフード業界の最新の動向、特にマクドナルドのメニューの変更についての情報を提供しており、この興味に合致しています。

Llama-2-13b-chat-hf

7bのモデルではあまり良い回答は得られませんでしたが、13bのモデルで試したところ、上手く実務にも適用できそうでした!

①のシンプルなpromptの結果です。
候補の順序や一般的な記事に影響されずに、履歴情報から根拠を上げてニュース記事のランキングができていそうです。

1. (E) Innovation in the Fast Food Realm: McDonald's Menu Evolution
Your reading history suggests that you are interested in articles about food and dining, as evidenced by your recent reading of an article about the Filet-O-Fish on the McDonald's menu. Therefore, it is likely that you would be interested in an article about innovation in the fast food industry, particularly if it involves a well-known brand like McDonald's.
2. (D) 11 Regional Thanksgiving Recipes That Food Bloggers Swear By
Your interest in food and dining is also reflected in your reading history, and the upcoming Thanksgiving holiday makes this article a relevant and timely choice. The focus on regional recipes and food bloggers adds a personal touch that may appeal to you.
3. (C) Trump campaign launching black outreach effort for 2020
Your reading history suggests that you are interested in political news, and the Trump campaign's outreach efforts are likely to be of interest to you. However, this article may not be as relevant to your interests as the first two choices.
4. (B) Home values in these cities have grown the most since the last recession
While your reading history does not specifically indicate an interest in real estate or home values, this article may still be of interest to you if you are a homeowner or are considering purchasing a home. The focus on cities that have experienced significant growth since the last recession could be relevant to your financial or investment goals.
5. (A) Executive Privilege Should Have No Power When It Comes to an Impeachment
This article is the least likely to be of interest to you based on your reading history, as it is focused on a legal and political issue that is not directly related to food, dining, or the fast food industry. While you may be interested in news about the impeachment inquiry, this specific article may not be as relevant to your interests.
I hope this ranking helps you find your next news article to read!

(E) ファーストフードの革新:マクドナルドのメニュー進化
あなたの最近の読書履歴からは、マクドナルドのメニューのフィレオフィッシュに関する記事を読んだことが示され、食べ物とダイニングに関する記事に興味を持っている可能性があります。したがって、特にマクドナルドのような有名ブランドが関与する場合、ファーストフード業界の革新に関する記事に興味を持つ可能性が高いです。
(D) フードブロガーが保証する地域ごとの感謝祭のレシピ11選
食べ物とダイニングへの興味はあなたの読書履歴にも反映されており、近づいている感謝祭の時期からこの記事は関連性があり、タイムリーな選択です。地域のレシピとフードブロガーへの焦点は、あなたにアピールする可能性があります。
(C) トランプ陣営が2020年のための黒人アウトリーチを開始
あなたの読書履歴からは政治ニュースに興味を持っていることが示されており、トランプ陣営のアウトリーチ活動はあなたにとって興味深い可能性があります。ただし、この記事は最初の2つの選択肢ほど関連性がないかもしれません。
(B) レシージョンのこれらの都市の住宅価値が最後の不況以来最も成長しています
あなたの読書履歴は特に不動産や住宅価値に興味を示していませんが、これはあなたが家主であるか、家を購入しようと考えている場合でも興味深いかもしれません。最後の不況以来大きな成長を遂げた都市に焦点を当てることは、あなたの財務または投資の目標に関連するかもしれません。
(A) 弾劾に関する際、行政特権は権限を持つべきではありません
この記事は、あなたの読書履歴に基づいて最も興味を引かれる可能性が低いものであり、食べ物やダイニング、ファーストフード産業とは直接関係のない法的および政治的な問題に焦点を当てています。弾劾調査に関するニュースに興味を持つかもしれませんが、この具体的な記事はあなたの関心にあまり関連していないかもしれません。

既にMcDonald'sの記事がランキング1位となっており、履歴の順番も考慮していそうですが、、"履歴の3番目の記事が直近に読んだ記事だ"という文言も追加して結果を見てみます。

履歴の3番目の記事は「弾劾調査:ホワイトハウスがトランプの以前のゼレンスキーとの通話の要約を公開」であり、一番近い候補は(A)です。

1. (E) Innovation in the Fast Food Realm: McDonald's Menu Evolution
This article is ranked first because it is related to the topic of the Real Reason McDonald's Keeps the Filet-O-Fish on Their Menu, which you recently read. The article provides an overview of the evolution of McDonald's menu, which may be of interest to you if you enjoyed reading about the history of the Filet-O-Fish.
2. (C) Trump campaign launching black outreach effort for 2020
This article is ranked second because it is related to the topic of the US Presidential Election, which you recently read about in the article on the Democratic Party Television Debate Begins. The article about the Trump campaign's outreach effort may be of interest to you if you are interested in learning more about the election and the candidates' strategies.
3. (A) Executive Privilege Should Have No Power When It Comes to an Impeachment
This article is ranked third because it is related to the topic of the impeachment inquiry, which you recently read about in the article on the White House's release of the rough transcript of Trump's call with Zelensky. The article about executive privilege may be of interest to you if you are interested in learning more about the legal aspects of the impeachment process.
4. (B) Home values in these cities have grown the most since the last recession
This article is ranked fourth because it is not directly related to the topics you recently read about. However, it may still be of interest to you if you are interested in news about the housing market and economic trends.
5. (D) 11 Regional Thanksgiving Recipes That Food Bloggers Swear By
This article is ranked last because it is not related to any of the topics you recently read about, and it may not be of interest to you based on your reading history.
Please note that the ranking is based on the content of the articles and the topics they cover, and not on the quality or accuracy of the articles.

(E) ファーストフードの革新:マクドナルドのメニュー進化
この記事は、最近読んだマクドナルドのフィレオフィッシュに関する記事のトピックに関連しており、第一位にランクされています。この記事では、マクドナルドのメニューの進化についての概要が提供されており、フィレオフィッシュの歴史に興味を持っていたら、この記事も興味深いかもしれません。
(C) トランプ陣営が2020年のための黒人アウトリーチを開始
この記事は、最近読んだデモクラティック党テレビ討論に関する記事のトピックに関連しており、第二位にランクされています。トランプ陣営の黒人アウトリーチに関する記事は、選挙と候補者の戦略についてもっと知りたい場合に興味を引くかもしれません。
(A) 弾劾に関する際、行政特権は権限を持つべきではありません
この記事は、最近読んだトランプのゼレンスキーとの通話の草稿を発表するホワイトハウスに関する記事のトピックに関連しており、第三位にランクされています。行政特権に関する記事は、弾劾プロセスの法的側面についてもっと知りたい場合に興味深いかもしれません。
(B) レシージョンのこれらの都市の住宅価値が最後の不況以来最も成長しています
この記事は、最近の読書に直接関連していないため、第四位にランクされています。ただし、住宅市場や経済の動向に関するニュースに興味がある場合は、この記事も興味深いかもしれません。
(D) フードブロガーが保証する地域ごとの感謝祭のレシピ11選
この記事は、最近読んだトピックには関連しておらず、あなたの読書履歴に基づいて興味深いとは考えにくいため、最後にランクされています。
ランキングは記事の内容とカバーしているトピックに基づいており、記事の品質や正確性には関係していません。

結果では直近に読んだ記事を考慮し、関連する(C)、(A)が上位にあがってきています。
ランキングの根拠についても、"履歴のどの記事から興味を持ちそうだと判断したか"、もわかる記載となっており、実務にも適用できそうです!

実際にやってみての感想

  • パラメーターの少ないLLMだと、promptの変化に回答が敏感で調整が難しいと学びました。

  • 13bのモデルであれば、回答内容やpromptの内容をよりLLMが理解し、実務でも利用できそうだということが分かりました。

  • ChatGPTを利用した参考論文とは異なる結果もあり、利用するモデルによって回答の傾向が違うことが分かりました。

    • 人気バイアスについては、Llama-2-7b-chat-hfでは影響がありそうでしたが、Llama-2-13b-chat-hfでは影響は無さそうでした。

    • 上記論文では「LLMの回答はCandidate Itemの順番に影響されるため(上位に位置するほど高評価されやすい)、正しく評価するにはbootstrap検証が必要」と記載がありましたが、今回Llama 2モデルではその影響は受けていない結果となりました。

参考文献

最後までご覧いただきありがとうございました。


Japan Digital Design株式会社では、一緒に働いてくださる仲間を募集中です。カジュアル面談も実施しておりますので下記リンク先からお気軽にお問合せください。

この記事に関するお問い合わせはこちら

M-AIS
Naomi Tanabe