Skip to content

Archive / page 82

All articles

Every practical article from the Nalar archive, newest first.

Python 03 Sep 2026 9 min read

Model Finite States Clearly with Python Enum

Many programs represent a small fixed set of states with plain strings: status = "paid" That looks simple, but the string carries no built-in guarantee that it belongs to the set of states your application actually supports. A typo such as "paied" is still a valid Python string. So is an unexpected value received from a file, database, message, or HTTP request.

Python 03 Sep 2026 9 min read

Model Domain Constants Safely with Python enum

Strings and integers are convenient ways to represent states, modes, result codes, and permissions. They are also easy to mistype, mix with unrelated values, or pass through an API without making their meaning obvious. Python’s enum module lets a program give those values names and a controlled set of members. The benefit is not simply replacing constants with a class. A well-chosen enumeration defines the domain boundary: which values exist, how they compare, whether integer compatibility is intentional, and whether values may be combined.

Artificial Intelligence 03 Sep 2026 9 min read

Mixture-of-Experts Models

A neural network does not have to use every parameter for every input. A mixture-of-experts (MoE) layer takes advantage of this idea by keeping several expert networks and using a router to select only a small subset for each token. This separates total parameter count from the number of parameters active for one token. That can increase model capacity without making the arithmetic performed for every token grow in direct proportion to the total number of expert parameters.

Software Engineering 03 Sep 2026 6 min read

Managing Technical Debt with Explicit Payoff Triggers

Technical debt is not simply bad code. It is the future cost created when an engineering decision makes today’s change easier at the expense of later work. Some debt is accidental: a rushed abstraction becomes difficult to extend, or duplicated logic grows in several places. Other debt is deliberate. A team may accept a narrow implementation to meet a deadline because building the general solution immediately would cost more than the expected benefit.

Cybersecurity 03 Sep 2026 6 min read

Manage Application Secrets Safely

Applications depend on sensitive values such as API keys, database passwords, signing keys, client secrets, and service credentials. These values often provide direct access to data or privileged operations, so protecting them requires more than keeping them out of source code. Good secrets management controls the entire lifecycle: creation, storage, delivery, use, rotation, revocation, and incident response. Treat secrets as credentials, not configuration A useful distinction is whether disclosure of a value would let an attacker authenticate, decrypt protected information, forge trusted data, or perform privileged actions.

Artificial Intelligence 03 Sep 2026 10 min read

LoRA for Parameter-Efficient Fine-Tuning

Fine-tuning a large model does not always require updating every model parameter. Low-Rank Adaptation (LoRA) takes advantage of this idea by keeping the original model weights frozen and learning much smaller matrices that modify selected layers. For developers, LoRA changes what must be trained, stored, and moved between experiments—not just the size of the fine-tuning job. That distinction determines when it is useful, what it does not save, and how adapter choices affect model behavior.

Artificial Intelligence 03 Sep 2026 7 min read

LLM Quantization for Efficient Inference

Large language models can require substantial memory bandwidth and compute during inference. Quantization reduces those requirements by representing some model values with fewer bits than the floating-point formats commonly used during training. The idea sounds simple: store numbers with lower precision. In practice, quantization trades memory, latency, hardware support, implementation complexity, and model quality. Choose the configuration from measurements rather than assuming that fewer bits are always better. What quantization changes A neural network contains many numerical values, especially weights. A model stored with 16-bit weights needs roughly two bytes per weight before accounting for runtime buffers and other overhead. If those weights can instead be represented with 8 or 4 bits, their raw storage requirement falls substantially.

Cybersecurity 03 Sep 2026 10 min read

Limit Bearer Token Damage with Scope and Lifetime

Bearer tokens are convenient because a service can accept a request based on a credential presented with it. That convenience creates a simple security problem: if an attacker obtains a usable bearer token, the attacker may be able to present it too. The receiving service usually cannot distinguish the legitimate holder from a thief merely by possession of the token. The defensive goal is therefore not only to keep tokens confidential. It is also to limit what a stolen token can authorize and how long that authority remains useful. A token that can perform one narrow task for a short period creates a smaller exposure than a long-lived token with broad access.

