Internet-Draft MLM Tokens over HTTP December 2026
Mekuria Expires 7 June 2027 [Page]
Workgroup:
HTTPBIS / Individual Submission
Internet-Draft:
draft-mekuria-httpbis-http-mlm-tokens-00
Published:
Intended Status:
Standards Track
Expires:
Author:
R. Mekuria, Ed.
Huawei Technologies Co., Ltd.

Media Type for Token Streams of Multimodal AI and Its Use with HTTP

Abstract

Distributed multimodal AI applications exchange the tokens that AI models consume and produce: discrete tokens and continuous embeddings, such as the output of a vision encoder. Today these are commonly carried over HTTP as text or JSON, which adds tens to hundreds of bytes per token. This document specifies how such token streams are carried in HTTP message bodies in a compact binary form, using a media type whose parameters describe the stream. It describes the intended use cases, explains where HTTP fits, and defines the body format, its framing, and its use with HTTP/1.1, HTTP/2, and HTTP/3. No HTTP extension is needed.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on 4 June 2027.

▲

Table of Contents

1. Introduction

AI applications increasingly run as pipelines split across devices, edge, and cloud. Language models operate on sequences of tokens, and non-text inputs such as images, video, and audio reach a model in one of two forms:

In split inference, part of a model runs on one device and the rest elsewhere; for example, a device runs the vision encoder of a VLM and sends the resulting embeddings, instead of the image, to the language model on a server. Models also produce tokens, such as audio tokens for speech synthesis, which are streamed to the client.

AI services are commonly accessed over HTTP. Current interfaces such as the OpenAI API and agent protocols such as MCP and A2A carry tokens as JSON, often streamed as Server-Sent Events, and media as base64 inside JSON ([I-D.discrete-token-transport-mlm] Section 4.5). This places tens to hundreds of bytes on the wire per token, against about 2 bytes for a discrete token in binary form ([I-D.discrete-token-transport-mlm] Section 7.5).

This document lets such services keep HTTP while carrying tokens in a compact binary form. It defines the use of the media type "application/mlm-tokens" in HTTP message bodies, following the guidance for building protocols on HTTP [RFC9205]. The framework document [I-D.discrete-token-transport-mlm] gives more background, measured traffic characteristics, and the transport requirements; companion documents specify carriage over RTP [I-D.rtp-payload-mlm-tokens] and MOQT [I-D.moqt-mlm-token-streams]. All three use the same unit format, so that a unit is interpreted in the same way whichever transport carries it (Section 11).

2. Use Cases and Architecture

2.1. Uploading Tokens Instead of Media

A client that runs a tokenizer or vision encoder locally sends the resulting tokens or embeddings to an HTTP inference endpoint instead of the image or video. The raw media then stays on the device, and with token selection and compact element formats the upload can be smaller than the compressed media ([I-D.discrete-token-transport-mlm] Section 7.3). This suits request/response and near-real-time use, for example the analysis of a short clip or of individual images.

2.2. Streaming Generated Tokens

A model that generates audio or other tokens returns them in the response body as they are produced, for example speech tokens that a client decodes and plays out. This is the binary counterpart of today's streaming of text tokens as Server-Sent Events.

2.3. Architecture

Figure 1 shows the use cases above.

+-------------------+                     +---------------------+
| Client            |  request body:      | HTTP inference      |
|                   |  tokens/embeddings  | endpoint            |
|  camera           | ------------------> |                     |
|  encoder          |                     |  language model     |
|  selection        |  response body:     |                     |
|  player           | <------------------ |  token generation   |
|                   |  generated tokens   |                     |
+-------------------+                     +---------------------+
Figure 1: Token streams in HTTP request and response bodies

Either body, or both, can use the media type of this document; the other body can use any format the service defines. The media type parameters in Content-Type tell the receiver how to interpret the body (Section 6).

3. Why HTTP, and Its Limits

HTTP is the transport of today's AI services, so carrying tokens in HTTP bodies changes the data format without changing the deployment:

