---
title: "Discussion on \"Choosing the Embedding Architecture for BrainZen\" | Hashnode"
description: "Discussion on \"Choosing the Embedding Architecture for BrainZen\". How I chose browser-side embeddings for BrainZen, comparing API, backend, and inference-server architectures and their tradeoffs."
url: "https://hashnode.com/posts/choosing-the-embedding-architecture-for-brainzen/6ab2c83bfeb6439ce5f73dc5"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Choosing the Embedding Architecture for BrainZen](https://learningwithyahya.hashnode.dev/choosing-the-embedding-architecture-for-brainzen?utm_source=hashnode&utm_medium=feed)

How I chose browser-side embeddings for BrainZen, comparing API, backend, and inference-server architectures and their tradeoffs.

Sep 22 · 5 min read · learningwithyahya.hashnode.dev  
Read the article

-   [#semantic-search](https://hashnode.com/tag/semantic-search)
-   [#search](https://hashnode.com/tag/search)
-   [#vector-search](https://hashnode.com/tag/vector-search)
-   [#information-retrieval](https://hashnode.com/tag/information-retrieval)
-   [#ai](https://hashnode.com/tag/ai)
-   [#embeddings](https://hashnode.com/tag/embeddings)
-   [#hybrid-search](https://hashnode.com/tag/hybrid-search)
-   [#nlp](https://hashnode.com/tag/nlp)
-   [#mongodb-atlas](https://hashnode.com/tag/mongodb-atlas)
-   [#transformersjs](https://hashnode.com/tag/transformersjs)
-   [#huggingface](https://hashnode.com/tag/huggingface)
-   [#software-architecture](https://hashnode.com/tag/software-architecture)
-   [#typescript](https://hashnode.com/tag/typescript)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#machine-learning](https://hashnode.com/tag/machine-learning)
-   [#lexical-search](https://hashnode.com/tag/lexical-search)
-   [#system-design](https://hashnode.com/tag/system-design)

## Written by

[Mohammed Yahya Ahmed](https://hashnode.com/@yahyaahmed)

@yahyaahmed

  
[View profile](https://hashnode.com/@yahyaahmed)

Full-stack developer | MERN • TypeScript • PostgreSQL • AI | Learning in public

Hi🤗, I'm a software developer focused on building full-stack applications and understanding how things work under the hood. Currently exploring full-stack development, search systems, AI, and backend architecture. I enjoy turning what I learn into real projects and writing about the concepts, problems, and lessons I encounter along the way. This space is where I document my learning journey, experiments, and things I wish I had understood earlier.

## Responses 1

Markdown supported · ⌘↵ to post

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[Oct 11](https://hashnode.com/posts/choosing-the-embedding-architecture-for-brainzen/6ab2c83bfeb6439ce5f73dc5/comment/6acb5af1b19fbe5ad15d688f)

The module-level cache prevents repeated loads after initialization, but two concurrent first calls can both see extractor as null before either pipeline promise resolves. A document upload and a query arriving together could therefore start two model initializations.

I would cache the initialization promise immediately, then clear it if loading fails so a later request can retry. A fixture with two simultaneous generateEmbedding calls and one rejected initialization would cover both concurrency and recovery. That keeps the browser architecture lightweight while making the claim that the model loads exactly once true during startup as well as steady use.
