# Cached Model-as-a-Resource: Provisioning Large Language Model Agents for
Edge Intelligence in Space-air-ground Integrated Networks

Minrui Xu, Dusit Niyato, _Fellow, IEEE_ , Hongliang Zhang, Jiawen Kang*, Zehui
Xiong,
Shiwen Mao, _Fellow, IEEE_ , and Zhu Han, _Fellow, IEEE_ M. Xu and D. Niyato
are with the School of Computer Science and Engineering, Nanyang Technological
University, Singapore 639798, Singapore (e-mail<EMAIL_ADDRESS>dniyato@ntu.edu.sg). H. Zhang is with School of Electronics, Peking
University, Beijing 100871, China (e-mail: hongliang.zhang92@gmail.com). J.
Kang is with the School of Automation, Guangdong University of Technology,
China (e-mail: kavinkang@gdut.edu.cn). Z. Xiong is with the Pillar of
Information Systems Technology and Design, Singapore University of Technology
and Design, Singapore 487372, Singapore (e-mail: zehui_xiong@sutd.edu.sg). S.
Mao is with the Department of Electrical and Computer Engineering, Auburn
University, Auburn, AL 36849-5201 USA (email: smao@ieee.org). Z. Han is with
the Department of Electrical and Computer Engineering at the University of
Houston, Houston, TX 77004 USA, and also with the Department of Computer
Science and Engineering, Kyung Hee University, Seoul, South Korea, 446-701
(e-mail: hanzhu22@gmail.com). (*Corresponding author: Jiawen Kang)

###### Abstract

Edge intelligence in space-air-ground integrated networks (SAGINs) can enable
worldwide network coverage beyond geographical limitations for users to access
ubiquitous and low-latency intelligence services. Facing global coverage and
complex environments in SAGINs, edge intelligence can provision approximate
large language models (LLMs) agents for users via edge servers at ground base
stations (BSs) or cloud data centers relayed by satellites. As LLMs with
billions of parameters are pre-trained on vast datasets, LLM agents have few-
shot learning capabilities, e.g., chain-of-thought (CoT) prompting for complex
tasks, which raises a new trade-off between resource consumption and
performance in SAGINs. In this paper, we propose a joint caching and inference
framework for edge intelligence to provision sustainable and ubiquitous LLM
agents in SAGINs. We introduce “cached model-as-a-resource” for offering LLMs
with limited context windows and propose a novel optimization framework, i.e.,
joint model caching and inference, to utilize cached model resources for
provisioning LLM agent services along with communication, computing, and
storage resources. We design “age of thought” (AoT) considering the CoT
prompting of LLMs, and propose a least AoT cached model replacement algorithm
for optimizing the provisioning cost. We propose a deep Q-network-based
modified second-bid (DQMSB) auction to incentivize network operators, which
can enhance allocation efficiency by 23% while guaranteeing strategy-proofness
and free from adverse selection.

###### Index Terms:

Space-air-ground integrated networks (SAGINs), edge intelligence, large
language model (LLM) agents, auction theory, deep reinforcement learning (DRL)

##  I Introduction

Space-air-ground integrated networks (SAGINs) can extend network coverage for
users to access real-time edge intelligence services, such as image
recognition and data analysis, with global connectivity [1]. Beyond
terrestrial communication systems, which are limited by network capacity and
the coverage of ground-based stations (BSs), satellites can provide seamless
connectivity for users in environmentally harsh areas such as oceans and
mountains, by acting as relays during provisioning computing services from
cloud data centers [2]. For instance, implementing edge intelligence in SAGINs
can enable various smart ocean activities [3], including real-time monitoring
and analysis for offshore aquaculture and AI assistant services requested by
onboard passengers, crew, and fishermen. The advance of large language models
(LLMs) [4, 5, 6] dramatically enhance the capabilities of edge intelligence in
SAGINs, allowing AI agents based on LLMs, i.e., LLM agents to tackle unseen
and complex reasoning tasks with various data modalities [7]. Moreover, edge
intelligence in SAGINs can provision low-latency and privacy-preserving LLM
agent services [7] at edge servers of ground BSs or at cloud data centers
relayed by satellites, which can act as autonomous life or work assistants for
human users.

Based on LLMs with billions of parameters and pre-trained on Internet-scale
datasets, LLMs agents can perform few-shot learning [8, 9], including in-
context learning (ICL) for unseen tasks chain-of-thought (CoT) prompting for
complex reasoning tasks and role-playing under specific instructions. Although
the training and inference of LLMs require enormous computing and data
resources, users with low-end mobile devices in SAGINs can request LLM agent
services from edge servers at ground BSs directly or from cloud data centers
using satellites/ground BSs as relays. Therefore, provisioning LLM agent
services in SAGINs with heterogeneous computing resources can reduce service
latency and preserve user privacy [10, 11, 12]. Different from the traditional
implementation of edge intelligence [13], the resource-constraint edge servers
at ground BSs cannot load every LLM to provision all LLM services
simultaneously [5]. Meanwhile, the capabilities of LLMs to perform few-shot
learning are limited by the size of context windows, which are determined by
the model architecture of LLMs [14]. During the provisioning of LLM agent
services, inference operations accumulate tokens in context windows to elicit
few-shot learning capabilities for better performance. After the accumulated
inference tokens exceed the context windows [15], the output of LLMs might no
longer be effective and the performance of LLM agents decreases significantly.

As the context windows of running LLMs can be depleted during provisioning LLM
agent services, the cached models at edge servers of ground BSs should be
considered as an unexplored type of resource analogous to conventional
communication, computing, and storage resources [5]. In this regard, network
operators aiming to minimize the provisioning cost of LLM agent services need
to schedule the running LLMs at ground BSs based not only on conventional
hardware constraints but also on the effective management of running LLMs.
Similar to content caching, model caching is an optimization framework for
implementing edge intelligence that aims to reduce service latency and
resource consumption of network operators. Nevertheless, facilitating model
caching for LLMs should consider their few-shot learning capabilities [8],
which affect resource consumption and inference performance at each inference
step. Furthermore, the valuations of the opportunities to provision LLM agent
services for network operators are positively correlated. However, as simple
relays between users and cloud data centers, satellites have asymmetric
information and cannot receive sufficient cost/performance feedback to measure
their valuation compared to ground BSs, which might lead to adverse selection
[16], i.e., inefficient network operator allocation, for real-time mechanisms.

In this paper, we propose a joint model caching and inference framework for
edge intelligence to provision sustainable and ubiquitous LLM agent services
to users in SAGINs, where LLMs can be run at edge servers at ground BSs and
cloud data centers via the relay of satellites/ground BSs. In this framework,
ground BSs can leverage edge servers close to users for provisioning low-
latency and privacy-preserving LLM agent services. Moreover, satellites can
relay LLM agent service requests to cloud data centers for users in remote
areas, e.g., mountains and oceans. To improve quality of services (QoS) for
LLM agents running on ground BSs, we introduce a new optimization framework
for serving LLMs in edge intelligence, i.e., joint model caching and
inference. In this framework, cached LLMs can be regarded as a type of
fundamental resource in provisioning LLM agent services. Leveraging the few-
shot learning capability of LLMs, e.g., chain-of-thought prompting, we design
a specific metric for the model caching algorithm, namely, age of thought
(AoT), to measure the relevance and coherence of intermediate thoughts during
CoT inference. Based on AoT, we propose the least AoT cache replacement
algorithm, which determines the eviction of cached models with the least AoT,
to reduce the total provisioning cost of network operators. To eliminate
adverse selection against satellites, we leverage modified second-bid (MSB)
auctions [16] and deep reinforcement learning (DRL) [17] to design a deep
Q-network-based MSB (DQMSB) auction that can select the optimal price scaling
factor in MSB to improve the marking efficiency in network operator allocation
while guaranteeing the DQMSB is strategy-proof and free from adverse
selection.

Our main contributions can be summarized as follows.

  * •

We formulate a novel optimization framework for edge intelligence, i.e., the
joint model caching and inference framework, to provision sustainable and
ubiquitous LLM agents for users with satellites and ground BSs in SAGINs.

  * •

In this framework, for the first time, we propose the concept of “cached
model-as-a-resource” to implement edge intelligence, where cached models are
regarded as a type of resource similar to conventional communication,
computing, and storage resources, at edge servers at ground BSs and cloud
datacenters in SAGINs.

  * •

We formulate the LLM agent provisioning problem for ground BSs to minimize
total system cost under resource and coverage constraints. To tackle this
problem effectively, we design a novel least AoT model caching algorithm to
schedule the loading and eviction of LLMs based on the metric of AoT,
evaluating the relevance and coherence of intermediate thoughts in context
windows.

  * •

To maximize the revenue of network operators in provisioning high-quality LLM
agent services, we propose the DQMSB auction, which can guarantee free of
adverse selection and fully strategy-proof, by using DRL to select the optimal
pricing scaling factor.

The remaining sections of this paper are organized as follows. In Section II,
we present a review of related work. In Section III, we describe the system
model for provisioning LLM agents in SAGINs. In Section IV, we formulate the
problem, propose the model caching algorithm, and design the market. In
Section V, we propose the DQMSB auction. In Section VI, we present the
simulation experiments. Finally, we conclude this paper in Section VII.

##  II Related Works

###  II-A Edge Intelligence in Space-air-ground Integrated Networks

Provisioning AI services in SAGINs can significantly enhance the intelligent
configuration and control of SAGINs to adapt to their environment, improving
various performance metrics such as latency, energy usage, bandwidth, and
real-time adaptability [1]. Xu et al. in [18] introduce a cloud-edge
aggregated artificial intelligence architecture that leverages the on-orbit
lightweight 5G core and edge computing platform provided by the Tiansuan
constellation. For mission-critical 6G services, Hou et al. in [19] propose a
three-layer architecture in SAGINs for ultra-reliable and low-latency edge
intelligence that includes unikernel-based ultra-lightweight virtualization
and microservice-based paradigms for prompt response and improved reliability.
Considering the time-varying characteristics of content sources and the
dynamic demands of users, Qin et al. in [20] propose a content service-
oriented resource allocation algorithm that aims to achieve a stable matching
based on users’ preferences for SAGINs.

###  II-B Large Language Models for Edge Intelligence

In literature, LLMs are an essential part of next-generation edge intelligence
systems, which have been leveraged to design, analyze, and optimize edge
intelligence [21, 22]. For instance, Du et al. in [23] investigate the
potential of LLMs as a valuable tool for FPGA-based wireless system
development. Furthermore, Cui et al. in [24] introduce LLMind, an AI framework
that integrates LLMs with domain-specific AI modules and IoT devices for
executing complex tasks. In multi-agent systems for 6G communications, Jiang
et al. [25] demonstrated the effectiveness of LLMs in collaborative data
retrieval, planning, and reflection through a semantic communication case
study. Considering the issues that traditional deep offloading architectures
are facing several issues, including heterogeneous constraints, partial
perception, uncertain generalization, and lack of traceability, Dong et al.
[26] propose an LLM-based offloading framework that utilizes LLMs for
offloading decisions, addressing issues like heterogeneous constraints and
uncertain generalization. Nevertheless, the execution of LLMs usually requires
enormous computing resources, which is infeasible for edge environments.
Therefore, considering efficient training and inference architecture in 6G
networks, Lin et al. in [27] explore feasible techniques such as split
learning/inference, parameter-efficient fine-tuning, quantization, and
parameter-sharing inference for pushing LLMs to the edge.

