You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [Research](https://microsoft.github.io/autogen/docs/Research), [blogposts](https://microsoft.github.io/autogen/blog) around AutoGen, and [Transparency FAQs](https://github.com/microsoft/autogen/blob/main/TRANSPARENCY_FAQS.md)
Copy file name to clipboardExpand all lines: website/blog/2023-04-21-LLM-tuning-math/index.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -71,4 +71,4 @@ The need for model selection, parameter tuning and cost saving is not specific t
71
71
* [Research paper about the tuning technique](https://arxiv.org/abs/2303.04673)
72
72
* [Documentation about inference tuning](/docs/Use-Cases/enhanced_inference)
73
73
74
-
*Do you have any experience to share about LLM applications? Do you like to see more support or research of LLM optimization or automation? Please join our [Discord](https://discord.gg/pAbnFJrkgZ) server for discussion.*
74
+
*Do you have any experience to share about LLM applications? Do you like to see more support or research of LLM optimization or automation? Please join our [Discord](https://aka.ms/autogen-dc) server for discussion.*
Copy file name to clipboardExpand all lines: website/blog/2023-05-18-GPT-adaptive-humaneval/index.mdx
+26-16
Original file line number
Diff line number
Diff line change
@@ -7,19 +7,19 @@ tags: [LLM, GPT, research]
7
7

8
8
9
9
**TL;DR:**
10
-
* **A case study using the HumanEval benchmark shows that an adaptive way of using multiple GPT models can achieve both much higher accuracy (from 68% to 90%) and lower inference cost (by 18%) than using GPT-4 for coding.**
11
10
11
+
- **A case study using the HumanEval benchmark shows that an adaptive way of using multiple GPT models can achieve both much higher accuracy (from 68% to 90%) and lower inference cost (by 18%) than using GPT-4 for coding.**
12
12
13
13
GPT-4 is a big upgrade of foundation model capability, e.g., in code and math, accompanied by a much higher (more than 10x) price per token to use over GPT-3.5-Turbo. On a code completion benchmark, [HumanEval](https://huggingface.co/datasets/openai_humaneval), developed by OpenAI, GPT-4 can successfully solve 68% tasks while GPT-3.5-Turbo does 46%. It is possible to increase the success rate of GPT-4 further by generating multiple responses or making multiple calls. However, that will further increase the cost, which is already nearly 20 times of using GPT-3.5-Turbo and with more restricted API call rate limit. Can we achieve more with less?
14
14
15
15
In this blog post, we will explore a creative, adaptive way of using GPT models which leads to a big leap forward.
16
16
17
17
## Observations
18
18
19
-
* GPT-3.5-Turbo can already solve 40%-50% tasks. For these tasks if we never use GPT-4, we can save nearly 40-50% cost.
20
-
* If we use the saved cost to generate more responses with GPT-4 for the remaining unsolved tasks, it is possible to solve some more of them while keeping the amortized cost down.
19
+
- GPT-3.5-Turbo can already solve 40%-50% tasks. For these tasks if we never use GPT-4, we can save nearly 40-50% cost.
20
+
- If we use the saved cost to generate more responses with GPT-4 for the remaining unsolved tasks, it is possible to solve some more of them while keeping the amortized cost down.
21
21
22
-
The obstacle of leveraging these observations is that we do not know *a priori* which tasks can be solved by the cheaper model, which tasks can be solved by the expensive model, and which tasks can be solved by paying even more to the expensive model.
22
+
The obstacle of leveraging these observations is that we do not know _a priori_ which tasks can be solved by the cheaper model, which tasks can be solved by the expensive model, and which tasks can be solved by paying even more to the expensive model.
23
23
24
24
To overcome that obstacle, one may want to predict which task requires what model to solve and how many responses are required for each task. Let's look at one example code completion task:
25
25
@@ -49,8 +49,8 @@ Some simple example test cases are provided in the docstr. If we already have a
49
49
50
50
Combining these observations, we can design a solution with two intuitive ideas:
51
51
52
-
* Make use of auto-generated feedback, i.e., code execution results, to filter responses.
53
-
* Try inference configurations one by one, until one response can pass the filter.
52
+
- Make use of auto-generated feedback, i.e., code execution results, to filter responses.
53
+
- Try inference configurations one by one, until one response can pass the filter.
54
54
55
55

56
56
@@ -72,6 +72,7 @@ The inference cost includes the cost for generating the assertions in our soluti
72
72
Here are a few examples of function definitions which are solved by different configurations in the portfolio.
73
73
74
74
1. Solved by GPT-3.5-Turbo, n=1, temperature=0
75
+
75
76
```python
76
77
def compare(game,guess):
77
78
"""I think we all remember that feeling when the result of some long-awaited
5. Solved by GPT-4, n=1, temperature=1, stop=["\nclass", "\ndef", "\nif", "\nprint"]:
129
+
123
130
```python
124
131
def sort_array(arr):
125
132
"""
@@ -135,8 +142,9 @@ def sort_array(arr):
135
142
```
136
143
137
144
The last problem is an example with wrong example test cases in the original definition. It misleads the adaptive solution because a correct implementation is regarded as wrong and more trials are made. The last configuration in the sequence returns the right implementation, even though it does not pass the auto-generated assertions. This example demonstrates that:
138
-
* Our adaptive solution has a certain degree of fault tolerance.
139
-
* The success rate and inference cost for the adaptive solution can be further improved if correct example test cases are used.
145
+
146
+
- Our adaptive solution has a certain degree of fault tolerance.
147
+
- The success rate and inference cost for the adaptive solution can be further improved if correct example test cases are used.
140
148
141
149
It is worth noting that the reduced inference cost is the amortized cost over all the tasks. For each individual task, the cost can be either larger or smaller than directly using GPT-4. This is the nature of the adaptive solution: The cost is in general larger for difficult tasks than that for easy tasks.
142
150
@@ -147,22 +155,24 @@ An example notebook to run this experiment can be found at: https://github.com/m
147
155
Our solution is quite simple to implement using a generic interface offered in [`autogen`](/docs/Use-Cases/enhanced_inference#logic-error), yet the result is quite encouraging.
148
156
149
157
While the specific way of generating assertions is application-specific, the main ideas are general in LLM operations:
150
-
* Generate multiple responses to select - especially useful when selecting a good response is relatively easier than generating a good response at one shot.
151
-
* Consider multiple configurations to generate responses - especially useful when:
158
+
159
+
- Generate multiple responses to select - especially useful when selecting a good response is relatively easier than generating a good response at one shot.
160
+
- Consider multiple configurations to generate responses - especially useful when:
152
161
- Model and other inference parameter choice affect the utility-cost tradeoff; or
153
162
- Different configurations have complementary effect.
154
163
155
164
A [previous blog post](/blog/2023/04/21/LLM-tuning-math) provides evidence that these ideas are relevant in solving math problems too.
156
165
`autogen` uses a technique [EcoOptiGen](https://arxiv.org/abs/2303.04673) to support inference parameter tuning and model selection.
157
166
158
167
There are many directions of extensions in research and development:
159
-
* Generalize the way to provide feedback.
160
-
* Automate the process of optimizing the configurations.
161
-
* Build adaptive agents for different applications.
162
168
163
-
*Do you find this approach applicable to your use case? Do you have any other challenge to share about LLM applications? Do you like to see more support or research of LLM optimization or automation? Please join our [Discord](https://discord.gg/pAbnFJrkgZ) server for discussion.*
169
+
- Generalize the way to provide feedback.
170
+
- Automate the process of optimizing the configurations.
171
+
- Build adaptive agents for different applications.
172
+
173
+
_Do you find this approach applicable to your use case? Do you have any other challenge to share about LLM applications? Do you like to see more support or research of LLM optimization or automation? Please join our [Discord](https://aka.ms/autogen-dc) server for discussion._
164
174
165
175
## For Further Reading
166
176
167
-
* [Documentation](/docs/Getting-Started) about `autogen` and [Research paper](https://arxiv.org/abs/2303.04673).
168
-
* [Blog post](/blog/2023/04/21/LLM-tuning-math) about a related study for math.
177
+
- [Documentation](/docs/Getting-Started) about `autogen` and [Research paper](https://arxiv.org/abs/2303.04673).
178
+
- [Blog post](/blog/2023/04/21/LLM-tuning-math) about a related study for math.
0 commit comments