About

NEGABARO AI

A technical encyclopedia of essential AI/ML concepts

Foundation

What Is a Neural Network? Layers, Weights, and Backpropagation

Connectionist learning model inspired by neurons

A learning method that transforms input data through weights across multiple layers and reduces errors via backpropagation

What Is a Transformer? Parallel Processing with Self-Attention

How it got past the sequential limits of RNNs

"Attention Is All You Need" — an architecture that overcomes RNN's sequential processing limitations using Self-Attention to process entire input sequences in parallel

AI Preprocessing Difficulty — Text, Image, Audio, Video, 3D in Order of Complexity

model(input) is one line, but the preprocessing to create that input is completely different per domain

AI is always model(input) → output, but preprocessing difficulty varies by domain. Text (tokenization = lookup) is easiest, then image (resize + normalize), audio (STFT + mel), video (frame extraction + temporal), 3D (point cloud + voxel). Start with text.

Text AI Pre-trained Model Catalog — 12 Things You Can Do in 3 Lines of Code

From sentiment analysis to code generation — model list and difficulty for HuggingFace one-liners

Text has the simplest preprocessing (tokenization = lookup table), making it ideal for AI beginners. HuggingFace pipelines enable sentiment analysis, translation, summarization, QA, text generation, code generation, NER, similarity comparison and more in 3 lines. Model recommendations, sizes, and difficulty per task.

HuggingFace pipeline() — How the npm of AI Models Works

1M+ models registered on the Hub, pipeline() auto-downloads by name and runs inference

HuggingFace Hub is the npm of AI models. Anyone can upload models, and pipeline() auto-downloads weights, tokenizer, and config by name. Text, audio, image, video — change the task name and use the same interface for 1M+ models.

Rap AI Model Catalog — Lyrics Generation, Rhyme Detection, and Flow Analysis

GPT-2 rap fine-tuned models + pronouncing rhyme analysis + all runnable code

Several rap lyrics generation models exist on HuggingFace. GPT-2 fine-tuned on rap lyrics runs directly via pipeline(), and the pronouncing library handles rhyme detection and syllable analysis. Lyrics generation → rhyme check → flow analysis, all in code.

Don't Put PyTorch, Hugging Face and Ollama on the Same Shelf — AI Frameworks Come in Three Layers

What does the math, what loads the model, what runs it fast

AI frameworks split into three layers: base frameworks (PyTorch), model libraries (HF transformers) and inference engines (llama.cpp, Ollama, vLLM). Compare only within a layer. To use a local model from Rails you end up running a separate Python server or calling it through ONNX.

Architecture Is the Circuit, Weights Are the Knob Positions — and Attention Variants Are Hacks Around n²

Can you use a model as soon as its weights are public, and why GQA matters for long context

A model file splits into a blueprint (config) and weights. The blueprint is usually public, and all of the model's knowledge lives in the weights. The architectural differences between labs are mostly Attention tweaks, aimed at the n² cost of every token looking at every token and at KV cache memory.

Training

What Is Pre-training? How LLMs Learn General Knowledge

Next-token prediction, repeated over internet-scale text

The process of acquiring general knowledge — grammar, facts, reasoning — by repeatedly predicting the next token from internet-scale text data

What Is Fine-tuning? Retraining a Pre-trained Model for One Task

Turning a general model into a specialist with extra training

The process of further training a pre-trained model's weights on domain or task-specific data to transform a general model into a specialist

UPDATED

What Is RLHF? Aligning LLMs with Human Feedback

Reinforcement Learning from Human Feedback

Humans pick which of two answers is better, a reward model learns from those picks, and PPO nudges the LLM toward higher scores. After this post you will know what each of the three stages does and whether SFT, DPO or RLHF fits your own project.

UPDATED

What Is DPO? Skipping RLHF's Reward Model and PPO

Direct preference optimization without a reward model

Train an LLM straight from "chosen / rejected" answer pairs and skip RLHF's reward model and PPO. After this post you will know what the DPO loss pushes and pulls, how to read β and the loss number, and when DPO is a fine replacement for RLHF.

UPDATED

What Is LoRA? Fine-tuning with Only a Few Trainable Parameters

Freeze the original weights and add two low-rank matrices

Fine-tuning that freezes the original weights and trains only two small matrices (B and A). When I attached it to a 7B-shaped model and counted, 0.06–0.6% of the parameters were trainable. After reading you can pick Full FT, LoRA or QLoRA for your GPU

Inference vs Fine-tuning — Using Someone Else's Model vs Making Your Own

pipeline() is ordering delivery, fine-tuning is taking a recipe and adjusting seasoning to your taste