###  II-C Auction Design for SAGINs

Auctions are efficient and effective methods for real-time network resource
allocation in SAGINs [28, 29, 30]. In civil aircraft augmented SAGINs, Chen et
al. [31] propose a truthful double auction for device-to-device (D2D)
communications and a reverse auction mechanism for spectrum sharing. For
lightweight blockchain-based SAGINs, Yang et al. in [32] propose a secure
sequential Vickrey auction mechanism to ensure secure and reliable spectrum
sharing within the SAGINs. However, existing auction designs for incentivizing
network operators in SAGINs consider the information of satellites, ground
BSs, and UAVs to be symmetric for evaluating their valuation of network
resources. Nevertheless, the asymmetric information among network operators in
SAGINs can cause efficiency loss during resource allocation, especially when
the values of network operators are positively correlated. Therefore, in this
paper, we propose DQMSB that can mitigate adverse selection and increase
market efficiency for SAGINs with DQN-based price scaling factor selection.

##  III System Model

Figure 1: Joint caching and inference framework for provisioning large
language model (LLM) agents in SAGINs.

For edge intelligence in SAGINs, each group of users would like to utilize LLM
agents based on one or several LLMs. In the system, each group of users can
use one LLM agent as their active assistant because their attention is limited
depending on their preferences and current tasks. In SAGINs, a group of users
needs to select network providers, including satellites and ground BSs, to
access LLM agent services. As shown in Fig. 1, the system consists of $N+1$
network operators, including one or several Low Earth Orbit (LEO) satellites
in orbit and multiple ground BSs equipped with edge servers, all connected to
the cloud data center via backhaul links. The set of network operators is
represented by $\mathcal{N}=\\{0,1,\ldots,N\\}$, where the LEO satellite is
represented by $0$ and the set of BSs is represented by $\\{1,\ldots,N\\}$.
The edge servers at ground BSs can execute LLM agent services for users while
the rest of the services can be offloaded to cloud data centers with the relay
of satellites or ground BSs. We use the set $\mathcal{I}=\\{1,2,\ldots,I\\}$
to denote the available LLM agent services based on the set of LLMs
$\mathcal{M}=\\{1,\ldots,M\\}$. As LLMs are capable of performing multiple
downstream tasks in LLM agent services simultaneously, it is considered that
the number of LLM agent services is far greater than the number of LLMs [7],
i.e., $I\gg M$. In the group of users $\mathcal{U}_{n}$ covered by network
operator $n$, $R_{n}^{t}=\\{R_{n,i,m}^{t}|i\in\mathcal{I},m\in\mathcal{M}\\}$
is used to represent the number of requests generated by LLM agent service $i$
to execute LLM $m$ for its specific functions, including planning, memory,
tool-using, and embodied actions. Initially, the size of input data of LLM
agent service $i$ can be denoted as $d_{i}$. Additionally, the configuration
of LLM $m$ consists of the amount of runtime GPU memory, which is proportion
to model size $s_{m}$, the computation required per token $e_{m}$, and the
size of context window $w_{m}$.

Figure 2: The workflow of the joint caching and inference framework for
provisioning LLM agents with cached models.

###  III-A Coverage Time Model

The coverage time model for LEO satellite networks addresses the dynamic
positioning of satellites concerning users. Unlike terrestrial networks, whose
infrastructure remains stationary, LEO satellites exhibit constant motion,
necessitating that users establish connections based on specific geometric
metrics [2]. These metrics include altitude $l$ of the LEO satellite orbit
above the mobile user, the Earth’s radius $E$, and the slant distance $s$ from
users to the LEO satellites. The elevation angle $\theta^{e}$, delineating the
line of sight between a mobile user and an LEO satellite, is determined by
$\theta^{e}=\arccos{\left(\frac{E+l}{s}\right)}\cdot\sin\theta^{g}$, where
$\theta^{g}$ represents the geocentric angle covering the LEO satellite’s
service area, calculated as
$\theta^{g}=\arccos{\left(\frac{E}{E+l}\right)}\cdot\cos\theta^{e}-\theta^{e}$.
Let $v^{S}$ denote the velocity of LEO satellite $0$. The maximal
communication duration $T_{0}^{S}$ between a mobile user and the LEO satellite
is given by

$T_{0}^{S}=\frac{L}{v^{S}},$ (1)

where $L=2\theta^{g}(E+l)$ is the arc length over which communication with the
LEO satellite is available for users.

###  III-B Communication Model

To facilitate interaction with LLM agents, a group of users covered by network
operator $n$, denoted by $\mathcal{U}_{n}$, can access services through
network operator $n$ for data transmission. These users share the same
spectral resources, resulting in mutual interference among them [3]. The
channel power gain from mobile user $u\in\mathcal{U}_{n}$ to LEO satellite
$0$, accounting for large-scale fading and shadowed-Rician fading, is
represented by $g_{u,0}$ [33]. Similarly, $g_{u,n}$ represents the channel
power gain from mobile user $u$ to ground BS $n=1,\ldots,N$, incorporating
large-scale fading and Rayleigh fading for terrestrial communications. The
bandwidth allocated by satellite $0$ and ground BSs $n=1,2,\ldots,N$, is
denoted as $B_{0}$ and $B_{n}$, respectively. Consequently, the uplink
transmission rate for user $u\in\mathcal{U}_{n}$ to transmit input data of LLM
agent services to network operators is given by

$r_{u,n}=B_{n}\log_{2}\left(1+\frac{g_{u,n}p_{u}}{\sum_{j\in\mathcal{U}_{n}\backslash\\{u\\}}g_{j,n}p_{j}+\sigma^{2}}\right),$
(2)

where $p_{u}$ is the transmit power of user $u$ and $\sigma^{2}$ is the power
of the additive white Gaussian noise (AWGN). The satellite serves as an
intermediary in providing LLM agent services between mobile users and cloud
data centers via the satellite backbone network [34], with the transmission
rate denoted by $r^{C}_{0}$. Moreover, ground BSs $n=1,2,\ldots,N$ connect to
cloud data centers through the terrestrial core network with a fixed
transmission rate $r^{C}_{n}$.

###  III-C Model Caching for LLM Agent Services

To facilitate the provisioning of LLM agent services in SAGINs, we introduce a
joint model caching and inference framework that enables edge servers located
at ground BSs to cache LLMs and offload requests, optimizing the utilization
of edge computing resources to provision LLM agent services for users, as
shown in Fig. 2. Specifically, ground BSs $n=1,\ldots,N$ are tasked with
determining local caching and offloading strategies. Here,
$a_{n,i,m}^{t}\in\\{0,1\\}$ represents the binary variable that indicates
whether model $m$ for service $i$ is cached at ground BS $n$ during time slot
$t$, and $b_{n,i,m}^{t}\in[0,1]$ signifies the continuous variable reflecting
the proportion of model $m$ for service $i$ being executed at ground BS $n$ at
time slot $t$. Let
$\mathbf{a}^{t}_{n}=\\{a^{t}_{n,1,1},\ldots,a^{t}_{n,I,M}\\}$ encapsulate the
model caching decisions at ground BS $n$, with
$\mathbf{a}^{t}=\\{\mathbf{a}^{t}_{1},\ldots,\mathbf{a}^{t}_{N}\\}$
aggregating these decisions across all network operators. Furthermore, the
request offloading decision for ground BS $n$ is denoted by
$\mathbf{b}^{t}_{n}=\\{b^{t}_{n,1,1},\ldots,b^{t}_{n,I,M}\\}$, while
$\mathbf{b}^{t}=\\{\mathbf{b}^{t}_{1},\ldots,\mathbf{b}^{t}_{N}\\}$ represents
the collective offloading decisions of ground BSs $n=1,\ldots,N$. To extend
the coverage of ground communication systems, satellite $0$ with limited
computing and energy resources acts as a relay between users and cloud data
centers, whose model caching decisions are $\mathbf{a}^{t}_{0}=\mathbf{0}$ and
request offloading decisions are $\mathbf{b}^{t}_{0}=\mathbf{0}$, i.e., all
the LLM agent services are offloaded to cloud data centers for remote
executing relayed by satellite $0$.

For edge intelligence in SAGINs, LLM agent services requested by users can be
executed at edge servers at ground BSs when the required LLMs are cached into
GPUs. Let $G_{n}$ denote the GPU computing capacity in terms of GPU memory of
ground BS $n$. Then, the decision of model caching $\mathbf{a}^{t}_{n}$ should
satisfy the following constraint at time slot $t$ for ground BS $n=1,\dots,N$,
as

$\sum_{i\in\mathcal{I}}\sum_{m\in\mathcal{M}}a_{n,i,m}^{t}s_{m}\leq G_{n},$
(3)

where $s_{m}$ is the running size of model $m$. This indicates that the edge
servers cannot load all the LLMs into GPUs as the computing resources at edge
servers are constrained. After the models are loaded into the GPUs of edge
servers, LLM agent services can be executed at the ground BSs. Therefore, the
constraint of LLM agent service provisioned at ground BS $n=1,\dots,N$, is
represented as

$b_{n,i,m}^{t}\mathbf{1}(R_{n,i,m}^{t}>0)\leq a_{n,i,m}^{t},\forall
i\in\mathcal{I},m\in\mathcal{M},$ (4)

where $\mathbf{1}(\cdot)$ is the indicator function and
$\mathbf{1}(R_{n,i,m}^{t}>0)$ indicates that there are requests of LLM agent
service $i$ for model $m$ at BS $n$ at time slot $t$. Finally, the total
computing power consumption of edge servers is constrained by the total
computing capacity of GPUs at ground BS $n=1,\dots,N$, which can be
represented as

$\sum_{i\in\mathcal{I}}\sum_{m\in\mathcal{M}}e_{m}a_{n,i,m}^{t}(1-b_{n,i,m}^{t})R_{n,i,m}^{t}\leq
E_{n}.$ (5)

Nevertheless, in cloud data centers, it could be assumed that there is no GPU
memory constraint or computing capacity constraint for executing LLMs.

###  III-D Chain-of-Thought Inference Model

To improve the relevance and coherence of LLM agents, LLMs can leverage CoT
prompting to perform step-by-step reasoning before obtaining the final
response [35].  As an advanced inference approach to elicit the emerging
abilities of LLMs, CoT prompting allows LLMs to generate a sequence of
intermediate reasoning steps towards problem-solving or concluding, instead of
attempting to solve the entire problem in merely zero-shot manner. During
inference of LLMs, given any task description prompt $d$, LLM $m$ can generate
an answer by recursively predicting the sequence of next tokens from the
learned distribution $p_{m}$ conditioned on the concatenation of $d$ and of
the tokens sampled so far. For all sequences of messages in LLM agent service
$i$, $D_{i}=\\{d_{i,0},\ldots,d_{i,k}\\}$ of at most $w_{m}$ tokens, the
$p_{m}(D_{i})$ follows the general product rule of probability [36], i.e.,

