Algorithms

Algorithms turn a well-defined problem into a reproducible computational procedure.

Constrained optimization: how to formalize a choice instead of picking it by hand

How to turn a practical choice into a model: decision variables, an objective function, hard and soft constraints. A checkable numerical example shows the difference between a feasible and an optimal solution, between fractional and integer choice, and the effect of the penalty weight. Here, optimum always means the best solution within the given model.

2026.10.19

How a Language Model Works: The Path from Tokens to an Answer

A step-by-step analysis of how an autoregressive language model works: tokenization using the verifiable example “2 + 2 = 4” in the r50k_base encoding, vector representations and position, the attention mechanism with a causal mask, Transformer blocks, next-token probabilities, and the rules used to choose a token. The article also examines the differences between training and inference, as well as practical limits: the context window, factual errors, memorization of training data, and architectural differences.

2026.10.01

Deterministic Computations Inside Probabilistic AI Systems: Architecture, Accuracy, and Reproducibility

Probabilistic text generation and deterministic computation do not contradict each other. A language model can interpret a prompt and select an operation, while verifiable code performs the arithmetic, database query, or other critical calculation. However, execution determinism must not be conflated with bitwise reproducibility, numerical accuracy, and problem formulation correctness. The article breaks down greedy decoding and sampling, external function calls, floating-point arithmetic limitations, CPU/GPU reproducibility levels, and the practical role of seed, `system_fingerprint`, and `torch.use_deterministic_algorithms(...)`.

2026.09.27

How to Read a SQL Execution Plan and Distinguish the Cause of a Slow Query from a Symptom

An execution plan does not explain a delay by itself: it shows the way the optimizer chose to process the data. To find the cause, you must match the estimates against the metrics of the specific execution, find the first significant cardinality gap before the growth in work, account for repetitions of operators, and check I/O, temporary data, and waits outside the plan. The article gives a step-by-step analysis method for PostgreSQL, SQL Server, Oracle Database and MySQL 8.x.

2026.09.19