Cybersecurity 03 Sep 2026 6 min read

Limit Authentication Abuse with Layered Rate Controls

Authentication endpoints attract automation because each request can test credentials, probe account state, or trigger expensive verification work. Rate controls reduce the speed and value of this abuse, but a single requests-per-minute limit is rarely enough. A useful design combines several signals and responses. The objective is to make abusive behaviour slower and noisier while keeping legitimate users able to recover from mistakes, shared networks, and temporary failures. Protect the whole authentication surface Login is only one part of authentication. Review every endpoint that can verify, change, or recover identity state, including:

Artificial Intelligence 03 Sep 2026 11 min read

Learning Rate Warmup and Decay for Stable Training

A neural network can have the right architecture, clean training data, and a sensible optimizer yet still train poorly because its learning rate changes at the wrong pace. The learning rate controls the scale of parameter updates. A rate that is too large can make optimization unstable or skip useful regions of the loss landscape. A rate that is too small can make progress unnecessarily slow. The appropriate rate can also change during training: cautious updates may help at the beginning, larger updates can drive progress once training is stable, and smaller updates can help refine the model later.

Python 03 Sep 2026 11 min read

Layer Configuration Safely with Python ChainMap

Applications often build configuration from several sources. Command-line arguments may override environment-derived values, which in turn override built-in defaults. A straightforward implementation copies dictionaries and applies update() repeatedly. That works, but copying hides an important part of the design: configuration is not merely one dictionary. It is a precedence chain of independent sources. Python’s collections.ChainMap makes that relationship explicit. It presents several mappings as one lookup view without merging them first.

Artificial Intelligence 03 Sep 2026 9 min read

Label Smoothing in Classification Models

A classification model is often trained as if the correct class deserves all of the target probability and every other class deserves none. For a three-class problem, an example labeled cat might therefore use this target: cat: 1.00 dog: 0.00 fox: 0.00 That target is convenient, but it asks the model to push probability toward an extreme even when labels are imperfect, classes overlap, or the input is genuinely ambiguous. Label smoothing changes the training target so that a small amount of probability mass is assigned away from the labeled class.

Artificial Intelligence 03 Sep 2026 7 min read

KV Caching in LLM Inference

Large language models generate text one token at a time. Without an optimization, every new token would force the model to repeat attention calculations for tokens it has already processed. KV caching avoids much of that repeated work. During inference, the model stores the key and value representations produced by attention layers for previous tokens. When generating the next token, it can reuse those stored representations instead of recomputing them from the beginning.

Artificial Intelligence 03 Sep 2026 9 min read

Knowledge Distillation for Smaller AI Models

A large model may produce useful predictions but still be too expensive or slow for the environment where it must run. A mobile application, an edge device, or a high-volume service can have tighter limits on memory, latency, and compute. Knowledge distillation is one way to address that gap. Instead of training a smaller model only from the original labels, we also train it to imitate information produced by a stronger teacher model. The smaller model is called the student.

Tech 03 Sep 2026 8 min read

JPEG vs PNG: Why the Same Image Can Have a Very Different File Size

Two image files can show almost the same picture yet occupy very different amounts of storage. A photograph saved as JPEG may be much smaller than a PNG version, while a screenshot with text and flat colours can behave quite differently. The reason is not simply that one format is newer or better. JPEG and PNG are designed to preserve image information in different ways. Understanding that difference makes it easier to choose a format for photos, screenshots, graphics, websites, and files you plan to edit again.

Artificial Intelligence 03 Sep 2026 7 min read

Improve RAG Retrieval with Reranking

Retrieval-augmented generation (RAG) depends on finding useful evidence before asking a language model to answer. A vector search can retrieve candidates quickly, but the nearest vectors are not always the passages that best answer the user’s question. Reranking adds a second relevance step. The system first retrieves a reasonably broad candidate set with a fast method, then applies a more precise model to reorder those candidates before selecting context for the LLM.

