Skip to content

Archive / page 68

All articles

Every practical article from the Nalar archive, newest first.

Artificial Intelligence 06 Sep 2026 8 min read

Reduce Language Model Parameters with Weight Tying

Language models need to turn token IDs into vectors before processing them and turn hidden vectors back into vocabulary scores before predicting the next token. A straightforward design gives those two operations separate parameter matrices. When the vocabulary and hidden dimension are large, each matrix can contain many parameters. Weight tying removes that duplication by reusing one parameter matrix for both roles. The input side reads rows from the matrix as token embeddings; the output side uses the same learned vectors to score candidate tokens, usually through the matrix transpose.

Artificial Intelligence 06 Sep 2026 10 min read

Reduce KV Cache Size with Grouped-Query Attention

Autoregressive language models generate one token at a time. To avoid recomputing attention keys and values for every previous token at every step, inference systems usually keep those tensors in a key-value cache, or KV cache. This saves computation, but the cache grows with sequence length and can become a major memory cost when serving long contexts or many requests at once. One architectural choice has a direct effect on that cost: how many separate key and value heads the attention layer stores. Standard multi-head attention gives every query head its own key and value head. Grouped-query attention (GQA) keeps multiple query heads but lets groups of them share key and value heads.

Cybersecurity 06 Sep 2026 11 min read

Rate-Limit Login Attempts by Account and Source

A login endpoint may verify passwords correctly and still give an attacker too many chances to guess them. If failed attempts can be repeated quickly, weak or reused passwords become easier to test through the same interface legitimate users use. A common response is to add a rate limit. The difficult part is choosing what the limit follows. Limiting only an IP address misses distributed attempts from many sources. Limiting only an account lets one source spread attempts across many accounts. Combining the IP address and account into one key looks stricter, but creates a fresh allowance for every pair.

Cybersecurity 06 Sep 2026 10 min read

Notify Users About Security-Sensitive Account Changes

A sensitive account change can succeed even when the application has reasonable preventive controls. An attacker may have a valid stolen session, a user may approve a fraudulent authentication prompt, or a support process may make the wrong change. If the application silently accepts the result, the legitimate user may not discover the problem until the attacker has had time to strengthen control of the account. A security notification gives the user an independent signal that an important change occurred. It does not authorize the change and should not be treated as proof that the change was legitimate. Its job is different: shorten the time between an unauthorized change and the moment the user can recognize and respond to it.

Cybersecurity 06 Sep 2026 10 min read

Normalize Before Making Security Decisions

A security check can inspect the right data and still reach the wrong decision if another component changes that data afterward. A path may be validated before path resolution removes .. segments. A percent-encoded value may pass a character check and then gain different characters when a later layer decodes it. Two names that look different to one component may be treated as equivalent by another. The consequence is a representation mismatch: the security decision is made about one form of a value, while the sensitive operation uses another. An attacker does not need to defeat the policy itself if they can make the validator and the consumer disagree about what the input means.

Artificial Intelligence 06 Sep 2026 11 min read

Length-Normalized Log Probabilities for Comparing Generated Sequences

A language model assigns a probability to each next token, but applications often need to compare complete candidate sequences. A reranker may choose among generated answers. A decoder may keep several partial hypotheses. An evaluator may compare alternative completions under the same prompt. The obvious approach is to multiply each candidate’s token probabilities, or equivalently add their log probabilities. That gives the probability the model assigns to the whole continuation. It also creates an important bias: every additional token contributes a probability no greater than 1, so longer sequences usually accumulate lower raw scores even when their individual tokens are highly plausible.

Cybersecurity 06 Sep 2026 10 min read

Keep Sensitive Data Out of URLs

A URL is convenient because it is easy to copy, bookmark, route, log, and inspect. Those same properties make it a poor place for passwords, long-lived access tokens, recovery secrets, or other values that should remain confidential. The problem is not that HTTPS exposes the URL to everyone on the network. HTTPS protects the request in transit between endpoints under its security assumptions. The problem is what happens before and after transport: URLs routinely pass through browser history, application and proxy logging, monitoring systems, support messages, screenshots, and copied links. A secret placed in a URL can therefore reach systems and people that never needed the secret.

Cybersecurity 06 Sep 2026 10 min read

Isolate Untrusted File Processing

