원래는 모델, 코드까지 다 공개할 생각이었으나....
안되니... 여기에 미리 작성되어있던 코드는 다 지우고 발표 자료나, 논문 올려놓겠습니다.
https://arxiv.org/abs/2604.06831
Towards Privacy-Preserving Large Language Model: Text-free Inference Through Alignment and Adaptation
Current LLM-based services typically require users to submit raw text regardless of its sensitivity. While intuitive, such practice introduces substantial privacy risks, as unauthorized access may expose personal, medical, or legal information. Although pr
arxiv.org


초기 PPFT 발표자료 였습니다.

First, I would like to briefly explain the motivation behind my experiment.
In most current LLM services, user prompts are transmitted to external servers,
and in many cases, the raw text is directly stored during this process.
While this may not be a critical issue in general applications,
inc domains such as law and healthcare,
the exposure of original text can directly result in severe privacy violations(바이얼레이션즈).
For example, if medical records or legal consultation(칸설테이션) data are stored as raw text on external servers,
this poses a serious risk to personal data protection.
Based on this problem, I formulated the following research question:
“Is it possible for an LLM to generate reliable answers without ever accessing the raw text?”
This question led to the core idea of my experiment—
building a privacy-preserving interface where only embeddings are transmitted, instead of raw text.

Now, I will briefly introduce the related work, which can be categorized into three main directions.
First, there are approaches for privacy-preserving LLM inference.
A representative method is Homomorphic(호우머모어픽) Encryption(엔크립션).
This allows computation on encrypted data and provides strong privacy guarantees.
However, it suffers from extremely high computational cost and severe latency,
making it impractical for real-world deployment.
Another approach is Text Masking,
which removes sensitive information before sending the prompt.
While this improves privacy, it often leads to significant performance degradation(데그러데이션) due to loss of contextual information.
The second direction is prompt compression and continuous embedding-based methods.
Early studies mainly focused on Discrete Compression,
which removes less important tokens from the input.
Later, Continuous Soft Prompt methods, such as Prefix-Tuning and P-Tuning, were proposed.
However, these methods primarily aim at efficiency rather than privacy,
and the compressed vectors still contain rich semantic information.
As a result, they remain highly vulnerable to inversion attacks such as Vec2Text.
✅ ③ Embedding Inversion Attacks & Defenses
The third direction is embedding inversion attacks and their defenses.
Recent studies have demonstrated that
text embeddings preserve semantic information almost equivalent(이퀴벌런트) to raw text.
To mitigate this,
Local Differential Privacy-based embedding sanitization(새너터제이션) methods have been introduced.
However, in practice, injecting noise often causes severe utility loss,
leading to a collapse(컬랩스) in model performance.
Due to these limitations of existing approaches,
my work focuses on the following key question:
“How can we preserve privacy at the embedding level while maintaining strong LLM performance?”

Now, I will explain the overall method of our approach, which consists of three main steps.
✅ Step 1. Prompt → Encoder → K-slot Latent Vectors
First, the user’s text prompt is never transmitted to the server.
Instead, it is encoded into K latent vectors on the client side.
This means that the server never sees the raw text and only receives vector representations.
This provides the first layer of privacy protection.
✅ Step 2. Add Privacy Noise
However, privacy is not fully guaranteed by encoding alone.
Recent studies have shown that it is often possible to recover or infer the original text from embeddings,
which is known as embedding inversion.
To prevent this, we add L2-Laplace noise to the K-slot latent vectors.
The purpose of this noise is simple:
to make it extremely difficult for the server to trace back or reconstruct the original input text from the vectors.
This step forms the second and critical privacy defense layer at the vector level.
✅ Step 3. LLM Decoder Generates the Answer
Finally, the server receives only the noisy latent vectors
and generates the output using the LLM decoder.
In other words,
the server performs inference without ever accessing the original text or clean embeddings.
Despite this restriction(리스트릭션), the LLM is still able to generate semantically meaningful answers.

Now, let me explain the two-stage training strategy of our method.
In Stage 1, we perform joint training of the encoder and the LLM
using general-purpose datasets.
The goal of this stage is to stabilize the semantic alignment between the encoder and the LLM
based on clean latent vectors without noise.
In other words, this stage allows the model to learn
how a given latent representation should be decoded into meaningful text.
In Stage 2, we completely freeze the encoder.
This means that the client-side encoder is fixed and no longer updated.
Then, the LLM is fine-tuned using domain-specific data,
but only with noisy latent vectors as input.
This ensures that:
The training condition exactly matches the real deployment setting with privacy noise, and
The server never accesses raw text at any point during domain adaptation.

