mirror of
https://github.com/dair-ai/Prompt-Engineering-Guide
synced 2024-11-02 15:40:13 +00:00
93 lines
6.7 KiB
Plaintext
93 lines
6.7 KiB
Plaintext
# Generated Knowledge Prompting
|
||
|
||
import {Screenshot} from 'components/screenshot'
|
||
import GENKNOW from '../../img/gen-knowledge.png'
|
||
|
||
<Screenshot src={GENKNOW} alt="GENKNOW" />
|
||
|
||
Источник изображения: [Liu et al. 2022](https://arxiv.org/pdf/2110.08387.pdf)
|
||
|
||
Большие языковые модели постоянно совершенствуются, и одной из популярных техник является возможность интегрировать знания или информацию, чтобы помочь модели делать более точные прогнозы.
|
||
|
||
Используя подобную идею, можно ли также использовать модель для генерации знаний перед предсказанием? Именно это пытается сделать статья [Liu et al. 2022](https://arxiv.org/pdf/2110.08387.pdf) - генерировать знания для использования в качестве части запроса. В частности, насколько полезно это для задач, связанных с здравым смыслом?
|
||
|
||
Давайте попробуем простой запрос:
|
||
|
||
*Запрос:*
|
||
```
|
||
Part of golf is trying to get a higher point total than others. Yes or No?
|
||
```
|
||
|
||
*Результат:*
|
||
```
|
||
Yes.
|
||
```
|
||
|
||
Такая ошибка выявляет ограничения LLM в выполнении задач, требующих большего количества знаний о мире. Как можно улучшить это с помощью генерации знаний?
|
||
|
||
Сначала сгенерируем несколько "знаний":
|
||
|
||
*Запрос:*
|
||
```
|
||
Input: Greece is larger than mexico.
|
||
Knowledge: Greece is approximately 131,957 sq km, while Mexico is approximately 1,964,375 sq km, making Mexico 1,389% larger than Greece.
|
||
|
||
Input: Glasses always fog up.
|
||
Knowledge: Condensation occurs on eyeglass lenses when water vapor from your sweat, breath, and ambient humidity lands on a cold surface, cools, and then changes into tiny drops of liquid, forming a film that you see as fog. Your lenses will be relatively cool compared to your breath, especially when the outside air is cold.
|
||
|
||
Input: A fish is capable of thinking.
|
||
Knowledge: Fish are more intelligent than they appear. In many areas, such as memory, their cognitive powers match or exceed those of ’higher’ vertebrates including non-human primates. Fish’s long-term memories help them keep track of complex social relationships.
|
||
|
||
Input: A common effect of smoking lots of cigarettes in one’s lifetime is a higher than normal chance of getting lung cancer.
|
||
Knowledge: Those who consistently averaged less than one cigarette per day over their lifetime had nine times the risk of dying from lung cancer than never smokers. Among people who smoked between one and 10 cigarettes per day, the risk of dying from lung cancer was nearly 12 times higher than that of never smokers.
|
||
|
||
Input: A rock is the same size as a pebble.
|
||
Knowledge: A pebble is a clast of rock with a particle size of 4 to 64 millimetres based on the Udden-Wentworth scale of sedimentology. Pebbles are generally considered larger than granules (2 to 4 millimetres diameter) and smaller than cobbles (64 to 256 millimetres diameter).
|
||
|
||
Input: Part of golf is trying to get a higher point total than others.
|
||
Knowledge:
|
||
```
|
||
|
||
*Знание 1:*
|
||
```
|
||
The objective of golf is to play a set of holes in the least number of strokes. A round of golf typically consists of 18 holes. Each hole is played once in the round on a standard golf course. Each stroke is counted as one point, and the total number of strokes is used to determine the winner of the game.
|
||
```
|
||
|
||
*Знание 2:*
|
||
```
|
||
Golf is a precision club-and-ball sport in which competing players (or golfers) use many types of clubs to hit balls into a series of holes on a course using the fewest number of strokes. The goal is to complete the course with the lowest score, which is calculated by adding up the total number of strokes taken on each hole. The player with the lowest score wins the game.
|
||
```
|
||
|
||
Мы используем запрос, представленный в статье [Liu et al. 2022](https://arxiv.org/pdf/2110.08387.pdf).
|
||
|
||
Следующий шаг - интеграция знаний и получение предсказания. Я переформулировал вопрос в формате вопрос-ответ, чтобы указать формат ответа.
|
||
|
||
*Запрос:*
|
||
```
|
||
Question: Part of golf is trying to get a higher point total than others. Yes or No?
|
||
|
||
Knowledge: The objective of golf is to play a set of holes in the least number of strokes. A round of golf typically consists of 18 holes. Each hole is played once in the round on a standard golf course. Each stroke is counted as one point, and the total number of strokes is used to determine the winner of the game.
|
||
|
||
Explain and Answer:
|
||
```
|
||
|
||
*Ответ 1 (очень высокая уверенность):*
|
||
```
|
||
No, the objective of golf is not to get a higher point total than others. Rather, the objective is to play a set of holes in the least number of strokes. The total number of strokes is used to determine the winner of the game, not the total number of points.
|
||
```
|
||
|
||
```
|
||
Question: Part of golf is trying to get a higher point total than others. Yes or No?
|
||
|
||
Knowledge: Golf is a precision club-and-ball sport in which competing players (or golfers) use many types of clubs to hit balls into a series of holes on a course using the fewest number of strokes. The goal is to complete the course with the lowest score, which is calculated by adding up the total number of strokes taken on each hole. The player with the lowest score wins the game.
|
||
|
||
Explain and Answer:
|
||
```
|
||
|
||
*Ответ 2 (уверенность намного ниже):*
|
||
```
|
||
Yes, part of golf is trying to get a higher point total than others. Each player tries to complete the course with the lowest score, which is calculated by adding up the total number of strokes taken on each hole. The player with the lowest score wins the game.
|
||
```
|
||
|
||
С этим примером происходят действительно интересные вещи. В первом ответе модель была очень уверена, но во втором ответе уже не так уверена. Я упростил процесс для целей демонстрации, но при определении окончательного ответа следует учесть несколько дополнительных деталей. Более подробную информацию можно найти в статье.
|