Tech 03 Sep 2026 9 min read

How ZIP Files Compress Data and When They Save Space

A ZIP file can turn a folder containing many files into one convenient archive, and that archive may take up less space than the originals. Sometimes the reduction is dramatic. Other times, a large collection barely becomes smaller at all. The difference is not random. ZIP compression works by finding patterns that can be represented more efficiently. Whether it saves much space depends largely on how much reusable structure remains in the files being compressed.

Tech 03 Sep 2026 7 min read

How Wireless Charging Works and Why Alignment Matters

Wireless charging can make powering a phone feel almost effortless: place the device on a charging pad or stand, and charging begins without plugging a cable into the phone. The process is wireless only across a very short gap. The charger itself still needs power, and energy must move from a coil inside the charger to another coil inside the phone. That short-distance transfer explains several familiar behaviours, including why placement matters, why thick cases can cause problems, and why wireless charging can produce noticeable heat.

Tech 03 Sep 2026 8 min read

How Wi-Fi Calling Works When Cellular Signal Is Weak

A phone can have excellent Wi-Fi while showing only one bar of cellular signal. In that situation, Wi-Fi calling can allow ordinary calls and, in many cases, text messaging to keep working through the internet connection instead of relying entirely on a nearby cellular radio signal. The feature can be especially useful inside buildings where walls weaken cellular coverage but a home or office Wi-Fi network remains strong. It can feel similar to making a normal mobile call because the phone still uses its standard dialler and phone number.

Tech 03 Sep 2026 7 min read

How the Clipboard Makes Copy and Paste Work

Copy and paste feels almost instantaneous: select something, copy it, move somewhere else, and paste. Behind those simple actions is a temporary holding area called the clipboard. Understanding the clipboard explains several everyday puzzles. Why can pasted text keep its formatting in one app but lose it in another? Why does copying a new item often replace the previous one? Why can an image be pasted into some destinations but not others? The answers come from separating the content you copied from the temporary clipboard data that represents it.

Tech 03 Sep 2026 7 min read

How QR Codes Store Information and Why They Still Scan When Damaged

QR codes appear on tickets, menus, product packaging, payment screens, Wi-Fi setup cards, and many other everyday objects. A phone can often point its camera at one and recover the information in a fraction of a second. Although a QR code looks like a random grid of black and white squares, its layout is highly structured. Some areas help a scanner locate and orient the symbol, while other areas contain encoded data and information that helps recover from errors.

Tech 03 Sep 2026 7 min read

How NFC Works on Phones and Why It Needs Such Short Range

Tapping a phone against a payment terminal, transit reader, accessory, or small electronic tag can trigger an action almost immediately. The technology behind many of these interactions is NFC, short for Near Field Communication. NFC is a wireless technology, but it behaves differently from Wi-Fi or Bluetooth. It is designed for communication across a very small distance, usually only a few centimetres. That short range is not simply a limitation. It is one of the characteristics that makes tap-based interactions practical.

Tech 03 Sep 2026 8 min read

How microSD Cards Expand Device Storage

A microSD card can add a surprising amount of storage to a small device. Phones, tablets, cameras, handheld game systems, dash cameras, and other electronics may use these tiny removable cards to hold photos, videos, downloads, maps, games, and other files. The basic idea is simple: a microSD card contains flash memory that keeps data even when power is removed. In practice, however, choosing and using one involves more than matching the physical shape. Capacity limits, file systems, speed ratings, workload requirements, and device support all affect whether a card will work well.

Tech 03 Sep 2026 8 min read

How GPS Finds Your Phone Without Mobile Data

A phone can often show your location even when mobile data is turned off. That can seem strange if you normally use GPS through a map app that downloads roads, traffic information, and search results from the internet. The key is that finding your position and downloading a map are separate jobs. Satellite navigation can calculate a position without an internet connection, while many of the services built around that position still need network access.