HTTP also has limits for real-time use: delivery is reliable, so a lost packet delays the data behind it instead of being skipped; there are no per-unit deadlines; and intermediaries do not act on the importance of individual tokens. For interactive use over lossy paths, the MOQT [I-D.moqt-mlm-token-streams] and RTP [I-D.rtp-payload-mlm-tokens] bindings may be more suitable.

4. What This Document Specifies

This document specifies:

No HTTP extension and no new header field is defined. Not specified, and for further study: carriage of media timestamps, mechanisms for rate adaptation, and a JSON representation of the AI Data Unit for debugging. Section 12 gives examples; readers mainly interested in how the media type can be used can start with Sections 2, 3, and 12.

5. Terminology

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals.

HTTP terms are used as in [RFC9110]. This document also uses the following terms (see also [I-D.discrete-token-transport-mlm]):

Discrete token:

an integer index into a learned codebook.

Continuous embedding:

a vector representing one token position in a model's input, e.g., the vision-encoder output for one image patch.

Model configuration:

everything both endpoints must share to interpret the tokens: the codebook for discrete tokens; the encoder, any adapter, and any quantizer for continuous embeddings. It is opaque to this document.

Element:

one discrete token or one continuous embedding.

AI Data Unit (ADU):

a header plus one or more elements that share the same handling (representation type, modality, layer, and priority). In this document an ADU is one length-delimited unit in the HTTP body (Section 7).

Token group:

the ADUs that together carry one unit of information, e.g., all tokens of one image or frame.

6. Media Type and Parameters

A body that carries a token stream is labeled with the media type "application/mlm-tokens". A client requests such a body in a response with Accept and labels such a request body with Content-Type. The media type parameters describe the stream (REQ-5); they are the parameters of [I-D.rtp-payload-mlm-tokens] Section 8.2 (rtype, token-bits, emb-dim, elem-format, codebook-id) with the same values, defaults, and meanings; "rate" is not used with HTTP. For example:

Content-Type: application/mlm-tokens; rtype=embedding; emb-dim=1152

The parameters follow the media type parameter syntax of [RFC9110] Section 8.3.1. A server that does not support the requested rtype, token-bits, or elem-format MUST reject the request (with 406 when requested through Accept, or 415 for a request body). A response carries in its Content-Type the parameters that apply to its body.

"application/mlm-tokens" is a binary media type. It MUST be sent without a "charset" parameter, and intermediaries and clients MUST treat the body as opaque octets and MUST NOT apply any character-set or text transformation to it. A lossless Content-Encoding MAY be applied as for any HTTP body; it yields little on these payloads.

7. Body Format and Framing

The body is a sequence of AI Data Units, each consisting of its header (Section 11) immediately followed by its Element Data, as raw octets; this is the same octet layout that the RTP and MOQT bindings use. In HTTP/1.1 the octets are carried with chunked transfer coding [RFC9112]; in HTTP/2 [RFC9113] and HTTP/3 [RFC9114] in DATA frames.

Self-delimitation: Chunk boundaries (HTTP/1.1) and DATA-frame boundaries (HTTP/2, HTTP/3) are not semantic and MAY be coalesced or split by intermediaries, so a receiver MUST NOT rely on them to delimit AI Data Units. Instead it locates the next ADU by computing the current ADU's length from its header:

header length  = 8 + 2*C + 4*G + 2*P*(Element Count) octets
payload length = ceil(Element Count * b / 8) octets for discrete
                 tokens (b = token-bits, default 16), or
                 Element Count * W for continuous embeddings

where W = 2*(integer format) + ceil(d * bits(elem-format) / 8) ([I-D.rtp-payload-mlm-tokens] Section 4.3). An end-of-group marker (T=1, Element Count=0) has no payload. Because the length is computable from the header, the body is self-delimiting as a continuous octet stream.

Batching (REQ-2): An ADU SHOULD carry many elements (Element Count > 1); several ADUs MAY be sent in one chunk or flush, but elements of a different layer or priority go in separate ADUs. Batching MUST NOT delay an ADU beyond the application's latency budget.