$\displaystyle p_{m}(D_{i})=p_{m}(d_{i,0},\ldots,d_{i,k})$ (6)
$\displaystyle=p_{m}(d_{i,0})p_{m}(d_{i,1}|d_{i,0})\ldots
p_{m}(d_{i,k}|d_{i,0},\ldots,d_{i,k-1}),$

which is a good approximation of the true distribution $\hat{q}(D_{i})$.

For eacg CoT prompt in LLM agent service $i$, LLM $m$ is provided with $c_{i}$
varying length CoT examples $E_{i}=\\{e_{i,0},\ldots,e_{i,k}\\}$ and each
thought $e_{i,k}$ in $E_{i}$ is a sequence of $k_{i}$ tokens representing one
reasoning step. Those examples are designed to aid the LLMs in producing
correct answers via CoT generation and thus for service $i$, $E_{i}$ are
generated with true intentions $\theta^{\star}$ and true context $c^{\star}$.
To sever LLM agent service $i$, for the given $E_{i}$ and a task $d_{i,0}$,
LLMs then generate $(d_{i,1},\ldots,d_{i,k})$ messages. To evaluate the
performance of the approximation of LLMs, we have the following definition.

######  Definition 1 ($\epsilon$-ambiguity [36]).

For CoT examples $E_{i}$ of LLM service $i$ generated based on true context
$c^{\star}$ and true intention $\theta^{\star}$, the ambiguity of the chain
$\epsilon(E_{i})$ is defined as the complement of the likelihood of the
context $c^{\star}$ and intentions $\theta^{\star}$ conditioned on CoT
examples $E_{i}$, i.e.,

$\hat{q}(c^{\star},\theta^{\star}|E_{i})=1-\epsilon(E_{i}).$ (7)

In addition to the ambiguous definition of LLMs, we define the quality of
contexts in training datasets as follows.

######  Definition 2.

To account for the potentially non-uniform distribution of contexts in
training datasets at network operators, we introduce a skewness parameter
$\gamma_{n}(c^{\star})$ for each network operator $n$, which is defined as

$\gamma_{n}(c^{\star})=\sup_{c\in
C}\frac{\hat{q}(c^{\star})}{\hat{q}(c_{n})},$ (8)

where $c_{n}$ is the context owned by network operator $n$.

Ground BSs can collect the context during their provisioning of LLM agent
services, which satisfies the preference of their local users. Therefore, we
have the following assumption.

######  Assumption 1.

The prior distribution associated with true contexts $c^{\star}$ is uniform.

Based on the uniform context considered in Assumption 1,
$\gamma_{n}(c^{\star})=1$ guarantees small values or provides CoT examples
that should have small enough ambiguity, so the model with high certainty
could guess the true context $c^{\star}$ from them [37]. Following Definition
2, we can estimate the difference of ambiguity measurements between the
learned distribution $p_{m}$ and the true distribution $\hat{q}$, conditioned
on input messages $D_{i}$ of service $i$, as follows.

######  Theorem 1.

Considering a collection of $c_{i}$ varying length CoT examples, which are
generated from the intention $\theta^{\star}$ with the optimal context
$c^{\star}$ sampled from $q_{m}(c)$ that satisfies Assumption 1. Furthermore,
let $d_{i,0}$ be the input message or task sampled from
$q(\cdot|\theta^{\star}_{0})$, which is generated from $\theta^{\star}_{0}$
sampled from $q_{m}(\cdot|c^{\star})$. Then, for any sequence of messages
$D_{i}$, we have

$|p_{m}(D_{i}|d_{i,0},E_{i})-\hat{q}(D_{i}|d_{i,0},c^{\star})|\leq\eta\prod_{y=1}^{c_{i}}\frac{\epsilon(E_{i,y})}{1-\epsilon(E_{i,y})},$
(9)

where $\eta=2\frac{\epsilon(d_{i,0})}{1-\epsilon(d_{i,0})}$ depends on the
ambiguity of the input.

###### Proof.

We provide a simplified proof to show how to obtain this bound with the
necessary steps and the complete proof can be found in[37]. Starting from
$p_{m}(D_{i}|d_{i,0},E_{i})$, we have

$\displaystyle p_{m}(D_{i}|d_{i,0},$ $\displaystyle
E_{i})=\frac{\hat{q}(D_{i},E_{i})}{\hat{q}(d_{i,0},E_{i})}$ (10)
$\displaystyle=\frac{\hat{q}(D_{i},E_{i},c^{\star})+\sum_{c\neq
c^{\star}}\hat{q}(D_{i},E_{i},c)}{\hat{q}(d_{i,0},E_{i},c^{\star})+\sum_{c\neq
c^{\star}}\hat{q}(d_{i,0},E_{i},c)}$
$\displaystyle=\frac{\hat{q}(D_{i}\backslash\\{d_{i,0}\\},E_{i},c^{\star})+\frac{\sum_{c\neq
c^{\star}}\hat{q}(D_{i},E_{i},c)}{\hat{q}(d_{i,0},E_{i},c^{\star})}}{1+\frac{\sum_{c\neq
c^{\star}}\hat{q}(d_{i,0},E_{i},c)}{\hat{q}(d_{i,0},E_{i},c^{\star})}}$
$\displaystyle=\frac{\hat{q}(D_{i}\backslash\\{d_{i,0}\\},E_{i},c^{\star})+\Lambda}{1+\Upsilon},$

where $\Lambda$ and $\Upsilon$ are given by

$\Lambda=\frac{\sum_{c\neq
c^{\star}}\hat{q}(D_{i},E_{i},c)}{\hat{q}(d_{i,0},E_{i},c^{\star})}\text{and
}\Upsilon=\frac{\sum_{c\neq
c^{\star}}\hat{q}(d_{i,0},E_{i},c)}{\hat{q}(d_{i,0},E_{i},c^{\star})}.$ (11)

By leveraging the definition of ambiguity measure for CoT example $E_{i,y}$,
we can establish the following bounds on $\Lambda$ and $\Upsilon$ as

$\Lambda,\Upsilon\leq\frac{\gamma^{c_{i}}_{n}(c^{\star})\epsilon(d_{i,0})}{1-\epsilon(d_{i,0})}\prod_{y=1}^{c_{i}}\frac{\epsilon(E_{i,y})}{1-\epsilon(E_{i,y})}.$
(12)

Finally, combining the above components, we have

$\displaystyle|p_{m}(D_{i}|d_{i,0},E_{i})$
$\displaystyle-\hat{q}(D_{i}|d_{i,0},c^{\star})|$ (13)
$\displaystyle=\frac{|\Lambda-\Upsilon\hat{q}(D_{i}/\\{d_{i,0}\\}|d_{i,0},c^{\star})|}{1+\Upsilon}$
$\displaystyle\leq|\Lambda+\Upsilon\hat{q}(D_{i}/\\{d_{i,0}\\}|d_{i,0},c^{\star})|$
$\displaystyle\leq\Lambda+\Upsilon$
$\displaystyle\leq\eta\prod_{y=1}^{c_{i}}\frac{\epsilon(E_{i,y})}{1-\epsilon(E_{i,y})},$

where
$\eta=2\frac{\gamma_{n}^{c_{i}}(c^{\star})\epsilon(d_{i,0})}{1-\epsilon(d_{i,0})}$,
following Assumption 1 and indicating that $\gamma_{n}(c^{\star})=1$ and thus
$\eta=2\frac{\epsilon(d_{i,0})}{1-\epsilon(d_{i,0})}$. ∎

Theorem 1 indicates that the LLM prompted with CoT example $E_{i}$ is capable
of approximating the true natural language distribution equipped with true
context and intentions.

######  Assumption 2.

The CoT example $E_{i}$ generated from $\theta^{\star}$ with a context
$c^{\star}\sim q(c)$ is bounded by the ambiguity measure, i.e.,

$\epsilon(E_{i})=\hat{q}(c^{\star},\theta^{\star}|E_{i})\leq\sigma,$ (14)

where $\sigma\in[0,\frac{1}{2}]$.

Assumption 2 implies that when carefully selected, CoT examples $E_{i}$ and
the true context $c^{\star}$ can be recovered from $E_{i}$ with reasonably
high certainty, i.e., the probability the $c^{\star}$ is behind $E_{i}$ is
strictly greater than on a half. Given such CoT examples, we can transform the
bound in Theorem 1 into a geometrical convergence rate with the number of
examples growing large as

$|p_{m}(D_{i}|d_{i,0},E_{i})-\hat{q}(D_{i}|d_{i,0},c^{\star})|\leq\eta\beta^{c_{i}},$
(15)

where the CoT gain is $\beta=\frac{\sigma}{1-\sigma}\in[0,1)$. Those examples
described in Assumption 2 should be carefully selected to guarantee low
ambiguity requirements. In practice, however, it can be challenging to collect
such chain-of-thought examples, as there can be an assumption that allows us
to measure ambiguity for a given sequence of thoughts as below.

######  Assumption 3.

For the CoT examples $E_{i}$ generated from true intentions $\theta^{\star}$
with the true context context $c^{\star}\sim q(c)$, the associated ambiguity
measure $\epsilon(E_{i})$ vanishes as the length of sequence grows large as

$\lim_{l\rightarrow\infty}\epsilon(E_{i})=0.$ (16)

Assumption 3 implies that uncertainty over true context $c^{\star}$ and true
intentions $\theta^{\star}$ for a sequence of thoughts is diminishing when
more of these thoughts are collected. Therefore, for long enough CoT examples,
the asymptotic requirement is sufficient to guarantee a low ambiguity measure.
Satisfying Assumption 3, we have the following lemma.

######  Lemma 1.

Considering CoT examples $E_{i}$ for any fixed $\sigma\in[0,\frac{1}{2})$
there is a length threshold $k^{\star}_{i,\sigma}\in\mathbb{N}$. For any
$k_{i}\geq k^{\star}_{i,\sigma}$, we have

$\epsilon(E_{i})\leq\sigma.$ (17)

###### Proof.

By selecting $\sigma\in[0,\frac{1}{2})$, CoT examples $E_{i}$ following
Assumption 3 have the approximation that
$\lim_{l\rightarrow\infty}\epsilon(E_{i})=0$. Then, there exists
$k_{i,\sigma}^{\star}\in\mathbb{N}$ such that for any $k_{i}\geq
k^{\star}_{i,\sigma}$, the inequality $\epsilon(E_{i})\leq\sigma$ holds. ∎

