Fine-tuning Custom Embedding Models for Enterprise Search

glean · Tech · 2025 · source Agentic: no · promotional bias: med · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Tech

Glean needed enterprise search embeddings that understand each customer's internal dialect, permissions, and heterogeneous enterprise data sources.

Constraints:

Architecture

Glean's enterprise AI stack starts by normalizing customer content from Google Drive, GitHub, Jira, Confluence, Slack, meetings, and other applications into a unified per-customer data model. Search sits underneath the assistant and agent layers, so Glean adapts a strong general embedding model into a company-specific language model through continued pre-training, then converts it into a search embedding model with task-specific pairs. Training signals include document title/body pairs, anchor links, co-access behavior, public embedding datasets, synthetic QA pairs for sparse customers, and production query-click or proxy feedback. Focused model-evaluation suites check specific query behaviors before improvements flow back into semantic search, RAG answers, and agents.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  enterprise-connectors["enterprise-connectors"] --> unified-data-model["unified-data-model"]
  unified-data-model --> continued-pretraining["continued-pretraining"]
  unified-data-model --> pair-generation-datasets["pair-generation-datasets"]
  pair-generation-datasets --> synthetic-qa-generator["synthetic-qa-generator"]
  continued-pretraining --> customer-specific-embedding-model["customer-specific-embedding-model"]
  pair-generation-datasets --> customer-specific-embedding-model
  customer-specific-embedding-model --> glean-search["glean-search"]
  glean-search --> glean-assistant["glean-assistant"]
  glean-search --> glean-agents-layer["glean-agents-layer"]
  glean-search --> query-click-feedback["query-click-feedback"]
  query-click-feedback --> customer-specific-embedding-model
  customer-specific-embedding-model --> automated-eval-suite["automated-eval-suite"]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
enterprise-connectors Bring content from customer applications such as Google Drive, GitHub, Jira, Confluence, Slack, meetings, and other tools. unified-data-model
unified-data-model Normalizes heterogeneous enterprise data into a per-customer representation that can support search, assistant, and agent workloads. enterprise-connectors, continued-pretraining, pair-generation-datasets, glean-search
continued-pretraining Adapts a strong general embedding/language model to the customer's internal terminology and project dialect with masked language modeling. unified-data-model, customer-specific-embedding-model
pair-generation-datasets Creates task-training pairs from title/body data, anchors, co-access sessions, public datasets, and synthetic QA. unified-data-model, customer-specific-embedding-model, synthetic-qa-generator
synthetic-qa-generator Uses LLMs to generate question/answer pairs for small corpuses or sparse user-signal environments. pair-generation-datasets
query-click-feedback Mines search clicks, citation clicks, and other weak proxies as user-aligned relevance feedback. glean-search, customer-specific-embedding-model
customer-specific-embedding-model Per-customer semantic model used to retrieve company-specific knowledge with the right terminology and access boundaries. continued-pretraining, pair-generation-datasets, query-click-feedback, glean-search, automated-eval-suite
glean-search Foundational semantic search layer that retrieves enterprise context for users and downstream RAG applications. customer-specific-embedding-model, glean-assistant, glean-agents-layer, query-click-feedback
glean-assistant RAG assistant that uses Glean Search to generate enterprise answers. glean-search, glean-agents-layer
glean-agents-layer Agent layer that uses RAG and assistant capabilities for more complex workflows. glean-search, glean-assistant
automated-eval-suite Unit-tests models on focused query behaviors and customer-specific quality bars before changes are considered beneficial. customer-specific-embedding-model

Data flow

Customer content is pulled from enterprise applications into a unified data model. Glean starts with a strong general embedding model, continues pre-training on company data to learn the customer's dialect, and then trains the model for search using positive pairs from title/body data, document anchors, co-access sessions, public datasets, synthetic QA, and eventually query-click or citation-click feedback. The resulting customer-specific embedding model powers Glean Search, which in turn supplies context to the assistant and agent layers. Model changes are checked with focused evaluations for query behaviors such as paraphrase understanding before being treated as search-quality improvements.

5 supporting quotes
“we take all your Enterprise data across all your different applications and data sources Google Drive GitHub jira Confluence and we bring it all together and include World data as well”transcript, stated
“glean builds custom embedding models for each one of our customers because each one of our customers is very different and unique and has their own sort of dialect”transcript, stated
“the first phase of training we uses uses mask language modeling to convert a general language model like a Burt based Lang LM into a company specific language model”transcript, stated
“one example of a data set that we create is something that we call Title body which takes titles of documents and maps to their body of random passages from the document”transcript, stated
“when people are searching for things and clicking on things those are like very easy signals that we can mine from to improve the quality of our edding models by just using query click Pairs”transcript, stated

Why this architecture

Glean makes search the foundation because poor retrieval causes hallucinations and employee confusion in RAG systems. Customer-specific models are favored over generic large models because enterprises have private dialects, project names, heterogeneous applications, and security boundaries. The two-stage training path separates domain adaptation from search-task optimization: masked language modeling teaches company language, but pair-based embedding training is needed for retrieval. Evaluation is decomposed into focused model unit tests because end-to-end enterprise RAG has many moving parts and hundreds of customer-specific models.

