Skip to content
Book Open access

RAGas: Retrieval Augmented Gas Optimization for Smart Contracts with Continuous Knowledge Integration

Apr 2026 · Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering · 1 citation · 69 references
Computer Science

TL;DR

This work systematically analyzed the grammatical and semantic features that lead to excessive Gas consumption and proposes RAGas, a three-stage retrieval enhancement generation framework that utilizes large language models to locate and automatically fix Gas inefficiency issues.

Abstract

Ethereum has gradually become an infrastructure in key areas such as finance, healthcare, and supply chain. When its smart contracts are executed, Gas fees increase with the growth of computational complexity. Therefore, reducing code with high Gas overhead while maintaining functional equivalence is of great significance to deployment costs. Currently available tools rely on fixed rule sets and cannot autonomously adapt to the dynamically evolving patterns of Gas consumption. To this end, we systematically analyzed the grammatical and semantic features that lead to excessive Gas consumption and constructed 12 fine-grained High Gas Consumption (HGC) patterns and knowledge bases covering 6 major categories. Based on this, we propose RAGas, a three-stage retrieval enhancement generation framework that utilizes large language models to locate and automatically fix Gas inefficiency issues. The experimental results show that RAGas can reduce Gas usage by up to 11.2% in real world deployed contracts.

Read PDF

Similar papers

Open access 2026

Carbon Footprint Accounting Driven by Large Language Models and Retrieval-Augmented Generation

LLMs-RAG-CFA, a unified framework that combines large language models with retrieval-augmented generation (RAG) to deliver real-time, reliable, cost-efficient, and privacy-preserving CFA, offers a scalable, practical pathway for real-time carbon emission monitoring and supports improved sustainability practices.

H.-J. Wang, M.-R. Zhang, Z. Chen et al. · 0 citations
Open access Jul 2026

RAG-Based AI Compliance Monitoring and Report Generation System

CompVault, an Enhanced Retrieval-Augmented Generation (ERAG)-based Artificial Intelligence Compliance Monitoring and Report Generation System for intelligent regulatory compliance assessment, and results indicate that the ERAG-based framework can be used as an efficient, scalable, and explainable solution for regulatory compliance monitoring and automated report generation.

S. N., Sathyapriya P., Vishnu Priya R. M. et al. · 0 citations
Preprint Aug 2026

Database-Augmented RAG for Automated Repair of REST API Misuses

Many Internet of Things (IoT) services provide Representational State Transfer (REST) APIs, which require client developers to implement applications that conform to the corresponding API specifications. When client programs contain API misuse, developers debug them based on error responses. However, such responses are often insufficient for identifying the root cause, requiring developers to repeatedly communicate with the server. Retrieval-Augmented Generation (RAG) is a promising approach for providing large language models (LLMs) with external knowledge. However, in automated repair of REST API misuses, it remains unclear how specifications should be stored in a RAG database. This study evaluates how different configurations for organizing API specifications affect RAG-based repair of REST API misuse. We constructed 11 RAG configurations with different database structures and compared their repair rates with a baseline method. For evaluation, we used REST API misuse cases collected from real-world repositories. The results show that, in the studied datasets, the baseline method achieved a repair rate of 54.3%, whereas a RAG-based method using four databases achieved a maximum repair rate of 88.6%. These results indicate that organizing specifications according to version and content type can be an effective design choice for RAG-based REST API misuse repair.

Shoei Inoue, Norihiro Yoshida, Erina Makihara et al. · 0 citations
Aug 2026

SafeRAG: A Large-Language-Model-Based Multistage Retrieval-Augmented Framework for Oil and Gas Safety Report Generation

In high-risk industrial settings, leveraging large language models (LLMs) for automated accident analysis and generating safety reports has emerged as an efficient workflow. However, this approach is fundamentally constrained by the models’ inherent knowledge limitations, frequently resulting in analyses that lack domain-specific understanding and regulatory alignment. To tackle this issue, we introduce SafeRAG, a multistage retrieval-augmented framework for safety report generation. Specifically, the framework uses an entity-centric approach that prompts the LLMs to internally generate domain-specific knowledge. Concurrently, it performs a hierarchical retrieval of external regulations relevant to the accident at topic, concept, and context levels. To obtain well-structured reports, we leverage prompt engineering, integrating internal and external knowledge. Furthermore, a domain-expert persona is also assigned to help LLMs analyze accidents from a specific perspective. To evaluate our approach, we construct a data set from 10,818 accident-description/report pairs collected from real-world industry reports. Experiments show that SafeRAG substantially outperforms baseline LLMs on metrics that include bidirectional encoder representations from transformers (BERTScore) and bidirectional auto-regressive transformers (BARTScore), demonstrating the effectiveness of our approach.

Qi Cao, Chiyu Zhang, Junxiong Ning et al. · 0 citations
Preprint Sep 2026

KnowFeat: Knowledge-Guided Feature Engineering via LLM Agents

Automated feature engineering with large language models (LLMs) can produce semantically meaningful features for tabular data, yet existing methods lack structured domain knowledge, rigorous verification, and explainable provenance. We propose KnowFeat, a knowledge-guided feature engineering framework that organizes domain knowledge into five types -- schema metadata, regulatory indicators, detection rules, expert opinions, and court document evidence -- and injects them as structured context into an LLM agent. A three-stage verification pipeline filters candidates through code execution, statistical quality checks, and model effectiveness evaluation. Every accepted feature carries a provenance record tracing its design to specific knowledge assets. Under a strict held-out protocol that eliminates feature-selection leakage, KnowFeat ranks first (avg. rank 2.3) across twelve public benchmarks among seven methods (one-sided Wilcoxon p=0.017), with a peak gain of +11.6 pp AUC on a telecom churn dataset. On a real-world Bitcoin anti-money laundering (AML) dataset (Elliptic) and a synthetic digital currency AML benchmark (SimECNY), KnowFeat maintains competitive detection performance with full provenance traceability.

Chengsong You, Wangyue Li, Wei-Qiao Que et al. · 0 citations
Conference Mar 2026

Utility-Guided Orchestration for Cost-Efficient Tool-Augmented LLM Services

Tool-augmented large language model (LLM) services can solve complex tasks through retrieval and external tools, but current execution paradigms often trade adaptability for efficiency. Fixed workflows are predictable but rigid, while freeform reasoning loops such as ReAct may over-execute and issue redundant tool calls. We propose a lightweight utility-guided orchestration framework that formulates agent control as a costaware sequential decision problem over a compact action space: respond, retrieve, tool call, verify, and stop. An interpretable utility function balances expected gain, step-cost proxies, uncertainty, and redundancy. Experiments on multi-hop question answering show that the policy offers a controllable quality-cost trade-off and reduces token consumption by up to 10.6% in the semantic-redundancy setting while preserving similar answer quality. The framework is intended as an inspectable control layer for practical LLM services rather than a universally dominant accuracy optimizer.

Bo-Yang Liu, Gongming Zhao, Hong-Liu Xu et al. · 4 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.