Skip to content

Archive / page 69

All articles

Every practical article from the Nalar archive, newest first.

Software Engineering 06 Sep 2026 11 min read

Design Retry Budgets to Prevent Retry Storms

Retries are one of the simplest reliability tools in distributed systems. A transient network failure, a short leader election, or a momentary overload can make a request fail even though the dependency becomes healthy again a few milliseconds later. Retrying can hide that temporary failure from the user. The same mechanism can also make an outage worse. If a struggling dependency starts failing requests and every caller retries immediately, the dependency receives extra work precisely when it has the least capacity to handle it. A small failure rate can turn into a retry storm: retries create more load, more load creates more failures, and those failures create still more retries.

Cybersecurity 06 Sep 2026 10 min read

Design Recovery Codes as Real Authenticators

Recovery codes are often presented as a convenience feature: save these codes somewhere, then use one if you lose access to your normal authenticator. That description can hide their real security role. A recovery code may be enough to regain control of an account, so anyone who obtains a valid code may gain the same recovery path as the legitimate user. The practical consequence is simple: a recovery code is an authenticator, not a harmless backup string. Its generation, storage, verification, use, replacement, and revocation all belong inside the authentication threat model.

Cybersecurity 06 Sep 2026 12 min read

Design Cryptography for Algorithm Change

Applications often keep encrypted records, signed objects, or authentication data for much longer than the code that first created them. During that lifetime, a cryptographic algorithm may be deprecated, a parameter may become too weak, a library may change, or an organization may need a different key-management design. The difficult part is usually not adding the new cryptographic operation. It is changing the system without making old data unreadable, silently accepting an unintended algorithm, or leaving legacy protection in place forever.

Artificial Intelligence 06 Sep 2026 12 min read

Cross-Entropy Loss for Classification

A classifier needs more than a way to count correct answers. During training, it needs a signal that says not only whether a prediction was wrong, but also how the model’s scores should change. Suppose the correct class is cat. A model that assigns cat probability 0.49 and another class 0.51 is wrong, but it is close to the decision boundary. A model that assigns cat probability 0.001 is also wrong, and much more confident in that mistake. Treating those predictions as equally bad throws away useful information.

Artificial Intelligence 06 Sep 2026 10 min read

Control LLM Repetition with Token Penalties

Language models sometimes repeat a phrase, return to the same point, or fall into a short loop even when the prompt asks for a concise answer. A common response is to increase randomness, but temperature changes the whole next-token distribution. That can reduce repetition while also making unrelated choices less predictable. Token penalties provide a more targeted control. They adjust the scores of tokens that have already appeared, making some repeated tokens less likely before the decoder chooses the next token. This can be useful for open-ended generation, but it is not a general quality switch: repeated tokens are often exactly what correct text requires.

Artificial Intelligence 06 Sep 2026 11 min read

Contrastive Learning for Text Embeddings

A text embedding model turns text into a vector so that software can compare meaning numerically. The difficult part is not producing vectors. A neural network can produce vectors for almost any input. The difficult part is teaching the geometry of those vectors so that distances correspond to the relationships your application cares about. Contrastive learning provides a practical way to do that. Instead of asking a model to predict a class label, you show it examples that should be close together and examples that should be farther apart. Training adjusts the encoder so that those relationships become easier to recover from the resulting vectors.

Cybersecurity 06 Sep 2026 10 min read

Consume One-Time Tokens Atomically

A password-reset link may be labelled “single use” while still being usable twice. The problem is often not token randomness or expiration. It is a race between two requests that both verify the token before either request marks it as used. That matters because temporary tokens frequently authorize sensitive actions: resetting a password, verifying an email address, accepting an invitation, or completing account recovery. If the application promises one-time use, concurrent requests should not be able to turn that promise into two successful authorizations.

Artificial Intelligence 06 Sep 2026 8 min read

Constrain LLM Output with Grammar-Guided Decoding

Asking a language model to return JSON, SQL, or another structured format creates a failure mode that ordinary prompting cannot remove: the model can understand the requested format and still generate a token that makes the output syntactically invalid. For applications that immediately parse model output, one missing quote or delimiter can turn an otherwise useful answer into an error. Retrying helps, but it spends more inference time without guaranteeing that the next attempt will parse.

