Mathematical Foundations of Modeling in MangaAssist
This folder explains the math that sits underneath the modeling stack used in MangaAssist. The focus is not only on formulas, but on how those formulas show up in practice across intent routing, retrieval, reranking, and generation.
Where public vendor documentation does not expose internal implementation details, these notes stay at the architectural level instead of asserting proprietary internals as facts.
Reading Order
| Document | What it covers | Why it matters |
|---|---|---|
| 01-matrix-theory-and-linear-algebra.md | Vectors, matrices, attention, decompositions, and factorization | Establishes the shared language behind embeddings, transformers, and recommenders |
| 02-linear-regression-and-generalized-models.md | OLS, logistic regression, GLMs, regularization, and optimization | Connects classical modeling to baselines, calibration, and classifier heads |
| 03-neural-network-architectures.md | Feedforward networks, encoder-only models, decoder-only models, and rerankers | Shows how the project combines different neural architectures for different jobs |
| 04-embedding-and-retrieval-architectures.md | Embeddings, similarity, ANN search, chunking, reranking, and retrieval metrics | Explains the math behind the RAG path that grounds model responses |
| 05-tools-and-libraries.md | PyTorch, Transformers, Bedrock, OpenSearch, SageMaker, and evaluation tooling | Maps the theory to the tools that operationalize it |
How This Maps to the Project
Every major model component in MangaAssist relies on the ideas in this folder:
DistilBERTuses matrix multiplication, attention, layer normalization, and a linear classification head.Titan Text Embeddings V2produces dense vectors that can be compared with cosine similarity for retrieval.- The
MiniLMreranker scores query-document pairs with token-level interaction rather than raw vector similarity alone. Claude 3.5 Sonnetis consumed as a large decoder-style text generation model whose outputs still rely on softmax, attention, and autoregressive next-token prediction.- The recommendation layer can be interpreted through matrix factorization and latent-vector scoring.
Suggested Use
If you are new to the topic, read the files in order. If you are debugging a retrieval or ranking issue, start with 04-embedding-and-retrieval-architectures.md. If you are trying to understand why the model stack behaves the way it does, pair 01-matrix-theory-and-linear-algebra.md with 03-neural-network-architectures.md.