ML Models & Algorithms
Encoder Model
In shortA neural network that turns text or other input into numeric representations. In a Google patent, the encoder builds the knowledge used to answer questions.
An encoder model is a neural network that reads an input, such as a sentence or a document, and turns it into a structured numeric representation that other systems can work with. The term appears in MLforSEO in two related senses: the encoder half of transformer models such as BERT, and the encoder component of a Google patent on answering questions with a knowledge graph.
How it works
In language models. Transformer encoders read all the words in a passage at once and produce an embedding for each token and often one for the whole passage. BERT and Sentence-BERT are encoder-only models. Their output is a vector, not generated text, which is why they are used for search, similarity, classification and clustering. Retrieval systems use them in two forms: bi-encoders embed queries and documents separately for fast matching, and cross-encoders read a query and a passage together to score relevance more precisely, often in a re-ranking step.
In Google’s question-answering patent. The patent “Natural language processing with an N-gram machine” describes a model with an encoder, a decoder and a programmer model. The encoder reads a body of text and outputs a knowledge graph made of short n-gram statements. The programmer model then turns a natural-language question into a small program that searches that graph for the answer. MLforSEO’s knowledge graph lessons describe this as a two-step process: the encoder side builds and maintains the knowledge, and the programmer side answers questions from it.
How it’s used in SEO and marketing
- Embedding keywords, titles or pages with an encoder (for example sBERT) to cluster them or map them to topics.
- Finding internal linking opportunities by comparing page embeddings.
- Understanding re-ranking in AI search: cross-encoders often decide which retrieved chunks make the final shortlist, which rewards passages that are clear and self-contained.
- Understanding zero-click answers: knowledge graph question answering explains why factual entity-attribute queries are answered directly in the results.
Example
Given the question “Who is Barack Obama married to?”, the patent’s approach does not search for pages containing those words. The programmer model produces a program that finds the entity Barack Obama in the encoded knowledge store and follows the spouse relationship, returning Michelle Obama. The quality of the answer depends on how well the encoder captured the facts in the first place.
Limitations and things to watch
- A patent shows what Google has explored, not what runs in Search today.
- Encoders have input length limits, so long pages are usually split into chunks before embedding.
- Embeddings from different encoder models are not comparable; use the same model for everything you compare.
Learn it on MLforSEO
- What Is a Knowledge Graph? How to Use It for Smarter Keyword Strategy
- Different ways to Map Keywords to topics – with Supervised and Unsupervised ML approaches
- The Semantic AI-powered SEO Keyword Research course and the AI Search & LLMs: Entity SEO and Knowledge Graph Strategies for Brands course, both of which cover how Google’s Knowledge Graph answers questions
- The AI Search Optimization and Agentic SEO course, which explains re-ranking with cross-encoders
Sources and further reading
- What Is a Knowledge Graph? How to Use It for Smarter Keyword Strategy MLforSEO
- Semantic AI-powered SEO Keyword Research (course) MLforSEO
- US11256866B2, Natural language processing with an N-gram machine (Google patent)
- Answering Questions Using Knowledge Graphs (Go Fish Digital)
- BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
Other terms from ML Models & Algorithms
- BERT (Bidirectional Encoder Representations from Transformers)Google's 2018 transformer language model that reads text in both directions to produce context-aware embedding…
- BERTopicA modular topic modelling technique that clusters transformer embeddings and labels each cluster with class-ba…
- BIRCH (Balanced Iterative Reducing and Clustering using Hierarchies)BIRCH (Balanced Iterative Reducing and Clustering using Hierarchies) clusters very large numeric datasets by s…
- BM25A classic ranking function that scores documents by how often query words appear, adjusted for word rarity and…
- Boyer-MooreA fast exact string-search algorithm that compares a pattern from right to left and skips ahead after mismatch…
- c-TF-IDFClass-based TF-IDF: treats each cluster as one document to find the words that best describe it, used by BERTo…
- Centroid-based ClusteringA clustering family that groups data around central points (centroids), each the average of its cluster's memb…
- Convolutional Neural Network (CNN)A deep learning architecture that scans data with small learned filters to detect local patterns; the classic…
- DBSCANDensity-based clustering that groups closely packed points, finds the number of clusters itself and labels iso…