Now, I will explain the goals and evaluation setup of my experiment.
The first goal of this experiment is to answer the following question:
“How well can an LLM generate answers using only embeddings, without access to raw text?”
In other words, we aim to verify whether the LLM can still understand the meaning of the input
and generate reliable responses when text is completely removed from the server side.
The second goal is:
“Can the model maintain its performance even when privacy noise is added?”
As explained earlier, noise is essential for preventing tracing and inversion,
but it may also degrade model performance.
Therefore, the second goal is to evaluate whether a practical balance between privacy and utility can be achieved.
The third goal focuses on security:
“How effectively can the method defend against embedding inversion attacks?”
These three questions define the core objectives of our experimental evaluation.
✅ Evaluation Tasks
To evaluate these goals, we conducted experiments on three different QA tasks:
Medical Question Answering,
Legal Question Answering, and
Open-domain Question Answering.
By evaluating both high-stakes domains such as medicine and law,
as well as general open-domain QA,
we were able to comprehensively assess the robustness and practicality of our privacy-preserving method across diverse domains.

Now, I will briefly go over the model configuration.
For the encoder, we use Modern BERT,
which provides stable and strong semantic representations.
For the decoder, we evaluate both LLaMA-1B and LLaMA-8B,
to analyze the effect of model scale.
The pooling size is set to 4,
which balances information preservation and computational efficiency.
For privacy noise, we apply Laplace noise,
with epsilon values ranging from 5 to 75,
allowing us to analyze the privacy–utility trade-off.

Now, I will briefly explain the overall trends of the results rather than each individual number.
First, when we use the basic LLaMA models,
the 8B model consistently outperforms the 1B model across all tasks,
which reflects the natural performance gain from larger model capacity.
Next, when pooling is applied,
we observe a significant performance improvement even for the 1B model.
This improvement is especially noticeable in the commonsense QA task.
Now, looking at the results with privacy noise added,
when the noise is very large (noise 76),
the performance almost completely collapses, regardless of model size.
However, when the noise level is moderate (noise 5),
we can see that the performance is still well preserved in both Medical QA and Legal QA.
In particular, the 8B model maintains relatively strong performance even under noise.
Next, Hayoon Ji will present our work on training-free robustness methods.

"현재 우리가 사용하는 대부분의 LLM 기반 서비스는 클라우드 기반의 MLaaS 형태로 배포되어 있습니다. 하지만 이 편리함 뒤에는 아주 치명적인 프라이버시 취약점이 숨어 있습니다.“
"자료의 1페이지와 2페이지에서 지적하듯이, 현재의 시스템은 사용자가 입력하는 프롬프트를 평문(Plaintext) 형태 그대로 서버에 전송하도록 요구합니다. 사용자가 질문을 던지는 순간, 그 텍스트는 가공되지 않은 상태로 네트워크를 타고 클라우드로 흘러가게 됩니다."
"이 방식은 직관이지만 보안상 매우 위험합니다. 만약 전송 과정에적서 적대적인 도청이 발생하거나, 서비스 제공자의 클라우드 인프라가 침해당할 경우, 사용자의 민감한 개인 정보나 의료·법률 정보가 그대로 노출될 수 있기 때문입니다. 특히 이러한 정보는 일회성 유출로 끝나지 않고, 시스템 로그에 남거나 모델의 후속 학습에 사용되면서 장기적인 보안 위협이 됩니다.“

"앞서 살펴본 위험을 해결하기 위해 그동안 다양한 방어 기법들이 연구되어 왔습니다. 하지만 이 기법들은 실제 서비스 환경에서 적용하기에는 몇 가지 근본적인 한계가 있습니다."
"첫째, 민감한 단어를 삭제하는 프롬프트 정제 방식입니다. 이 방식은 언뜻 안전해 보이지만, 문장 전체의 맥락 속에 숨겨진 암묵적인 정보 유출을 막지 못합니다. 무엇보다 서버가 여전히 '텍스트'를 직접 받는 인터페이스를 유지한다는 점이 가장 큰 취약점입니다."
"둘째, 텍스트 대신 임베딩에 노이즈를 섞어 보내는 표현 교란 방식입니다. 최근 연구에 따르면, 단순한 노이즈 처리만으로는 정교한 역추론 공격을 막을 수 없으며, 의미적으로 원문이 복원될 위험이 큽니다. 또한 노이즈를 늘리면 모델의 성능이 급격히 떨어지는 문제가 발생합니다."
"마지막으로 암호학적 방식은 이론적으로는 완벽할지 모르나, 대규모 트랜스포머 모델을 실시간으로 처리하기에는 계산 비용과 통신량이 너무 커서 실제 서비스에 적용하기가 매우 어렵습니다."
(마무리) "결국, 기존 방법들은 프라이버시를 지키면 성능이나 효율이 떨어지는 '상충 관계'를 해결하지 못했습니다. 저희는 이러한 공백을 메우기 위해 PPFT라는 새로운 대안을 제안하게 되었습니다."