Applications often need to inspect files they did not create. A service may resize an uploaded image, extract text from a document, read archive metadata, generate a preview, or scan a media file. Each task requires complex code to interpret attacker-controlled bytes. Input validation helps reject files that do not meet your rules, but it cannot guarantee that every parser and library is free of defects. If a file processor has a vulnerability, a specially constructed file may trigger behavior beyond ordinary parsing. The consequence depends heavily on what authority that processor has: access to application secrets, writable storage, internal services, or other users’ data can turn a parser failure into a much larger incident.

Artificial Intelligence 06 Sep 2026 9 min read

Inspect Transformer Predictions with the Logit Lens

A transformer language model produces its next-token prediction only after many layers of computation. When that prediction is wrong or surprising, developers often want a more specific question answered: how did the model’s candidate tokens change as the input moved through the network? The logit lens is a simple interpretability technique for exploring that question. Instead of waiting for the final layer, it takes an intermediate representation and passes it through the model’s final decoding machinery to obtain vocabulary logits. Repeating this across layers gives a rough view of how token predictions evolve with depth.

Artificial Intelligence 06 Sep 2026 9 min read

Inspect Language Model Uncertainty with Token Entropy

A language model can produce fluent text even when several continuations look similarly plausible to the model. Looking only at the selected token hides that ambiguity: a token chosen with probability 0.90 and one chosen from a nearly even 0.51 versus 0.49 split both appear as a single output token. Token entropy summarizes how spread out the model’s next-token probability distribution is. It can help developers inspect uncertain generation steps, compare decoding behavior under controlled conditions, and build diagnostic signals for evaluation. But entropy is not a probability that the model is correct, and using it as one leads to unreliable decisions.

Tech 06 Sep 2026 8 min read

How Your Phone Compass Knows Which Way You Are Facing

A map can show your position correctly while the direction arrow points the wrong way. You turn the phone, but the arrow hesitates, swings around, or seems several degrees off. Then a compass app asks you to move the device through the air to improve its accuracy. These behaviours make more sense once you separate two questions: Where is the phone? and Which way is it facing? Location systems can help answer the first question, but a phone usually needs additional sensors to estimate the second when it is standing still.

Tech 06 Sep 2026 9 min read

How Your Computer Keeps Time When It Is Turned Off

Turn a computer off overnight and its clock is usually correct when you start it the next morning. It can even remember the date after spending much longer disconnected from normal power. That may seem surprising because the operating system was not running to count the passing seconds. The computer does not rely on the operating system for this job. It has a small hardware clock that can continue keeping time while most of the machine is off. After startup, the operating system reads that clock and can later compare its time with a trusted source over the internet.

Tech 06 Sep 2026 8 min read

How Loudness Normalization Keeps Audio Volume More Consistent

You may play two songs at the same volume setting and find that one sounds much louder than the other. The same thing can happen when moving between videos, podcasts, or other audio. Reaching for the volume control each time is inconvenient, so many playback systems offer some form of loudness normalization. Loudness normalization tries to make different pieces of audio start from a more consistent perceived loudness. It does not flatten every quiet and loud moment into one level, and it does not guarantee that every recording will sound identical in volume.

Tech 06 Sep 2026 8 min read

How Devices Find Printers, Speakers, and Other Services on Your Local Network

Open a printing menu and a printer may appear without you entering its address. A music app can sometimes find a speaker just as quickly. Yet the same device may suddenly disappear even though both products still show that they are connected to Wi-Fi. This works because many devices do more than connect to a network. They can also announce services they provide and listen for announcements from other devices nearby. The process is called service discovery: finding a useful service, such as printing, without requiring you to know the device’s network address in advance.

Tech Updated 15 Sep 2026 6 min read

How Bluetooth Item Trackers Find Things Beyond Bluetooth Range

A small tracker attached to keys or luggage usually has no mobile-data plan and may not have GPS. Yet its app can sometimes show a location even when the tracker is far from your phone. That can make the device seem as if it has a long-range radio hidden inside it. The more accurate model is this: the tracker does not need to reach your phone directly if another compatible device can notice it and report its location through a finding network.

Tech Updated 15 Sep 2026 8 min read

How Active Noise Cancellation Reduces Background Sound