Based on Lemma 1, the geometrical convergence rate in Eq. (15) can be
established when the LLM is prompted with CoT examples $E_{i}$ of sufficient
length, i.e., $k_{i}\geq k^{\star}_{i,\sigma}$ following Assumption 3. In
contrast to the low ambiguity requirement, CoT examples with low asymptotic
ambiguity can be more attainable. Therefore, during the step-by-step inference
of LLMs, the original CoT examples $E_{i}$ satisfying Assumption 3 can be
split or divided into different lengths and sizes of thoughts $E_{i}^{\prime}$
following the required threshold $\sigma\in[0,\frac{1}{2})$, which can be more
refined reasoning steps with predefined ambiguity.

LLMs, such as GPT-3, can perform CoT prompting which indicates that they can
learn from past CoT examples for complex tasks presented to them. The
intermediate thoughts can be used to enhance the performance of LLM agents, as
LLMs can use meta-gradient learning during interaction to fit them [38].
However, depending on the relevance and coherence of intermediate thoughts,
few-shot learning may have favorable or unfavorable impacts on the model
performance. Based on the caching decision $a_{n,i,m}^{t}$ and offloading
decision $b_{n,i,m}$, the batch of requests executed as ground BS $n$ can be
calculated as
$\delta_{n,i,m}^{t}=a_{n,i,m}^{t}(1-b_{n,i,m}^{t})R_{n,i,m}^{t}k_{i}$ for
service $i$ and model $m$, where $k_{i}$ is the size of CoT examples for
service $i$ which can be estimated via Lemma 1. In general, the number of
thoughts increases monotonically when the LLM is cached into the edge servers,
which can be represented as

$K^{t}_{n,i,m}=\begin{cases}0,&t=0,\\\
a_{n,i,m}^{t}(K^{t-1}_{n,i,m}+\delta_{n,i,m}^{t}),&\text{otherwise}.\end{cases}$
(18)

Similar to the definition of age of information (AoI), the AoT measures the
freshness of intermediate thoughts within the cached LLMs for the current
inference requests. With a vanishing factor $\Delta_{i,m}^{t}$ of thoughts,
the AoT is adjusted by the non-increasing age utility function, which is
represented as

$\kappa^{t}_{n,i,m}=\begin{cases}0,&t=0,\\\
a_{n,i,m}^{t}\\{\kappa^{t-1}_{n,i,m}+\delta_{n,i,m}^{t}-\Delta_{i,m}^{t}\\}^{+},&\text{otherwise}.\end{cases}$
(19)

According to the AoT, the weighted total of the number of examples in
demonstrations may be used to determine the number of examples in context.

Based on Eq. (15), the few-shot CoT reasoning performance $A_{i,m}$ of model
$m$ in service $i$ can be defined as

$A_{n,i,m}^{t}=\alpha_{i,m}\log(1/\beta_{i,m}^{\kappa^{t}_{n,i,m}}),$ (20)

where $\alpha_{i,m}$ is the zero-shot accuracy of LLM $m$ for service $i$ and
$\log(1/\beta_{i,m}^{\kappa^{t}_{n,i,m}})$ is the performance gain of
generated CoT examples of LLM $m$ for service $i$.

##  IV Problem Formulation, Caching Algorithm Design, and Market Design

In this section, we first formulate the problem of provisioning LLM agents in
SAGINs to maximize the quantity and quality of LLM agent services. To solve
the formulated problem, we next propose a model caching algorithm for local
cached model management for ground BSs. Furthermore, we design an LLM agent
market for incentivizing network operators, i.e., satellites and ground BSs,
to contribute their resources to execute LLM agents.

During the provisioning of LLM agent services, network operators, i.e.,
satellite or terrestrial BSs, need to provide communication, computation,
storage, and cached model resources to run the LLM agent services. In detail,
the user’s request and returned results need to be transmitted over the
wireless channel, which costs bandwidth to complete the interaction between
the user and the LLM agent deployed at the edge. The reasoning process of LLM
consumes a lot of computing resources, especially when LLMs perform CoT
reasoning; they need a large amount of intermediate computation to obtain the
final high-quality results. Since LLM uses CoT reasoning to improve the
quality of model inference, they need substantial storage resources to store
past CoT examples locally for demonstration. Finally, since the context window
of LLM is limited, when the model inference is deployed beyond a certain
number of tokens, the model needs to be refreshed, i.e., to evict the old
model and load another fresh model.

###  IV-A Cost Structure

As mentioned above, the LLM agent services provisioned at ground BSs can be
handled by edge servers or offloaded to cloud data centers via the core
network. Based on the decisions of model caching and request offloading, the
overall cost of providing LLM agent services, including the cost at the edge
and the cost at the cloud, can be expressed as follows.

####  IV-A1 Edge Inference Cost

Specifically, the cost of edge inference includes the cost of switching in
GPUs, the cost of transmitting data across edges, the cost of performing
computations on edges, and the cost of model accuracy. Based on decisions
about model caching, each edge server must load models into the GPU memory
before execution. During the model loading process, there is a cost associated
with switching between models in GPUs, which includes the latency of loading
the model and the cost of wear and tear on the hardware [39]. Therefore, the
switching cost $l^{s}_{n}$ of ground BS $n$ to load and evict models can be
calculated as

$l^{switch}_{n}(\mathbf{a}^{t})=\sum_{i\in\mathcal{I}}\sum_{m\in\mathcal{M}}\lambda\mathbf{1}(a_{n,i,m}^{t}>a_{n,i,m}^{t-1}),$
(21)

where $\lambda$ denotes the coefficient for loading and evicting the model and
$\mathbf{1}(\cdot)$ is the indicator function. When
$a_{n,i,m}^{t}>a_{n,i,m}^{t-1}$, i.e., $a_{n,i,m}^{t}=1$ and
$a_{n,i,m}^{t-1}=0$, $\mathbf{1}(a_{n,i,m}^{t}>a_{n,i,m}^{t-1})$ indicates
that the loading of an uncached model. Otherwise, there is no switching cost
incurred at edge servers.

When the requested models are cached into the GPU memory of edge servers,
users communicate with the edge servers to request LLM agent services. Let
$l_{n}^{trans}$ denote the transmission cost of input prompts and inference
results. The transmission cost of ground BS $n$ can be calculated as

$l_{n}^{trans}(\mathbf{a}^{t},\mathbf{b}^{t})=\sum_{i\in\mathcal{I}}\sum_{m\in\mathcal{M}}R_{n,i,m}^{t}\left(l_{n,i}+\frac{d_{i}}{r_{n}^{C}}b_{n,i,m}^{t}\right),$
(22)

where $l_{n,i}=d_{i}/\mathbb{E}_{u\in\mathcal{U}_{n}}[r_{u,n}]$ is the unit
transmission cost per input and result for service $i$ to transmit the input
data with size $d_{i}$ from users $\mathcal{U}_{n}$ to ground BS $n$.

Let $f_{n}$ denote the computing capacity of ground BS $n$. The execution of
LLM agent services at ground BSs incurs inference latency, which is denoted as
$l^{comp}_{n}$ for ground BS $n$. The edge computing cost can be calculated as

$l^{comp}_{n}(\mathbf{a}^{t},\mathbf{b}^{t})=\sum_{i\in\mathcal{I}}\sum_{m\in\mathcal{M}}\delta_{n,i,m}^{t}\frac{e_{m}}{f_{n}},$
(23)

where $\delta_{n,i,m}^{t}=a_{n,i,m}^{t}(1-b_{n,i,m}^{t})R_{n,i,m}^{t}k_{i}$ is
the total computation token for a batch of LLM agent service $i$. Finally, as
ground BSs might not have sufficient resources for executing the best-matched
model requested by LLM agents, which might introduce a performance gap, the
requests processed by other LLMs with the equivalent function incur accuracy
cost $l^{acc}_{n}$, which can be represented as

$l^{acc}_{n}(\mathbf{a}^{t},\mathbf{b}^{t})=\sum_{i\in\mathcal{I}}\sum_{m\in\mathcal{M}}\bar{A}_{n,i,m}^{t}R_{n,i,m}^{t}a_{n,i,m}^{t}(1-b_{n,i,m}^{t}),$
(24)

where
$\bar{A}_{n,i,m}^{t}=\frac{1-\alpha_{i,m}}{\kappa^{t}_{n,i,m}\log(1/\beta_{i,m})}$
is the unit accuracy cost following Eq. (20). By sacrificing some accuracy of
LLM agent services, the system can reduce the model missing rate. Therefore,
the total edge inference cost of ground BS $n$ is

$\displaystyle L^{t}_{n}(\mathbf{a}^{t},\mathbf{b}^{t})=$ $\displaystyle
l^{switch}_{n}(\mathbf{a}^{t}_{n})+l_{n}^{trans}(\mathbf{a}^{t}_{n},\mathbf{b}^{t}_{n})$
(25)
$\displaystyle+l^{comp}_{n}(\mathbf{a}^{t}_{n},\mathbf{b}^{t}_{n})+l^{acc}_{n}(\mathbf{a}^{t}_{n},\mathbf{b}^{t}_{n}).$

The edge inference cost is jointly determined by the caching decisions and
offloading decisions of ground BSs. Nevertheless, the missed or offloaded
requests are executed by cloud data centers.

####  IV-A2 Cloud Inference Cost

The ground BSs are typically limited in resources and cannot serve all LLM
agent service requests. There are two main reasons for this limitation. First,
the ground BSs’ computing capacities may be insufficient to load many LLMs
into the GPU memory. Second, the ground BSs’ energy capacity may not be enough
to handle all requests. Therefore, some requests will be offloaded to cloud
data centers for remote execution.

When the requested models are not available or the ground BS lacks sufficient
resources, these user requests are transmitted to the cloud data center, which
then allocates resources to serve them. According to [39], cloud data centers
can provide serverless LLM agent services, charging users on a “pay-as-you-go”
basis. This means that users pay based on the number of requests rather than
the specific resources occupied. However, this cloud-based inference
introduces additional latency due to data transmission in the core network,
which is larger than the latency at ground BSs. Additionally, the accuracy
cost of offloaded inference requests executed by the cloud data center is
expected to be minimal, as the requests can be processed using the most
accurate model with common CoT examples owned by the data center.

Based on the above analysis, we use $l_{n}^{C}$ to represent the total cost of
offloading requests to the cloud data center for remote execution. Then, the
total cloud computing cost at time slot $t$ is

$L^{t}_{C}(\mathbf{a}^{t},\mathbf{b}^{t})=\sum_{n\in\mathcal{N}}\sum_{i\in\mathcal{I}}\sum_{m\in\mathcal{M}}l_{0,m}b_{n,i,m}^{t}R_{n,i,m}^{t},$
(26)

where $l_{0,m}$ is the unit process cost of model $m$ at cloud data centers.
Therefore, the total cost $L^{total}_{n}$ for provisioning LLM agent services
at network operator $n$ can be calculated as

$L^{total}_{n}=\frac{1}{T}\sum_{t\in\mathcal{T}}\left(L^{t}_{C}+L_{n}^{t}\right).$
(27)

###  IV-B Problem Formulation of Ground Base Stations