"그림 상단의 'OTHERS' 라인을 보시면, 기존의 일반적인 LLM 서비스 구조가 나옵니다. 사용자가 자신의 건강 상태와 같은 민감한 질문을 던지면, 이 내용은 텍스트 형태 그대로 서버로 넘어갑니다. 이때 중간에 공격자가 침입한다면, 말풍선에 보이는 것처럼 사용자가 어떤 병을 앓고 있는지 아주 손쉽게 알아낼 수 있습니다. 이것이 바로 현재 LLM 서비스의 가장 큰 프라이버시 구멍입니다."
"반면 하단의 'OURS' 라인을 봐주시기 바랍니다. 저희는 텍스트를 서버로 보내는 단계 자체를 없앴습니다. 대신 클라이언트 기기 내부에서 인코더 모델을 통해 텍스트를 숫자의 나열인 임베딩으로 변환합니다. 여기에 한 단계 더 나아가, 라플라스 노이즈(Laplace Noise)를 주입하여 데이터를 한 번 더 꼬아버립니다."
"이제 서버로 전송되는 데이터는 의미를 알 수 없는 숫자 뭉치일 뿐입니다. 해커가 서버를 해킹하여 이 데이터를 얻더라도, 원래 어떤 내용이었는지 전혀 복원할 수 없습니다. 하지만 서버에 있는 저희의 '정렬된 LLM'은 이 난독화된 숫자들을 해석할 수 있도록 미리 학습되어 있기 때문에, 프라이버시는 완벽히 지키면서도 사용자에게 정확한 진단 결과를 제공할 수 있습니다.“

"이제 PPFT가 구체적으로 어떻게 텍스트 없이 학습(Text-Free Training)을 진행하고, 도메인 지식을 습득하는지 그 내부 메커니즘을 말씀드리겠습니다. 저희의 방법론은 크게 두 단계로 구성됩니다."
"첫 번째 단계는 **'Alignment Tuning'**입니다. 독립적으로 학습된 인코더와 서버의 디코더가 서로의 신호를 이해할 수 있도록 잠재 공간을 정렬하는 과정입니다.
이때는 일반적인 상식이나 지시문 데이터셋을 사용합니다. 그림 상단을 보시면 인코더가 단어를 숫자로 바꾸고, 이를 뭉치는 $k$-Pooling 과정을 거칩니다.
이를 통해 통신량도 줄이고, 시퀀스 차원이 줄어들기에 의미적으로 복구하기 상당히 어려워집니다.
디코더는 이제 단어라는 텍스트 대신, 이 숫자의 뭉치를 보고도 원래 어떤 지시였는지 이해하고 정확한 답변을 생성하도록 훈련됩니다."
"두 번째 단계는 **'Domain Adaptation'**입니다. 이제 정렬된 모델에게 의료나 법률 같은 전문 지식을 가르칠 차례입니다.
그림 하단을 보시면, 클라이언트는 노이즈가 섞여서 원래 내용을 알 수 없는 '암호화된 벡터'만 전송합니다. 서버는 이 노이즈 섞인 입력값만 보고도 정답을 맞히도록 학습됩니다. 이 과정에서 클라이언트의 인코더는 고정시킨 채 서버의 디코더만 파인튜닝하기 때문에, 프롬프트 텍스트는 서버에 단 한 글자도 노출되지 않습니다."
"결과적으로, 1단계에서 '임베딩으로 소통하는 법'을 배우고, 2단계에서 '전문 지식을 처리하는 법'을 배움으로써, 텍스트가 디바이스를 벗어나지 않고도 강력한 성능을 내는 안전한 시스템이 완성되는 것입니다."