Inference is using someone else's trained model. Fine-tuning is retraining that model with your data to create your own. Fine-tuning doesn't train from scratch — it slightly adjusts an already well-trained base model, doable on a single laptop GPU. Sentiment analysis is the best starting point.

The Simplest Fine-tuning Guide in the World — It's Adjusting, Not Merging

Slightly adjusting 66M numbers. Not injecting data into a model, not merging models together

Fine-tuning isn't merging data into a model or adding models together. It's slightly adjusting the weights (66M numbers) of a completed model while showing it your data. Like giving OJT to a college graduate — not re-reading textbooks, but teaching new job skills on top of existing knowledge.

LoRA — Don't Change All 66M, Just Plug In a 1M Adapter

Efficient alternative to fine-tuning — freeze the base model, train just two small matrices

Fine-tuning adjusts all 66M numbers. LoRA freezes the base model and trains only a small adapter (1M) alongside it. Similar quality, much less training time, memory, and storage. Like putting a case on your phone — you don't change the phone itself, just swap cases.

RAG — Giving the Model Reference Materials Without Retraining

Retrieval + Generation — attach external knowledge to prompts without changing model weights

RAG (Retrieval-Augmented Generation) doesn't change model weights at all. Instead, when a question comes in, it retrieves relevant documents and attaches them to the prompt before passing to the model. Like bringing open-book reference materials to an exam. Unlike fine-tuning, when data changes you just update the documents.

Model Merging — The Only Way to Actually "Add" Two Models Together

Korean model + coding model = model that codes in Korean? Merge by averaging weights

Model merging is the only technique in AI that truly qualifies as "adding." Average the weights of two models into one. Merge a Korean model and a coding model, you might get a model that codes in Korean. No training needed, no GPU required. But it's experimental — results aren't guaranteed.

Inference

What Is Prompt Engineering? Steering LLM Output Through Input

No weight changes — better results from the input alone

The art of designing optimal inputs (prompts) to guide LLMs toward desired outputs. Maximizes performance through input alone without changing model weights

What Is RAG? Letting an LLM Answer with Retrieved Documents

Use up-to-date or specialist knowledge the model never trained on

A method where LLMs retrieve relevant documents from a vector DB before generating answers, appending them to the prompt. Enables use of latest/specialized knowledge not in training data

What Is Chain-of-Thought Prompting? Step-by-Step Reasoning in LLMs

A prompting technique that helps on math, logic, and code

A prompting technique that instructs the LLM to "think step by step," explicitly generating intermediate reasoning steps. Dramatically improves performance on complex math, logic, and coding problems

UPDATED

What Is Function Calling? How LLMs Call Tools with JSON

Hand over a schema, let the model pick arguments, return the result

The model never runs your function. It emits JSON saying "call this with these arguments" and your code does the running. After reading you can wire the request → call → run → return-result loop yourself and tell it apart from structured outputs and MCP

Jev: The LLM That Doesn't Write, It Just Decides

Takes input like an LLM, answers like a classifier. It takes over the spots where we made LLMs act as if statements

Jev returns probabilities for predefined choices instead of text. You can use it like a classifier that needs no per-task training, and the point is to split work by probability into auto-apply, human check and hand-off. It does not fit work that needs a written reason.

Scaling & Optimization

What Is Quantization? Shrinking Models with Lower-Precision Weights

From FP32/FP16 to INT8/INT4 to cut memory use

An optimization technique that converts model weights stored in FP32 (32-bit) or FP16 (16-bit) to INT8 (8-bit) or INT4 (4-bit), reducing model size and memory usage by 1/2 to 1/8

What Is Knowledge Distillation? Teaching a Small Model from a Big One

The Student learns by imitating the Teacher's output distribution

A technique that trains a small model (Student) to mimic the output distribution (soft labels) of a large model (Teacher), bringing small model performance close to large models

What Is Mixture of Experts (MoE)? Big Models, Small Compute

A router picks experts per token — the Mixtral 8x7B example

An architecture that activates only a subset of expert networks instead of one massive model. Total parameters are large but actual computation uses only a portion

What Is Speculative Decoding? Faster LLM Inference with a Draft Model

The large model only verifies the draft in one pass

A technique where a fast small model (Draft Model) generates multiple tokens at once, and a slow large model (Target Model) verifies/corrects them all at once, improving inference speed by 2-3x

NEW

Every Azure OpenAI Batch Suddenly Failed with 500: the 500-File Limit and the API That Hid the 400

Delete, expire or sweep: which to pick, and how to stop flattening 4xx errors

