- ビジネスに関する時事情報
- デジタル化・IT化によるビジネスの自動化・効率化
- ホームページ作成
- ビジネス効率化に有効な情報機器の紹介
- デジタルマーケティング
- ロボット・IoT・AI (人工知能)・その他
【運営元】株式会社ダークマター
【その他】プライバシーポリシー

今回は全11回中の7回目です。
第1回 1 Introduction:はじめに
第2回 2 What Are LLMs?:LLMとは何か?
第3回 3 Applications:応用
第4回 3.1 Ideation:アイデア出し
第5回 3.2 Writing:執筆
第6回 3.3 Background Research:背景調査
第9回 3.6 Mathematical Derivations:数学的導出
第10回 3.7 Summary:まとめ
第11回 4 Outlook and Concluding Thoughts:展望と考察
LLMs can serve both as assistants for micro tasks and as tutors for coding. They can write, edit, modify, translate, or debug snippets of code based on instructions in plain English (or other common languages). Moreover, they can act as tutors when using new libraries, functions, or even programming languages that the user is not very familiar with by quickly generating output that shows what libraries and functions are needed for specific types of operations or what syntactic structures to use in a given programming language. This allows the human programmer to consult the LLM and weave together code from many different snippets generated by it. GPT3.5 has been trained on large amounts of computer code and is accordingly quite powerful at coding. OpenAI’s Codex is accessible through the code-davinci-002-model or, alternatively, is integrated as Copilot into GitHub. The language model text-davinci-003 is a descendant of code-davinci-002 and is therefore not only ca pable of generating natural language but also computer code. Because of its training data, the two programming languages in which it is most well-versed are python and R, but it is quite capable in any common programming language - from basic functions in Excel to complex C/C++ code.
▽
LLMは、簡単なタスクのアシスタントの他に、コーディングの家庭教師にもなってくれます。ごくシンプルな自然言語で指示を与えるだけで、コードのスニペットを作成、編集、変更、翻訳、またはデバッグを行うことができます。さらに、新しい分析ライブラリ、関数、プログラミング言語を使おうとする際に、LLMはそれらの使い方や特徴を教えるための出力を生成してくれて、家庭教師のように教えてくれます。従って、人間のプログラマはLLMに相談をし、LLMによって生成されたさまざまなスニペットをコードとして組み合わせることができます。GPT3.5の訓練データには大量のプログラミングコードが含まれているため、コーディングにおいては非常に強力です。 OpenAIのCodexは、code-davinci-002-modelを通じてアクセスすることも、CopilotとしてGitHubに統合することもできます。言語モデルtext-davinci-003はcode-davinci-002の子孫であるため、自然言語だけでなくコードも生成できます。訓練データの量の関係で、特に得意とするプログラミング言語はPythonとRですが、Excelの基本関数から複雑なC/C++のコー ドまで、一般的なプログラミング言語であればほとんどどれでもある程度は対応できます。
LLMs can be very useful for writing code, in particular for standard programming tasks, data manipulation and repetitive tasks. The following is an example:
# Python code to calculate the Fibonacci numbers
def Fibonacci(n):
if n<0:
print("Incorrect input")
# First Fibonacci number is 0
elif n==1:
return 0
# Second Fibonacci number is 1
elif n==2:
return 1
else:
return Fibonacci(n-1)+Fibonacci(n-2)
# Driver Program
print(Fibonacci(9))
Another example for which the system is very useful is for plotting graphs. I modified the prompt above to “# Python code to calculate the Fibonacci numbers and plot the first 10 numbers and compare against an exponential curve”. The result worked well. The system can also be told to repeat graphs with different variables or changes in formatting. Turning to data manipulation tasks, an example is the prompt “# Python code to reformat a name in standard format to [Last name], [First name]”. The current capabilities of publicly available LLMs are insufficient to write the full code to simulate most economic problems without human help - for example, I tried various prompts to solve basic economic problems like optimal consumption smoothing, optimal monopoly pricing, etc., and the results were rather inconsistent. However, LLMs can still be useful assistants for automating micro tasks involved in such problems. Moreover, they can act as tutors that help users to find the packages and functions that they need for specific use cases.
▽
LLMは、コードの作成、特に標準的なプログラミングのタスク、データ操作、繰り返すタスクに非常に役立ちます。 以下はその例です。
# Python code to calculate the Fibonacci numbers
def Fibonacci(n):
if n<0:
print("Incorrect input")
# First Fibonacci number is 0
elif n==1:
return 0
# Second Fibonacci number is 1
elif n==2:
return 1
else:
return Fibonacci(n-1)+Fibonacci(n-2)
# Driver Program
print(Fibonacci(9))
もう1つ役に立つ応用例は、データのプロットをしグラフを作成することです。上記のプロンプトを「#フィボナッチ数を計算し、最初の10個の数値をプロットし、指数曲線と比較するためのPythonコード」に変更しました。結果として、うまくいきました。しかも、いろいろな変数や書式を変更してグラフを繰り返し更新するように指示することもできます。データ加工・整形のタスクにも使用できて、例えば、「#標準形式の名前を[姓]、[名]の形式に変換するためのPythonコード」というプロンプトで指示できます。現在公開されているLLMの機能では、人間の助けなしでは、経済学の問題をシミュレーションするためのコードを書くことができません。私自身は、消費平滑化や独占価格の最適化などの基本的な問題を解決させるために様々なプロンプトを試行錯誤しましたが、得られた結果には一貫性がなかったです。それでもLLMは、これらの問題を得プロセスの中で出てくる簡単なタスクの自動化に役に立ちます。例えば、問題解決に必要なパッケージや関数を探してくれます。
Whereas the previous example wrote code based on English language instructions, LLMs can also do the reverse and explain what a given piece of code does in plain English, akin to a tutor:
[continued from previous example]
Explain the code above:
The code above is a function that calculates the Fibonacci numbers. The function takes an integer n as an argument and returns the nth Fibonacci number. The function uses recursion to calculate the Fibonacci numbers. The base cases are when n is 1 or 2, in which case the function returns 0 or 1 respectively. For any other value of n, the function returns the sum of the two previous Fibonacci numbers.
This functionality is particularly useful when working with programming languages one is not very familiar with.
▽
上の例では、英語の指示に従ってコードを書かせていたのに対し、LLMはその逆も行うことができます。コードを与えると自然言語で家庭教師のように説明してくれ ます。
[先程と同じ例]
上記のコードを説明してください。
上記のコードはフィボナッチ数を計算する関数です。この関数は引数として整数nを受け取り、n番目のフィボナッチ数を返します。この関数は再帰を使用してフィボナッチ数を計算します。nが1または2の場合、関数はそれぞれ0または1を返します。nのその他の値をとる場合、関数は前の2つのフィボナッチ数の合計を返します。
上記のような機能は、あまり慣れていないプログラミング言語を使用する場合に特に便利です。
Frequently, we have code in one programming language that needs to be converted into another language, for example, because we are porting a project to another platform, or because we have found code snippets in an online coding forum such as StackExchange that is useful but in the wrong language. The following example speaks for itself:
[continued from the example in 3.4.1]
#Translate the function above from Python to Matlab
function F = Fibonacci(n)
if n < 0
disp('Incorrect input')
elseif n == 1
F = 0;
elseif n == 2
F = 1;
else
F = Fibonacci(n-1) + Fibonacci(n-2);
end
end
Current LLMs are quite reliable in translating short pieces of code in this fashion across most common languages. For longer sequences, human assistance is still required.
▽
あるプログラミング言語で書かれたコードを別のプログラミング言語に変換したい場合があります。例えば、プロジェクトを別のプラットフォームに移行するとき、あるいはStackExchangeで見つけた、現在使っていない言語でアドバイスが書かれているときなどです。次がよく機能するプロンプト例です。
[例 3.4.1からの続き]
#上記の関数を Python から Matlab に変換してください。
function F = Fibonacci(n)
if n < 0
disp('Incorrect input')
elseif n == 1
F = 0;
elseif n == 2
F = 1;
else
F = Fibonacci(n-1) + Fibonacci(n-2);
end
end
現在開発されているLLMは、ほとんどのプログラミング言語について、このような短めのコードの変換が結構得意です。しかし、より長いシーケンスの場合は、人間の支援が必要になるかもしれません。
One of the most frustrating parts of programming is to debug code. LLMs display some useful capabilities in this domain, as shown in the following example:
What is the mistake in the following code?
def Fibonacci(n):
elif n==1:
return 0
elif n=2:
return 1
else:
return Fibonacci(n-1)+Fibonaci(n-2)
As illustrated, here, the system is highly useful for catching typos and violations of basic syntax. It has some capabilities that go beyond this, e.g., when indices are mixed up and similar situations. For high-level mistakes such as mistakes in the algorithms underlying the code, human debugging is still required. For example, when I changed one of the numbers returned in the code above to a nonsensical number (say “2” instead of “0” ), the system did not nd anything wrong about that.
▽
プログラミングで最もイライラする部分の 1 つは、コードのデバッグです。次の例に示すように、LLM はこの領域でいくつかの便利な機能を表示します。
次のコードの間違いは何ですか?
def Fibonacci(n):
elif n==1:
return 0
elif n=2:
return 1
else:
return Fibonacci(n-1)+Fibonaci(n-2)
ここで示されているように、このシステムはタイプミスや基本構文の違反を検出するのに非常に役立ちます。これには、インデックスが混在している場合や同様の状況など、これを超える機能がいくつかあります。コードの基礎となるアルゴリズムの間違いなどの高レベルの間違いについては、依然として人間によるデバッグが必要です。たとえば、上記のコードで返された数値の 1 つを意味のない数値 (たとえば、「0」の代わりに「2」) に変更したとき、システムはそれについて何も問題を検出しませんでした。
原論文
Language Models and Cognitive Automation for Economic Research
LLMについては以前のブログ記事を参考にしてください。
LLMとは?未来のAI技術を理解する
👇このページのQRコード
【運営元】株式会社ダークマター
【その他】プライバシーポリシー