"앞서 설명드린 PPFT의 프라이버시 보호 능력이 실제 모델 성능에는 어떤 영향을 주었는지, 실험 결과를 통해 말씀드리겠습니다. 저희는 의료, 법률, 그리고 일반 상식까지 총 5가지의 핵심 데이터셋을 통해 성능을 검증했습니다.“
("먼저 우측 상단은 민감 정보가 집중된 전문 도메인 결과입니다. Pri-DDX와 NLICE는 복잡한 의학적 진단 능력을, Pri-SLJA는 까다로운 법률적 추론 능력을 평가합니다. 결과를 보시면, Llama-3.1-8B 모델 기준 PPFT는 모든 데이터셋에서 기존의 패러프레이징이나 표현 교란 방식보다 압도적으로 우수한 성능을 보여줍니다. 특히 법률 도메인(Pri-SLJA)에서는 노이즈가 전혀 없는 상태의 약 95% 수준까지 성능을 회복하며, 프라이버시를 지키면서도 전문적인 작업 수행에 전혀 지질이 없음을 확인했습니다.“
"오른쪽 하단은 일반 도메인에서의 성능입니다. CSQA는 모델의 상식 추론을, SQuAD는 지문 독해 능력을 측정합니다. 기존의 프라이버시 기법들이 텍스트를 왜곡하면서 일반적인 추론 능력이 급격히 망가지는 것과 달리, PPFT는 인코더와 디코더의 안정적인 정렬(Stage 1) 덕분에 일반 도메인에서도 강력한 성능을 유지합니다. 특히 SQuAD 데이터셋에서는 타 기법들이 거의 답변을 하지 못하는 상황에서도 PPFT는 상한선에 근접한 높은 정확도를 기록했습니다.“
"종합하면, PPFT는 텍스트를 서버에 노출하지 않는 엄격한 제약 하에서도 의료와 법률 같은 전문 분야는 물론, 모델 본연의 일반적인 지능까지 모두 보존할 수 있는 효과적인 프라이버시 보존 파인튜닝 솔루션입니다."

(도입) "PPFT가 성능만 좋은 것이 아니라, 실제로 얼마나 안전한지도 정밀하게 검증했습니다. 저희는 공격자가 전송된 임베딩을 가로채서 원래 문장을 복원하려고 시도하는 '역추론 공격' 환경을 가정하여 테스트를 진행했습니다.“
(지표 설명: ROUGE-L) "여기서 보안성을 측정하는 핵심 지표는 ROUGE-L입니다. 이는 공격자가 복원해낸 문장이 원래 프롬프트와 얼마나 유사한지를 나타내는 점수입니다. 따라서 이 점수가 낮으면 낮을수록 저희의 방패가 강력하다는 뜻입니다."
(Figure 3 & 4 설명) "먼저 우측 상단 그래프를 보시겠습니다. 기존 방식들은 프라이버시 보호 강도가 약해질수록 정보가 급격히 유출되는 반면, 빨간색 선인 PPFT는 아주 낮은 점수를 일관되게 유지하고 있습니다. 또한 Figure 4에서 보시는 것처럼, 저희가 선택한 라플라스 노이즈 방식이 가우시안 노이즈보다 임베딩의 의미를 훨씬 더 효과적으로 숨겨준다는 사실도 수치로 확인했습니다."
(Table 3 및 정성적 분석 설명) "특히 우측 하단의 속성별 분석 결과가 매우 흥미롭습니다. 의료 데이터에서 가장 민감한 정보인 연령과 과거 병력의 경우, 재현율이 0.01 수준으로 사실상 복원이 불가능했습니다. 함께 첨부된 예시를 보시면, 공격 모델이 27세 남성의 췌장암 관련 질문을 28세 여성의 천식 관련 내용으로 완전히 잘못 짚고 있는 것을 볼 수 있습니다. 이는 PPFT가 표면적인 텍스트 구조는 유지할지 몰라도, 핵심적인 민감 정보는 완벽하게 난독화하고 있음을 증명합니다.“
"PPFT는 강력한 수치적 증거와 정성적 사례 모두에서 실제 서비스에 적용 가능한 수준의 프라이버시 보호 능력을 갖추었음을 입증했습니다."

(도입)
"이제 발표를 마무리하며 본 연구의 결론을 정리해 보겠습니다. 저희가 제안한 PPFT는 LLM 서비스의 고질적인 문제였던 프라이버시 유출 위험에 대한 실질적인 해답을 제시했습니다."
"PPFT는 추론뿐만 아니라 데이터 학습(파인튜닝) 단계에서도 텍스트를 단 한 글자도 서버에 보내지 않는다는 점에 있습니다. 정보 압축과 노이즈 주입 기술을 결합하여, 공격자가 데이터를 가로채더라도 원문을 복원할 수 없는 강력한 방패를 구축했습니다. 그럼에도 불구하고 성능 면에서는 노이즈가 없는 이상적인 환경의 95% 수준까지 도달하며, '보안을 강화하면 성능이 떨어진다'는 기존의 상충 관계를 성공적으로 극복했습니다.










'인공지능 > 자연어 처리' 카테고리의 다른 글
| QA, SFT 데이터 셋 조사 (0) | 2025.11.27 |
|---|---|
| 허깅페이스 4 기초 - Trainer (2) | 2025.11.16 |
| 허깅페이스 3 기초 - Audio Feature Extractors (0) | 2025.11.15 |
| 허깅페이스 1 기초 - 모델 부르기, 모델 공유하기, 모델 구성 요소 변경하기 (0) | 2025.11.12 |
| Embedding 모델 학습하기 - Sentence Transformer Trainer (0) | 2025.09.07 |