---
title: maximumSequenceLength
framework: Natural Language
role: symbol
role_heading: Instance Property
platforms: [iOS 17.0+, iPadOS 17.0+, Mac Catalyst 17.0+, macOS 14.0+, tvOS 17.0+, visionOS 1.0+, watchOS 10.0+]
path: naturallanguage/nlcontextualembedding/maximumsequencelength
---

# maximumSequenceLength

The maximum number of tokens in sequence for which the embedding generates vectors.

## Declaration

```swift
var maximumSequenceLength: Int { get }
```

## Discussion

Discussion note: The model operates on subword tokens rather than whole words. Each token may represent a single character, part of a word, or (less commonly) an entire word. Most words are split into multiple tokens, especially rare or complex terms. As a result, the number of tokens in a sequence is often greater than the number of words. Inputs longer than the token limit will be truncated, and only the first maximumSequenceLength tokens will be processed to generate embeddings. NLContextualEmbedding works best with text snippets at the sentence or paragraph level. The model truncates text that exceeds this maximum length and only processes the truncated portion of the input.

## See Also

### Inspecting the contextual embedding

- [dimension](naturallanguage/nlcontextualembedding/dimension.md)
- [hasAvailableAssets](naturallanguage/nlcontextualembedding/hasavailableassets.md)
- [languages](naturallanguage/nlcontextualembedding/languages.md)
- [modelIdentifier](naturallanguage/nlcontextualembedding/modelidentifier.md)
- [revision](naturallanguage/nlcontextualembedding/revision.md)
- [scripts](naturallanguage/nlcontextualembedding/scripts.md)
