[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-84021-en":3,"doc-seo-84021-105":30,"detail-sidebar-cat-0-en-105":92},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":20,"is_deleted":4,"is_public":21,"is_downloadable":21,"audit_status":21,"page_count":22,"language":23,"language_code":24,"site_id":25,"html_lang":24,"table_of_contents":26,"faqs":27,"seo_title":13,"seo_description":14,"update_tm":28,"read_time":29},84021,13056703019404,"Miles","https://ap-avatar.wpscdn.com/davatar_29158cc5080c5b710cf443261637dec0",8,"Research & Report","Code-Level Cost Function Generation for Spatial Image Steganography Using RAG-Enhanced Large Language Models","Designing adaptive steganography cost functions often requires extensive manual tuning, while existing deep-learning approaches offer limited interpretability. Large language models can automate this via evolutionary code generation, yet they may violate domain-specific mathematical constraints without explicit guidance. A RAG-enhanced evolutionary framework is proposed for automatic code-level generation of spatial steganography cost functions using Self Evolving RAG (SE-RAG). CSS enables semantics-aware retrieval from a static literature base and a dynamic experience base, refined by a feedback mechanism. Experiments on BOSSBase and BOWS2 show improved security, 46.3% higher average code execution rate, and 26.1% lower search cost.","Code-Level Cost Function Generation for Spatial Image Steganography Using RAG-Enhanced Large  \nLanguage Models  \nYige Wang Shiqi Yi Hanzhou Wu∗  \nSchool of Communication & Information School of Communication & Information School of Communication & Information  \nEngineering, Shanghai University Shanghai 200444, China [24721152@shu.edu.cn](24721152@shu.edu.cn)  \nEngineering, Shanghai University Shanghai 200444, China [shiqiyi2025@163.com](shiqiyi2025@163.com)  \nEngineering, Shanghai University Shanghai 200444, China [h.wu.phd@ieee.org](h.wu.phd@ieee.org)  \narXiv :2607 .05868v 1 [ cs .CR] 7 Jul 2026  \nAbstract—Designing cost functions of adaptive steganography traditionally requires extensive manual tuning, while deep learning methods lack interpretability. Although large language models (LLMs) offer an automated alternative via evolutionary generation, they often violate domain specific mathematical constraints due to a lack of explicit domain knowledge. To address this problem, we propose a novel evolutionary system focused on exploiting Retrieval-Augmented Generation (RAG) enhanced LLMs for the automatic code-level generation of spatial steganography cost functions. This system incorporates a core Self Evolving RAG (SE-RAG) module, wherein a Code Semantic Signature (CSS) translates procedural code into aligned queries, retrieving explicit guidance from static literature and dynamic experience knowledge bases to steer the LLM generation process. A dedicated feedback mechanism then continuously refines the dynamic knowledge base with successful optimization strategies. Extensive experiments on the BOSSBase and BOWS2 datasets demonstrate that the proposed framework consistently achieves higher steganographic security than existing automatically designed methods, and increases the average code execution rate by 46.3% while reducing the search cost by 26.1%, thereby highlighting the effectiveness, efficiency, and potential of combining LLMs with domain-specific knowledge in the field of automaticsteganographic algorithm generation.  \nIndex Terms—Adaptive steganography, cost function, security, large language models, retrieval augmented generation.  \nI. INTRODUCTION  \nImage steganography conceals secret information within innocuous cover images while minimizing detectable embedding artifacts. Among existing adaptive steganographic approaches, the minimum-distortion framework has achieved remarkable success due to its flexibility and effectiveness, where embedding costs are typically manually assigned according to local image characteristics and optimized using syndrome trellis codes (STCs) [1] . Although highly effective, designing distortion cost functions still relies heavily on expert knowledge and extensive trial and error [2]–[4] . Recent deep learning based approaches alleviate manual feature engineering by learning steganographic representations directly from data, at the cost  \n∗Author to whom any correspondence should be addressed.  \nof large training data requirements and limited interpretability. Recently, large language models (LLMs) have begun tobe applied to steganographic tasks [6] . They have further emerged as a promising alternative for automatic algorithm design through evolutionary code generation [5] . However, without explicit domain knowledge, language models tend to perform unguided evolutionary modifications that may violate mathematical constraints or deviate from effective distortion optimization.  \nUnlike general code generation, automatic steganographic cost function design is fundamentally a knowledge-intensive task. The objective is not merely to generate executable programs, but to generate mathematically valid distortion functions that satisfy strict steganographic constraints while improving resistance against steganalysis. Such domain-specific knowledge cannot be fully captured by the general-purpose knowledge embedded in LLMs alone. Updating the internal knowledge of LLMs through continual trainin","cbCaigzyTIzEfJnO","https://ap.wps.com/l/cbCaigzyTIzEfJnO","pdf",2117663,5,1,6,"English","en",105,"# Introduction\n## Problem Background\n## Limitations of Existing Approaches\n## Proposed Approach: SE-RAG\n## Contributions","[{\"question\":\"Why is steganography cost function design difficult to automate with standard LLM code generation?\",\"answer\":\"Because valid cost functions must satisfy strict mathematical and steganographic constraints; without explicit domain knowledge, LLM-driven evolutionary edits may violate constraints or drift from effective distortion optimization.\"},{\"question\":\"How does the proposed SE-RAG framework guide LLM generation?\",\"answer\":\"It combines a static literature knowledge base with a dynamic experience knowledge base. The Code Semantic Signature (CSS) maps procedural code to aligned queries, enabling semantics-aware retrieval that steers generation.\"},{\"question\":\"What evidence supports the effectiveness of the method?\",\"answer\":\"Experiments on BOSSBase and BOWS2 demonstrate higher steganographic security than existing automatically designed methods, with a 46.3% increase in average code execution rate and a 26.1% reduction in search cost.\"}]",1784192059,15,{"code":4,"msg":31,"data":32},"ok",{"site_id":25,"language":24,"slug":33,"title":13,"keywords":34,"description":14,"schema_data":35,"social_meta":87,"head_meta":89,"extra_data":91,"updated_unix":28},"code-level-cost-function-generation-for-spatial-image-steganography-using-rag-enhanced-large-language-models","",{"@graph":36,"@context":86},[37,54,69],{"@type":38,"itemListElement":39},"BreadcrumbList",[40,44,48,51],{"item":41,"name":42,"@type":43,"position":21},"https://docshare.wps.com","Home","ListItem",{"item":45,"name":46,"@type":43,"position":47},"https://docshare.wps.com/document/","Document",2,{"item":49,"name":12,"@type":43,"position":50},"https://docshare.wps.com/document/research-report/",3,{"item":52,"name":13,"@type":43,"position":53},"https://docshare.wps.com/document/code-level-cost-function-generation-for-spatial-image-steganography-using-rag-enhanced-large-language-models/84021/",4,{"url":52,"name":13,"@type":55,"author":56,"headline":13,"publisher":58,"fileFormat":61,"inLanguage":24,"description":14,"dateModified":62,"datePublished":63,"encodingFormat":61,"isAccessibleForFree":64,"interactionStatistic":65},"DigitalDocument",{"name":9,"@type":57},"Person",{"url":41,"name":59,"@type":60},"DocShare","Organization","application/pdf","2026-07-24","2026-07-16",true,{"@type":66,"interactionType":67,"userInteractionCount":20},"InteractionCounter",{"@type":68},"ViewAction",{"@type":70,"mainEntity":71},"FAQPage",[72,78,82],{"name":73,"@type":74,"acceptedAnswer":75},"Why is steganography cost function design difficult to automate with standard LLM code generation?","Question",{"text":76,"@type":77},"Because valid cost functions must satisfy strict mathematical and steganographic constraints; without explicit domain knowledge, LLM-driven evolutionary edits may violate constraints or drift from effective distortion optimization.","Answer",{"name":79,"@type":74,"acceptedAnswer":80},"How does the proposed SE-RAG framework guide LLM generation?",{"text":81,"@type":77},"It combines a static literature knowledge base with a dynamic experience knowledge base. The Code Semantic Signature (CSS) maps procedural code to aligned queries, enabling semantics-aware retrieval that steers generation.",{"name":83,"@type":74,"acceptedAnswer":84},"What evidence supports the effectiveness of the method?",{"text":85,"@type":77},"Experiments on BOSSBase and BOWS2 demonstrate higher steganographic security than existing automatically designed methods, with a 46.3% increase in average code execution rate and a 26.1% reduction in search cost.","https://schema.org",{"og:url":52,"og:type":88,"og:title":13,"og:site_name":59,"og:description":14},"article",{"robots":90,"canonical":52},"index,follow",{"doc_id":7,"site_id":25},{"code":4,"msg":5,"data":93},[94,98,102,106,110,114,119,122,127,130,134],{"id":21,"doc_module":4,"doc_module_name":46,"category_name":95,"show_sort_weight":96,"slug":97},"Story & Novel",90,"story-novel",{"id":47,"doc_module":4,"doc_module_name":46,"category_name":99,"show_sort_weight":100,"slug":101},"Literature",80,"literature",{"id":53,"doc_module":4,"doc_module_name":46,"category_name":103,"show_sort_weight":104,"slug":105},"Exam",70,"exam",{"id":20,"doc_module":4,"doc_module_name":46,"category_name":107,"show_sort_weight":108,"slug":109},"Comic",60,"comic",{"id":22,"doc_module":4,"doc_module_name":46,"category_name":111,"show_sort_weight":112,"slug":113},"Technology",50,"technology",{"id":115,"doc_module":4,"doc_module_name":46,"category_name":116,"show_sort_weight":117,"slug":118},7,"Healthcare",40,"healthcare",{"id":11,"doc_module":4,"doc_module_name":46,"category_name":12,"show_sort_weight":120,"slug":121},30,"research-report",{"id":123,"doc_module":4,"doc_module_name":46,"category_name":124,"show_sort_weight":125,"slug":126},9,"Religion & Spirituality",20,"religion-spirituality",{"id":125,"doc_module":4,"doc_module_name":46,"category_name":128,"show_sort_weight":125,"slug":129},"World Cup","world-cup",{"id":131,"doc_module":4,"doc_module_name":46,"category_name":132,"show_sort_weight":131,"slug":133},10,"Lifestyle","lifestyle",{"id":135,"doc_module":4,"doc_module_name":46,"category_name":136,"show_sort_weight":20,"slug":137},19,"General","general"]