Positions (REQ-12): When the elements of a token group are a selected subset (e.g., selected visual tokens), every ADU of the group MUST set P=1 and list the positions of its elements.

No fragmentation: The HTTP body is a reliable, ordered byte stream with no packet-size limit, so F MUST be 0 and S and E are 1. Seq Start gives the index of the ADU's first element within its token group, as for the other bindings.

Timing (REQ-4): Order within the body provides sequencing (REQ-3); carriage of an absolute media clock and per-unit timestamp is for further study.

8. End of Group and End of Body

A token group is one or more ADUs that together form one unit of information (e.g., all tokens of one image). Because the HTTP body has no packet or object boundaries, a token group is identified either by a common Group Identifier (G=1, Section 11) carried in every ADU of the group, whose scope is the HTTP body, or, when no Group Identifier is used, as the run of consecutive ADUs up to and including the ADU with T=1 (or an end-of-group marker). Such a token group aligns with the 3GPP PDU Set concept; the precise mapping to PDU Sets is left for further study ([I-D.discrete-token-transport-mlm] Section 10.3).

End of group (REQ-13): A sender that ends a token group, including one it decides to truncate, sets T=1 on the last ADU of the group or sends an end-of-group marker (T=1, Element Count=0, with the fields of [I-D.rtp-payload-mlm-tokens] Section 4.6) carrying the group's Group Identifier, if one is used. The receiver can then start processing the group without waiting for more data.

End of body: The zero-length terminating chunk (HTTP/1.1) or the end of the DATA frames of the stream signals completion.

9. HTTP Versions, Multiplexing, and Priority

HTTP/1.1 relies on TCP and is subject to head-of-line blocking; it is suited to relaxed latency (batch, asynchronous) only. HTTP/2 multiplexes requests over one TCP connection but is still subject to TCP head-of-line blocking. HTTP/3 over QUIC removes transport head-of-line blocking and is RECOMMENDED for interactive and lossy-path use. Carrying the whole exchange over a single HTTP/3 connection also avoids the multiple-connection and connection-setup overhead observed for text/JSON agent transports ([I-D.discrete-token-transport-mlm] Section 7.5).

Multiplexing (REQ-8): A single request or response carries the token stream by default. A deployment MAY use one request per modality or representation (or, if layers are exposed, per layer) over HTTP/2 or HTTP/3, and a client MAY drop an optional one by cancelling it.

Priority (REQ-6): Importance is expressed per ADU by the PRI field (1 highest, 15 lowest, 0 not specified) and, where grouping is used, by a common Group Identifier. When no importance information is available, PRI is 0. Where several requests are used, a sender MAY map PRI to the urgency parameter of the HTTP prioritization scheme [RFC9218]; since PRI has 15 levels and urgency 8, the mapping is deployment-specific. This does not require a layered structure.

Loss and adaptation (REQ-7, REQ-13): HTTP delivers a body reliably and in order, so ADUs are not lost from within a body. Elements can be missing for other reasons, which a receiver handles as follows:

For missing discrete tokens, the receiver conceals them and resumes at the next independently decodable unit (I=1). Because delivery is reliable, loss is not a means of adaptation; a sender facing falling throughput can send fewer elements per token group and end groups early (Section 8). How quickly AI senders can adapt, and the mechanisms for doing so, are for further study.

Network-visible marking (informative). Under HTTPS the body, including the AI Data Unit header, is encrypted on the path. A sender MAY map PRI to a DSCP value within an administrative domain; DSCP is commonly re-marked or ignored across the public Internet. How a 5G/6G network treats such traffic is a 3GPP matter on which this document places no requirement.

10. Model Configuration

The model configuration -- the codebook for discrete tokens, or the encoder, adapter, and quantizer for continuous embeddings -- is opaque to this document and handled per the binding modes of [I-D.discrete-token-transport-mlm] Section 10.7:

11. AI Data Unit Format