To improve the efficiency of mobile edge intelligence, we take into account
both the cost of edge inference and cloud inference. This includes considering
the switching cost, accuracy cost, transmission cost, and inference cost over
a specific period $T$. For ground BSs $n=1,\ldots,N$, the problem of providing
LLM agent services is formulated as

$\displaystyle\underset{\displaystyle\mathbf{a}^{t}_{n},\mathbf{b}^{t}_{n}}{\mathrm{min}}\quad
L^{total}_{n}$ (28a)
$\displaystyle\mathmakebox[\widthof{$\underset{\displaystyle\phantom{\mathbf{a}^{t}_{n},\mathbf{b}^{t}_{n}}}{\mathrm{min}}$}][c]{\mathmakebox[\widthof{$\mathrm{min}$}][l]{\mathrm{\kern
1.00006pts.t.}}}\quad$ $\displaystyle(3),(4),(5),$ (28b) $\displaystyle
K_{n,i,m}^{t}\leq w_{m},\forall i\in\mathcal{I},\forall m\in\mathcal{M},$
(28c) $\displaystyle a_{n,i,m}^{t}\in\\{0,1\\},$ (28d) $\displaystyle
b_{n,i,m}^{t}\in[0,1].$ (28e)

Constraint (28c) indicates that the context tokens cannot exceed the size of
context windows. To address the optimization problem described above, we need
to overcome the challenge of time-coupled elements, such as GPU memory and CoT
examples, as it takes into account both future request dynamics and historical
CoT examples. Furthermore, the problem is a mixed-integer programming problem,
which is known to be NP-hard. To solve the problem efficiently, we require
low-complexity algorithms to determine decisions of model caching and request
offloading.

###  IV-C The Least Age-of-Thought Caching Algoirhtm

To effectively serve LLMs for provisioning LLM agent services, we propose the
least AoT algorithm based on the proposed AoT metric. When additional GPU
memory is required for loading an uncached requested LLM, the least AoT
algorithm counts the value of CoT examples, calculates them, and removes the
cached LLM with the lowest AoT. Therefore, at each time slot $t$, the model
caching decisions can be obtained by solving the maximization problem of the
number of CoT examples for the cached models, which can be represented as

$\displaystyle\underset{\displaystyle\mathbf{a}^{t}}{\mathrm{max}}\quad\sum_{i\in\mathcal{I}}\sum_{m\in\mathcal{M}}\kappa^{t}_{n,i,m}$
(29a)
$\displaystyle\mathmakebox[\widthof{$\underset{\displaystyle\phantom{\mathbf{a}^{t}}}{\mathrm{max}}$}][c]{\mathmakebox[\widthof{$\mathrm{max}$}][l]{\mathrm{\kern
1.00006pts.t.}}}\quad$
$\displaystyle\sum_{i\in\mathcal{I}}\sum_{m\in\mathcal{M}}a_{n,i,m}^{t}s_{m}\leq
G_{n},\forall n\in\mathcal{N},$ (29b)
$\displaystyle\sum_{i\in\mathcal{I}}\sum_{m\in\mathcal{M}}(1-b_{n,i,m}^{t})e_{m}\leq
E_{n},\forall n\in\mathcal{N},$ (29c) $\displaystyle
a_{n,i,m}^{t}\in\\{0,1\\}.$ (29d)

The available capacity of GPU memory $G_{n}^{t}$ of ground BS $n=1,\ldots,N$
at time slot $t$ can be calculated as
$G_{n}^{t}=G_{n}-\sum_{i\in\mathcal{I}}\sum_{m\in\mathcal{M}}a_{n,i,m}^{t}s_{m}$.
This algorithm allows the least important LLM to have a higher chance for
eviction in the current inference task. The complexity of the algorithm
increases linearly as the number of models increases. Therefore, it works well
with a large number of LLMs on ground BSs with limited GPU memory. Using more
intermediate reasoning steps during inference makes the LLMs perform more
accurately. Based on caching decisions $\mathbf{a}^{t}_{n}$ by solving the
optimization problem in (29a), offloading decisions $\mathbf{b}^{t}_{n}$ are
obtained by solving the optimization problem in (28a). The detailed
implementation of the Least AoT algorithm is provided in Algorithm 1.

1 Input: Model caching status $\mathbf{a}^{t-1}_{n}$, model context status
$\kappa_{n}^{t}$, and LLM agent service requests $R^{t}_{n}$, GPU memory
capacity $G_{n}$, GPU computing capacity $E_{n}$.

2 Output: Model caching decision $\mathbf{a}^{t}_{n}$ and request offloading
decision $\mathbf{b}^{t}_{n}$.

3 Initialize $\mathbf{a}^{t}_{n}=\mathbf{0}$, $\mathbf{b}^{t}_{n}=\mathbf{0}$,
$G_{n}^{t}=G_{n}-\sum_{i\in\mathcal{I}}\sum_{m\in\mathcal{M}}a_{n,i,m}^{t-1}s_{m}$,
and $E_{n}^{t}=0$.

4 for  _$R_{n,i,m}^{t} >0$ in $R_{n}^{t}$_ do

5 if  _$a_{n,i,m}^{t-1}=1$_ then

6 $a_{n,i,m}^{t}\leftarrow 1$;

7

8 end if

9 else if  _ $G_{n}^{t}+s_{m}\leq G_{n}$_ then

10 $a_{n,i,m}^{t}\leftarrow 1$;

11 $G_{n}^{t}\leftarrow G_{n}^{t}+s_{m}$;

12

13 end if

14 else

15 while  _$G_{n}^{t}+s_{m}\geq G_{n}$_ do

16
$(\bar{i},\bar{m})\rightarrow\arg\min_{(\bar{i},\bar{m})}\\{\kappa_{n,\bar{i},\bar{m}}^{t}\in\kappa_{n}^{t}\\}$;

17 if  _$a_{n,\bar{i},\bar{m}}^{t-1}=1$ and $a_{n,\bar{i},\bar{m}}^{t}=0$_
then

18 $G_{n}^{t}=G_{n}^{t}-s_{\bar{m}}$;

19

20 end if

21

22 end while

23 if  _$G_{n}^{t}+s_{m}\leq G_{n}$_ then

24 $a_{n,i,m}^{t}\leftarrow 1$;

25 $G_{n}^{t}\leftarrow G_{n}^{t}+s_{m}$;

26

27 end if

28

29 end if

30 if  _$a_{n,i,m}^{t}=1$ and $E_{n}^{t}+e_{m}a_{n,i,m}^{t}R_{n,i,m}^{t}\leq
E_{n}$_ then

31 $b_{n,i,m}^{t}\leftarrow 1$;

32 $E_{n}^{t}\leftarrow
E_{n}^{t}+e_{m}a_{n,i,m}^{t}b_{n,i,m}^{t}R_{n,i,m}^{t}$;

33 Update context status $\kappa_{n,i,m}^{t}$ following Eq. (19);

34

35 end if

36 if  _$K_{n,i,m}^{t} >w_{m}$_ then

37 $a_{n,i,m}^{t}\leftarrow 0$;

38 $b_{n,i,m}^{t}\leftarrow 0$.

39 end if

40

41 end for

42

Algorithm 1 The Least Age-of-Thought Cached Model Replacement Algorithm

###  IV-D Market Design

To motivate LLM agent providers to construct and update LLM agents for users,
we design an LLM agent market where sellers (LLM agent providers) can earn
profits from provisioning LLM agent services, and bidders (network operators)
are competing for provisioning LLM agent services to their users. We consider
that the network operators are risk-neutral bidders in the market whose
surpluses are positively correlated with each other based on the revelation
principle [16].

In SAGINs, users can obtain the services of a running LLM agent via a
satellite or ground BS as their assistants to perform their local tasks. Each
network operator $n\in\mathcal{N}$ has valuation $v_{n}=c_{n}m_{n}$ for the
opportunity to serve the LLM agent, which is a production of the common value
$c_{n}=\mathbb{E}_{t\in\mathcal{T}}[L^{total}_{n}-l^{acc}_{n}(\mathbf{a}^{t},\mathbf{b}^{t})]$
about physical resource consumption and the match performance gain
$m_{n}=\mathbb{E}_{t\in\mathcal{T}}[\log(1/\beta_{i,m}^{\kappa^{t}_{n,i,m}})]$
obtained in Eq. (20). Specifically, the common value captures attributes of
the resource consumption required to execute the LLMs, which depends on the
communication, computing, and storage resources. Meanwhile, the match quality
captures idiosyncratic components of cached models in network operators that
affect the quality of LLM agents [16]. During the valuation of LLM agents, the
common value is considered to be independent of match quality, i.e., the
resource consumption of LLM agents is not relevant to the quality of LLM
agents. We use $v_{(i)}$, $c_{(i)}$, and $m_{(i)}$ to denote the $i$-th
highest valuation, common value, and match value factor, respectively.

In the market, a mechanism $\mathcal{M}(\mathbf{v})=(\mathbf{z},\mathbf{p})$
is required to map the privately held valuation $\mathbf{v}$ to allocation
probabilities $\mathbf{z}=(z_{0},z_{1},\ldots,z_{N})$ and payment
$\mathbf{p}=(p_{0},p_{1},\ldots,p_{N})$. The expected surplus, i.e., the
realization of valuation, for satellite is
$\mathbb{E}[v_{0}z_{0}(\mathbf{v})]$. Meanwhile, the surplus from the LLM
agent allocated to the ground BSs is given by
$\mathbb{E}[\sum_{n=1}^{N}v_{n}z_{n}(v)]$. To maximize the total surplus of
network operators to provision LLM agents, the problem for the mechanism can
be formulated as

$\displaystyle\underset{\displaystyle\mathcal{M}}{\mathrm{max}}\quad\mathbb{E}\left[\sum_{n=0}^{N}v_{i}z_{i}(v)]\right]$
(30a)
$\displaystyle\mathmakebox[\widthof{$\underset{\displaystyle\phantom{\mathcal{M}}}{\mathrm{max}}$}][c]{\mathmakebox[\widthof{$\mathrm{max}$}][l]{\mathrm{\kern
1.00006pts.t.}}}\quad$
$\displaystyle\sum_{t\in\mathcal{T}}\sum_{i\in\mathcal{I}}\sum_{m\in\mathcal{M}}\frac{d_{i}R_{0,i,m}^{t}}{\mathbb{E}_{u\in\mathcal{U}_{0}}[r_{u,0}+r_{0}^{C}]}\leq
T_{0}^{S}{},$ (30b) $\displaystyle\sum_{n=0}^{N}z_{n}\leq 1{}{},$ (30c)
$\displaystyle z_{n}\in\\{0,1\\},\forall n\in\mathcal{N}{}.$ (30d)

Constraint (30b) indicates that the provisioning time of satellites cannot
exceed their coverage time. Constraints (30c) and (30d) indicate that there is
one and only one network operator that can obtain the opportunity to run LLM
agents.

##  V The Deep Q-Network-based Modified Second-bid Auction

###  V-A Modified Section-price Auction