Artificial Intelligence 06 Sep 2026 11 min read

Compress Embeddings with Scalar Quantization

Embedding systems can become expensive for a reason that has little to do with the embedding model itself: storing and scanning the vectors. A collection of millions of dense vectors can consume gigabytes even before an index adds its own data structures. Moving those vectors through memory can also become part of query latency. Scalar quantization reduces that cost by representing each embedding coordinate with fewer bits. Instead of storing every coordinate as a 32-bit floating-point value, a system might map it to an 8-bit integer and keep enough information to approximately reconstruct or compare the original value.

Cybersecurity 06 Sep 2026 9 min read

Compare Secret Values with Constant-Time Functions

A verifier often ends with a simple question: does a value derived from this request match the value the system expects? That question appears when checking message authentication codes, signed-request authenticators, reset-token digests, and other security-sensitive values. Using an ordinary string or byte comparison can introduce a subtle problem. Some comparison routines stop as soon as they find the first difference. Their work can therefore depend on how much of the input matches. If an attacker can make many measurements under sufficiently stable conditions, that timing difference may reveal information about a secret-dependent value.

Artificial Intelligence 06 Sep 2026 10 min read

Compare Model Distributions with KL Divergence

AI systems often produce probability distributions rather than single answers. A classifier assigns probabilities to classes, a language model assigns probabilities to possible next tokens, and a teacher model can provide a soft target distribution for a smaller student. In all of these cases, developers need a way to ask: how different is one probability distribution from another? Kullback-Leibler divergence, usually shortened to KL divergence, is one answer. It measures how much a comparison distribution Q differs from a reference distribution P, with the differences weighted by what P considers important.

Artificial Intelligence 06 Sep 2026 9 min read

Combine Fine-Tuned Models with Weight Averaging

Fine-tuning the same model for different datasets or objectives can leave a team with several useful checkpoints. Serving all of them as an ensemble may improve robustness, but it also multiplies inference work. Choosing only one checkpoint avoids that cost but discards what the others learned. Weight averaging offers a third option: combine compatible checkpoints by averaging their parameters, then serve the result as one model. The arithmetic is simple. The important question is whether the checkpoints occupy a compatible region of parameter space so that interpolation preserves useful behavior rather than destroying it.

Linux 06 Sep 2026 13 min read

Choose the Right Advisory File Lock on Linux

Two processes can open the same file and both write to it successfully. That is often exactly what Unix applications need, but sometimes the programs are supposed to coordinate: only one worker should update a state file, several readers may share a resource, or a process must avoid changing a byte range while another process is using it. Linux offers several advisory file-locking mechanisms. The confusing part is not how to request a lock. The confusing part is what owns the lock and when that lock disappears.

Artificial Intelligence 06 Sep 2026 9 min read

Choose Pooling Strategies for Text Embeddings

A transformer usually produces one contextual representation for every input token. Many applications, however, need one vector for an entire sentence, query, or document. Semantic search, clustering, and similarity systems commonly compare these fixed-size vectors rather than every token representation separately. The operation that turns a variable number of token vectors into one vector is called pooling. It can look like a minor implementation detail, but changing it changes the representation being compared. Averaging every meaningful token, selecting a designated token, or emphasizing particular positions encodes different assumptions about where useful information lives.

Software Engineering 06 Sep 2026 9 min read

Building Focused Test Data with Test Data Builders

Tests become hard to understand when creating the object under test requires many values that are irrelevant to the behavior being checked. A test for an overdue invoice may need an identifier, customer, currency, issue date, due date, line items, tax settings, and status even though only the due date matters. Copying complete fixtures into every test makes that irrelevant detail visible everywhere. Sharing one mutable fixture hides the detail, but it can make tests depend on each other. A test data builder offers a middle path: it creates a valid object from sensible test defaults while letting each test override only the values important to its scenario.

Cybersecurity 06 Sep 2026 11 min read

Bound Work Before Processing Untrusted Input

An input does not need to be malicious code to hurt a service. It only needs to make the service spend far more memory, CPU time, storage, or concurrency than the sender spent creating the request. A parser may accept deeply nested data. A compressed upload may expand far beyond its transfer size. A search endpoint may allow a query that is valid but unusually expensive. If enough work begins before the application applies a limit, a small amount of incoming traffic can consume resources needed by legitimate users.