Each AI Data Unit in the body uses the format shared with the RTP and MOQT bindings. The fields are defined in [I-D.rtp-payload-mlm-tokens] Section 4.2; a unit can therefore be passed between transports without re-encoding. The fixed part of the header is 8 octets; optional fields follow only when their flag is set:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Ver=1 | RType |Modal. | Layer |S|E|I|C|  PRI  |G|X|P|T|F| Rsv |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         Element Count         |          Seq Start            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
:  Codebook/Model ID (16, iff C=1)                              :
:  Group Identifier (32, iff G=1)                               :
:  Position List (16 x Element Count, iff P=1)                  :
:  Element Data ...                                             :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 2: AI Data Unit header

In summary:

For discrete tokens, each element is a codebook index of b bits (16 by default), packed as defined in [I-D.rtp-payload-mlm-tokens] Section 4.3. For continuous embeddings, each element is one vector of dimension d in the negotiated element format, preceded by a scale for integer formats ([I-D.rtp-payload-mlm-tokens] Section 4.3). Only the header fields are meaningful to the transport; elements and positions are opaque, interpretable only by an endpoint holding the codebook or model.

12. Illustrative Examples

The following examples illustrate the use of the media type. The paths, sizes, and values are example values, not recommendations; header lines folded for display are a single line in practice. The AI Data Unit layouts themselves are illustrated in [I-D.discrete-token-transport-mlm] Section 10.10.

Example 1: uploading embeddings instead of an image. A client runs a vision encoder and an adapter, keeps the 64 most important tokens of an image, and uploads them to an inference endpoint:

POST /v1/analyze HTTP/1.1
Host: inference.example.com
Content-Type: application/mlm-tokens; rtype=embedding;
              emb-dim=256; elem-format=int8
Transfer-Encoding: chunked

The body is 16 ADUs of four elements each, with their positions (P=1), 1048 octets per ADU and about 16.5 KB in total. The ADUs carry Seq Start 0, 4, 8, ..., and the last ADU has T=1; no Group Identifier is needed, since the group ends with that ADU. The response, e.g., a text answer, uses whatever format the service defines.

Example 2: streaming generated speech tokens. A client asks a speech model for synthesized speech as discrete tokens:

POST /v1/speak HTTP/1.1
Host: inference.example.com
Accept: application/mlm-tokens; rtype=token

The server responds with "Content-Type: application/mlm-tokens; rtype=token" and sends one ADU every 200 ms, each carrying the tokens produced in that interval, flushing each ADU as it is produced. The client decodes and plays out the tokens as they arrive; the end of the body ends the stream.

Example 3: unsupported parameters. If the client of Example 1 sends "elem-format=int4" to a server that supports only "bf16" and "int8", the server rejects the request with 415 (Unsupported Media Type), and the client can retry with a supported format.

13. Security Considerations

All endpoints MUST use HTTPS (TLS 1.3 RECOMMENDED); plain HTTP MUST NOT be used in production. Discrete tokens and continuous embeddings inherit the sensitivity of the source data (reconstruction from codebook, embedding inversion; see [I-D.discrete-token-transport-mlm] Section 11), so access control for the source media applies to these endpoints, including when only vision-encoder embeddings rather than images are uploaded. Server authentication counters adversarial injection; servers accepting embedding uploads SHOULD authenticate clients. Receivers MUST bound the resources committed per token group. The media type parameters are visible to any intermediary that terminates TLS; terminate TLS close to the client where modality or session identity is sensitive. Keeping the codebook or model out of band (Section 10) reduces model-fingerprint exposure; an identifier that includes a hash of the configuration allows a mismatch to be detected without disclosing the configuration, and a tampered configuration to be detected when the expected identifier is authenticated or pinned. A hash supplied or modified together with the configuration does not by itself authenticate it.

14. IANA Considerations

The media type "application/mlm-tokens" is registered by [I-D.rtp-payload-mlm-tokens]; this document defines its use, with the parameters of Section 6, as an HTTP message body (Section 7). This document has no further IANA actions. The Representation Type and Modality registries shared by the bindings are requested by [I-D.rtp-payload-mlm-tokens].

15. References

15.1. Normative References