In the LLM agent market, all network operators submit their bids
$\mathbf{x}=(x_{0},x_{1},\ldots,x_{N})$ to the auctioneers. Then, the
auctioneer leverages MSB auction [16] to determine the winning bidder and
payment, which can be formulated as follows.

######  Mechanism 1 (Modified Second-bid Auction).

The MSB auction allocates the LLM agent to the highest BS if their bid exceeds
the second-highest bid by a price scaling factor of $\rho$ or more and prices
the LLM agent with the second-highest bid scaling with $\rho$. When no
performance bidders win, the opportunity is allocated to the relaying
satellite, which offloads LLM agent services to cloud data centers, with the
contracted price $x_{0}$ is chosen to maximize its expected profit as
$x_{0}=\max_{x}\mathbb{E}[(v_{0}-v_{(1)}\textbf{1}(v_{(1)\leq x_{0}}))]$ [16].
Formally, the allocation rule and the pricing rule can be represented as
follows.

  * •

Allocation rule: For ground BSs, namely, the performance bidders,
$n=1,\ldots,N$, the allocation probabilities $z_{n}\in\\{0,1\\}$ for the
deterministic mechanism are determined by

$z_{n}(\mathbf{x})=\mathbf{1}(x_{n}>\rho\max\\{\mathbf{x}_{-n}\\}),$ (31)

for $\rho\geq 1$. Then, the allocation probability for the satellite can be
calculated based on the allocation probabilities of ground BSs, as
$z_{0}(\mathbf{x})\leq 1-\sum_{n=1}^{N}z_{n}(\mathbf{x})$.

  * •

Pricing rule: If the winner is ground BS $n=1,\ldots,N$, the winning ground BS
is charged with the product of the price scaling factor $\rho$ the second
highest bid, i.e., the payment $p_{n}$ can be calculated as

$p_{n}(\mathbf{x})=z_{n}(\mathbf{x})\cdot\rho\max\\{\mathbf{x}_{-n}\\}.$ (32)

Furthermore, the payment of the satellite depends on their contract price
$x_{0}$, i.e., $p_{0}(\mathbf{x})=z_{0}(\mathbf{x})x_{0}$.

###  V-B DQN-based Price Scaling Factor

To leverage DRL to determine the price scaling factor, we formulate the
process of MSB as a Markov decision process (MDP), consisting of states,
actions, and rewards. At each time step, the DRL-based auctioneer observes the
current state and selects an action, i.e., the price scaling factor from the
feasible action space. Then, the auctioneer determines the winning bidder and
the payment, and receives the total surplus as the reward. Formally, the MDP
of MBS can be formulated as follows. During the auction process, multiple
network operators submit their bids to the auctioneer. Therefore, the state
space consists of the bidding information in MSB, i.e.,
$S_{k}\triangleq\\{\mathbf{x}^{k}\\}$ at decision slot $k$. To calculate the
pricing rule and allocation rule, the auctioneer needs to determine the level
of the price scaling factor, i.e., $a_{k}\in\mathcal{A}\subseteq\mathbb{N}$.
Then, the price scaling factor is calculated as
$\rho=10^{a_{k}/|\mathcal{A}|}$, where $|\mathcal{A}|$ is the size of action
space. The reward is calculated as the total surplus achieved in the market,
i.e., $r_{k}=\mathbb{E}\left[\sum_{n=0}^{N}v_{i}z_{i}(v)]\right]$ calculated
in Eq. (30a).

Based on the MDP of MBS, the objective of the DRL-based auctioneer is to
optimize a non-linear function approximation with parameters $\phi$ as a
Q-network to maximize the future discounted return
$R_{k}=\sum_{k^{\prime}=k}^{K}\gamma^{k^{\prime}-k}r_{k^{\prime}}$. In this
regard, the auctioneer needs to learn the optimal action-value function as

$Q^{\star}(S,a)=\mathbb{E}_{S^{\prime}}\left[r+\gamma\max_{a^{\prime}}Q^{\star}(S^{\prime},a^{\prime})|S,a\right],$
(33)

where the action $a^{\prime}$ is selected to maximize the expected value of
$r+\gamma Q^{\star}(S^{\prime},a^{\prime})$. Therefore, the target for
iteration $k$ can be calculated as
$y_{k}=r_{k}+\gamma\max_{a^{k+1}}Q_{\phi^{\prime}}(S^{k+1},a^{k+1}),$ where
$\phi^{\prime}$ is the parameters of target network $Q_{\phi^{\prime}}$. To
minimize the performance gap between the current Q value and the target, the
loss function can be defined as

$L=\frac{1}{K}\sum_{k=1}^{K}\left(y_{k}-Q_{\phi}(S_{k},a_{k})\right)^{2}.$
(34)

For computational efficiency and performance stability, DQN leverages
stochastic gradient descent to optimize the parameters $\phi$ on the loss
calculated in Eq. (34) and update the target network $\phi^{\prime}$ in each
period of iteration. Finally, the DQMSB auction is provided in Algorithm 2.

1 Input: Bids $\mathbf{x}$;

2 Output: Allocation probabilities and payments;

3 Initialize Q-function parameters $\phi$, target Q-function parameters
$\phi^{\prime}$, and replay buffer $\mathcal{B}$;

4 for  _episode in $1,\dots,T$_ do

5 for  _iteration $k$ in $1,\dots,K$_ do

6 Receive the bids $\mathbf{x}$ from bidders and observe the state $S_{k}$;

7 Determine the price scaling factor $\rho=10^{a_{k}/|\mathcal{A}|}$,
following $a_{k}=\arg\max_{a}Q_{\phi}(S_{k},a)$;

8 Calculate the winning probabilities $\mathbf{z}$ and payments $\mathbf{p}$
obtained from the allocation rule in Eq. (31) and the pricing rule in Eq.
(32);

9 Observe the next states $S_{k+1}$ and reward $r_{k}$;

10 Store transition $(S_{k},a_{k},r_{k},S_{k+1})$ to $\mathcal{B}$;

11 Sample a mini-batch of experiences $(S_{k},A_{k},r_{k},S_{k+1})$ from
$\mathcal{B}$;

12 Calculate
$y_{k}=r_{k}+\gamma\max_{a^{k+1}}Q_{\phi^{\prime}}(S_{k+1},a_{k+1})$ using
target network $Q_{\phi^{\prime}}$;

13 Update $\phi$ by performing gradient descent on the loss calculated in Eq.
(34);

14 Update target network $\phi^{\prime}$.

15

16 end for

17

18 end for

Algorithm 2 The DQMSB Auction

###  V-C Property Analysis

For an auction, strategy-proofness means that participants cannot achieve a
higher utility by altering their honest bids. Adverse-selection-free means
that the presence of market externalities and asymmetric information is
unrelated to bidders’ valuations. Therefore, it is important to note that the
DQMSB auctions are fully strategy-proof and adverse-selection-free, as given
in the following theorem.

######  Theorem 2.

The DQMSB auction with the price scaling policy with fixed parameters
$\bar{\phi}$ is anonymous, fully strategy-proof, and adverse-selection-free.

###### Proof.

To prove that the proposed DQMSB auction is anonymous, fully strategy-proof,
and adverse-selection-free, the auction should be characterized by a critical
payment function $\chi$ conditioned on $\bar{\phi}$ such, for any competing
bids $\mathbf{x}_{-n}$, ground BS bidder $n=1,\ldots,N$ wins if and only if
its bid exceeds the critical payment
$\chi(\mathbf{x}_{-n};\bar{\phi})=\rho^{a_{k}/|\mathcal{A}|}\max\\{\mathbf{x}_{-n}^{k}\\}$,
where
$a_{k}=\arg\max_{a}Q(\mathbf{x}_{-n}^{k}\cup\\{\mathbb{E}[x_{n}]\\},a;\bar{\phi})$.
Then, when the ground BS bidder $n$ is conditional on winning, it needs to pay
the critical payment $\chi(\mathbf{x}_{-n};\bar{\phi})$. As
$\rho^{a_{k}/|\mathcal{A}|}\geq 1$, only the ground BS with the highest bid
bidder can win, which can satisfy the condition that
$\chi(\mathbf{x}_{-n};\bar{\phi})\geq\max\\{\mathbf{x}_{-n}\\}$. In addition,
the critical payment function of DQMSB
$\chi(\mathbf{x}_{-n};\bar{\phi})=\rho^{a_{k}/|\mathcal{A}|}\max\\{\mathbf{\mathbf{x}_{-n}^{k}}\\}$
satisfies

$\displaystyle\chi(\max\\{\mathbf{x}_{-n}\\};\bar{\phi})$
$\displaystyle=\rho^{a_{k}/|\mathcal{A}|}\max\\{\max\\{\mathbf{x}_{-n}\\}\\}$
(35) $\displaystyle=\rho^{a_{k}/|\mathcal{A}|}\max\\{\mathbf{x}_{-n}\\}$
$\displaystyle=\chi(\textbf{x}_{-n};\bar{\phi}).$

Therefore, considering there are two bidders in the market with one value
higher than $\chi(\mathbf{x}_{-n};\bar{\phi})$ and the other one value
$\max\\{\mathbf{x}_{-n}\\}$, which will cause
$\chi(\max\\{\mathbf{x}_{-n}\\};\bar{\phi})\neq\chi(\mathbf{x}_{-n};\bar{\phi})$,
the DQMSB auction cannot satisfy false-name proof. Specifically, when
$\chi(\mathbf{x}_{-n};\bar{\phi})<\chi(\max\\{\mathbf{x}_{-n}\\};\bar{\phi})$,
the first bidder can submit a lower bid while maintaining the other bids in
the set of bids and thus the auction is not winner false-name proof.
Otherwise, the auction is not loser false-name proof when
$\chi(\mathbf{x}_{-n};\bar{\phi})>\chi(\max\\{\mathbf{x_{-n}}\\};\bar{\phi})$,
where the losing bidder in the market can submit a higher bid compared with
the winner’s bid while maintaining the other bids in the set of bids
$\mathbf{x}_{-n}$. Furthermore, the critical payment function $\chi$ of the
DQMSB auction is homogeneous of degree one, which indicates that the auction
is adverse selection-free. Suppose that $\chi$ is not homogeneous of degree
one, a bidder could manipulate the system by adjusting their bid in response
to their private information $C\in\\{1,c\\}$, i.e.,
$\chi(\textbf{m}_{-n};\bar{\phi})<\chi(c\textbf{m}_{-n};\bar{\phi})/c$, where
$c\in\mathbb{R}_{+},n\geq 2$, and $\mathbf{x}_{-n}\in\mathbb{R}^{n-1}_{+}$ and
$C=1$,
$z_{n}(C\mathbf{m})=z_{n}(\mathbf{m})=\mathbf{1}_{\\{m_{n}>\chi(m_{-n};\bar{\phi})\\}}=1$,
so $z_{0}(C\mathbf{m})=0$. When $C\neq 1$, it indicates that the bidder can
change its bid from $C=c$ to influence the probability of winning the auction,
i.e.,
$z_{n}(C\mathbf{m})=z_{n}(c\mathbf{m})=\mathbf{1}(cm_{n}>\chi(cm_{-n};\bar{\phi}))=0$.
However, the ground BS bidder $n$ with the highest bid cannot win the auction,
and thus the satellite bidder $0$ wins the auction, i.e.,
$z_{0}(C\mathbf{m})=1$.

