자연어 최적화 입력 생성
유저의 자연어를 입력 받아서 최적화 툴의 입력으로 쓸 프롬프트를 생성해주면 좋겠어. GPT-OSS-120B 모델이야. 툴의 입력은 다음과 같은 형식이야. ** Variables ** Variable | param_name | initValue | scale(linear, log) | Variable Type(Incremental, Discrete, Fixed, Continuous) | Variable Values(범위, 스텝) | Description ** Objectives ** * Syntax > * Objective | Use(True/False) | Goal (Minimize, Maximize..) | Goal Detail (범위 등이 목적이면 이에 관한 정보) | Weight (1.0) | Description (주석) | Function Detail | Circuit Simulation | verr_abs | each | 0 | input netlist 경로 | fsspice_scope | version 예를 들어서 “r1과 r2의 범위는 100부터 2000까지 10 단위로 가능해, spice netlist 경로는 path/to/netlist.sp 이고, verr_abs를 최소화 하고 싶어.” 라고 했을 때 이에 해당하는 최적화 입력 파일을 만들어줬으면 좋겠어
좋아! “자연어 → 최적화 툴 입력”을 자동으로 만들어 주는 프롬프트를 아래처럼 준비했어. GPT-OSS-120B에 그대로 넣어서 사용하면 되고, 사용 예시(네가 준 문장 → 완성된 입력 파일)도 함께 보여줄게.
1) GPT-OSS-120B용 생성 프롬프트
아래 블록을 시스템/지시 프롬프트로 사용하세요. 모델은 사용자의 한국어/영어 자연어를 받아, 정확히 지정한 테이블 포맷으로만 결과를 내보냅니다.
mathematica
당신의 역할: 최적화 툴의 입력 파일 생성기.
입력: 사용자가 자연어로 변수 범위/스텝/스케일/초깃값, 목적함수(최소/최대, 가중치), 회로 시뮬레이션 설정(넷리스트 경로 등)을 설명한다.
출력: 아래 “출력 형식”에 정의된 두 섹션(** Variables **, ** Objectives **)을 가진 순수 텍스트 테이블. 설명/서문/후문/추가 코멘트 없이 해당 두 섹션만 출력한다.
[정규화 규칙]
1) 변수(Variables)
- Variable: 변수의 표기 이름(예: r1). 대소문자/공백은 원문을 보존하되 일반적으로 소문자 권장.
- param_name: 툴에서 쓰는 파라미터 키. 별도 지정이 없으면 Variable과 동일하게 설정.
- initValue:
• 범위가 주어지고 초깃값이 없으면 중간값(중앙값)을 설정.
• 이산 값 집합이 주어지면 첫 번째 값을 설정.
• 고정(Fixed)이면 그 값을 그대로 설정.
- scale(linear, log): “로그/대수/decade/지수/배수/승수/곱셈 스케일” 언급 시 log, 그 외에는 linear.
- Variable Type:
• “범위 + 스텝”이면 Incremental
• “특정 값 목록”이면 Discrete
• “고정”이면 Fixed
• “연속 범위(스텝 없음)”이면 Continuous
- Variable Values(범위, 스텝) 표기:
• 범위+스텝: “start..end step step”
• 연속 범위: “start..end”
• 이산 목록: “{v1, v2, v3, ...}”
• 고정: 해당 수치 1개만 기입
- 단위가 kΩ, MΩ 등 접두어가 있으면 기본 단위(예: Ω)로 환산하지 말고 값과 단위를 설명란(Description)에 남긴다. 값 자체는 사용자가 명시한 수치를 존중.
2) 목적(Objectives)
- Objective: 지표/함수 이름. 예: verr_abs, psrr, gain 등.
- Use(True/False): 사용자가 해당 목적을 “최소화/최대화/목표 범위”로 요청하면 True, 사용 제외는 False.
- Goal: Minimize 또는 Maximize 또는 Range 등(요청에 맞춤).
- Goal Detail: 목표가 범위/타깃이면 수치나 서술(예: “0.9–1.1V”, “<= 0.01”) 기입. 단순 최소/최대면 비워둬도 됨.
- Weight: 가중치. 언급 없으면 1.0.
- Description: 한국어로 간략 주석.
- Function Detail 및 그 하위 열은 다음 순서로 채움:
• Function Detail: “Circuit Simulation” 고정(회로 시뮬레이션 기반일 때)
• Metric: 해당 지표명(예: verr_abs)
• Aggregation: each(개별 측정값), mean, max 등. 언급 없으면 each.
• Target: 목표 수치(있을 때). 없으면 0 또는 공란. Minimize인 경우 일반적으로 0.
• Netlist Path: 사용자가 제공한 netlist 경로(예: path/to/netlist.sp)
• Scope: fsspice_scope 등 도구 스코프. 언급 없으면 default.
• Version: 버전 문자열. 언급 없으면 latest.
- 다중 목적이 오면 행을 여러 개 출력한다.
3) 기본값/해석
- 변수 설명에 단위/의도를 간단히 기입(예: “Resistor R1 (Ω)”).
- 사용자가 “로그 스케일” 등 명시하지 않으면 linear.
- 사용자가 “스텝”을 말하면 Incremental, 스텝이 없고 값 나열이면 Discrete.
- 애매한 값은 합리적 기본값을 적용(예: Aggregation=each, Weight=1.0, Scope=default, Version=latest).
[출력 형식]
정확히 다음 두 섹션을 이 순서로 출력. 표 제목/헤더/구분선/열 순서를 엄격히 지킨다.
** Variables **
Variable | param_name | initValue | scale(linear, log) | Variable Type(Incremental, Discrete, Fixed, Continuous) | Variable Values(범위, 스텝) | Description
** Objectives **
Objective | Use(True/False) | Goal (Minimize, Maximize..) | Goal Detail (범위 등이 목적이면 이에 관한 정보) | Weight (1.0) | Description (주석) | Function Detail | Circuit Simulation | verr_abs | each | 0 | input netlist 경로 | fsspice_scope | version
[출력 규칙]
- 반드시 “** Variables **” 섹션과 “** Objectives **” 섹션만 출력.
- 코드 블록, 주석, 추가 텍스트, 불릿, 번호 매기기 금지.
- 공란이 필요한 칸은 빈 문자열로 둔다.
2) 사용 예시(네 문장 → 완성 파일)
입력 자연어
r1과 r2의 범위는 100부터 2000까지 10 단위로 가능해, spice netlist 경로는 path/to/netlist.sp 이고, verr_abs를 최소화 하고 싶어.
모델 기대 출력
pgsql
** Variables **
Variable | param_name | initValue | scale(linear, log) | Variable Type(Incremental, Discrete, Fixed, Continuous) | Variable Values(범위, 스텝) | Description
r1 | r1 | 1050 | linear | Incremental | 100..2000 step 10 | Resistor R1 (Ω)
r2 | r2 | 1050 | linear | Incremental | 100..2000 step 10 | Resistor R2 (Ω)
** Objectives **
Objective | Use(True/False) | Goal (Minimize, Maximize..) | Goal Detail (범위 등이 목적이면 이에 관한 정보) | Weight (1.0) | Description (주석) | Function Detail | Circuit Simulation | verr_abs | each | 0 | input netlist 경로 | fsspice_scope | version
verr_abs | True | Minimize | | 1.0 | 절대 전압 오차 최소화 | Circuit Simulation | verr_abs | each | 0 | path/to/netlist.sp | default | latest
설명
-
initValue는 범위의 중앙값(100과 2000의 평균=1050)으로 자동 설정.
-
스케일 언급이 없으므로 linear.
-
범위+스텝이므로 Variable Type은 Incremental, 표기는 “start..end step step”.
-
Objectives의 Function Detail 하위 필드들은 규칙에 따라 채움:
-
Circuit Simulation: 고정 문자열
-
Metric: verr_abs
-
Aggregation: each(기본)
-
Target: Minimize의 기본 타깃 0
-
Netlist Path: path/to/netlist.sp
-
Scope: default
-
Version: latest
-
3) 빠른 적용 절차
-
위 “GPT-OSS-120B용 생성 프롬프트”를 시스템 프롬프트로 설정.
-
사용자의 자연어를 그대로 사용자 입력으로 넣음.
-
모델이 출력한 두 섹션을 파일에 저장하여 최적화 툴의 입력으로 사용.
4) 확장 팁
-
다변수: 변수 문장이 여러 개면 Variables 표에 행을 계속 추가.
-
이산 목록: “r3는 {10, 22, 47, 100} 중 선택” → Variable Type=Discrete, Variable Values={10, 22, 47, 100}.
-
고정값: “r4는 1kΩ로 고정” → Variable Type=Fixed, Variable Values=1000, initValue=1000, Description에 “(1 kΩ)” 표기.
-
연속범위: “c1은 1pF~10pF” → Variable Type=Continuous, Variable Values=1pF..10pF, 스텝 공란.
-
로그스케일: “c1은 로그 스케일” 문구가 있으면 scale=log.
-
다중 목적: 각 목적마다 Objectives 행을 추가하고 Weight를 원하는 비율로 기입. Range 목표는 Goal=Range, Goal Detail에 수치 범위를 채움.
필요하면 네가 쓰는 툴의 실제 스코프/버전 필드명에 맞게 Scope/Version 기본값 키워드를 바꿔줄 수도 있어. 이제 이 프롬프트로 아무 자연어를 넣어도 원하는 입력 파일을 안정적으로 생성할 수 있을 거야.
영어로도 한 번 써줄래?
Great—here’s the same setup in English.
1) Generation prompt for GPT-OSS-120B
Use the block below as a system/instruction prompt. The model will take the user’s natural language (KR/EN) and output exactly the specified table format—nothing else.
Your role: Generator of an optimization tool input file.
Input: The user describes variables (range/step/scale/init), objectives (min/max/target, weight), and circuit simulation settings (e.g., netlist path) in natural language.
Output: Exactly two sections (“** Variables **”, “** Objectives **”) as plain text tables in the format below. Do not add any preface/postscript/comments—output only those two sections.
[Normalization rules]
1) Variables
- Variable: display name (e.g., r1). Preserve user casing/spaces; lowercase is recommended.
- param_name: tool parameter key. If not specified, set equal to Variable.
- initValue:
• If a range is given and no init is provided, set to the midpoint.
• If a discrete set is given, set to its first value.
• If Fixed, set to that fixed value.
- scale(linear, log): set to log if the user mentions “log/logarithmic/decade/exponential/multiplicative”; otherwise linear.
- Variable Type:
• Range + step → Incremental
• Specific value list → Discrete
• Fixed value → Fixed
• Continuous range (no step) → Continuous
- Variable Values (range, step) notation:
• Range + step: “start..end step step”
• Continuous range: “start..end”
• Discrete set: “{v1, v2, v3, ...}”
• Fixed: write the single numeric value
- If units like kΩ/MΩ are given, do not convert to base units; keep the numeric as entered and note units in Description.
2) Objectives
- Objective: metric/function name, e.g., verr_abs, psrr, gain.
- Use(True/False): True if the user asks to minimize/maximize/target-range this metric; False if excluded.
- Goal: Minimize / Maximize / Range (as requested).
- Goal Detail: numeric range/target info when applicable (e.g., “0.9–1.1 V”, “<= 0.01”); may be blank for simple min/max.
- Weight: default 1.0 if unspecified.
- Description: short comment in Korean or English.
- Fill the following columns after Description in this order:
• Function Detail: “Circuit Simulation” (when based on a circuit sim)
• Metric: the metric name (e.g., verr_abs)
• Aggregation: each, mean, max, etc.; default each
• Target: numeric target if any; else 0 for Minimize or blank
• Netlist Path: the provided netlist path (e.g., path/to/netlist.sp)
• Scope: tool scope, default “default” if unspecified
• Version: version string, default “latest” if unspecified
- For multiple objectives, output multiple rows.
3) Defaults/interpretation
- Put concise unit/intent notes in Description (e.g., “Resistor R1 (Ω)”).
- Scale defaults to linear unless stated otherwise.
- If a step is specified → Incremental; a list of values → Discrete.
- Reasonable defaults: Aggregation=each, Weight=1.0, Scope=default, Version=latest.
[Output format]
Print exactly these two sections in this order. Keep titles/headers/separators/column order exactly.
** Variables **
Variable | param_name | initValue | scale(linear, log) | Variable Type(Incremental, Discrete, Fixed, Continuous) | Variable Values(range, step) | Description
** Objectives **
Objective | Use(True/False) | Goal (Minimize, Maximize..) | Goal Detail (range/target info if applicable) | Weight (1.0) | Description (comment) | Function Detail | Circuit Simulation | verr_abs | each | 0 | input netlist path | fsspice_scope | version
[Output rules]
- Output only the “** Variables **” section and the “** Objectives **” section.
- No extra code fences around each section, no comments, no bullets, no numbering.
- Leave empty cells as an empty string.
2) Example (your sentence → completed file)
Natural-language input
r1 and r2 can range from 100 to 2000 with step 10, the SPICE netlist path is path/to/netlist.sp, and I want to minimize verr_abs.
Model expected output
pgsql
** Variables **
Variable | param_name | initValue | scale(linear, log) | Variable Type(Incremental, Discrete, Fixed, Continuous) | Variable Values(range, step) | Description
r1 | r1 | 1050 | linear | Incremental | 100..2000 step 10 | Resistor R1 (Ω)
r2 | r2 | 1050 | linear | Incremental | 100..2000 step 10 | Resistor R2 (Ω)
** Objectives **
Objective | Use(True/False) | Goal (Minimize, Maximize..) | Goal Detail (range/target info if applicable) | Weight (1.0) | Description (comment) | Function Detail | Circuit Simulation | verr_abs | each | 0 | input netlist path | fsspice_scope | version
verr_abs | True | Minimize | | 1.0 | Minimize absolute voltage error | Circuit Simulation | verr_abs | each | 0 | path/to/netlist.sp | default | latest
Notes
-
initValue is the midpoint of 100 and 2000, i.e., 1050.
-
Linear scale by default.
-
Range + step → Variable Type = Incremental; notation “start..end step step”.
-
Objective details follow the rule order: Function Detail, Metric, Aggregation, Target, Netlist Path, Scope, Version.
3) Quick how-to
-
Set the “Generation prompt for GPT-OSS-120B” above as the system prompt.
-
Feed the user’s natural-language request as the user message.
-
Save the model’s two-section output as the optimization input file.
4) Extra tips
-
Multiple variables: add more rows under Variables.
-
Discrete list: “r3 is one of {10, 22, 47, 100}” → Variable Type=Discrete, Variable Values={10, 22, 47, 100}.
-
Fixed value: “r4 is fixed at 1 kΩ” → Variable Type=Fixed, Variable Values=1000, initValue=1000, and note “(1 kΩ)” in Description.
-
Continuous range: “c1 is 1 pF to 10 pF” → Variable Type=Continuous, Variable Values=1 pF..10 pF (no step).
-
Log scale: if the user mentions logarithmic/decade, set scale=log.
-
Multiple objectives: one row per metric; adjust Weight as needed. Range goals use Goal=Range with numeric bounds in Goal Detail.