Artificial Intelligence 06 Sep 2026 10 min read

Accelerate LLM Generation with Speculative Decoding

Autoregressive language models generate text one token at a time. Even when an accelerator has substantial parallel compute available, the model normally cannot determine token 12 until token 11 is known. That dependency makes generation latency difficult to reduce simply by adding more parallel hardware. Speculative decoding attacks this bottleneck by doing cheap work ahead of the expensive model. A faster draft model proposes several future tokens. The full target model then evaluates those proposals together and accepts the portion that is consistent with its own distribution. With the appropriate acceptance-and-correction algorithm, this changes how generation is computed without changing the distribution that the target model defines.

Tech 05 Sep 2026 8 min read

Why Your Phone Camera Preview Can Look Different From the Final Photo

You frame a photo on your phone, tap the shutter, and then notice that the saved image does not look exactly like the viewfinder did a moment earlier. Shadows may be brighter, highlights may be less intense, colours can shift slightly, or fine detail may look sharper or smoother. That does not necessarily mean the camera captured the wrong image. The live preview and the finished photo have different jobs. The preview must update quickly enough to help you compose the shot, while the final photo can receive additional processing after you press the shutter.

Tech 05 Sep 2026 8 min read

Why Your Laptop’s Battery Time Remaining Keeps Changing

A laptop may say it has four hours of battery time remaining, then show two and a half hours after you start a video call. Close the call, lower the screen brightness, and the estimate may climb again. The battery did not suddenly lose and regain a large amount of energy. The changing number makes more sense once you treat it as a forecast, not a countdown. Your laptop knows roughly how much usable charge remains, but it cannot know exactly what you will ask the computer to do for the rest of the day. It estimates runtime from the battery state and the power the system is using or expects to use.

Tech 05 Sep 2026 7 min read

Why Your Device May Use a Private Wi-Fi Address

You may open your router’s device list and find a phone or laptop under an unfamiliar address. A network may also treat a device you have used before as if it were new. One common reason is a feature often called a private Wi-Fi address, randomized MAC address, or similar name. The feature changes the identifier your device presents on a Wi-Fi network. It does not give the device a new internet connection, and it does not make the device anonymous. Its main purpose is narrower: reducing how easily one persistent Wi-Fi identifier can be used to recognize the same device across networks or over time.

Tech 05 Sep 2026 7 min read

Why Screen Recordings Can Have No Audio

You record a useful tutorial, a video call, or a problem on your phone, then play the recording and discover that the sound is missing. The screen recorder clearly captured the picture, so it can seem as though audio should have been recorded automatically too. Screen video and audio are separate inputs. A recorder can capture the pixels being shown while recording no sound at all, or it can capture one audio source but not another. The exact choices depend on the device, operating system, app, and content being recorded.

Tech 05 Sep 2026 7 min read

Why Photos Can Look Worse After You Send Them

A photo can look sharp in your gallery but softer after you send it through a messaging or social app. Fine text may become harder to read, hair and grass may lose detail, and a picture that originally occupied several megabytes may arrive as a much smaller file. This usually does not mean the camera changed the photo after you took it. The more common explanation is that the sharing service created a different version for transmission or display. It may reduce the image dimensions, compress the image more strongly, or do both.

Tech 05 Sep 2026 8 min read

Why Phone Charging Slows Down Near Full

A phone that gains a large amount of charge quickly can seem to slow dramatically as the battery approaches full. That can be confusing when the same charger and cable are still connected. If a charger is advertised for fast charging, why does the final part take so long? The short answer is that charging speed is not meant to stay constant from empty to full. A phone controls how much power its battery receives, and the safe, appropriate rate changes as the battery’s state of charge, voltage, and temperature change.

Tech 05 Sep 2026 9 min read

Why Moving a File Can Be Much Faster Than Copying It

Move a large video from one folder to another and it may appear to finish almost instantly. Move the same video to an external drive and you may have to wait while a progress bar slowly advances. The file is the same size, so why can the two operations take such different amounts of time? The answer is that moving a file does not always mean moving all of its data. When the source and destination are on the same file system, a move can often be completed mostly by changing the file system’s records about where the file belongs. When the destination is on a different file system, the data generally has to be copied to the new location before the old file can be removed.