새소식

딥러닝, 머신러닝/프롬프트 엔지니어링

개발자를 위한 챗 GPT 프롬프트 엔지니어링 #3. Iterative

  • -

이전 글 보기

개발자를 위한 챗 GPT 프롬프트 엔지니어링 #2. Guidelines

 

chatGPT prompt Engineering for Developers 영상 강의를 듣고 정리한 내용입니다.

 

 

이번 강의에서는 더 나은 결과를 얻기 위해 프롬프트를 반복적으로 개선하는 과정을 설명하고 있다. 앤드류 응은 "단번에 최적의 결과를 내는 프롬프트를 만들기는 너무 어렵다. 계속 명령을 바꿔가며 결과를 개선해봐야 한다" 라고 강조하고 있다. 어찌보면 현재 Chat GPT 같은 LLM의 한계라, 잘 이용할 수 있는 방법을 알아야 하는 것 같다.

 

 

목적 : <마케팅 팀의 제품 설명 작성 시간을 줄이기 위한 초안 작성>

위와 같은 목적을 위해 정확한 고객(타깃)을 명시하고, HTML로 출력하는 예시까지 살펴보자.

 

 

1. 제품 설명

prompt = f"""
Your task is to help a marketing team create a 
description for a retail website of a product based 
on a technical fact sheet.

Write a product description based on the information 
provided in the technical specifications delimited by 
triple backticks.

The description is intended for furniture retailers, 
so should be technical in nature and focus on the 
materials the product is constructed from.

At the end of the description, include every 7-character 
Product ID in the technical specification.

Use at most 50 words.

Technical specifications: ```{fact_sheet_chair}```
"""
response = get_completion(prompt)
print(response)

 

[결과]

"The description is intended for furniture retailers, so should be technical in nature and focus on the materials the product is constructed from."

- 프롬프트 상에서 "가구 소매점을 위한 글"이라고 타깃을 명시했다. (The description is intended for furniture retailers)

- 아무래도 가구 소매점이 타깃이다 보니 제품의 재료에 초점을 맞추고, 기술적인 부분을 쓰게 했다. (should be technical in nature and focus on the materials)

더보기

Introducing our versatile and stylish office chair, featuring a durable cast aluminum shell with a nylon coating and a comfortable HD36 foam seat. Choose from a variety of base finishes and upholstery options to suit your space. Perfect for both home and office use. Product IDs: SWC-100, SWC-110.

 

한글 번역 (참고)

- 지시한대로 재료(나일론, 알루미늄 등)는 강조됐으나 기술적인 부분보다는 기능적 부분이 강조된 듯하다 (내구성, 편안한)

더보기

나일론 코팅이 된 내구성이 뛰어난 주조 알루미늄 쉘과 편안한 HD36 폼 시트를 갖춘 다용도 스타일리시 사무용 의자를 소개합니다. 다양한 기본 마감재와 커버 옵션 중에서 공간에 맞게 선택하세요. 가정과 사무실 모두에 적합합니다. 제품 ID: SWC-100, SWC-110.

 

 

2. HTML 제작(개발)

prompt = f"""
Your task is to help a marketing team create a 
description for a retail website of a product based 
on a technical fact sheet.

Write a product description based on the information 
provided in the technical specifications delimited by 
triple backticks.

The description is intended for furniture retailers, 
so should be technical in nature and focus on the 
materials the product is constructed from.

At the end of the description, include every 7-character 
Product ID in the technical specification.

After the description, include a table that gives the 
product's dimensions. The table should have two columns.
In the first column include the name of the dimension. 
In the second column include the measurements in inches only.

Give the table the title 'Product Dimensions'.

Format everything as HTML that can be used in a website. 
Place the description in a <div> element.

Technical specifications: ```{fact_sheet_chair}```
"""

response = get_completion(prompt)
print(response)

 

 

그래도 나름 쓸만한 수준의 HTML이 나왔다. 최근 openui 라는 오픈소스가 github star 14K가 될 정도로 인기가 많다.

openui

이 툴도 LLM 을 이용해서 HTML 디자인까지 해주는데 1개 페이지이긴 하지만 웬만큼 이쁘게 잘 만들어준다. 웹 페이지는 웹 디자인, 퍼블리싱 작업도 꽤나 공수가 드는데 이게 있으면 간단한 수준의 웹 디자인과 퍼블리싱 능력만으로도 커버가 될 듯하다. 처음부터 만드는 것보다는 수정이 훨씬 쉬우니까.

 

 

 

사실 오늘 강의에 나온 내용의 결과물도 완전 만족할 만한 수준은 아니다. 하지만 앤드류 응 교수가 강조하듯 프롬프트 개발은 반복 과정이 중요하다. 처음부터 최선의 결과를 내려 하지 말고 이 2가지를 생각하며 계속 수정하고 결과를 보면 좋다.

 

1. 더 지시를 명확하게 해보기

2. 어떻게 하면 더 많은 걸 생각하게 해서 결과를 명확하게 할지 생각해보기

 

 

아직 Chat GPT나 LLM은 발전할 부분이 많이 남았다. 하지만 현 수준으로도 많은 사람들의 불편한 부분들을 해결해주고 있다. 특히나 엑셀, 문서 작업 같은 단순 반복 작업의 경우 도움이 많이 되는 것 같다. 꼭 모든 사람에게 도움이 되는 대단한 기술을 만들 필요는 없다. 일부 사람들에게만 확실하게 도움이 된다면 좋은 서비스, 좋은 프로그램이 될 것 같다. 이번 강의가 이런 틀을 깨는 데 더 도움이 된 것 같다. 

Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.