Based on the above analysis, the proposed DQMSB can guarantee the anonymous,
fully strategy-proof, and adverse-selection-free with the deterministic
$Q_{\bar{\phi}}$. ∎

Theorem 2 describes MSB auctions as robust auctions that are anonymous,
deterministic, not prone to adverse selection, and fully strategy-proof. It is
important to note that the authors based on other DRL algorithms may possess
any three of these characteristics. By allowing non-anonymity, the value of
$\rho$ determined by DRL algorithms can vary depending on the bids of the
current bidders.

##  VI Experimental Results

In this section, we validate the joint model caching and inference framework
while evaluating the performance of the proposed least AoT cached model
replacement algorithm and the DQMSB auction.

###  VI-A Parameter Settings

(a) Average total cost versus time steps.

(b) Average total cost versus number of services.

(c) Average total cost versus number of GPUs.

(d) Average total cost versus number of users.

Figure 3: Performance of model caching algorithms under different system
settings.

We consider the SAGINs with one satellite and multiple ground BSs to provision
LLM agent services to users. We evaluate the proposed algorithm within 100
time steps. For each GPU in the edge servers of ground BSs, the memory is 80
GB, energy efficiency is 810 GFLOPS/W, and energy capacity is 300 W. The
default number of services is set to 10, the default number of GPUs at ground
BSs is set to 24, and the default number of users is set to 10. We leverage
ImageBind [40] as the multimodal perception module of LLM agents, whose
performance is 77.7% for images, 50.0% for videos, 63.4% for infrared, 54.0%
for depth, 66.9% for audio, 25.0% for IMU. We consider two types of LLMs for
performing CoT reasoning, including the LLAMA-65B and GPT3-174B, whose context
windows are 2k and 8k tokens, respectively. The total number of reasoning LLMs
is set to 10. The default context vanishing factor $\Delta_{n}^{t}$ is set to
0.6. For each CoT reasoning example, the maximum size is set to 200 tokens.
The transmit power of users is set to 0.2 W and the allocated bandwidth is set
to 20 MHz. The size of input data of LLM agent services is uniformly selected
from [100, 200] MB. The quantity of LLM service requests is generated from the
Poisson point process depending on the number of users. Due to the ratio of
existing ground BS and communication satellites, the edge access cost for
satellites is set to 0.005 and 0.0001 for ground BSs. The cloud access cost is
set to 0.04 for ground BSs and 0.025 for satellites. For the LLM agent service
market, the number of BSs is set to 5 by default. The satellite-related
settings follow [2] and the DRL-related parameter settings follow [41].

###  VI-B Performance Evaluation of the Least AoT Algorithm

(a) Accuracy cost versus vanishing factor.

(b) Performance gain versus vanishing factor.

Figure 4: Model performance under different vanishing factors.

During the performance evaluation of the proposed model caching algorithm, we
leverage several traditional caching baselines for comparison, including
first-in-first-out (FIFO) and least frequently used (LFU) algorithms. For
instance, Fig 3(a) presents the average cost of different caching and
offloading strategies (A-E) over a series of time slots. The costs are divided
into four categories: switching cost, accuracy cost, edge inference cost, and
cloud inference cost. For all strategies, there is a clear trend of decreasing
average cost as the number of time slots increases. This indicates that over
time, the systems may become more efficient, possibly due to improved caching
optimization or better distribution of LLM agent tasks between the edge and
the cloud. In addition, Fig. 3(b) demonstrates the increase of the average
total cost for different caching and offloading schemes as the number of
services increases. This suggests that as the system has to handle a larger
variety of services, the associated costs rise, possibly due to increased
complexity and demand for resources. The least AoT algorithm demonstrates a
consistent performance advantage, maintaining the lowest average total cost
across different numbers of services.

Furthermore, Fig. 3(c) illustrates how the average total cost changes for
various caching and offloading schemes with the number of GPUs utilized. As we
can observe, more available GPUs tend to lower the cost, likely due to the
improved computational efficiency and reduced processing time at the edge. The
relative stable switching and accuracy costs across different GPU counts
suggest these costs are more dependent on the efficiency of the algorithm
itself rather than on hardware resources. Meanwhile, edge inference cost
reductions point to the benefits of local processing power, highlighting the
importance of edge capabilities in managing LLM caching. Overall, the average
total cost decreases for most schemes as GPU resources increase. Finally, Fig.
3(d) demonstrates an upward trend in average total cost for all schemes as the
number of users increases. This suggests that the system’s costs escalate with
the growing user base, likely due to increased demand for LLM services, which
intensifies the load on caching and computation resources. The increase in
average total cost across all schemes with more users suggests that user
demand has a direct impact on the system’s resource utilization and cost
efficiency. The least AoT algorithm demonstrates scalability by maintaining
the lowest increase in cost, indicating its potential for cost-effective
expansion as user numbers grow. The relative stability of the switching cost
across varying user counts may imply that the action of switching between
cached LLMs does not contribute significantly to cost variations.

Figure 5: The convergence of the proposed DQMSB auction.

(a) Total surplus versus number of ground BSs.

(b) Total surplus versus number of services.

(c) Total surplus versus number of GPUs.

(d) Total surplus versus number of users.

Figure 6: Performance of the proposed DQMSB auction under different system
settings.

As shown in Fig. 4(a), as the context factor increases, the cost of accuracy
also increases for all three algorithms (FIFO, LFU, and least AoT). This
indicates that when the context becomes more influential, which can be seen as
the importance of cache relevance, it becomes more challenging and expensive
for all methods to maintain high accuracy in caching decisions. Meanwhile, in
Fig. 4(b), there is a decrease in performance gain for all algorithms as the
context factor increases. This suggests that as the importance of the context
in caching decisions increases, the performance gain of these algorithms
decreases. The overall decrease in performance gain with a higher context
factor suggests that as the relevance of the context increases, the potential
for any algorithm to outperform basic caching strategies diminishes. This
might be because the decision-making process becomes more complex and the
benefits of sophisticated strategies are less pronounced.

###  VI-C Convergence Analysis

Initially, we demonstrate the convergence performance of the DQMSB auction in
Fig. 5. At the beginning of training, the total surplus achieved by the DQMSB
auction starts with a sharp increase and then levels off, indicating that the
mechanism quickly learns an effective strategy for maximizing surplus and then
converges to a stable solution. At around 200 epochs, the total surplus
stabilizes at a high level. Although there are minor fluctuations following
this rise, the surplus remains relatively consistent, indicating that the
system has reached a convergence in its learning phase. Interestingly, the
performance of DQMBS in ground BS surplus can achieve similar performance with
the SPA, at around 3,000. This indicates that the SPA can realize the surplus
of satellites, which can reach around 4,500 for the optimal solution.
Furthermore, the total surplus achieved by the DQMSB auction can outperform
the MSB auction by around 20%. The convergence performance of the DQMSB
auction can be considered constantly robust, as it achieves and maintains a
higher total surplus compared to the benchmarks.

###  VI-D Performance Evaluation for the DQMSB Auction

To evaluate the performance of the DQMSB auction, we leverage several auction
baselines, including second-price auction, myopic MSB, and optimal MSB.
Particularly, the price scaling factor of myopic MSB is set as
$\rho=\max(1,x_{0}/x_{(2)})$ with current round information and the price
scaling factor of optimal MSB can be set as
$\rho=\max(1,\mathbb{E}[x_{0}]/\mathbb{E}[x_{(2)}])$ with historical statistic
information. Under different numbers of bidders, Fig. 6(a) demonstrates the
total surplus achieved by various auction mechanisms based on the number of
ground BSs. Across all auction mechanisms, the total surplus increases as the
number of ground BSs grows from 3 to 7. This suggests that a larger number of
ground BSs enables better service provision and coverage, resulting in a
higher overall value generated by the auctions. The DQMSB auction consistently
yields the highest total surplus, regardless of the number of ground BSs. This
indicates that the DQMSB auction is more efficient in resource allocation and
surplus generation compared to other auction types. The Myopic MSB and Optimal
MSB auctions outperform SPA but fall short of the performance achieved by the
DQMSB auction. As we can observe from Fig. 6(b), the total surplus does not
monotonically increase or decrease with the number of services. For instance,
there is a drop in total surplus for all mechanisms when varying from 10 to 12
services, followed by an increase at 14 services, another decrease at 16, and
an increase again at 18. In most cases, the surplus from ground BS services is
greater than the surplus from satellite services. This non-linear relationship
implies that simply increasing the number of services cannot guarantee a
higher surplus.

In Fig. 6(c), there appears to be a general increase in the total surplus for
all the auctions as the number of GPUs increases. The surplus for the other
mechanisms also tends to increase, although not as consistently or
significantly as the DQMSB auction. The ground BS surplus dominates the total
surplus for all auction mechanisms and quantities of GPUs. However, as the
number of GPUs increases, the satellite surplus also increases, suggesting a
positive relationship between computing resources and the ability to generate
surplus in satellite-based services. The increasing trend of total surplus
with more GPUs implies that having more computing resources allows the auction
mechanisms, particularly DQMSB, to perform better. Finally, Fig. 6(d)
demonstrates an upward trend in the total surplus with an increasing number of
users for all auction mechanisms, which suggests that more users contribute to
a higher valuation and competition, thus increasing the total surplus. When
the number of users increases, the DQMSB auction can yield a larger surplus
from ground BSs, thereby limited computing and communication resources can be
allocated effectively to maximize the total surplus.

##  VII Conclusions

In this paper, we proposed a joint caching and inference framework for
provisioning ubiquitous edge intelligence services in SAGINs. In SAGINs,
satellites and ground BSs were utilized to provision global LLM agent services
with edge servers at ground BSs or remote cloud data centers. Specifically,
considering the unique few-shot learning capabilities of LLMs and new
constraints on the size of context windows, we introduced a new concept, i.e.,
the cached model as a resource, beyond conventional communication, computing,
and storage resources. For allocating cached model resources, we designed a
new metric, namely, age of thought, to evaluate the relevance and consistency
of thoughts/CoT examples in context windows during inferences and proposed the
least AoT algorithm. Finally, we proposed the DQMSB for incentivizing network
operators to provision LLM agents with high market efficiency through the DQN-
based price scaling factor. Theoretically, we proved that the proposed DQMSB
auction is anonymous, fully strategy-proof, and adverse-selection-free.

