QEUR23_ CHRLTM14 : 閑話休題~Predibaseでfinetuneを使ってみる(SOLAR LLM)
~ CJK語の能力を高めるためには? ~
QEU:FOUNDER(設定年齢65歳) : “前回は、Predibaseが提供しているサービスでRAGをやってきました。今回はfinetune(FT)をやっています。このときに使ったモデルは、無難な「mistral-7b」です。ただし、モデルのJ語の処理能力がまだまだでした。まあ、予想はついていましたが・・・。”
QEU:FOUNDER : “ですから、今回はK国のエースLLMであるSOLARを使いたいわけです。また、10bクラスの「やや大きめLLM」は、Predibaseには多くないんですね。”
QEU:FOUNDER : “2024年1月のリリースで、適切なファインチューニングをした前提ではGPT4並みの能力を持っているらしいです。そして、このLLMの構築においてユニークな手法を導入したとか・・・。もともと、「SOLAR」という言葉に、このLLMの性質が現れているんです。”
D先生: “そもそも、よくわかんないことがあるんです・・・。Predibaseのサービスは、どうして10b以下の小さなモデルに偏っているんでしょうね。”
QEU:FOUNDER : “この動画(↑)は、Predibaseが設立してまもなく取ったものです。この会社の考え方がよく出ています。この会社の目的は、ユーザーのEngineeringを手助けすることであり、別にGPTと「どちらがきれいな文章を書けるのか?」を競うつもりはないのです。それがSOLAR_LLMのスタンスに合ってたんですね。”
D先生: “そうも、彼らの言うEngineeringという言葉に引っかかるのだが・・・。”
D先生: “言語処理にかかわる教師あり学習という意味でしょうか・・・。Sentiment analysisとか、従来はナイーブ・ベイズでやっていた仕事を軽量なLLMで代用しましょうという考え方ですね。”
QEU:FOUNDER : “だったら、Predibaseのビジネスのスタンスがわかるよね。プロダクションへの移行基準がエラー率が0.01%だとすると、ナイーブ・ベイズでそのレベルを達成するのは大変です。ちなみに、おなじFTのサービスにLAMINIがあるんですが、調べてみたらちょっと一般ユーザーには使いにくいようです。Databricksと提携して、Enterpriseに特化したサービスをやっていますからね。”
QEU:FOUNDER : “じゃあ、これからSOLAR_LLMを使ってみましょう。ここで、使うデータは前回と全く同じです。このデータの中には、J語やC語が大量に入っています。”
D先生: “すいません・・・。最初に、ふつうに推論をしてください。”
QEU:FOUNDER : “じゃあ、単純な推論をやってみましょう。ちなみに、SOLARはPre-trainedのままでは最大の能力が出てこない設計ですからね。”
# ---
from predibase import PredibaseClient
# If you've already run `pbase login`, you don't need to provide any credentials here.
# If you're running in an environment where the `pbase login` command-line tool isn't available,
# you can also set your API token using `pc = PredibaseClient(token="<your token here>")`.
pc = PredibaseClient()
# ---
# SOLAR LLMを使った単純推論
llm_deployment = pc.LLM("pb://deployments/solar-1-mini-chat-240612")
result = llm_deployment.prompt("Please introduce some delicious dishes using kimchi.")
print(result.response)
Kimchi is a staple in Korean cuisine and can be used in a variety of dishes to add a tangy, spicy flavor. Here are some delicious dishes you can try:
- Kimchi Jjigae: This is a hearty stew made with kimchi, tofu, pork, and various vegetables. It's a popular comfort food in Korea.
- Kimchi Fried Rice: A simple yet tasty dish where kimchi is stir-fried with rice, vegetables, and sometimes meat.
- Kimchi Pancake: Thin
キムチは韓国料理の定番で、さまざまな料理に使用して、ピリッとしたスパイシーな風味を加えることができます。ここでは、試してみる価値のあるおいしい料理をいくつか紹介します。
- キムチチゲ: キムチ、豆腐、豚肉、さまざまな野菜を使ったボリュームたっぷりのシチューです。韓国で人気の家庭料理です。
- キムチチャーハン: キムチを米、野菜、時には肉と一緒に炒めた、シンプルですがおいしい料理です。
QEU:FOUNDER : “K国のLLMに敬意を表して、KIMCHIの話をさせてみました。”
D先生: “まあ、当たり前の結果が出てきますよね。じゃあ、finetuneに行きましょう。”
QEU:FOUNDER : “前回とは導入するモデルが違うだけで、同じコードになります。PredibaseのSDKはうまくできていますね。このSDKが、「prompt,completion」のデータ構造しか受け入れないのには閉口しますが・・・。”
# ---
# データのupload
from predibase import Predibase, FinetuningConfig, DeploymentConfig
pb = Predibase()
#dataset = pb.datasets.from_file("drive/MyDrive/simple_multi_language_train0714.csv", name="simple_QEU_train0714_2")
#dataset
# ----
# すでにuploadしたdatasetを引っ張ってくる
dataset = pb.datasets.get("simple_QEU_train0714_2") # Looks for "tldr_dataset" under file_uploads
dataset
# ---
# Kick-off Training
# Create an adapter repository
repo = pb.repos.create(name="QEU_solar_model", description="UR and JP Economy with solar LLM", exists_ok=True)
# Start a fine-tuning job, blocks until training is finished
adapter = pb.adapters.create(
config=FinetuningConfig(
base_model="solar-1-mini-chat-240612"
),
dataset=dataset, # Also accepts the dataset name as a string
repo=repo,
description="UR and JP Economy with solar LLM"
)
D先生: “同じデータを使っているのだから、おそらく学習の損失の大きさも同じ程度でしょうが・・・。K国のLLMなので、若干、MISTRALよりもJ語、C語に明るいか?”
QEU:FOUNDER : “それなりに、損失レベルが良くなっているような気がします。J語を入力して推論してみましょう。”
D先生 : “おっと!いきなり、正解が出てきました。じゃあ、C語の方は?”
QEU:FOUNDER : “これも正解です。Mistralは7bだし、solarは10bです。ひょっとして、「地アタマ」が出ているのかもしれません。ああ・・・、その意味ではPhi-3-mediumモデルがPredibaseのサービスに入っていればなあ・・・。さて、次にU-R紛争の関連問題を見てみましょう。”
(質問)
Who is Volodymyr Zelensky?
(SOLAR LLM)
Volodymyr Zelensky is the current President of Ukraine. He was elected in April 2019 and took office on May 20, 2019. Prior to his election, he was an actor and comedian. He is known for his pro-European Union and pro-NATO views
ウォロディミル・ゼレンスキーはウクライナの現大統領である。2019年4月に選出され、2019年5月20日に就任した。選出前は俳優やコメディアンとして活動していた。EU支持派、NATO支持派として知られている。
(Predibase:mistral-finetune)
Volodymyr Zelensky is the President of Ukraine. He was elected in 2019.
D先生: “回答の出来がmistralよりもいいですね。さらに「J国経済の黄昏」に行ってみましょう。”
(Question:1)
20 世紀の日本の経済成長には、戦後の復興と政府の介入が重要な役割を果たし、通商産業省の設立が国の経済発展と産業政策を導きました。この時期の日本の急速な経済成長に貢献したのは、具体的にはどのような通商産業省の政策と決定だったのでしょうか。
Post-war reconstruction and government intervention played a key role in Japan's economic growth in the 20th century, and the establishment of the Ministry of International Trade and Industry guid-ed the country's economic development and industrial policies. What specific MITI policies and deci-sions contributed to Japan's rapid economic growth during this period?
(SOLAR LLM)
The Ministry of International Trade and Industry (MITI) played a crucial role in Japan's rapid eco-nomic growth during the post-war period. MITI's policies and decisions contributed to the country's industrialization, export-led growth, and technological advancement. Here are some key points:
- Industrial Policy: MITI formulated and implemented industrial policies that aimed to promote industrialization and diversify Japan's economy. These policies included the promotion of specific industries, such as automobiles, electronics, and steel, as well as the development of infrastructure and support for small and medium-sized enterprises.
- Export-led Growth: MITI actively promoted export-led growth, which was a key factor in Japan's economic success. MITI provided financial support to exporters, such as low-interest loans and ex-port subsidies, and facilitated trade missions and market research to help Japanese companies ex-pand into new markets.
- Technological Advancement: MITI encouraged technological advancement and innovation, which was essential for Japan's rapid economic growth. MITI provided funding for research and develop-ment, supported the development of new technologies, and encouraged collaboration between indus-try and academia.
- Protectionism: MITI implemented protectionist measures, such as tariffs and quotas, to protect domestic industries from foreign competition. This allowed Japanese companies to grow and develop without the pressure of immediate competition from established foreign companies.
- Coordination with Other Ministries: MITI worked closely with other ministries, such as the Min-istry of Finance and the Ministry of Economy, Trade, and Industry, to coordinate economic policies and ensure that Japan's economic growth was sustainable.
These policies and decisions by MITI contributed to Japan's rapid economic growth in the 20th cen-tury. The ministry's focus on industrialization, export-led growth, technological advancement, and protectionism helped Japan to become one of the world's leading industrial powers.
通商産業省(MITI)は、戦後の日本の急速な経済成長において重要な役割を果たしました。MITIの政策と決定は、日本の工業化、輸出主導の成長、技術の進歩に貢献しました。主なポイントは次のとおりです。
産業政策:MITIは、工業化を促進し、日本経済の多様化を目指す産業政策を策定し、実施しました。これらの政策には、自動車、電子機器、鉄鋼などの特定の産業の振興、インフラの開発、中小企業の支援が含まれていました。
輸出主導の成長:MITIは、日本の経済的成功の重要な要因であった輸出主導の成長を積極的に推進しました。MITIは、低金利ローンや輸出補助金などの金融支援を輸出業者に提供し、日本企業が新しい市場に進出するのを支援するために貿易使節団や市場調査を促進しました。
技術の進歩:MITIは、日本の急速な経済成長に不可欠であった技術の進歩と革新を奨励しました。 MITI は研究開発に資金を提供し、新技術の開発を支援し、産業界と学界の連携を奨励しました。
- 保護主義: MITI は関税や割当などの保護主義的措置を実施し、国内産業を外国の競争から保護しました。これにより、日本企業は既存の外国企業との直接の競争のプレッシャーを受けることなく成長し、発展することができました。
- 他の省庁との調整: MITI は財務省や経済産業省などの他の省庁と緊密に連携し、経済政策を調整して日本の経済成長が持続可能であることを保証しました。
MITI のこれらの政策と決定は、20 世紀の日本の急速な経済成長に貢献しました。同省が工業化、輸出主導の成長、技術の進歩、保護主義に重点を置いたことで、日本は世界有数の工業大国となりました。
(Predibase:mistral-finetune)
The Ministry of International Trade and Industry (MITI) played a crucial role in Japan's rapid eco-nomic growth during the post-war period. Some of the specific policies and decisions that contribut-ed to this growth include:
- Export-oriented industrial policies: MITI encouraged the growth of export-oriented industries, such as automobiles, electronics, and machinery, to increase Japan's competitiveness in the global market.
- Technological cooperation with foreign companies: MITI facilitated the transfer of technology and knowledge from foreign companies to Japanese firms, which helped to accelerate Japan's industrial development.
- Industrial location policies: MITI encouraged the decentralization of industries to regional areas, which helped to reduce regional disparities and promote economic growth in the entire country.
- Financial policies: MITI implemented financial policies to support the growth of small and medi-um-sized enterprises, which helped to create a more balanced economy.
- Trade policies: MITI negotiated trade agreements with other countries, which helped to expand Japan's exports and increase its global competitiveness.
- Labor policies: MITI implemented labor policies to promote labor-management cooperation and improve working conditions, which helped to increase productivity and reduce labor disputes.
- Infrastructure development: MITI invested in infrastructure development, such as transportation and communication networks, which helped to reduce costs and increase efficiency.
- International cooperation: MITI worked with international organizations, such as the World Bank and the International Monetary Fund, to promote international economic cooperation and stability.
通商産業省 (MITI) は、戦後の日本の高度経済成長において重要な役割を果たしました。この成長に貢献した具体的な政策や決定には次のようなものがあります。
- 輸出志向型産業政策:通商産業省は、世界市場における日本の競争力を高めるため、自動車、エレクトロニクス、機械などの輸出志向型産業の成長を奨励しています。
- 外国企業との技術協力:通産省は、外国企業から日本企業への技術や知識の移転を促進し、日本の産業発展の加速に貢献しました。
- 産業立地政策:通商産業省は産業の地方分散を奨励し、これにより地域格差が縮小し、国全体の経済成長が促進された。
- 金融政策: 通商産業省は、中小企業の成長を支援する金融政策を実施し、よりバランスのとれた経済の構築に貢献しました。
- 貿易政策: 通商産業省は他国と貿易協定を交渉し、それが日本の輸出を拡大し、世界競争力を高めるのに役立った。
- 労働政策:通商産業省は、労使協力の促進と労働条件の改善を目的とした労働政策を実施し、これにより生産性の向上と労働争議の減少に貢献した。
- インフラ開発:通商産業省は、交通網や通信ネットワークなどのインフラ開発に投資し、コストの削減と効率の向上に貢献しました。
- 国際協力:通商産業省は、国際経済協力と安定を促進するために、世界銀行や国際通貨基金などの国際機関と協力した。
D先生: “回答がE語ですからね。2つのLLMは同レベルです。”
QEU:FOUNDER : “もう1つ、事例を見てみましょう。”
(Question:3)
第二次世界大戦後の米国による日本占領は、広範囲にわたる改革と民主主義的価値観をもたらし、急速な経済成長と工業化に貢献しました。しかし、この成長は主に輸出主導の成長と米国戦略への追随に依存していました。米国戦略への日本の依存は、日本独自の経済的アイデンティティを築く能力を妨げたのでしょうか?
The US occupation of Japan after World War II brought far-reaching reforms and democratic values, which contributed to rapid economic growth and industrialization. However, this growth was pri-marily dependent on export-led growth and following US strategies. Did Japan's reliance on US strategies hinder its ability to forge a unique economic identity?
(Solar LLM)
The US occupation of Japan after World War II brought about significant changes in the country's political and economic landscape. The introduction of democratic values and far-reaching reforms contributed to rapid economic growth and industrialization. However, this growth was primarily de-pendent on export-led strategies, which were influenced by US economic policies. This raises the question of whether Japan's reliance on US strategies hinder its ability to forge a unique economic identity.
The US occupation of Japan was marked by a comprehensive program of reforms aimed at trans-forming the country's political and economic system. The Allied forces dismantled the Japanese mili-tary and introduced democratic values, which had a profound impact on the country's political land-scape. These changes were accompanied by economic reforms, including the redistribution of land and the dismantling of the zaibatsu, Japan's powerful conglomerates.
The introduction of democratic values and far-reaching reforms contributed to rapid economic growth and industrialization. However, this growth was primarily dependent on export-led strategies, which were influenced by US economic policies. The US encouraged Japan to focus on export-led growth, which was seen as a way to promote economic recovery and integration into the global econ-omy. This strategy was successful in the short term, as Japan's exports increased rapidly, and the country experienced a period of rapid economic growth.
However, this reliance on US strategies may have hindered Japan's ability to forge a unique econom-ic identity. The country's economic policies were heavily influenced by US economic theories and strategies, which may have limited Japan's ability to develop its own unique economic model. Addi-tionally, the focus on export-led growth may have contributed to Japan's economic vulnerability, as the country became dependent on external factors, such as global demand, for its economic success.
In conclusion, the US occupation of Japan after World War II brought about significant changes in the country's political and economic landscape. The introduction of democratic values and far-reaching reforms contributed to rapid economic growth and industrialization. However, this growth was primarily dependent on export-led strategies, which were influenced by US economic policies. This raises the question of whether Japan's reliance on US strategies hinder its ability to forge a unique economic identity.
第二次世界大戦後の米国による日本占領は、日本の政治と経済に大きな変化をもたらした。民主的価値観の導入と広範囲にわたる改革は、急速な経済成長と工業化に貢献した。しかし、この成長は主に米国の経済政策の影響を受けた輸出主導の戦略に依存していた。このことから、日本が米国の戦略に依存していることが、独自の経済的アイデンティティを築く能力を妨げているのではないかという疑問が生じる。
米国による日本占領は、日本の政治と経済のシステムを変革することを目的とした包括的な改革プログラムによって特徴づけられた。連合軍は日本軍を解体し、民主的価値観を導入したが、これは日本の政治状況に大きな影響を与えた。これらの変化には、土地の再分配や日本の強力な複合企業である財閥の解体などの経済改革が伴った。
民主的価値観の導入と広範囲にわたる改革は、急速な経済成長と工業化に貢献した。しかし、この成長は主に輸出主導の戦略に依存しており、米国の経済政策の影響を受けた。米国は日本に対し、経済回復と世界経済への統合を促進する方法とみなされていた輸出主導の成長に重点を置くよう奨励した。この戦略は短期的には成功し、日本の輸出は急速に増加し、日本は急速な経済成長期を経験した。
しかし、米国の戦略への依存は、日本が独自の経済的アイデンティティを築く能力を妨げた可能性がある。日本の経済政策は米国の経済理論と戦略に大きく影響されており、日本が独自の経済モデルを開発する能力を制限した可能性がある。さらに、輸出主導の成長に重点を置いたことは、日本が経済的成功を世界的な需要などの外部要因に依存するようになったため、日本の経済的脆弱性の一因となった可能性がある。
結論として、第二次世界大戦後の米国の日本占領は、日本の政治経済状況に大きな変化をもたらした。民主主義の価値観の導入と広範囲にわたる改革は、急速な経済成長と工業化に貢献した。しかし、この成長は主に米国の経済政策の影響を受けた輸出主導の戦略に依存していた。このことから、日本が米国の戦略に依存していることが、独自の経済的アイデンティティを築く能力を妨げているのではないかという疑問が生じる。
(Answer:QEU_mistral)
Yes, Japan's reliance on US strategies hindered its ability to forge a unique economic identity. While the US occupation brought about important reforms and democratic values, the country's economic growth was largely dependent on export-led strategies, which limited its ability to develop a diverse economy. Additionally, the US-led economic policies favored large corporations and favored indus-tries such as automobiles and electronics, which further limited Japan's economic diversity.
そうです、日本は米国の戦略に依存しており、独自の経済アイデンティティを築く能力を妨げていました。一方、米国の占領は重要な改革と民主的価値観をもたらしましたが、日本の経済成長は主に輸出主導の戦略に依存しており、それが多様性を発展させる能力を制限していました。さらに、米国主導の経済政策は大企業を優遇し、自動車やエレクトロニクスなどの産業を優遇したため、日本の経済の多様性はさらに制限されました。
D先生 : “SOLARの回答が重複していますね。ただし、この程度ならばRAG推論をするときには解決できるでしょうね。結論としては、SOLAR_LLMはC語やJ語を使った複雑なロジックの処理ではなければ十分に使えますね。”
QEU:FOUNDER : “本当は、Unslothを使ったFTで行きたかったのですが、そのシステム成熟度に問題があるので、さしあたりの「つなぎ」にとしてPredibaseが使えますね。もちろん、今後の新発見によって、こっちの方がイケているケースがあるのかもしれません。”
D先生: “それでは、次のテーマに行きましょう。”
~ まとめ ~
・・・ 前回のつづきです ・・・
QEU:FOUNDER : “J国に蔓延している通俗道徳を打ち倒すには、自分が強いと思い込んでいる人々に対して、「オマエは弱いのだ」と言って回るしかないんですよ。つまり、「正しい人が強い」にパラダイムを変えなければならない。”
C部長(設定は50台前半): “今回は、ずいぶん詳しく解説されていますね。ただし、J国の人口動態からみて、(彼の思想は)そう簡単には広がらないでしょうね。まっ・・、私のような「若者」には受け入れられますが・・・(笑)。”
QEU:FOUNDER : “アンタが若者かね・・・(絶句)。それじゃ、A君、B君(設定30代)の立場がないわな。おーい・・・。B君に質問です。若者は保守化しているというニュースを、昔、聞いたことがあります。それは本当ですか?”
B係長: “まさか・・・。我々の年代は、哀れな「パワハラ被害者の世代」ですよ。あんなもんにハマるもんですか・・・。”
QEU:FOUNDER : “「パワハラ被害者の世代」ねえ・・・。まあ、普通に考えて、そう簡単に世の中がかわると思わんわな・・・。”
- おっさん(@QCサークル講話);「従業員の皆さんにはテレビを見てください。皆が同じように考えてください。」
- オッサン(@車中、N社検査不正について): 「“検査不正”っていうのはなァ、(組織外に不正を)漏らしたヤツが悪いんだよ・・・」
- オッサン(海外工場のあいさつにて):「私の使命はこの会社で終身雇用制を実現することにある・・・。」
QEU:FOUNDER : “ああいう人たちは、会社で習った通俗道徳が、「人生の全部」です。人生の間際まで変わるとはおもわんわ。逆ギレするだけ・・・。そのための精神バランスの避難地として、「保守()思想」があるですね。”
B係長: “保守()って、とっても人気がありますからね。”
QEU:FOUNDER : “そりゃあもう・・・。B係長が小生の年齢になって、初めて本当の保守の意味が社会的に共有されるんじゃないか?小生が生きてるうちには、その日を見ることはないかもね。”