# Prose-to-P4: Leveraging High Level Languages

Mihai-Valentin Dumitru, Vlad-Andrei Bădoiu, Costin Raiciu  University
Politehnica of Bucharest
{mihai.dumitru2201, vlad_andrei.badoiu<EMAIL_ADDRESS>
###### Abstract

Languages such as P4 and NPL have enabled a wide and diverse range of
networking applications that take advantage of programmable dataplanes.
However, software development in these languages is difficult. To address this
issue, high-level languages have been designed to offer programmers powerful
abstractions that reduce the time, effort and domain-knowledge required for
developing networking applications. These languages are then translated by a
compiler into P4/NPL code.

Inspired by the recent success of Large Language Models (LLMs) in the task of
code generation, we propose to raise the level of abstraction even higher,
employing LLMs to translate prose into high-level networking code. We analyze
the problem, focusing on the motivation and opportunities, as well as the
challenges involved and sketch out a roadmap for the development of a system
that can generate high-level dataplane code from natural language
instructions. We present some promising preliminary results on generating
Lucid code from natural language.

###### Index Terms:

P4, programmable dataplanes, LLM, code generation

##  I Introduction

Figure 1: Proposed pipeline of going from prose to concrete dataplane
applications on actual switches. Some languages may require network
configurations or other extra information, grouped here under “input
artifacts”. Compilation produces one or more dataplane programs, perhaps
together with program-to-device mappings or other information, grouped here as
“output artifacts”.

The introduction of programmable dataplanes and associated languages, such as
P4 [1] and NPL [2], has opened the door for a broad range of networking
applications [3].

Software development in these languages has proven to be difficult [4, 5]. For
example, limited hardware resources require programmers to be familiar with
the target and customize programs for it, reducing portability; adding or
removing support for a protocol requires changes in multiple parts of the
program (parser, deparser, control), making it hard to compose programs or to
compartmentalize functionality into separate libraries.

One strategy to address these problems is the development of high-level
dataplane programming languages (HLDPLs) that compile to P4/NPL code for one
or more switches, enabling programmers themselves to not focus on low-level
details. Over the years, quite a few such languages have been designed,
including Graph-to-P4 [6], Lucid [7, 5], Lucid 2.0 [8], Lyra [4], O4 [9],
P4All [10], P4rrot [11], pcube [12]. These are much closer to natural
language, provide less burden on the developer and in many cases have a less
complex grammar.

The field remains volatile: new languages appear periodically and none of the
existing ones has been widely adopted and given the opportunity to mature.

Inspired by the recent success of Large Language Models (LLMs) in the task of
code generation [13, 14, 15, 16, 17, 18], we wish to push the move towards
higher-level network programming languages even further, by employing natural
language as the top layer for the development of dataplanes. Ideally, the
network programmer should be able to express desired functionalities in the
form of a natural language prompt that is then progressively transformed into
code that runs on actual devices (Figure 1). The user of such a system can not
only ignore platform-specific details, but can do away with learning to
program in a language that may easily be abandoned or superseded. All that is
needed is a rudimentary knowledge of basic networking architectures and
protocols.

One of the main obstacles in developing such a system is the low amount of
data. The authors of The Stack v2 [16], one of the largest publicly available
coding datasets, refer to Perl as a “low-resource language” – with over a
million documents available, totalling 7.82 GB. We wish to address “no-
resource” languages, for which only several programs are available.

Our focus is not code-generation for a particular, already existing dataplane
language, but rather code-generation for recently published, non-mature
HLDPLs, for which there is no existing program dataset or active community.

One may ask what makes dataplane networking a good candidate for code
generation under the no-resources constraints. Computations intended to be run
in the dataplane are linear in nature; each program can be modeled as a chain
of simple instructions, with occasional branching for conditional blocks, but
no loops. Due to the nature of the applications themselves, as well as the
constraints ultimately mandated by the target switches, programs are also
quite limited in length. We believe these features make HLDPLs ideal
candidates for using LLMs to generate “no-resource languages”.

The aim of this work is to leverage code-generating LLMs and conventional
transpilers to transform natural languages prompts into concrete code that can
run on a programmable switch. The opportunity to do so is enabled by the
simple nature of HLDPLs and the relatively short program length. The main
challenge stems from the lack of a dataset of programs written in these
languages: code-generating LLMs are usually trained or fine-tuned on
gigabytes, or even terabytes of data; we only assume the existence of a
handful of examples.

We make the following key contributions:

  * •

identify a series of characteristics that make HLDPLs good candidates for no-
resource code generation

  * •

analyze the challenges and opportunities of utilizing LLMs to generate no-
resource languages

  * •

evaluate the plausibility of our methodology using the Lucid language [7] as a
target

##  II High-level dataplane programming languages

The difficult nature of software development in P4 has lead to research into
new dataplane programming languages which abstract away target-specific
details, offering programmers high-level constructs to aid with portability,
composability etc. These language differ in the level of abstraction, scope
and motivation but in general they aim to reduce time, effort and domain-
knowledge needed to develop new dataplane applications.

We briefly survey existing languages, focusing on features relevant to our
goal of LLM-assisted code generation and present our rationale for singling
out Lucid [7] for our preliminary experiments.

O4 [9], pcube [12], P4All [10] add to P4 several syntactical constructs such
as fixed-size loops and arrays (O4, pcube) and _elastic structures_ (P4All).
This results in languages syntactically similar to P4 itself.

Graph-to-P4 [6] can translate state diagrams (designed visually and
represented as an XML) into parser graphs. Its scope is limited to P4 parsers
and does not address other components of dataplane programming, such as
control blocks.

P4rrot [11] aims to ease the implementation of “application-layer tasks” in
the dataplane. It is designed as a Python library, which has interesting
implications, as Python seems to be at the center of LLM-based code generation
efforts. For the purposes of this work, we choose to focus on a language with
a standalone syntax, as this is more common among the languages considered.

Lyra [4] addresses the issues of portability, extensibility and composition.
The Lyra compiler takes as input code in the Lyra language, an algorithm scope
describing the placement of various and a description of the network’s
topology and configuration; from these it first produces a “context-aware
intermediate representation” that can be then turned by the backend into P4 or
NPL code. Unfortunately neither a complete grammar, a compiler implementation,
detailed documentation or complete examples are publicly available.

Lucid [7]’s goal is “putting control functionality into the data plane.” Lucid
introduces events (such as an arriving packet) and event handlers – procedures
that describe stateful computation to be executed when an event occurs, as
well as a novel type system and memory operations. We consider Lucid the most
mature HLDPL currently available. It has been followed by Lucid 2.0 [8], which
introduces new constructs to aid with modular programming, such as
polymorphism and type inference. The presentation has also been extended to a
PhD thesis [5] that provides additional detail on the language design and
motivation. Both the compiler and example programs are openly available
111https://github.com/PrincetonUniversity/lucid; this makes Lucid an ideal
candidate for our experiments, because it offers all the resources that we may
expect.

At the time of writing, none of these languages has been standardised or
widely-adopted; they are research projects in various degrees of active
development. We expect this volatility to continue in the near future, with
existing languages being improved or modified and new languages being
designed. The lack of stability in the field makes it difficult for novices
(and perhaps experienced programmers alike) to enjoy the benefits of these
languages, since the learning effort can be considered wasted if a language is
soon abandoned by the community or superseded by a new one.

We wish to offer potential network programmers the possibility of rapid
prototyping with low effort and little domain-knowledge, harnessing the power
of HLDPLs without requiring the commitment to familiarize oneself with a
particular language: its syntax, semantics and idiosyncrasies. To this end, we
propose using LLMs to translate natural language specifications into code.

##  III Generating no-resource languages

Our goal is to use LLMs to translate natural language specifications into
HLDPL code. Due to their maturity and impressive results on a wide range of
applications, we target ChatGPT 4 and Gemini Ultra. While LLMs have, in recent
times, shown very good results in the task of prose-to-code, they usually
generate code in popular programming languages for which a large number of
programs written by human developers is available; models are fine-tuned or
trained on these large code datasets. For a newly published programming
language with no active community, such a wide range of examples is not
available, making fine-tuning or training non-viable strategies.

We assume the resources available are a subset of the following:

  * •

the contents of the scientific paper that introduces the language

  * •

additional documentation

  * •

description of the formal grammar

  * •

several code examples

  * •

a compiler implementation

The documentation, grammar and examples could be available as appendices to
the original paper, or as part of a public repository; a compiler could be
useful for the possibility of extracting a formal grammar description from its
parser, as well as for offering a better understanding of the semantics of the
language.

Lacking a dataset of programs to retrain the LLM, we have to rely on _prompt
engineering_ techniques, which involve carefully constructing the inputs to
the LLM, guiding it to produce high-quality answers. Prompt engineering has
already developed into a wide and diverse field [19] with techniques such as
Chain-of-Thought [20] and Tree-of-thoughts [21] achieving impressive results
on tasks such as arithmetic reasoning, symbolic reasoning, creative writing
etc.

The technique of “grammar prompting” developed by Wang et al. [22] is most
relevant to our goals. The authors tackle the problem of generating programs
in a Domain Specific Language (DSL) that is absent (or present in small
quantities) in the LLM’s training set. To this end, a few-shot approach is
employed, attaching to each example a small subset of the DSL grammar,
“minimally sufficient” for generating that particular example. The model is
then required to first produce a specialized grammar for the requested
program, then generate the code conditioned on this grammar.

That same paper presents state-of-the-art results on five DSLs for the tasks
of semantic parsing, AI planning and molecule generation. Jain et al. [23]
experiment with grammar prompting, as well as other techniques, for the task
of prose-to-diagram: translating a natural language description into the
syntax used by the Penrose framework, which produces visual diagrams.

Because our goal is to develop a system for generating newly published
languages, it is relevant to know whether data associated with the tested
language (Lucid), such as the text of the original paper or the public
repository code, are part of these LLMs’ training sets. Unfortunately, for
ChatGPT 4 and Gemini Ultra, this information is not publicly available; basic
interrogation of the two LLMs reveal that they have at least some knowledge of
Lucid. This is a limitation of our experiments and results, because the
language information does not come solely from the contents of the prompt,
which may cast doubt on whether the results could transfer to completely new
programming languages, completely absent from the training dataset.

However, we illustrate that this is not a critical limitation, by building a
baseline of results that show how, without advanced prompt-engineering
techniques, neither ChatGPT 4 nor Gemini Ultra can generate code in the
considered languages.

##  IV Preliminary results

We evaluate the grammar prompting technique [22] for few-shot HLDPL code
generation in Lucid, because of its standalone syntax and public availability
of all the resources mentioned in §III. To this end, we leverage the Gemini
and ChatGPT models due to their overall performance on a wide variety of
tasks, including natural language understanding, symbolic reasoning and code
generation, which we believe are useful skills for the task at hand.

One important constraint for prompt engineering is the _context length_ of the
LLM – the number of tokens that the LLM can effectively consider when
producing the answer. A naive prompt for Lucid, consisting of task-specific
instructions, the contents of the original paper [7], a complete grammar in
Backus-Naur form (extracted from the publicly available parser) and the full
code of the ten applications presented in the paper has a length of 35K
tokens; this is more than the web interfaces of both ChatGPT 4 and Gemini
Ultra can handle. However, state of the art models have context lengths in the
hundreds of thousands, even millions of tokens; Google’s Gemini 1.5 [24]
boasts of a context length of ten million tokens. We ran only a few simple
tests using OpenAI’s API to query GPT 4. The results seem syntactically
coherent but more testing is needed. For the rest of our experiments, we used
the web interface of ChatGPT and Gemini (to avoid API costs) and employed
grammar prompting.

To integrate Lucid into the framework, we wrote a grammar for it in Lark
222https://github.com/lark-parser/lark and designed 20 samples for few-shot
learning. The samples vary from basic concepts (e.g. defining the type for
IPv4 packets), to more complex prompts (i.e. MAC address learning). Lastly, we
modify the base prompt to introduce a high level description of the HLDPL.

Besides the program written in the Lucid language, a P4 template is also
required, containing basic elements such as parsers and deparser, as well as
annotations for where the high-level bits should fit. For the purposes of this
paper, we do not require the LLM to generate it.

The resulting grammar-learning prompts are structured as shown in Figure 2.
They sum up to around 5.5K tokens; the responses are just several hundred
tokens in length.

The model is provided with the full Lucid grammar and several example queries
consisting of a specialized grammar (subset of the complete grammar) and the
resulting code that implements the query. Lastly, the model is asked to
predict a grammar for a given query and generate the program that implements a
query conforming to it (Figure 3).

We have tested simple queries, requiring one-line responses and three complex
ones: writing a firewall that can drop packets based on the connection 5-tuple
(partial answer in Figure 3), a stateful NAT and a 6to4 tunnel.

From our experiments, we noticed that Gemini sometimes fails to conform to the
requirements and does not produce a grammar subset to drive the generated
code, resulting in incorrect syntax even for simple examples.

ChatGPT 4 is able to follow the guidance of grammar prompting and always
produces a grammar for its output; however, this grammar is not always
correct, so neither is the accompanying program. Figure 3 shows a fragment of
ChatGPT 4’s answer for a firewall query.

Prompt to LLM

⬇

You are an expert dataplane programmer, and you need to write a program for
the given language query.

A complete grammar of the language is presented below. First, you should write
grammar rules by choosing from the following BNF rules.

Then, you should write programs that conform to your predicted rules.

[BEGIN RULES]

// Full definition of the Lucid grammar

[END RULES]

query: generate a global array "nat_to_port" with NUM_PORTS values

⬇

BNF grammar rules:

prog ::= decls

decls ::= decl

decl ::= GLOBAL cid poly ID ASSIGN cid paren_args SEMI

GLOBAL ::= "global"

cid ::= ID "." cid | ID

ID ::= "Array" | "t" | "nat_to_port" | "create" | "NUM_PORTS"

poly ::= LLEFT polys RRIGHT

LLEFT ::= "<<"

polys ::= size

size ::= NUM

NUM ::= "32"

RRIGHT ::= ">>"

ASSIGN ::= "="

paren_args ::= LPAREN args RPAREN

LPAREN ::= "("

args ::= exp

exp ::= cid

RPAREN ::= ")"

SEMI ::= ";"

⬇

program based on the BNF grammar rules:

global Array.t<<32>> nat_to_port = Array.create(NUM_PORTS);

⬇

// other examples

query: <the desired query>

Figure 2: Sample of prompt engineering for Lucid

⬇

BNF grammar rules:

⬇

prog ::= decls

decls ::= decl decls | decl

decl ::= "const" ty ID ASSIGN exp SEMI | GLOBAL cid poly ID ASSIGN cid paren_args SEMI | event_decl SEMI | HANDLE ID paramsdef "{" statement "}" | FUN ty ID paramsdef "{" statement "}"

ty ::= TINT | TINT single_poly | TBOOL

[...]

FUN ::= "fun"

RETURN ::= "return"

program based on the BNF grammar rules:

const int HASH_SEED = 1234;

const int NUM_PORTS = 6;

global Array.t<<32>> nat_to_ip = Array.create(NUM_PORTS);

global Array.t<<32>> nat_to_port = Array.create(NUM_PORTS);

[...]

handle outside_packet(int<<32>> dst_port) {

int ip = Array.get(nat_to_ip, dst_port);

int<<32>> port = Array.get(nat_to_port, dst_port);

generate outside_continue(ip, port);

}

Figure 3: ChatGPT response for the query: “a stateful NAT”.

Table I summarizes ChatGPT’s performance on the three complex tasks; for each task, it lists the number of rules in the output grammar (“A ::= B | C” counts as two rules), the number of lines of code in the output Lucid program and the number of lines that need to be fixed for the program to compile. The task prompts are admittedly vague, so it is hard to assess the “correctness” of the implementation, which is why we focus on whether programs compile. The generated code is aligned with the input query and could serve well as a starting point for a more particular implementation.

While always generating a grammar fragment, ChatGPT doesn’t always respect it.
For the tunnel implementation, it uses hexadecimal constants with the “0x”
prefix, which are invalid both in the fragment generated and in the Lucid
grammar; it also uses a bitwise “&” without generating rules for it.
Conversely, it includes rules that it does not use; for example it allows the
equality operator “==” then generates a program that does not perform any
equality check.

Task |  # of rules |  LoC |  LoC to fix
---|---|---|---
Firewall |  91 |  17 |  2
NAT |  97 |  39 |  0
6to4 tunnel |  74 |  15 |  4
TABLE I: Summary of the results on the three complex tasks

##  V Discussion and Future Work

The results presented in §IV are just a initial move towards the task of
translating natural language instructions into HLDPLs. An immediate next step
is mostly quantitative in nature: increasing the number of example programs
included in the prompt and running additional tests to generate snippets and
programs of increasing complexity. We would like to do further experiments
both with the baseline prompt (a large dump of all available resources) and
with grammar prompting, so that we can have evaluation metrics that allow us
to numerically compare the efficacy of the two methods.

The issues mentioned at the end of §IV, concerning constructs that are not
valid for the grammar fragment and grammar rules that are unneeded, warrant
additional attention. We believe they can be addressed effectively through a
loop of additional queries that point out the errors in the output.

Lucid requires a P4 harness with the basic structure of the dataplane,
together with annotations for where the functionality described in the high-
level language should fit. In our tests, we only focused on the Lucid language
itself; in the future, we would like the LLM to also generate the P4 template.

We also wish to explore code generation in P4rrot, whose very different
structure can cast light on whether our technique generalizes to other
languages.

Information about Lucid, as well as about all the languages presented in §II,
is very likely part of the dataset on which ChatGPT 4 and Gemini were trained.
Our experiments show that grammar prompting yields better results than the
naive baseline of relying solely on the LLM’s existing knowledge, but such
improvements may be possible solely due to the latent knowledge of the LLM. To
explore this issue, we must experiment with new languages that are not part of
the training dataset. We plan to design a minimalistic HLDPL, producing all
the relevant artifacts (description of the language, formal grammar, code
examples) and apply the techniques presented here to evaluate code generation
for this new language.

##  VI Conclusion

In order to address the difficulties of programming in P4 or NPL, several
high-level dataplane programming languages have been proposed. As this is an
active, ever-changing field, neither of these have been standardized or
widely-adopted.

Thanks to the simple structure, narrow scope and short program length, we
believe these languages are good candidates for the task of employing LLMs to
generate languages for which virtually no dataset is available.

In §IV we presented preliminary results of using ChatGPT 4 and Gemini in order
to generate code for the Lucid language.

## References

  * [1] P. Bosshart, D. Daly, G. Gibb, M. Izzard, N. McKeown, J. Rexford, C. Schlesinger, D. Talayco, A. Vahdat, G. Varghese, et al., “P4: Programming protocol-independent packet processors,” ACM SIGCOMM Computer Communication Review, vol. 44, no. 3, pp. 87–95, 2014.
  * [2] Broadcom, “NPL: Open, High-Level language for developing feature-rich solutions for programmable networking platforms,” 2019.
  * [3] F. Hauser, M. Häberle, D. Merling, S. Lindner, V. Gurevich, F. Zeiger, R. Frank, and M. Menth, “A survey on data plane programming with p4: Fundamentals, advances, and applied research,” Journal of Network and Computer Applications, vol. 212, p. 103561, 2023.
  * [4] J. Gao, E. Zhai, H. H. Liu, R. Miao, Y. Zhou, B. Tian, C. Sun, D. Cai, M. Zhang, and M. Yu, “Lyra: A cross-platform language and compiler for data plane programming on heterogeneous asics,” in Proceedings of the Annual conference of the ACM Special Interest Group on Data Communication on the applications, technologies, architectures, and protocols for computer communication, pp. 435–450, 2020.
  * [5] D. K. Loehr et al., “Lucid: A high-level, easy-to-use dataplane programming language,” 2024.
  * [6] E. O. Zaballa and Z. Zhou, “Graph-to-p4: A p4 boilerplate code generator for parse graphs,” in 2019 ACM/IEEE Symposium on Architectures for Networking and Communications Systems (ANCS), pp. 1–2, IEEE, 2019.
  * [7] J. Sonchack, D. Loehr, J. Rexford, and D. Walker, “Lucid: A language for control in the data plane,” in Proceedings of the 2021 ACM SIGCOMM 2021 Conference, pp. 731–747, 2021.
  * [8] D. Loehr and D. Walker, “Safe, modular packet pipeline programming,” Proceedings of the ACM on Programming Languages, vol. 6, no. POPL, pp. 1–28, 2022.
  * [9] A. G. Alcoz, C. Busse-Grawitz, E. Marty, and L. Vanbever, “Reducing p4 language’s voluminosity using higher-level constructs,” in Proceedings of the 5th International Workshop on P4 in Europe, pp. 19–25, 2022.
  * [10] M. Hogan, S. Landau-Feibish, M. Tahmasbi Arashloo, J. Rexford, D. Walker, and R. Harrison, “Elastic switch programming with p4all,” in Proceedings of the 19th ACM Workshop on Hot Topics in Networks, pp. 168–174, 2020.
  * [11] C. Györgyi, S. Laki, and S. Schmid, “P4rrot: Generating p4 code for the application layer,” ACM SIGCOMM Computer Communication Review, vol. 53, no. 1, pp. 30–37, 2023.
  * [12] R. Shah, A. Shirke, A. Trehan, M. Vutukuru, and P. Kulkarni, “pcube: Primitives for network data plane programming,” in 2018 IEEE 26th International Conference on Network Protocols (ICNP), pp. 430–435, IEEE, 2018\.
  * [13] M. Chen, J. Tworek, H. Jun, Q. Yuan, H. P. d. O. Pinto, J. Kaplan, H. Edwards, Y. Burda, N. Joseph, G. Brockman, et al., “Evaluating large language models trained on code,” arXiv preprint arXiv:2107.03374, 2021.
  * [14] Y. Wei, Z. Wang, J. Liu, Y. Ding, and L. Zhang, “Magicoder: Source code is all you need,” arXiv preprint arXiv:2312.02120, 2023.
  * [15] R. Li, L. B. Allal, Y. Zi, N. Muennighoff, D. Kocetkov, C. Mou, M. Marone, C. Akiki, J. Li, J. Chim, et al., “Starcoder: may the source be with you!,” arXiv preprint arXiv:2305.06161, 2023.
  * [16] A. Lozhkov, R. Li, L. B. Allal, F. Cassano, J. Lamy-Poirier, N. Tazi, A. Tang, D. Pykhtar, J. Liu, Y. Wei, et al., “Starcoder 2 and the stack v2: The next generation,” arXiv preprint arXiv:2402.19173, 2024.
  * [17] D. Guo, Q. Zhu, D. Yang, Z. Xie, K. Dong, W. Zhang, G. Chen, X. Bi, Y. Wu, Y. Li, et al., “Deepseek-coder: When the large language model meets programming–the rise of code intelligence,” arXiv preprint arXiv:2401.14196, 2024.
  * [18] G. Team, R. Anil, S. Borgeaud, Y. Wu, J.-B. Alayrac, J. Yu, R. Soricut, J. Schalkwyk, A. M. Dai, A. Hauth, et al., “Gemini: a family of highly capable multimodal models,” arXiv preprint arXiv:2312.11805, 2023.
  * [19] P. Sahoo, A. K. Singh, S. Saha, V. Jain, S. Mondal, and A. Chadha, “A systematic survey of prompt engineering in large language models: Techniques and applications,” arXiv preprint arXiv:2402.07927, 2024.
  * [20] J. Wei, X. Wang, D. Schuurmans, M. Bosma, F. Xia, E. Chi, Q. V. Le, D. Zhou, et al., “Chain-of-thought prompting elicits reasoning in large language models,” Advances in neural information processing systems, vol. 35, pp. 24824–24837, 2022.
  * [21] S. Yao, D. Yu, J. Zhao, I. Shafran, T. Griffiths, Y. Cao, and K. Narasimhan, “Tree of thoughts: Deliberate problem solving with large language models,” Advances in Neural Information Processing Systems, vol. 36, 2024.
  * [22] B. Wang, Z. Wang, X. Wang, Y. Cao, R. A Saurous, and Y. Kim, “Grammar prompting for domain-specific language generation with large language models,” Advances in Neural Information Processing Systems, vol. 36, 2024\.
  * [23] R. Jain, W. Ni, and J. Sunshine, “Generating domain-specific programs for diagram authoring with large language models,” in Companion Proceedings of the 2023 ACM SIGPLAN International Conference on Systems, Programming, Languages, and Applications: Software for Humanity, pp. 70–71, 2023.
  * [24] M. Reid, N. Savinov, D. Teplyashin, D. Lepikhin, T. Lillicrap, J.-b. Alayrac, R. Soricut, A. Lazaridou, O. Firat, J. Schrittwieser, et al., “Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context,” arXiv preprint arXiv:2403.05530, 2024.


* Hartmann et al. (2022) Yale Hartmann, Hui Liu, and Tanja Schultz. 2022.  Interactive and Interpretable Online Human Activity Recognition. In _2022 IEEE International Conference on Pervasive Computing and Communications Workshops and other Affiliated Events (PerCom Workshops)_. IEEE, 109–111.
  * Hong et al. (2015) Jin-Hyuk Hong, Julian Ramos, and Anind K Dey. 2015.  Toward personalized activity recognition systems with a semipopulation approach.  _IEEE Transactions on Human-Machine Systems_ 46, 1 (2015), 101–112.
  * Hu et al. (2018) Chunyu Hu, Yiqiang Chen, Lisha Hu, and Xiaohui Peng. 2018.  A novel random forests based class incremental learning method for activity recognition.  _Pattern Recognition_ 78 (2018), 277–290.
  * Huynh et al. (2008) Tâm Huynh, Mario Fritz, and Bernt Schiele. 2008.  Discovery of activity patterns using topic models. In _Proceedings of the 10th international conference on Ubiquitous computing_. 10–19.
  * Jiang et al. (2018) Wenjun Jiang, Chenglin Miao, Fenglong Ma, Shuochao Yao, Yaqing Wang, Ye Yuan, Hongfei Xue, Chen Song, Xin Ma, Dimitrios Koutsonikolas, et al. 2018\.  Towards environment independent device free human activity recognition. In _Proceedings of the 24th annual international conference on mobile computing and networking_. 289–304.
  * Kong et al. (2019) Quan Kong, Ziming Wu, Ziwei Deng, Martin Klinkigt, Bin Tong, and Tomokazu Murakami. 2019.  Mmact: A large-scale dataset for cross modal human action understanding. In _Proceedings of the IEEE/CVF International Conference on Computer Vision_. 8658–8667.
  * Kwapisz et al. (2011) Jennifer R Kwapisz, Gary M Weiss, and Samuel A Moore. 2011.  Activity recognition using cell phone accelerometers.  _ACM SigKDD Explorations Newsletter_ 12, 2 (2011), 74–82.
  * Lago et al. (2019) Paula Lago, Claudia Roncancio, and Claudia Jiménez-Guarín. 2019.  Learning and managing context enriched behavior patterns in smart homes.  _Future Generation Computer Systems_ 91 (2019), 191–205.
  * Lentzas and Vrakas (2020) Athanasios Lentzas and Dimitris Vrakas. 2020.  Non-intrusive human activity recognition and abnormal behavior detection on elderly people: A review.  _Artificial Intelligence Review_ 53, 3 (2020), 1975–2021.
  * Li et al. (2020b) Frédéric Li, Kimiaki Shirahama, Muhammad Adeel Nisar, Xinyu Huang, and Marcin Grzegorzek. 2020b.  Deep transfer learning for time series data based on sensor modality classification.  _Sensors_ 20, 15 (2020), 4271.
  * Li et al. (2020a) Tengyue Li, Simon Fong, Kelvin KL Wong, Ying Wu, Xin-she Yang, and Xuqi Li. 2020a.  Fusing wearable and remote sensing data streams by fast incremental learning with swarm decision table for human activity recognition.  _Information Fusion_ 60 (2020), 41–64.
  * Lima et al. (2021) Wesllen Sousa Lima, Hendrio LS Bragança, and Eduardo JP Souto. 2021.  NOHAR-NOvelty discrete data stream for Human Activity Recognition based on smartphones with inertial sensors.  _Expert Systems with Applications_ 166 (2021), 114093.
  * Lin et al. (2007) Jessica Lin, Eamonn Keogh, Li Wei, and Stefano Lonardi. 2007.  Experiencing SAX: a novel symbolic representation of time series.  _Data Mining and knowledge discovery_ 15, 2 (2007), 107–144.
  * Liu et al. (2023) Hui Liu, Hugo Gamboa, and Tanja Schultz. 2023.  Sensor-Based Human Activity and Behavior Research: Where Advanced Sensing and Recognition Technologies Meet.  , 125 pages.
  * Liu et al. (2021) Hui Liu, Yale Hartmann, and Tanja Schultz. 2021.  Motion Units: Generalized sequence modeling of human activities for sensor-based activity recognition. In _2021 29th European signal processing conference (EUSIPCO)_. IEEE, 1506–1510.
  * Liu and Schultz (2022) Hui Liu and Tanja Schultz. 2022.  How Long Are Various Types of Daily Activities? Statistical Analysis of a Multimodal Wearable Sensor-based Human Activity Dataset.. In _HEALTHINF_. 680–688.
  * Lu et al. (2022) Wang Lu, Jindong Wang, and Yiqiang Chen. 2022.  Local and global alignments for generalizable sensor-based human activity recognition. In _ICASSP 2022-2022 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)_. IEEE, 3833–3837.
  * Malekzadeh et al. (2018) Mohammad Malekzadeh, Richard G Clegg, Andrea Cavallaro, and Hamed Haddadi. 2018.  Protecting sensory data against sensitive inferences. In _Proceedings of the 1st Workshop on Privacy by Design in Distributed Systems_. 1–6.
  * Masud et al. (2010) Mohammad M Masud, Qing Chen, Latifur Khan, Charu Aggarwal, Jing Gao, Jiawei Han, and Bhavani Thuraisingham. 2010.  Addressing concept-evolution in concept-drifting data streams. In _2010 IEEE International Conference on Data Mining_. IEEE, 929–934.
  * Mazankiewicz et al. (2020) Alan Mazankiewicz, Klemens Böhm, and Mario Bergés. 2020.  Incremental real-time personalization in human activity recognition using domain adaptive batch normalization.  _Proceedings of the ACM on Interactive, Mobile, Wearable and Ubiquitous Technologies_ 4, 4 (2020), 1–20.
  * Meng et al. (2017) Lei Meng, Chunyan Miao, and Cyril Leung. 2017.  Towards online and personalized daily activity recognition, habit modeling, and anomaly detection for the solitary elderly through unobtrusive sensing.  _Multimedia Tools and Applications_ 76, 8 (2017), 10779–10799.
  * Micucci et al. (2017) Daniela Micucci, Marco Mobilio, and Paolo Napoletano. 2017.  Unimib shar: A dataset for human activity recognition using acceleration data from smartphones.  _Applied Sciences_ 7, 10 (2017), 1101.
  * Ohashi et al. (2018) Hiroki Ohashi, Mohammad Al-Naser, Sheraz Ahmed, Katsuyuki Nakamura, Takuto Sato, and Andreas Dengel. 2018.  Attributes’ importance for zero-shot pose-classification based on wearable sensors.  _Sensors_ 18, 8 (2018), 2485.
  * Presotto et al. (2022) Riccardo Presotto, Gabriele Civitarese, and Claudio Bettini. 2022.  FedCLAR: Federated Clustering for Personalized Sensor-Based Human Activity Recognition. In _2022 IEEE International Conference on Pervasive Computing and Communications (PerCom)_. IEEE, 227–236.
  * Reiss et al. (2010) Attila Reiss, Gustaf Hendeby, Gabriele Bleser, and Didier Stricker. 2010.  Activity Recognition Using Biomechanical Model Based Pose Estimation.. In _EuroSSC_. Springer, 42–55.
  * Reiss and Stricker (2012) Attila Reiss and Didier Stricker. 2012.  Introducing a new benchmarked dataset for activity monitoring. In _2012 16th international symposium on wearable computers_. IEEE, 108–109.
  * Rodríguez et al. (2014) Natalia Díaz Rodríguez, Manuel P Cuéllar, Johan Lilius, and Miguel Delgado Calvo-Flores. 2014.  A survey on ontologies for human behavior recognition.  _ACM Computing Surveys (CSUR)_ 46, 4 (2014), 1–33.
  * Roggen et al. (2013) Daniel Roggen, Kilian Förster, Alberto Calatroni, and Gerhard Tröster. 2013.  The adarc pattern analysis architecture for adaptive human activity recognition systems.  _Journal of Ambient Intelligence and Humanized Computing_ 4, 2 (2013), 169–186.
  * Rokni and Ghasemzadeh (2018) Seyed Ali Rokni and Hassan Ghasemzadeh. 2018.  Autonomous training of activity recognition algorithms in mobile sensors: A transfer learning approach in context-invariant views.  _IEEE Transactions on Mobile Computing_ 17, 8 (2018), 1764–1777.
  * Rokni et al. (2018) Seyed Ali Rokni, Marjan Nourollahi, and Hassan Ghasemzadeh. 2018.  Personalized human activity recognition using convolutional neural networks. In _Proceedings of the AAAI conference on artificial intelligence_ , Vol. 32.
  * Saeedi et al. (2018) Ramyar Saeedi, Keyvan Sasani, Skyler Norgaard, and Assefaw H Gebremedhin. 2018.  Personalized human activity recognition using wearables: A manifold learning-based knowledge transfer. In _2018 40th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC)_. IEEE, 1193–1196.
  * Sagi and Rokach (2018) Omer Sagi and Lior Rokach. 2018.  Ensemble learning: A survey.  _Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery_ 8, 4 (2018), e1249.
  * Sanabria et al. (2021) Andrea Rosales Sanabria, Franco Zambonelli, and Juan Ye. 2021.  Unsupervised domain adaptation in activity recognition: A GAN-based approach.  _IEEE Access_ 9 (2021), 19421–19438.
  * Shi et al. (2020) Zhenguo Shi, J Andrew Zhang, Richard Yida Xu, and Qingqing Cheng. 2020.  Environment-robust device-free human activity recognition with channel-state-information enhancement and one-shot learning.  _IEEE Transactions on Mobile Computing_ 21, 2 (2020), 540–554.
  * Shoaib et al. (2014) Muhammad Shoaib, Stephan Bosch, Ozlem Durmaz Incel, Hans Scholten, and Paul JM Havinga. 2014.  Fusion of smartphone motion sensors for physical activity recognition.  _Sensors_ 14, 6 (2014), 10146–10176.
  * Stisen et al. (2015) Allan Stisen, Henrik Blunck, Sourav Bhattacharya, Thor Siiger Prentow, Mikkel Baun Kjærgaard, Anind Dey, Tobias Sonne, and Mads Møller Jensen. 2015.  Smart devices are different: Assessing and mitigatingmobile sensing heterogeneities for activity recognition. In _Proceedings of the 13th ACM conference on embedded networked sensor systems_. 127–140.
  * Sztyler and Stuckenschmidt (2016) Timo Sztyler and Heiner Stuckenschmidt. 2016.  On-body localization of wearable devices: An investigation of position-aware activity recognition. In _2016 IEEE International Conference on Pervasive Computing and Communications (PerCom)_. IEEE, 1–9.
  * Sztyler et al. (2017) Timo Sztyler, Heiner Stuckenschmidt, and Wolfgang Petrich. 2017.  Position-aware activity recognition with wearable devices.  _Pervasive and mobile computing_ 38 (2017), 281–295.
  * Tan et al. (2015) Ben Tan, Yangqiu Song, Erheng Zhong, and Qiang Yang. 2015.  Transitive transfer learning. In _Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining_. 1155–1164.
  * Van Kasteren et al. (2010) TLM Van Kasteren, Gwenn Englebienne, and Ben JA Kröse. 2010.  An activity monitoring system for elderly care using generative and discriminative models.  _Personal and ubiquitous computing_ 14 (2010), 489–498.
  * van Kasteren et al. (2011) Tim LM van Kasteren, Gwenn Englebienne, and Ben JA Kröse. 2011.  Human activity recognition from wireless sensor network data: Benchmark and software.  In _Activity recognition in pervasive intelligent environments_. Springer, 165–186.
  * Vavoulas et al. (2016) George Vavoulas, Charikleia Chatzaki, Thodoris Malliotakis, Matthew Pediaditis, and Manolis Tsiknakis. 2016.  The mobiact dataset: Recognition of activities of daily living using smartphones. In _International Conference on Information and Communication Technologies for Ageing Well and e-Health_ , Vol. 2. SciTePress, 143–151.
  * Vo et al. (2013) Quang Viet Vo, Minh Thang Hoang, and Deokjai Choi. 2013.  Personalization in mobile activity recognition system using K-medoids clustering algorithm.  _International Journal of Distributed Sensor Networks_ (2013).
  * Wang et al. (2019a) Jindong Wang, Yiqiang Chen, Shuji Hao, Xiaohui Peng, and Lisha Hu. 2019a.  Deep learning for sensor-based activity recognition: A survey.  _Pattern recognition letters_ 119 (2019), 3–11.
  * Wang et al. (2018a) Jindong Wang, Yiqiang Chen, Lisha Hu, Xiaohui Peng, and S Yu Philip. 2018a.  Stratified transfer learning for cross-domain activity recognition. In _2018 IEEE international conference on pervasive computing and communications (PerCom)_. IEEE, 1–10.
  * Wang et al. (2018b) Jie Wang, Qinhua Gao, Miao Pan, and Yuguang Fang. 2018b.  Device-free wireless sensing: Challenges, opportunities, and applications.  _IEEE network_ 32, 2 (2018), 132–137.
  * Wang et al. (2022) Jindong Wang, Cuiling Lan, Chang Liu, Yidong Ouyang, Tao Qin, Wang Lu, Yiqiang Chen, Wenjun Zeng, and Philip Yu. 2022.  Generalizing to unseen domains: A survey on domain generalization.  _IEEE Transactions on Knowledge and Data Engineering_ (2022).
  * Wang et al. (2020b) Jie Wang, Yunong Zhao, Xiaorui Ma, Qinghua Gao, Miao Pan, and Hongyu Wang. 2020b.  Cross-scenario device-free activity recognition based on deep adversarial networks.  _IEEE Transactions on Vehicular Technology_ 69, 5 (2020), 5416–5425.
  * Wang et al. (2018c) Jindong Wang, Vincent W Zheng, Yiqiang Chen, and Meiyu Huang. 2018c.  Deep transfer learning for cross-domain activity recognition. In _proceedings of the 3rd International Conference on Crowd Science and Engineering_. 1–8.
  * Wang (2017) Lidong Wang. 2017.  Heterogeneous data and big data analytics.  _Automatic Control and Information Sciences_ 3, 1 (2017), 8–15.
  * Wang et al. (2017a) Wei Wang, Chunyan Miao, and Shuji Hao. 2017a.  Zero-shot human activity recognition via nonlinear compatibility based method. In _Proceedings of the International Conference on Web Intelligence_. 322–330.
  * Wang et al. (2019b) Wei Wang, Vincent W Zheng, Han Yu, and Chunyan Miao. 2019b.  A survey of zero-shot learning: Settings, methods, and applications.  _ACM Transactions on Intelligent Systems and Technology (TIST)_ 10, 2 (2019), 1–37.
  * Wang et al. (2020a) Yaqing Wang, Quanming Yao, James T Kwok, and Lionel M Ni. 2020a.  Generalizing from a few examples: A survey on few-shot learning.  _ACM computing surveys (csur)_ 53, 3 (2020), 1–34.
  * Wang et al. (2017b) Zhelong Wang, Donghui Wu, Raffaele Gravina, Giancarlo Fortino, Yongmei Jiang, and Kai Tang. 2017b.  Kernel fusion based extreme learning machine for cross-location activity recognition.  _Information Fusion_ 37 (2017), 1–9.
  * Wijekoon et al. (2020) Anjana Wijekoon, Nirmalie Wiratunga, Sadiq Sani, and Kay Cooper. 2020.  A knowledge-light approach to personalised and open-ended human activity recognition.  _Knowledge-based systems_ 192 (2020), 105651.
  * Xing et al. (2018) Tianwei Xing, Sandeep Singh Sandha, Bharathan Balaji, Supriyo Chakraborty, and Mani Srivastava. 2018.  Enabling edge devices that learn from each other: Cross modal training for activity recognition. In _Proceedings of the 1st International Workshop on Edge Systems, Analytics and Networking_. 37–42.
  * Xu et al. (2013) Chang Xu, Dacheng Tao, and Chao Xu. 2013.  A survey on multi-view learning.  _arXiv preprint arXiv:1304.5634_ (2013).
  * Xue et al. (2019) Hongfei Xue, Wenjun Jiang, Chenglin Miao, Ye Yuan, Fenglong Ma, Xin Ma, Yijiang Wang, Shuochao Yao, Wenyao Xu, Aidong Zhang, et al. 2019\.  Deepfusion: A deep learning framework for the fusion of heterogeneous sensory data. In _Proceedings of the Twentieth ACM International Symposium on Mobile Ad Hoc Networking and Computing_. 151–160.
  * Yang et al. (2019b) Qiang Yang, Yang Liu, Tianjian Chen, and Yongxin Tong. 2019b.  Federated machine learning: Concept and applications.  _ACM Transactions on Intelligent Systems and Technology (TIST)_ 10, 2 (2019), 1–19.
  * Yang and Wang (2016) Rong Yang and Baowei Wang. 2016.  PACP: a position-independent activity recognition method using smartphone sensors.  _Information_ 7, 4 (2016), 72.
  * Yang et al. (2019a) Yang Yang, Chunping Hou, Yue Lang, Dai Guan, Danyang Huang, and Jinchen Xu. 2019a.  Open-set human activity recognition based on micro-Doppler signatures.  _Pattern Recognition_ 85 (2019), 60–69.
  * Ye (2018) Juan Ye. 2018.  SLearn: Shared learning human activity labels across multiple datasets. In _2018 IEEE International Conference on Pervasive Computing and Communications (PerCom)_. IEEE, 1–10.
  * Ye and Callus (2020) Juan Ye and Elise Callus. 2020.  Evolving models for incrementally learning emerging activities.  _Journal of Ambient Intelligence and Smart Environments_ 12, 4 (2020), 313–325.
  * Ye et al. (2021) Juan Ye, Pakawat Nakwijit, Martin Schiemer, Saurav Jha, and Franco Zambonelli. 2021.  Continual activity recognition with generative adversarial networks.  _ACM Transactions on Internet of Things_ 2, 2 (2021), 1–25.
  * Ye et al. (2014) Juan Ye, Graeme Stevenson, and Simon Dobson. 2014.  USMART: An unsupervised semantic mining activity recognition technique.  _ACM Transactions on Interactive Intelligent Systems (TiiS)_ 4, 4 (2014), 1–27.
  * Zappi et al. (2008) Piero Zappi, Clemens Lombriser, Thomas Stiefmeier, Elisabetta Farella, Daniel Roggen, Luca Benini, and Gerhard Tröster. 2008.  Activity recognition from on-body sensors: accuracy-power trade-off by dynamic sensor selection. In _European Conference on Wireless Sensor Networks_. Springer, 17–33.
  * Zhang and Sawchuk (2012) Mi Zhang and Alexander A Sawchuk. 2012.  USC-HAD: A daily activity dataset for ubiquitous activity recognition using wearable sensors. In _Proceedings of the 2012 ACM conference on ubiquitous computing_. 1036–1043.
  * Zhang and Alshurafa (2020) Shibo Zhang and Nabil Alshurafa. 2020.  Deep generative cross-modal on-body accelerometer data synthesis from videos. In _Adjunct Proceedings of the 2020 ACM International Joint Conference on Pervasive and Ubiquitous Computing and Proceedings of the 2020 ACM International Symposium on Wearable Computers_. 223–227.
  * Zhang and Yang (2021) Yu Zhang and Qiang Yang. 2021.  A survey on multi-task learning.  _IEEE Transactions on Knowledge and Data Engineering_ (2021).
  * Zhao et al. (2018) Shizhen Zhao, Wenfeng Li, and Jingjing Cao. 2018.  A user-adaptive algorithm for activity recognition based on k-means clustering, local outlier factor, and multivariate gaussian distribution.  _Sensors_ 18, 6 (2018), 1850.
  * Zheng et al. (2019) Yue Zheng, Yi Zhang, Kun Qian, Guidong Zhang, Yunhao Liu, Chenshu Wu, and Zheng Yang. 2019.  Zero-effort cross-domain gesture recognition with Wi-Fi. In _Proceedings of the 17th Annual International Conference on Mobile Systems, Applications, and Services_. 313–325.
  * Zhou et al. (2020) Rui Zhou, Xiang Lu, Shuai Lu, Yang Fu, and Mingjie Tang. 2020.  Phone Position Independent Recognition of Fine Walking Modes with Phone Sensors.  _Adhoc & Sensor Wireless Networks_ 46 (2020).
  * Zhuang et al. (2020) Fuzhen Zhuang, Zhiyuan Qi, Keyu Duan, Dongbo Xi, Yongchun Zhu, Hengshu Zhu, Hui Xiong, and Qing He. 2020.  A comprehensive survey on transfer learning.  _Proc. IEEE_ 109, 1 (2020), 43–76.