## References

  * [1] J. Liu, Y. Shi, Z. M. Fadlullah, and N. Kato, “Space-air-ground integrated network: A survey,” _IEEE Commun. Surv. Tutor._ , vol. 20, no. 4, pp. 2714–2741, May 2018.
  * [2] Q. Tang, Z. Fei, B. Li, and Z. Han, “Computation offloading in leo satellite networks with hybrid cloud and edge computing,” _IEEE Internet Things J._ , vol. 8, no. 11, pp. 9164–9176, Feb. 2021.
  * [3] T. Wei, W. Feng, Y. Chen, C.-X. Wang, N. Ge, and J. Lu, “Hybrid satellite-terrestrial communication networks for the maritime internet of things: Key technologies, opportunities, and challenges,” _IEEE Internet Things J._ , vol. 8, no. 11, pp. 8910–8934, Feb. 2021.
  * [4] B. Min, H. Ross, E. Sulem, A. P. B. Veyseh, T. H. Nguyen, O. Sainz, E. Agirre, I. Heintz, and D. Roth, “Recent advances in natural language processing via large pre-trained language models: A survey,” _ACM Comput. Surv._ , vol. 56, no. 2, pp. 1–40, Sep. 2023.
  * [5] M. Xu, D. Niyato, H. Zhang, J. Kang, Z. Xiong, S. Mao, and Z. Han, “Sparks of generative pretrained transformers in edge intelligence for the metaverse: Caching and inference for mobile artificial intelligence-generated content services,” _IEEE Veh. Technol. Mag._ , vol. 18, no. 4, pp. 35–44, Dec. 2023.
  * [6] M. Xu, N. Dusit, J. Kang, Z. Xiong, S. Mao, Z. Han, D. I. Kim, and K. B. Letaief, “When large language model agents meet 6g networks: Perception, grounding, and alignment,” _arXiv preprint arXiv:2401.07764_ , 2024.
  * [7] Z. Xi, W. Chen, X. Guo, W. He, Y. Ding, B. Hong, M. Zhang, J. Wang, S. Jin, E. Zhou _et al._ , “The rise and potential of large language model based agents: A survey,” _arXiv preprint arXiv:2309.07864_ , 2023.
  * [8] T. Brown, B. Mann, N. Ryder, M. Subbiah, J. D. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell _et al._ , “Language models are few-shot learners,” _Proceeding of Advances in Neural Information Processing Systems_ , vol. 33, pp. 1877–1901, Dec. 2020.
  * [9] H. Yang, M. Siew, and C. Joe-Wong, “An llm-based digital twin for optimizing human-in-the loop systems,” _arXiv preprint arXiv:2403.16809_ , 2024.
  * [10] S. Jiang and J. Wu, “Approaching an optimal bitcoin mining overlay,” _IEEE/ACM Trans. Netw._ , vol. 31, no. 5, pp. 2013–2026, Oct. 2023.
  * [11] S. Hong, L. Duan, and J. Huang, “Protecting location privacy by multiquery: A dynamic bayesian game theoretic approach,” _IEEE Trans. Inf. Forensics_ , vol. 17, pp. 2569–2584, 2022.
  * [12] M. Xu, H. Du, D. Niyato, J. Kang, Z. Xiong, S. Mao, Z. Han, A. Jamalipour, D. I. Kim, X. Shen _et al._ , “Unleashing the power of edge-cloud generative AI in mobile networks: A survey of AIGC services,” _IEEE Commun. Surv. Tutor._ , pp. 1–1, 2024.
  * [13] Z. Zhou, X. Chen, E. Li, L. Zeng, K. Luo, and J. Zhang, “Edge intelligence: Paving the last mile of artificial intelligence with edge computing,” _Proc. IEEE_ , vol. 107, no. 8, pp. 1738–1762, Jun. 2019.
  * [14] C. Packer, V. Fang, S. G. Patil, K. Lin, S. Wooders, and J. E. Gonzalez, “Memgpt: Towards llms as operating systems,” _arXiv preprint arXiv:2310.08560_ , 2023.
  * [15] J. Yang, “Longqlora: Efficient and effective method to extend context length of large language models,” _arXiv preprint arXiv:2311.04879_ , 2023.
  * [16] N. Arnosti, M. Beck, and P. Milgrom, “Adverse selection and auction design for internet display advertising,” _Am. Econ. Rev._ , vol. 106, no. 10, pp. 2852–2866, Oct. 2016.
  * [17] V. Mnih, K. Kavukcuoglu, D. Silver, A. A. Rusu, J. Veness, M. G. Bellemare, A. Graves, M. Riedmiller, A. K. Fidjeland, G. Ostrovski _et al._ , “Human-level control through deep reinforcement learning,” _Nature_ , vol. 518, no. 7540, pp. 529–533, Feb. 2015.
  * [18] X. Xu, Q. Wang, Y. Hou, and S. Wang, “AI-SPACE: A cloud-edge aggregated artificial intelligent architecture for tiansuan constellation-assisted space-terrestrial integrated networks,” _IEEE Netw._ , vol. 37, no. 2, pp. 22–28, Sep. 2023.
  * [19] X. Hou, J. Wang, Z. Fang, Y. Ren, K.-C. Chen, and L. Hanzo, “Edge intelligence for mission-critical 6g services in space-air-ground integrated networks,” _IEEE Netw._ , vol. 36, no. 2, pp. 181–189, Apr. 2022.
  * [20] P. Qin, M. Wang, X. Zhao, and S. Geng, “Content service oriented resource allocation for space–air–ground integrated 6g networks: A three-sided cyclic matching approach,” _IEEE Internet Things J._ , vol. 10, no. 1, pp. 828–839, 2022.
  * [21] Z. Chen, Z. Zhang, and Z. Yang, “Big AI models for 6G wireless networks: Opportunities, challenges, and research directions,” _arXiv preprint arXiv:2308.06250_ , 2023.
  * [22] Y. Shen, J. Shao, X. Zhang, Z. Lin, H. Pan, D. Li, J. Zhang, and K. B. Letaief, “Large language models empowered autonomous edge AI for connected intelligence,” _IEEE Commun. Mag._ , pp. 1–7, Jan. 2024.
  * [23] Y. Du, S. C. Liew, K. Chen, and Y. Shao, “The power of large language models for wireless communication system development: A case study on FPGA platforms,” _arXiv preprint arXiv:2307.07319_ , 2023.
  * [24] H. Cui, Y. Du, Q. Yang, Y. Shao, and S. C. Liew, “Llmind: Orchestrating ai and iot with llms for complex task execution,” _arXiv preprint arXiv:2312.09007_ , 2023.
  * [25] F. Jiang, L. Dong, Y. Peng, K. Wang, K. Yang, C. Pan, D. Niyato, and O. A. Dobre, “Large language model enhanced multi-agent systems for 6g communications,” _arXiv preprint arXiv:2312.07850_ , 2023.
  * [26] L. Dong, F. Jiang, Y. Peng, K. Wang, K. Yang, C. Pan, and R. Schober, “Lambo: Large language model empowered edge intelligence,” _arXiv preprint arXiv:2308.15078_ , 2023.
  * [27] Z. Lin, G. Qu, Q. Chen, X. Chen, Z. Chen, and K. Huang, “Pushing large language models to the 6g edge: Vision, challenges, and opportunities,” _arXiv preprint arXiv:2309.16739_ , 2023.
  * [28] M. Zhang, L. Yang, S. He, M. Li, and J. Zhang, “Privacy-preserving data aggregation for mobile crowdsensing with externality: An auction approach,” _IEEE/ACM Trans. Netw._ , vol. 29, no. 3, pp. 1046–1059, 2021.
  * [29] D. Niyato, N. C. Luong, P. Wang, and Z. Han, _Auction Theory for Computer Networks_. Cambridge University Press, 2020.
  * [30] J. Du, C. Jiang, H. Zhang, Y. Ren, and M. Guizani, “Auction design and analysis for sdn-based traffic offloading in hybrid satellite-terrestrial networks,” _IEEE J. Sel. Areas Commun._ , vol. 36, no. 10, pp. 2202–2217, Sep. 2018.
  * [31] Q. Chen, W. Meng, S. Han, and C. Li, “Service-oriented fair resource allocation and auction for civil aircrafts augmented space-air-ground integrated networks,” _IEEE Trans. Veh. Technol._ , vol. 69, no. 11, pp. 13 658–13 672, Sep. 2020.
  * [32] N. Yang, D. Guo, Y. Jiao, G. Ding, and T. Qu, “Lightweight blockchain-based secure spectrum sharing in space-air-ground integrated iot network,” _IEEE Internet Things J._ , vol. 10, no. 23, pp. 20 511–20 527, Jun. 2023.
  * [33] R. Deng, B. Di, S. Chen, S. Sun, and L. Song, “Ultra-dense leo satellite offloading for terrestrial networks: How much to pay the satellite operator?” _IEEE Trans. Wirel. Commun._ , vol. 19, no. 10, pp. 6240–6254, Jun. 2020.
  * [34] N. Cheng, F. Lyu, W. Quan, C. Zhou, H. He, W. Shi, and X. Shen, “Space/aerial-assisted computing offloading for iot applications: A learning-based approach,” _IEEE J. Sel. Areas Commun._ , vol. 37, no. 5, pp. 1117–1129, Mar. 2019.
  * [35] Z. Zhang, Y. Yao, A. Zhang, X. Tang, X. Ma, Z. He, Y. Wang, M. Gerstein, R. Wang, G. Liu _et al._ , “Igniting language intelligence: The hitchhiker’s guide from chain-of-thought reasoning to language agents,” _arXiv preprint arXiv:2311.11797_ , 2023.
  * [36] H. Jiang, “A latent space theory for emergent abilities in large language models,” _arXiv preprint arXiv:2304.09960_ , 2023.
  * [37] R. Tutunov, A. Grosnit, J. Ziomek, J. Wang, and H. Bou-Ammar, “Why can large language models generate correct chain-of-thoughts?” _arXiv preprint arXiv:2310.13571_ , 2023.
  * [38] D. Dai, Y. Sun, L. Dong, Y. Hao, S. Ma, Z. Sui, and F. Wei, “Why can gpt learn in-context? language models secretly perform gradient descent as meta-optimizers,” in _Findings of the Association for Computational Linguistics_ , Toronto, Canada, Jul. 2023, pp. 4005–4019.
  * [39] K. Zhao, Z. Zhou, X. Chen, R. Zhou, X. Zhang, S. Yu, and D. Wu, “Edgeadaptor: Online configuration adaption, model selection and resource provisioning for edge dnn inference serving at scale,” _IEEE Trans. Mob. Comput._ , pp. 1 – 16, Jul. 2022.
  * [40] R. Girdhar, A. El-Nouby, Z. Liu, M. Singh, K. V. Alwala, A. Joulin, and I. Misra, “Imagebind: One embedding space to bind them all,” in _Proc. of IEEE/CVF Conference on Computer Vision and Pattern Recognition_ , Los Alamitos, CA, Jun. 2023, pp. 15 180–15 190.
  * [41] J. Weng, H. Chen, D. Yan, K. You, A. Duburcq, M. Zhang, Y. Su, H. Su, and J. Zhu, “Tianshou: A highly modularized deep reinforcement learning library,” _J. Mach. Learn._ , vol. 23, no. 1, pp. 12 275–12 280, Jan. 2022.