Skip to content

Generative AI & LLMs

N-gram

A set number of items in a row, such as three consecutive words.

Example

The phrase 'customer service team' contains the word bigrams 'customer service' and 'service team'.

Why people use it

It captures short word patterns that can help compare or predict text.

What you'll hear

“Look for common pairs of words.”

What this means for you

Use n-grams where local patterns are useful and recognize their limits.

Can you control it?

Developer-only

The people building or running the AI choose this setup. An everyday user generally needs their help to change how this part works.

Common questions

Does an n-gram represent the full meaning of a sentence?
No. It captures a local sequence, not all background information.
Can n-grams contain characters instead of words?
Yes. The pieces can be characters, words or another chosen unit.
Does a larger n always work better?
No. Longer sequences can be more specific but may appear too rarely to be useful.

Related terms

Still have questions?

Up to 500 characters.

Ask LATHIC about AI. Relevant glossary entries may be included.

Your question, the glossary entries it matches, and a rotating pseudonymous identifier go to Microsoft Azure’s OpenAI service through Vercel AI Gateway to generate an answer. Zero retention and no training are required of the provider, and LATHIC does not save your question or answer. Privacy Notice