Master's Thesis

Security Aspects of Single-Fact Insertion into LLMs

Final Thesis 9.21 MB

Author of thesis: Ing. Adam Zvara

Acad. year: 2025/2026

Supervisor: Ing. Jakub Reš

Reviewer: RNDr. Martin Ukrop, Ph.D.

Abstract:

This thesis investigates single-fact behavioral changes in code generation models as a practical attack vector, comparing fine-tuning and knowledge-editing methods in terms of minimum data requirements, insertion success, detectability and practical attack viability. Four security-relevant use-cases are selected, and dedicated datasets are constructed for each, covering use-case specific filtering, code refactoring for diversity, and target behavior insertion. Since knowledge editing methods are designed for single-edit scenarios, a sequential multi-edit setup is proposed and evaluated, exploring how the number and composition of edit triples affect insertion success. The experiments show that both ROME and MEMIT are capable of reliable single-fact code insertions, with the best configurations reaching attack success rate above 90\% across most use-cases. Several of these configurations achieve this without any measurable degradation on standard coding benchmarks, making the resulting models difficult to detect through routine evaluation.

Keywords:

LLM, code generation, knowledge editing, ROME, MEMIT, fine-tuning, security

Date of defence

22.06.2026

Result of the defence

Defended (thesis was successfully defended)

znamkaAznamka

Grading

A

Process of defence

Student nejprve prezentoval výsledky, kterých dosáhl v rámci své práce. Komise se poté seznámila s hodnocením vedoucího a posudkem oponenta práce. Student následně odpověděl na otázky oponenta a na další otázky přítomných. Komise se na základě posudku oponenta, hodnocení vedoucího, přednesené prezentace a odpovědí studenta na položené otázky rozhodla práci hodnotit stupněm A.

Topics for thesis defence

  1. Given the sensitivity of the knowledge editing configuration discussed in subsection 4.2.2, how reliable do you consider your results in the knowledge editing cases?
  2. Can you briefly summarize the overall limitations of your results?

Language of thesis

English

Faculty

Department

Study programme

Information Technology and Artificial Intelligence (MITAI)

Specialization

Cybersecurity (NSEC)

Composition of Committee

doc. Mgr. Kamil Malinka, Ph.D. (předseda)
doc. Ing. Ondřej Ryšavý, Ph.D. (místopředseda)
Ing. Zbyněk Křivka, Ph.D. (člen)
doc. Ing. Ivan Homoliak, Ph.D. (člen)
Ing. Libor Polčák, Ph.D. (člen)
Ing. Radek Hranický, Ph.D. (člen)

Supervisor’s report
Ing. Jakub Reš

Student prokázal vysoké schopnosti systematické práce a samostudia. Student taktéž sám navrhoval možná vylepšení ve formě rozšíření a návrhu různých aspektů k analýze.


Výsledky práce jsou v současné podobě cenným náhledem do řešené problematiky a budou složit jako solidní základ vědecké činnosti.


Práci navrhuji hodnotit stupněm A (90 b.).

Evaluation criteria Verbal classification
Informace k zadání

Cílem práce bylo prozkoumat novou výzkumnou oblast útoků typu fact injection. Student měl za úkol porovnat vkládání znalostí do velkých jazykových modelů pomocí metod pro úpravu znalostí (knowledge editing) a fine-tuningu. Dále měl  sestavit datovou sadu vhodnou pro tuto úlohu.

Zadání je vědecké povahy a hodnotím jej jako náročné vzhledem ke složitému a neprozkoumanému tématu.

S výsledky práce jsem spokojen.

Aktivita při dokončování

Student práci dokončil včas, nicméně finální textová část práce nebyla hotova v dostatečném předstihu pro konzultaci a zapracování úprav.

Publikační činnost, ocenění

Zatím neprobíhá žádná publikační činnost spojená s touto prací.

Práce s literaturou

Student prokázal vysokou schopnost práce s doporučenou literaturou. Zároveň si student aktivně dohledával další vědecké relevantní zdroje.

Aktivita během řešení, konzultace, komunikace

Student aktivně konzultoval svoji práci. Na konzultace vždy chodil včas a připraven.

Points proposed by supervisor: 90

Grade proposed by supervisor: A

Reviewer’s report
RNDr. Martin Ukrop, Ph.D.

A complex topic executed well, accompanied by a well-written technical report. The quality of the methodology and execution is, in many places, sufficient for an academic publication.

Evaluation criteria Verbal classification Points
Rozsah splnění požadavků zadání

Evaluation level: zadání splněno

  • The student formulated four well-chosen research questions that effectively cover the scope of the assignment.
  • Many parts of the experiment design and analysis reach a quality sufficient for a research publication; in some others, further detail would be required to meet that standard.
  • The experiments and analyses performed are of considerable scope, exceeding the standard requirements for a thesis.

Rozsah technické zprávy

Evaluation level: je v obvyklém rozmezí

  • All chapters are of appropriate length.
  • All necessary context is provided.
  • All results are fully discussed.

Prezentační úroveň technické zprávy
  • The report is well structured and reads well, guiding the reader through all the necessary details and context.
  • Chapters 1 and 2, covering the background, are pleasantly concise — sufficiently deep without becoming overlong.
  • The methodology is very well explained and justified, supported by excellent custom diagrams that make it easy to comprehend.
  • The results are presented through good graphs with appropriate textual explanations, though comprehensibility is occasionally reduced by overlapping lines or hard-to-distinguish colors.
  • A dedicated section providing an overview of the work's limitations is missing.
90
Formální úprava technické zprávy
  • The report is well typeset, with only occasional extra whitespace.
  • The English is smooth, polished, and reads very well.
95
Práce s literaturou
  • All sources are appropriately cited.
  • The background research is sufficient.
  • All decisions are well justified.
100
Realizační výstup
  • The code is well structured and of good quality, enabling full reproducibility.
  • It is well documented.
  • It is transparently licensed.
100
Využitelnost výsledků
  • The work brings novel insights to the field.
  • It has strong potential for academic publication.
Náročnost zadání

Evaluation level: značně obtížné zadání

  • The assignment spans a very broad spectrum of activities, including experiment design, implementation, HPC workloads, and data analysis.
  • The requested experimental investigation is complex, requiring the comparison and evaluation of the influence of multiple factors.
  • The work is situated in a novel and fast-moving domain, demanding significant study to fully grasp the relevant context.

Topics for thesis defence:
  1. Given the sensitivity of the knowledge editing configuration discussed in subsection 4.2.2, how reliable do you consider your results in the knowledge editing cases?
  2. Can you briefly summarize the overall limitations of your results?
Points proposed by reviewer: 95

Grade proposed by reviewer: A

Responsibility: Mgr. et Mgr. Hana Odstrčilová