4 supporting quotes
“you can't have a good rag system you can't have a good overall Enterprise AI product unless you have good search because there's always context lurking somewhere in your Enterprise”transcript, stated
“small embedding models when fine-tuned to The Domain and the specific task you have in hand can give you a lot better performance compared to just using large llms”transcript, stated
“just using mask language modeling it doesn't really improve the quality of of your embeddings of your model for the specific task of search”transcript, stated
“evaluating rag system end to end is a complex task because there are so many moving Parts”transcript, implied

Models used: custom embedding models · BERT-based language models · LLMs for synthetic question generation

Scale

Alternatives considered (roads not taken)

Using only large general-purpose LLMs or generic embedding models

Rejected because: Generic models do not reliably capture customer-specific language, project names, application context, and private enterprise dialects.

“large llms they're super General and don't necessarily work well for the specific application that you're working on for a particular customer”transcript, stated

Stopping after continued pre-training with masked language modeling

Rejected because: Masked language modeling adapts company language, but search needs task-specific pair training to make embeddings perform well.

“just using mask language modeling it doesn't really improve the quality of of your embeddings of your model for the specific task of search”transcript, stated
“if you want to make sure you get good performance there you need to train your model on the task specifically”transcript, stated

Treating every Slack message as its own training document

Rejected because: Individual messages are often too short and context-poor; Glean models threads or short-time-window conversations as documents instead.

“the B naive notion of building a version of slack message as documents is to take each message and consider it as a document but there's are a lot of problems”transcript, stated
“we don't just think about each individual message as a document we want to take into account the broader context and which your message is sent and create conversation documents”transcript, stated

Evaluating only the whole RAG system end to end

Rejected because: The full RAG stack has too many moving parts, so Glean also unit-tests focused embedding-model behaviors to isolate improvements.

“you want to really focus on individual components sometimes and think about how you can improve improve those individual components and optimize against a more specific metric”transcript, stated

Patterns

fine-tuning-adaptation (model-operations)

Glean builds a separate custom embedding model for each customer to capture company-specific language.

“glean builds custom embedding models for each one of our customers because each one of our customers is very different and unique and has their own sort of dialect for how they talk about work and talk about projects at work”transcript, stated

data-quality-loop (feedback)

User feedback and new company documents are treated as ongoing signals for improving the embedding model.

“you want to make sure your language model is constantly evolving as the company grows over time and learns from like user feedback learns from as new projects come up and new documents come up new applications get uced Etc”transcript, stated

rag-retrieval (retrieval)

Search quality is treated as the foundation for enterprise RAG because poor retrieval leads to hallucinations and confusion.

“you can't have a good rag system you can't have a good overall Enterprise AI product unless you have good search because there's always context lurking somewhere in your Enterprise that you need to bring in order to do things correctly”transcript, stated

Tradeoffs

Build smaller customer-specific embedding models instead of relying only on generic large models.

Chose fine-tuned per-customer embedding models over large general LLMs or generic embedding models.

Rationale: Company-specific language and privacy constraints make generic models less reliable for enterprise search.

“small embedding models when fine-tuned to The Domain and the specific task you have in hand can give you a lot better performance compared to just using large llms”transcript, stated
“working within like single customer deployments given like security and privacy constraints you want to also think about using smaller embedding models for when you can”transcript, stated

Train search embeddings with task-specific pairs after domain pre-training.

Chose pair-based embedding fine-tuning over masked-language-modeling adaptation alone.

Rationale: Masked language modeling teaches company language, but does not directly optimize retrieval quality.

“just using mask language modeling it doesn't really improve the quality of of your embeddings of your model for the specific task of search”transcript, stated
“you need to train your model on the task specifically and so that's good starting point for thinking about how you can train your model um using um pairs of data”transcript, stated

Use focused model unit tests alongside end-to-end RAG evaluation.

Chose component-level embedding evaluations over only holistic end-to-end RAG evaluation.

Rationale: The RAG system has many moving parts; focused evaluations make it easier to isolate which customer models or query patterns need work.

“evaluating rag system end to end is a complex task because there are so many moving Parts”transcript, stated
“we also unit test our models in a lot of ways example of the is like you want to pick out behaviors that your mod of a model that you find desirable and build an eval set for them”transcript, stated

Gotchas (what bit them)

Generic embedding models miss customer-specific language.

Root cause: Each enterprise has its own internal terminology, project names, and data structures.

Resolution: Glean performs continued pre-training on company data before training search embeddings.

“if you want to make that into a company specific model you need to do some form of continued pre-training on company data in order to make it take a go from language model to a company language model that really understands the nuances of your company”transcript, stated

Evaluation

Glean uses user feedback and search behavior such as query-click pairs as signals for embedding-model quality.

Metrics: search quality · query-click pairs · user feedback

“when people are searching for things and clicking on things those are like very easy signals that we can mine from to improve the quality of our edding models by just using query click Pairs”transcript, stated

Outcomes

The approach implies operating custom models across many customers.

“One data point we've seen is like after 6 months you can see like a 20% improvement from our overall search system just by gaining like by learning from user feedback adapting to the nuances of the company as it grows over time Etc”transcript, stated