Batch input files stay around after the job is done. Without an expiry, uploads stop at 500 per resource, and if a middle API turns that 400 into a 500 the cause hides behind two layers. After this post you can work out when your resource will hit the wall and prevent it with one upload parameter.

Agent & Tool Use

What Is an AI Agent? LLMs That Plan and Use Tools

The plan → tool call → observe → next action loop

A system using LLMs as the "brain," repeating plan → tool call → observe result → decide next action to autonomously perform complex tasks

What Is MCP? One Standard Instead of N×M AI-Tool Integrations

Standard protocol connecting AI to external tools

An open protocol by Anthropic that connects AI models to external tools (DB, files, APIs) in a standardized way. Like USB-C, "one standard to connect all tools"

What Is Eval-Driven Development? Improving AI Systems with Evals

Measure prompt, model, and RAG changes with automated evals

A development methodology that measures the impact of changes to prompts, models, RAG pipelines, etc. through automated evaluation (Eval) and improves based on data

Same Reviewer, Different Results — AI Code Quality Is Decided Before the Review

Putting "just build it" next to a plan-approval harness

When AI writes the code, quality depends less on the reviewer and more on what a human approved before any code existed, and whether the first PR a human sees has already been filtered. One-line changes: just ask. Design choices or DB changes: use the harness.

NEW

Giving an AI Agent Production Data: Block Writes with Database Permissions, Not the Prompt

Why we added a read replica and a bastion when exec already worked, and what PostgreSQL actually refuses

Telling an AI agent to only read is a probabilistic promise, and even a read-only session setting turns off with one SET. After this post you'll know what actually refuses a write, and how far to separate database access for AI-driven investigation.

NEW

Don't Ask the Agent, Enforce It with Hooks: What I Took from Reading oh-my-openagent's Code

A harness that grew to 57 hooks, one per failure mode, and how the hooks started colliding until every message had to go through one gate

Write re-read before editing or don't stop with todos left in a prompt and the agent follows it most of the time. Only most. The OpenCode plugin oh-my-openagent blocks these in hook code instead. After this post you can pick which rules to move into hooks, and try one right away with a Claude Code Stop hook.

Speech & Audio AI

What Is Audio Tokenization? How Neural Codecs Turn Sound into Tokens

EnCodec, SoundStream and RVQ — why modern TTS runs like an LLM

Technology that converts continuous audio waveforms into discrete token sequences using VQ-VAE based codecs (EnCodec, SoundStream, etc.), enabling generation and understanding via Transformers like text

Evolution of Speech Models

Rule-based → Deep learning pipeline → Token-based → Unified multimodal

History of TTS technology evolution: 1st gen (rule/concatenative synthesis) → 2nd gen (statistical parametric) → 3rd gen (deep learning mel spectrogram pipeline) → 4th gen (token-based LLM approach) → future (unified multimodal)

Pre-training vs Fine-tuning in Real Code: A GPT-SoVITS Case Study

Reading an open-source voice synthesis project

A case study analyzing how Pre-training and Fine-tuning are implemented in actual code through the GPT-SoVITS open-source project

Demucs Code Analysis — How One Song Gets Split into Vocals, Drums, Bass, and Guitar

Meta/Facebook Research's Hybrid Transformer source separation model — architecture, inference pipeline, real-world usage

Demucs is an open-source music source separation model by Meta (Facebook Research). It splits a complete song into 4 stems: vocals, drums, bass, and other. The current version htdemucs combines a time-domain encoder-decoder with a frequency-domain Transformer in a hybrid architecture.

Mel-Band RoFormer Karaoke Model — How 913MB Isolates Lead Vocals Only

RoPE + mel-scale frequency decomposition + hierarchical time-freq Transformer — with code and config

The Mel-Band RoFormer Karaoke model by UVR community's aufr33+viperx is a 913MB PyTorch checkpoint. A karaoke-specific model that isolates lead vocals while keeping backing vocals in the instrumental. 60 mel bands decompose frequencies, and a hierarchical Transformer alternating between time and frequency axes is the core. SDR 10.1956.

UVR Mel-Band RoFormer vs Demucs — Music Source Separation Model Comparison

Karaoke-specific 2-stem vs general-purpose 4-stem — architecture, training, performance, selection criteria

Comparison of the two most popular source separation models. UVR Mel-Band RoFormer Karaoke is a 913MB karaoke-specific model isolating lead vocals only, while Demucs htdemucs is an 80MB general-purpose model splitting into 4 stems. Different tools for different jobs.

Vocal Separation in 2 Minutes — Running Demucs and UVR Karaoke Locally

Hands-on comparison — installation, execution, processing time, and output from actual runs

