AI that survives contact with production #
I am interested in AI as a systems discipline: how models interact with data, tools, people, latency budgets, evaluation, and failure. Model capability matters, but the product is the complete decision loop around the model.
This page is a working map of papers, ideas, and engineering notes I use while building AI-enabled products such as Saleslyt.
My current principles #
- Start with the decision, not the model. Define what the system must decide, for whom, with what evidence, and at what cost of error.
- Prompts are code and data. Version them, review them, evaluate them, and observe their behaviour in production.
- Retrieval is a data-quality problem. Better chunking, metadata, ranking, and source coverage often beat a larger generation model.
- Agents need bounded authority. Tool access, budgets, termination conditions, and audit trails are architectural requirements.
- Evaluation is part of the product loop. Offline benchmarks, adversarial cases, production traces, and user corrections should inform each other.
- Use the smallest model that clears the bar. Quality is one axis beside latency, privacy, operational control, and total cost.
LoRA and parameter-efficient adaptation #
LoRA freezes a pretrained model and learns small low-rank matrices inside selected layers. Instead of maintaining a complete model copy for every task, we store compact adapters.
The useful mental model is not “cheap fine-tuning.” It is controlled specialization:
- keep a stable base model;
- train small, independently versioned adapters;
- choose adapter rank and target modules based on the task;
- evaluate whether the specialisation improves the exact behaviour that matters.
What rank means #
If a weight update can be approximated by two narrow matrices, its effective change lives in a lower-dimensional space. The rank controls the capacity of that update. Higher rank is not automatically better; it adds parameters and may fit noise without improving the target behaviour.
QLoRA #
QLoRA combines low-rank adapters with a frozen, quantized base model. Its practical importance is memory: adaptation becomes possible on much smaller hardware while preserving strong task performance.
Questions I ask before fine-tuning:
- Is the problem missing knowledge, missing context, or wrong behaviour?
- Can retrieval or a better interface solve it without changing weights?
- Is there enough representative, permissioned training data?
- What regression suite will detect damage to general capability?
- Can the adapter be rolled back independently?
Retrieval-augmented generation #
Retrieval-Augmented Generation connects generation to an external corpus. In production, RAG is not one technique but a pipeline:
ingest → clean → segment → enrich → embed → retrieve → rerank → assemble → generate → cite → evaluate
Each arrow is a place where relevance can be lost.
Failure patterns #
- the answer exists but the correct passage is never retrieved;
- the passage is retrieved but pushed out of the context window;
- stale or conflicting sources are treated as equally authoritative;
- the model answers fluently when retrieval confidence is weak;
- citations point to a source that does not support the claim.
My preferred design makes evidence visible, attaches provenance to every chunk, measures retrieval separately from generation, and gives the system an honest abstention path.
For the lexical side of a retrieval stack, read BM25 from first principles: the scoring math, inverted-index execution, Elasticsearch behavior, relevance evaluation, and hybrid fusion with dense retrieval.
Agents and tool-using systems #
ReAct demonstrated the value of interleaving reasoning and actions. The production lesson is that a tool-using model is a workflow engine with probabilistic control logic.
An agent needs:
- a clear objective and explicit stopping condition;
- narrowly scoped, typed tools;
- limits on time, steps, tokens, and money;
- confirmation boundaries for consequential actions;
- durable state for long-running work;
- traces that explain tool selection and outcomes;
- deterministic fallbacks when model control fails.
The right question is rarely “How autonomous can this be?” It is “Which decisions can be delegated safely, observed clearly, and reversed cheaply?”
Evaluation #
A single aggregate score hides the failures users remember. I prefer an evaluation portfolio:
- golden cases for core product behaviour;
- edge cases for ambiguity, missing context, and conflicting evidence;
- adversarial cases for prompt injection and unsafe tool use;
- pairwise review when quality is subjective;
- task metrics such as resolution rate, correction rate, and time saved;
- operational metrics such as latency, token use, failure rate, and cost.
G-Eval is useful context for model-based evaluation, but an evaluator model is still a measurement instrument with bias and variance. Calibrate it against human judgement and preserve the raw evidence.
Papers I keep returning to #
Foundations #
- Attention Is All You Need — the Transformer architecture
- Language Models are Few-Shot Learners — scale and in-context learning
- Training Compute-Optimal Large Language Models — balancing model size and training tokens
Adaptation #
- LoRA: Low-Rank Adaptation of Large Language Models
- QLoRA: Efficient Finetuning of Quantized LLMs
- Direct Preference Optimization — preference alignment without an explicit reward model
Retrieval and context #
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
- Lost in the Middle — how position affects long-context use
- ColBERT — late interaction for efficient neural retrieval
Reasoning, tools, and evaluation #
- ReAct — reasoning and acting with language models
- Toolformer — teaching models to use external tools
- G-Eval — evaluation with chain-of-thought-enabled language models
Open questions #
- How should product teams version prompts, retrieval policy, model choice, and tool contracts as one release unit?
- When does adapter specialisation outperform retrieval plus examples over the full system lifecycle?
- How do we measure whether an AI-generated recommendation improves the eventual human decision?
- What is the smallest useful audit trail for a multi-step agent?
- How should cost and latency budgets influence the model’s reasoning strategy dynamically?
I will keep expanding this page as experiments produce evidence. Related material also appears in my papershelf and engineering notes.