[논문 리뷰] StruQ: Defending Against Prompt Injection with Structured Queries
StruQ는 구조화된 쿼리를 통해 프롬프트와 데이터를 분리하고, 데이터 부분의 명령을 무시하도록 구조화된 지시 튜닝으로 특수한 LLM을 훈련시켜 여러 공격 유형에 걸친 프롬프트 인젝션 성공률을 최소한의 유틸리티 손실로 줄임.
Recent advances in Large Language Models (LLMs) enable exciting LLM-integrated applications, which perform text-based tasks by utilizing their advanced language understanding capabilities. However, as LLMs have improved, so have the attacks against them. Prompt injection attacks are an important threat: they trick the model into deviating from the original application's instructions and instead follow user directives. These attacks rely on the LLM's ability to follow instructions and inability to separate prompts and user data. We introduce structured queries, a general approach to tackle this problem. Structured queries separate prompts and data into two channels. We implement a system that supports structured queries. This system is made of (1) a secure front-end that formats a prompt and user data into a special format, and (2) a specially trained LLM that can produce high-quality outputs from these inputs. The LLM is trained using a novel fine-tuning strategy: we convert a base (non-instruction-tuned) LLM to a structured instruction-tuned model that will only follow instructions in the prompt portion of a query. To do so, we augment standard instruction tuning datasets with examples that also include instructions in the data portion of the query, and fine-tune the model to ignore these. Our system significantly improves resistance to prompt injection attacks, with little or no impact on utility. Our code is released at https://github.com/Sizhe-Chen/StruQ.
연구 동기 및 목표
- OWASP가 최상위 위험으로 식별한 LLM-통합 애플리케이션에서 프롬프트 인젝션을 보안 위험으로 다룬다.
- 제어(프롬프트)와 데이터를 분리하는 안전 설계 기반의 LLM 인터페이스를 제안한다.
- LLMs가 프롬프트 기반 지시만 따르고 데이터 기반 지시는 무시하도록 학습시키는 접근법을 개발한다.
제안 방법
- 프롬프트와 데이터를 특수 토큰으로 인코딩하고 구분자를 사용하는 프런트엔드로 구조화된 쿼리를 도입한다.
- 사용자 데이터에서 구분자 토큰을 필터링하여 완료 기반 공격을 방지한다.
- 프롬프트 부분의 지시를 따르되 데이터 부분의 지시는 무시하도록 구조화된 지시 튜닝으로 기본 LLM을 훈련시킨다.
- 정제된 샘플과 공격 샘플(나이브 및 완료-타 비공격)을 포함한 구조화된 지시 튜닝 데이터셋을 구성하여 데이터 기반 지시를 무시하는 법을 가르친다.
- 열한 가지 공격 기법에 대한 보안을 평가하고 AlpacaEval 1.0으로 유틸리티를 측정한다.
- 완료(C completion) 공격을 방지하기 위해 프런트엔드의 토큰 임베딩 초기화와 전용 구분자 정책을 사용한다.
실험 결과
연구 질문
- RQ1구조화된 쿼리가 컨트롤과 데이터를 의미 있게 분리하여 프롬프트 인젝션 공격으로부터 방어할 수 있는가?
- RQ2구조화된 지시 튜닝이 LLM이 데이터에 포함된 지시를 무시하면서도 작업 유틸리티를 유지하게 하는가?
- RQ3StruQ가 완료 및 TAP 공격을 포함한 광범위한 프롬프트 인젝션 기법에 대해 얼마나 효과적인가?
주요 결과
- StruQ는 Alpaca 및 Mistral에서 대부분의 공격 기법에 대한 공격 성공률을 2% 이하로 감소시킨다.
- StruQ는 TAP 기반 공격 성공을 크게 낮춘다( Alpaca에서 97%에서 9%로; Mistral에서 100%에서 36%로).
- 유틸리티는 AlpacaEval에서 약 한 표준 오차 손실로 유지된다.
- 구분자 설계와 프런트엔드의 필터링으로 완료 공격이 완화된다.
- 이 접근법은 많은 프롬프트 인젝션 방식에 대한 넓은 방어를 제공하면서도 유틸리티의 소폭 저하를 초래한다.
더 나은 연구,지금 바로 시작하세요
연구 설계부터 논문 작성까지, 연구 시간을 획기적으로 줄여보세요.
카드 등록 없음 · 무료 플랜 제공
이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.