Installed and ran both Demucs and UVR Karaoke locally. Demucs: one pip install + one command, 80MB model, 10s audio in 10s. UVR Karaoke: 913MB model, same audio in 43s. Demucs is simpler; UVR has better karaoke quality.

Audio AI Foundations — What Demucs, Mel-Band RoFormer, and GPT-SoVITS Share

STFT spectrograms, Transformer attention, encoder-decoder, PyTorch — the shared DNA of audio AI

Source separation (Demucs, Mel-Band RoFormer) and voice synthesis (GPT-SoVITS) have different goals but share the same foundation. STFT converts audio to frequency domain, Transformers capture long-range dependencies, encoder-decoders decompose and reconstruct. Understanding this shared DNA unlocks all of audio AI.

Audio AI Hello World — 7 Projects in 5 Minutes with Pre-trained Models

One pip install + 3 lines of code for source separation, speech recognition, TTS, pitch detection, and music generation

No training, no GPU, 3 lines of code. Source separation, speech recognition, TTS, pitch detection, music tagging, sound classification, music generation — all using pre-trained model downloads with immediate results.

input → pre-trained model → output — The Essence of AI Inference in One Line

Forget STFT and masking — the model does exactly one thing: take input, produce output

In audio AI pipelines, STFT, masking, and ISTFT are all math. The neural network does exactly one line — model(input) produces output. Source separation, speech recognition, TTS, sound classification all follow this structure.

Voice Cloning Is a Prompt, Not Training — Modern TTS Is an LLM Over Audio Tokens

What the Fish Audio API fields give away: you pass a voice as a reference clip, not a model id

Modern TTS turns audio into codec tokens and predicts the next one, the same way an LLM does with text. So "speak in my voice" means putting a reference clip in front of the prompt, not training a new model. The Fish Audio API field names make this obvious.

OCR & Document AI

OCR Open Source Catalog — Every Way to Extract Text from Images

From Tesseract to EasyOCR, PaddleOCR, Surya, TrOCR, Qwen2-VL — difficulty, language, speed comparison

OCR is entirely a neural network domain. Image → model(image) → text. From the easiest EasyOCR (3 lines, 80 languages) to CJK-strongest PaddleOCR, latest high-precision Surya, Transformer-based TrOCR, and multimodal LLMs (Qwen2-VL).

PDF-Specialized OCR — Tools That Convert Complex Layouts, Tables, and Equations to Markdown

Marker, Docling, MinerU, Nougat, olmOCR — making PDFs readable for LLMs

Regular OCR extracts text from images, but PDFs are more complex — multi-column layouts, tables, equations, code blocks, headers/footers. PDF-specialized tools understand this structure and convert to Markdown/JSON. Essential first step for RAG pipelines.

Contract & Legal Document OCR — Clause Extraction, Party Identification, Structuring

Structuring contracts with Legal-BERT, CUAD and LayoutLMv3, and where to split API and local

With contract OCR, pulling out text is the easy part. The real work is extracting clauses, parties and deadlines from it. OCR, field extraction and clause classification are structured tasks that small or local models handle; only open-ended reading like "find risky clauses" goes to a large LLM API. API versus local is decided by whether data may leave, how structured the task is, and volume, not by accuracy.

Japanese-Specialized OCR — Manga, Vertical Text, Furigana, and Historical Documents

manga-ocr, Sarashina2.2-OCR, PaddleOCR, KuroNet — every option for Japanese OCR

Why Japanese OCR is hard: vertical text (tategaki), furigana, mixed hiragana/katakana/kanji, manga-specific fonts. manga-ocr (manga-specific), Sarashina2.2-OCR (best Japanese document accuracy), PaddleOCR (general CJK), KuroNet (historical kuzushiji).

OCR Fine-tuning Guide — Building Your Own Model That Reads Japanese Real Estate Contracts

TrOCR + Trainer.train() — exactly the same pattern as sentiment analysis fine-tuning

OCR fine-tuning has the same structure as sentiment analysis fine-tuning. Input changed from text to image, but adjusting model weights with Trainer.train() is identical. TrOCR (ViT encoder + text decoder) is easiest — standard HuggingFace interface.

OCR API Catalog — Extract Text with One API Call, No Model Management

Google Vision, Azure Document Intelligence, AWS Textract, Clova OCR — price, accuracy, code comparison

OCR without installing or managing models — just API calls. Google Cloud Vision (highest accuracy), Azure Document Intelligence (contract/receipt specialized), AWS Textract (strong table extraction), Naver Clova OCR (best Korean) — code examples and pricing compared.

Japanese Contract OCR Benchmark — API vs Open Source, Which Is Better?

