Hossain, Muhammad IqbalRohan, Abrar MahirKhan, NafizTanni, Tahsin TajwarFardin, FuadBushra, Anika2026-04-192026-04-1920262026-01ID 22101267ID 22101045ID 22101744ID 22101027ID 21201068http://hdl.handle.net/10361/27945Cataloged from PDF version of thesis.Includes bibliographical references (pages 61-62).This thesis is submitted in partial fulfillment of the requirements for the degree of Bachelor of Science in Computer Science and Engineering, 2026.Large Language Models (LLMs) are increasingly released as open-source and are susceptible to post-release attacks, including weight noise injection and low-precision quantization. Such attacks often have a significant negative effect on model stability and performance, augmenting perplexity and creating unreliable behavior. In practice, users might not have access to original clean weights and may unknowingly download compromised models. This thesis presents a defense mechanism called Anchor-Guided Repair, which aims to improve the stability of weakened LLMs against weight noise and low-precision attacks. The proposed method optimizes a fine-tuned attacked model on clean textual data while mitigating parameter changes via an anchor loss, which penalizes the difference from a clean, task-adapted baseline. This approach reduces instability by optimizing a composite task involving language modeling loss and anchor regularization, without distorting the knowledge acquired by the original model. The proposed method was put to the test across a range of model architectures and attack setups, including low-precision and Gaussian weight noise. The experimental results clearly show that Anchor-Guided Repair outperforms the attacked models consistently, keeping a favorable state of desirable conditions. While the defended model performs slightly below the clean baseline, it is significantly better than the compromised model. This emphasizes the power of anchoring in stabilizing large models without accessing proprietary training data. Altogether, Anchor-Guided Repair is a viable post-deployment defense for weightlevel attacks, promoting safer and more trustworthy model reuse in open-source settings.62 pagesenBRAC University theses are protected by copyright. They may be viewed from this source for any purpose, but reproduction or distribution in any format is prohibited without written permission.Quantization attacksLarge language modelsWeight noise injectionBackdoor detectionLlow-precision quantizationAnchor-guided repairNatural language generation (Computer science)--Security measures.Generative artificial intelligence--Security measures.Deep learning (Machine learning)--Security measures.Machine learning--Mathematical models.Neural networks (Computer science).Computer software--Reliability.Anchor-guided repair: a defense mechanism for enhancing stability of compromised pretrained language models against low-precision and weight noise attacksThesis