Building and Scaling a Production Generative AI Assistant for Professional Networking

linkedin · Tech · 2024 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.5 (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: Professional-networking assistant

LinkedIn needed a production generative assistant that could help members explore feed posts, assess job fit, and get career advice while grounding answers in LinkedIn data and maintaining consistent product quality across many specialized agent experiences.

Constraints:

Architecture

LinkedIn built a fixed three-step RAG assistant pipeline. Routing uses smaller models and development sets to choose whether a query is in scope and which specialized agent should handle it. The chosen agent performs retrieval by deciding which internal skills, LinkedIn APIs, or Bing calls to invoke, then a larger generation model filters the retrieved dossier into a response with attachments. A horizontal platform pod owns hosting, shared prompts, evaluation, instrumentation, UX templates, server-driven UI, and common skills, while vertical pods own individual agents such as job assessment, company understanding, post takeaways, and interview tips.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  member-experience[Member experience] --> assistant-hosting-service[Assistant hosting service]
  assistant-hosting-service --> router[Router]
  router --> specialized-agents[Specialized agents]
  specialized-agents --> skill-layer[Skill layer]
  skill-layer --> linkedin-internal-apis[LinkedIn internal APIs]
  skill-layer --> bing-api[Bing API]
  skill-layer --> defensive-yaml-parser[Defensive YAML parser]
  specialized-agents --> generation-model[Generation model]
  shared-prompt-templates[Shared prompt templates] --> specialized-agents
  generation-model --> realtime-messaging-infrastructure[Realtime messaging infrastructure]
  realtime-messaging-infrastructure --> member-experience
  assistant-hosting-service --> evaluation-pipeline[Evaluation pipeline]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Member experience Feed, job, and professional-content surfaces that show starter questions and receive streamed assistant responses. Assistant hosting service
Assistant hosting service Common product service that receives member questions, coordinates routing, retrieval, generation, streaming, instrumentation, and server-driven UI. Member experience, Router, Specialized agents, Realtime messaging infrastructure, Evaluation pipeline
Router Classifies whether the query is in scope and chooses the specialized agent using smaller models, development sets, prompts, and in-house models. Assistant hosting service, Specialized agents
Specialized agents Vertical agent implementations for job assessment, company understanding, post takeaways, interview tips, and general knowledge questions. Router, Skill layer, Generation model, Shared prompt templates
Skill layer LLM-friendly wrappers around LinkedIn RPC APIs and external APIs, with descriptions, schemas, mapping logic, and structured YAML invocation. Specialized agents, LinkedIn internal APIs, Bing API, Defensive YAML parser
LinkedIn internal APIs People, company, job, skill, course, analytics, and content services used to ground responses in LinkedIn-specific data. Skill layer
Bing API External retrieval source for broader web examples and facts. Skill layer
Defensive YAML parser Repairs common malformed structured-output mistakes before skill-call parsing, reducing failed invocations without a retry LLM call. Skill layer
Generation model Larger model step that filters noisy retrieved data and produces the synthesized answer. Specialized agents, Realtime messaging infrastructure
Shared prompt templates Common identity, conversation-history, jailbreak-defense, and UX prompt components consumed by vertical agents. Specialized agents
Realtime messaging infrastructure Streams generated tokens and incremental classification results to clients to reduce perceived latency. Assistant hosting service, Generation model, Member experience
Evaluation pipeline Combines engineer checks, linguist annotation, model-based evaluators, and member feedback to track quality, hallucination, Responsible AI, coherence, and style. Assistant hosting service

Data flow

A member clicks a starter question beside a feed item or job post. The service routes the request to a specialized agent, such as a general-knowledge, job, or career agent. That agent gathers grounding data through internal APIs, LinkedIn skills, and external search such as Bing, using structured YAML outputs to pick skills and call parameters. The generation step filters and synthesizes the dossier, decorates the answer with attachments, streams the final response through realtime messaging, and sends conversations into evaluation and annotation pipelines for quality tracking.

3 supporting quotes
“Our system takes your question and decides which AI agent is best equipped to handle it. In this case, it recognizes your interest in accessibility within tech companies and routes your query to an AI agent specialized in general knowledge seeking questions.”article, stated
“The AI agent calls a combination of internal APIs & Bing, searching for specific examples and case studies that highlight how accessibility in design has contributed to business value in tech.”article, stated
“The final synthesized response is also streamed all the way to the client using our realtime messaging infrastructure”article, stated

Why this architecture

LinkedIn kept the product architecture deliberately decomposed: routing and retrieval are classification-like and could be handled with smaller models and per-step evals, while generation needed larger models and more creative tuning. A common horizontal platform prevented independent agent teams from fracturing the experience, and skill wrappers let LLMs use LinkedIn-specific APIs without retraining on private data. Streaming, async execution, defensive parsing, and model tiering are production concessions to latency, capacity, and structured-output reliability.

4 supporting quotes
“Tuning ‘routing’ and ‘retrieval’ felt more natural given their classification nature: we built dev sets and fitted them with prompt engineering and in-house models.”article, stated
“By parallelizing tasks, we gained in terms of speed, but it came at the cost of fragmentation. Maintaining a uniform user experience became challenging when subsequent interactions with an assistant might be managed by varied models, prompts, or tools. To”article, stated
“LLMs, however, have not been trained with this information and hence are unable to use them as is for reasoning and generating responses.”article, stated
“To circumvent these limitations, we ended up writing an in-house defensive YAML parser. Through an analysis of various payloads, we determined common mistakes made by the LLM, and wrote code to detect and patch these appropriately before parsing. We also”article, stated

Models used: smaller routing/retrieval models · larger generation models · in-house models · model-based evaluators

Scale

Alternatives considered (roads not taken)

One general assistant team owning every capability

Rejected because: LinkedIn split work across vertical agent teams to move quickly, then added a horizontal platform pod to reduce fragmentation.

“We wanted to move fast across multiple teams and hence decided to split tasks into independent agents (i.e., AI agents) developed by different people: general knowledge, job assessment, post takeaways, etc.”article, stated

A fragmented set of fully independent agent products

Rejected because: Fragmentation made it hard to maintain a uniform user experience across models, prompts, and tools, so common prompts, UX, evaluation, and hosting were centralized.

“Maintaining a uniform user experience became challenging when subsequent interactions with an assistant might be managed by varied models, prompts, or tools.”article, stated

Re-prompting the LLM whenever structured YAML output failed

Rejected because: Re-prompting would add latency and burn scarce GPU capacity, so the team repaired common YAML mistakes locally.

“While this technique works, it adds a non-trivial amount of latency and also consumes precious GPU capacity due to the additional LLM call.”article, stated

Optimizing only time to first token

Rejected because: Chain-of-thought reasoning made time between tokens a major hidden-latency driver, so capacity and latency management had to account for TBT too.

“we initially only bounded TTFT as that mapped to member latency directly for our initial product. As we tackled hallucinations and Chain of Thought became prominent in our prompts, we neglected that TBT would hurt us much more”article, stated

Patterns

rag-retrieval (knowledge-access)

The assistant grounds responses by routing to an agent that calls LinkedIn internal APIs and Bing, then uses retrieved context to synthesize an answer.

“Some of you might’ve noticed from the explanation above that our pipeline follows what’s known as Retrieval Augmented Generation (RAG), which is a common design pattern with generative AI systems.”article, stated
“The AI agent calls a combination of internal APIs & Bing, searching for specific examples and case studies”article, stated

multi-agent-orchestration (orchestration)

Member queries are routed to specialized agents for job assessment, company understanding, post takeaways, career advice, and general knowledge.

“Routing: decides if the query is in scope or not, and which AI agent to forward it to. Examples of agents are: job assessment, company understanding, takeaways for posts, etc.”article, stated

tool-use-orchestration (tooling)

LinkedIn wraps internal RPC APIs as LLM-friendly skills so agents can select APIs, emit call parameters, and invoke LinkedIn-specific data services.

“We write prompts that ask the LLM to decide what skill to use to solve a particular job (skill selection via planning), and then also output the parameters to invoke the skill with (function call).”article, stated

structured-output-contract (interface)

Skill invocation requires structured YAML parameters matching LLM-friendly schemas, with parser repair for common schema and syntax mistakes.

“Since the parameters to the call have to match the input schema, we ask the LLM to output them in a structured manner.”article, stated

eval-driven-development (quality)

LinkedIn made evaluation the main signpost for prompt iteration and launch readiness, combining engineer checks, annotators, member feedback, and model-based evaluators.

“This became our main signpost to understand trends, iterate on prompts & ensure we were ready to go live.”article, stated

latency-optimization (operations)

The system streams end to end, progressively parses tool-call parameters, fires APIs as soon as parameters are ready, and uses async non-blocking execution to reduce perceived latency and wasted threads.

“we actually stream within our pipeline end to end. For example the LLM response deciding which APIs to call is progressively parsed and we fire API calls as soon as parameters are ready”article, stated

Tradeoffs

Agent organization

Chose vertical specialized agents plus a horizontal platform pod over one monolithic assistant team or fully independent agent experiences.

Rationale: Specialized teams could move quickly, while shared prompts, evaluation, UX, and hosting reduced product fragmentation.

“To address this, we adopted a simple organizational structure: * A small ‘horizontal’ engineering pod that handled common components and focused on the holistic experience.”article, stated

Model allocation

Chose small models for routing/retrieval and larger models for generation over using the largest model for every step.

Rationale: Routing and retrieval behaved more like classification tasks, while generation required higher-capability models for precision and synthesis.

“still requires a lot of work and creativity to gain every 1%. What worked for us: * Fixed 3-step pipeline * Small models for routing/retrieval, bigger models for generation * Embedding-Based Retrieval (EBR) powered by an in-memory database as our 'poor man's fine-tuning' to inject response”article, stated

Structured output format

Chose YAML skill-call parameters with a defensive parser over JSON or retrying failed structured-output calls with another LLM request.

Rationale: YAML consumed fewer tokens than JSON, and parser repair avoided extra latency and GPU capacity for re-prompts.

“We picked YAML because it is less verbose, and hence consumes fewer tokens than JSON.”article, stated
“While this technique works, it adds a non-trivial amount of latency and also consumes precious GPU capacity due to the additional LLM call.”article, stated

Latency strategy

Chose end-to-end streaming and async non-blocking execution over waiting for full LLM/tool completion before responding.

Rationale: Full answers could take minutes, so streaming and non-blocking processing reduced perceived latency and avoided tying up resources on I/O.

“a full answer might take minutes to complete, so we make all our requests stream to reduce perceived latency.”article, stated
“we optimized our service throughput by building a fully async non-blocking pipeline that does not waste resources on account of threads blocked on I/O.”article, stated

Gotchas (what bit them)

Independent agent teams can fragment the user experience.

Root cause: Different vertical teams may ship different models, prompts, tools, and interaction patterns for subsequent turns of the same assistant.

Resolution: Create a horizontal pod for hosting, evaluation, shared prompts, shared UX components, instrumentation, and server-driven UI.

“By parallelizing tasks, we gained in terms of speed, but it came at the cost of fragmentation. Maintaining a uniform user experience became challenging”article, stated

Human evaluation guidelines were hard to make consistent for nuanced career advice.

Root cause: Some answers had to be factual and empathetic at the same time, especially when users were considering career changes.

Resolution: Develop consistent annotation guidelines and use linguist-built tooling and processes for scaled scoring.

“We want it to be factual but also empathetic. Some members may be contemplating a career change into fields where they currently do not have a strong fit”article, stated

Structured tool-call parameters failed often enough to break production parsing.

Root cause: About 10% of LLM outputs had invalid schema formats or were not valid YAML at all.

Resolution: Analyze common mistakes, patch them before parsing, and add prompt hints to reduce bad structured outputs to about 0.01%.

“Through an analysis of various payloads, we determined common mistakes made by the LLM, and wrote code to detect and patch these appropriately before parsing.”article, stated

Quality improvement plateaued after early progress.

Root cause: The easy 80% experience arrived quickly, but hallucination detection and every additional quality percentage point required far more effort.

Resolution: Invest in more sophisticated evaluation, automated evaluators, and fine-tuning to make the pipeline more data-driven.

“We underestimated the challenge of detecting and mitigating hallucinations, as well as the rate at which quality scores improved—initially shooting up, then quickly plateauing.”article, stated

Bounding only TTFT hid latency created by chain-of-thought tokens.

Root cause: Hidden reasoning tokens make time-between-tokens accumulate into visible delay even before member-visible output appears.

Resolution: Increase capacity quickly during the ramp and work on moving simpler tasks to in-house fine-tuned models, predictable deployments, and token reduction.

“This caused one of our public ramps to suddenly sound alerts left and right that some tasks were hitting timeouts, and we quickly had to increase capacity to alleviate the issue.”article, stated

Evaluation

LinkedIn used a layered evaluation process: engineers ran fast directional checks, internal linguists annotated up to 500 conversations per day with quality and safety metrics, member feedback supplied scale, and model-based evaluators were being built for faster experimentation.

Metrics: overall quality score · hallucination rate · Responsible AI violation · coherence · style · up to 500 daily conversations · 1+ day delay for annotation metrics · 3+ days for some member-feedback metrics

3 supporting quotes
“Our internal linguist team built tooling and processes by which we could evaluate up to 500 daily conversations and get metrics around: overall quality score, hallucination rate, Responsible AI violation, coherence, style, etc.”article, stated
“Without it, engineers are left with eye-balling results and testing on a limited set of examples, and having a 1+ day delay to know metrics.”article, stated
“had some success on hallucination detection (but it wasn’t easy!).”article, stated

Outcomes

The case reports a six-month build, dozens of agents, annotation of up to 500 conversations daily, and production ramps that exposed capacity and latency limits.

3 supporting quotes
“In just a few days we had the basic framework up and running: * Routing: decides if the query is in scope or not, and which AI agent to forward it to.”article, stated
“The team achieved 80% of the basic experience we were aiming to provide within the first month and then spent an additional four months attempting to surpass 95% completion”article, stated
“As we continue to refine quality, develop new features, and optimize the pipeline for speed, we'll be rolling out to more users very soon.”article, stated