Google Vision, Azure, PaddleOCR, Sarashina2.2 — accuracy, speed, price comparison on Japanese contracts

Comparing API (Google Vision, Azure) and open-source (PaddleOCR, Sarashina2.2-OCR, manga-ocr) performance on Japanese real estate contracts. Accuracy: Google Vision ≈ Sarashina2.2 > PaddleOCR > Azure > EasyOCR. Cost: open-source $0 vs API per-page billing.

OCR Comprehensive Comparison — API vs Open Source vs Fine-tuning, What Should You Use?

Accuracy, cost, security, difficulty, and maintenance of 3 approaches in one chart

3 ways to implement OCR: API calls (Google Vision, etc.), open-source self-hosting (EasyOCR, PaddleOCR, etc.), fine-tuning (TrOCR, manga-ocr). Comparing across 5 axes — accuracy, cost, security, difficulty, maintenance — the optimal choice varies by situation.

Azure Document Intelligence Pre-built Models — All 15 Models from Receipts to Contracts

prebuilt-read, prebuilt-receipt, prebuilt-contract, prebuilt-invoice — change model name, get structured data

Azure Document Intelligence isn't just OCR. It has 15+ pre-built models per document type. Feed a receipt, get store name, date, amount. Feed a business card, get name, title, phone. Feed a contract, get parties, jurisdiction, clauses. All as structured JSON. Just change the model name.

Structured Document Extraction API Comparison — What Azure, Google, AWS Each Offer

Does Google and AWS have "document understanding APIs" like Azure prebuilt-contract?

APIs that structurally extract fields per document type — like Azure's prebuilt-contract — exist in Google (Document AI) and AWS (Textract) too. But supported document types, languages, and pricing all differ. Azure has the most specialized models, Google has strong custom processors, AWS specializes in table extraction.

Face, Avatar & Video AI

A Talking AI Avatar Is Not One Model — It Is STT, LLM and TTS With a Face on the End, and Latency Adds Up

Look at this before face quality: four stages of latency, and streaming that overlaps them

A talking AI avatar is a voice agent (STT -> LLM -> TTS) with a face generator bolted on. What users feel is decided by the sum of four latencies, not by the face model. Measure per stage, overlap with streaming, handle interruptions, in that order.

Pick an AI Avatar SDK by How Much You Can Unbundle — Anam's Three Modes and the Work That Moves to You

What I hit wiring up full, custom_llm and passthrough: a 400, PCM formats, and keeping the API key on the server

Choose an AI avatar service by which stages you can take over, not by face quality. Anam has three modes (full, custom_llm, passthrough); the more you unbundle, the more interruption handling and audio formatting land on you. Keep the API key on the server and give the browser only a session token.

FaceFusion Is a Parts Assembler, Not a Method — A Map of Four Families of Face-Changing AI

Face swap, identity-conditioned generation, reenactment, video generation: different families are not comparable

Face-changing AI falls into four families: face swap, identity-conditioned generation, face reenactment and video-generation replacement. Tools in different families are not comparable. FaceFusion is a face-swap tool, a shell that lets you swap detection, swap and enhancement models. Most parts come from InsightFace, whose models are licensed for non-commercial research.

Face Swap Can't Change Your Hair Because of the Mask, Not the Model — A Relay of Several Models

Taking FaceFusion apart: hair was never in scope, and the flicker was an "another person" check

Face swap is a pipeline where several models hand off: detection, landmarks, alignment, identity, swap, mask, enhancement. The swap model only draws inside the aligned face crop and the mask pastes back only the face, so no model will change the hair. The flicker came from reference mode's "another person" check and went away in one mode.

Putting Your Face Into a Music Video Scene — Three Methods That Solve Different Problems

Running FaceFusion, Runway Aleph and Nano Banana Pro + Veo myself; one got stuck at the payment step

Most "my face in this MV scene" videos only swap the face (FaceFusion and similar). The acting and lighting survive, but the hair stays the original actor's. To replace the whole person you need video replacement like Runway Aleph; if it can differ from the original, edit the first frame and generate a new clip. Generative APIs may block it with celebrity filters.

Split AI Tags by How You Use a Shot in the Edit, Not by What Is in It — 12 Axes Across 4,341 Files

Stuck picking footage for a family video, I rebuilt the tag scheme, and fixed about half of it by eye

When editing, the questions you ask aren't "what is in this shot" but "is there a wide shot for the opening" or "is there room for a caption". So I split tags into 12 `axis:value` axes such as framing, empty space, quality and use, all computed locally on macOS. Checking 14 samples per tag by eye showed that few of the first rules were usable as is.