Put on noise-cancelling headphones during a flight or train ride and a steady rumble can become much quieter. Nearby speech, a sudden door slam, or wind around the microphones may still be noticeable. That difference is not simply a matter of how expensive the headphones are. It follows from what active noise cancellation can and cannot do. Active noise cancellation, usually shortened to ANC, uses microphones, electronic processing, and the headphone speakers to reduce some sound reaching your ears. It works alongside the physical blocking provided by ear tips or earcups rather than replacing it.

Go 06 Sep 2026 9 min read

Handle Long Lines Safely in Go with bufio.Scanner

bufio.Scanner is one of the simplest ways to process line-oriented input in Go. It is a good fit for log files, command output, newline-delimited JSON, and other formats where one logical record fits in memory. The convenience has an important boundary: a Scanner will stop if the next token grows beyond the amount of buffering it is allowed to use. That default protects a program from growing memory without bound, but it can surprise code that works on small test files and later encounters one unusually long line in production.

Software Engineering 06 Sep 2026 8 min read

Grouping Related Parameters into a Parameter Object

A function can have individually reasonable parameters and still be difficult to use correctly. The problem often appears when several values travel together through many calls and only make sense as a group. Consider code that repeatedly passes startTime, endTime, and timezone. Each value has a clear type, but callers must remember their relationship: the end must not precede the start, and both timestamps are interpreted using the same timezone rule.

Cybersecurity 06 Sep 2026 9 min read

Do Not Use Security Questions for Account Recovery

A login system can use a strong password and multi-factor authentication, then quietly weaken the whole account through one recovery question: “What was the name of your first school?” If answering that question is enough to reset the password or replace an authentication factor, the answer is effectively another way to authenticate. An attacker does not need to defeat the stronger login path if the recovery path accepts information that can be guessed, researched, reused, or learned from another breach.

Artificial Intelligence 06 Sep 2026 10 min read

Direct Preference Optimization for LLM Alignment

Supervised fine-tuning can teach a language model to imitate good answers, but many alignment problems are easier to express as comparisons: given two responses to the same prompt, which one is better? A preference dataset captures that signal as triples containing a prompt, a preferred response, and a rejected response. The challenge is turning those comparisons into model updates without treating a subjective preference as an ordinary next-token target. Direct Preference Optimization (DPO) provides one practical answer. It trains a policy model to increase its relative preference for chosen responses over rejected responses while measuring that change against a fixed reference model. Unlike a common reinforcement-learning-from-human-feedback pipeline, standard DPO does not require training a separate reward model and then running a reinforcement-learning optimizer.

Software Engineering 06 Sep 2026 9 min read

Designing Tolerant Readers for Evolving Contracts

A service reads a response from another system. It needs two fields, but its deserializer models twenty. A harmless producer change adds a field, changes an unused field, or expands an enum that the consumer never acts on. The consumer still breaks because it accidentally depended on more of the contract than its job required. A tolerant reader avoids that unnecessary coupling. It reads the smallest part of an external representation that the consumer needs and rejects changes only when they threaten assumptions the consumer actually relies on.

Software Engineering 06 Sep 2026 9 min read

Designing Modules with Information Hiding

A module can have private fields and still expose too much of its design. Callers may know how its data is stored, which steps must happen in which order, or which third-party concepts sit underneath it. When one of those decisions changes, code outside the module must change too. Information hiding is the practice of placing a design decision behind a boundary so other code depends on what the module provides, not on how it provides it. The goal is not secrecy. The goal is to contain the cost of change.

Software Engineering 06 Sep 2026 9 min read

Designing APIs with Preconditions and Postconditions

An API can have clear parameter names and still leave its most important rules unstated. Can a withdrawal amount be zero? Must an account already be open? If a call succeeds, is the balance guaranteed to have changed, or has the request merely been accepted for later processing? When those questions are unclear, callers make assumptions. Different callers may make different assumptions, and failures appear far from the decision that caused them.

Cybersecurity 06 Sep 2026 12 min read

Design Session Revocation for Real Incidents

A user changes a compromised password, an administrator disables an account, or an incident responder chooses “sign out all devices.” The application confirms the action. Yet a browser or stolen session token that was already authenticated continues to work. That gap matters because changing a password and ending an authenticated session are different operations. A password is usually checked when a session is created. Once the session exists, later requests may rely only on the session credential. If the system has no way to withdraw that credential’s authority, fixing the original login secret does not necessarily end access that was established earlier.