[RFC2119]
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, , <https://www.rfc-editor.org/rfc/rfc2119>.
[RFC8174]
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, , <https://www.rfc-editor.org/rfc/rfc8174>.
[RFC9110]
Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, Ed., "HTTP Semantics", STD 97, RFC 9110, , <https://www.rfc-editor.org/rfc/rfc9110>.
[RFC9112]
Fielding, R., Ed. and J. Reschke, Ed., "HTTP/1.1", STD 99, RFC 9112, , <https://www.rfc-editor.org/rfc/rfc9112>.
[RFC9113]
Thomson, M., Ed. and C. Benfield, Ed., "HTTP/2", RFC 9113, , <https://www.rfc-editor.org/rfc/rfc9113>.
[RFC9114]
Bishop, M., Ed., "HTTP/3", RFC 9114, , <https://www.rfc-editor.org/rfc/rfc9114>.
[RFC9205]
Nottingham, M., "Building Protocols with HTTP", BCP 56, RFC 9205, , <https://www.rfc-editor.org/rfc/rfc9205>.
[RFC9218]
Oku, K. and L. Pardue, "Extensible Prioritization Scheme for HTTP", RFC 9218, , <https://www.rfc-editor.org/rfc/rfc9218>.
[I-D.rtp-payload-mlm-tokens]
Mekuria, R., "RTP Payload Format for Token Streams of Multimodal AI: Discrete Tokens and Continuous Embeddings", Work in Progress, Internet-Draft, draft-mekuria-avtcore-rtp-payload-mlm-tokens-00, <https://datatracker.ietf.org/doc/html/draft-mekuria-avtcore-rtp-payload-mlm-tokens-00>.

15.2. Informative References

[I-D.discrete-token-transport-mlm]
Mekuria, R., "Transport of Tokens for Distributed Multimodal AI: Discrete Tokens and Continuous Embeddings", Work in Progress, Internet-Draft, draft-mekuria-multimodal-ai-token-transport-00, <https://datatracker.ietf.org/doc/html/draft-mekuria-multimodal-ai-token-transport-00>.
[I-D.moqt-mlm-token-streams]
Mekuria, R., "Media over QUIC Transport (MOQT) Mapping for Token Streams of Multimodal AI: Discrete Tokens and Continuous Embeddings", Work in Progress, Internet-Draft, draft-mekuria-moq-moqt-mlm-token-streams-00, <https://datatracker.ietf.org/doc/html/draft-mekuria-moq-moqt-mlm-token-streams-00>.

Appendix A. Requirements Conformance

Mapping to the requirements of [I-D.discrete-token-transport-mlm]:

REQ-1  Low latency     HTTP/3 streaming; flush per unit; MOQT/RTP
                       may suit lossy real-time paths better.
REQ-2  Batching/compact Many elements per ADU; several ADUs per
                       chunk; b-bit tokens, quantized embedding
                       formats; binary body (Section 7).
REQ-3  Sequencing      Body order + Seq Start.
REQ-4  Timestamping    Not provided: body order only; media
                       clock for further study.
REQ-5  Metadata        Media type parameters in Content-Type
                       (Section 6).
REQ-6  Priority        Per-unit PRI (+ optional Group Identifier);
                       optional RFC 9218 urgency across requests
                       (Section 9).
REQ-7  Partial reliab. Reliable body; omitted elements handled by
                       concealment or proceed-with-received;
                       cancel optional requests (Section 9).
REQ-8  Multiplexing    Single request by default; one request per
                       track optional (HTTP/2, HTTP/3).
REQ-9  Security        HTTPS (TLS 1.3) (Section 13).
REQ-10 Codebook agree. Opaque, out-of-band by default
                       (Section 10).
REQ-11 Rep-type signal RType field / "rtype" parameter.
REQ-12 Positions       Position List (P flag) (Section 7).
REQ-13 Adaptation      T flag / end-of-group marker (Section 8);
                       rate adaptation for further study.

Author's Address

Rufael Mekuria (editor)
Huawei Technologies Co., Ltd.