SShortSingh.
Back to feed

Int4 Per-Row Quantization Cuts Transformer Size 6x With No Accuracy Loss

0
·1 views

A series of experiments on a small transformer model found that 71.7% of its parameters resided in the embedding lookup table, making it the primary target for compression. Quantizing the embedding to int4 precision with per-tensor scaling caused a notable accuracy drop, but switching to per-row scaling — adding just 16 KB of extra data — recovered nearly all of that loss. The int4 per-row configuration matched the full fp32 model's top-1 mixture score of 0.384 while reducing model size from 5.72 MB to 0.93 MB, a 6.2x reduction with no measurable performance cost. The findings highlight how sweeping only one variable at a time — such as bit-width without varying granularity — can produce misleading conclusions, since the benefit of per-row scaling only becomes visible at lower bit-widths. The experiment required no retraining and was conducted across just seven runs, suggesting the cross-product sweep approach is practical even in low-resource settings.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

How Node.js Webhook Consumers Should Handle Rate Limits and Dead-Letter Queues

A technical guide for B2B SaaS platforms warns that successful HTTP delivery responses do not confirm that downstream business actions—like renewal reminders—actually completed on time. The core principle is that a consumer must treat the business deadline as the primary service-level objective, making rate limits, retry policies, and dead-letter decisions explicit parts of the system contract. Engineers are advised to define three key numbers before choosing queue technology: the business deadline, the sustainable downstream processing rate, and the maximum tolerable duplicate effect. The guide distinguishes between acknowledgement, negative acknowledgement, and dead-lettering as separate outcomes based on the future likelihood of success, not HTTP status codes. Duplicate handling is flagged as an application-level responsibility under at-least-once delivery, with uniqueness constraints on event IDs recommended to prevent stale or repeated actions.

0
ProgrammingDEV Community ·

How a Stale Retry Silently Restored Access to a Deactivated Account

A technical case study highlights how a timed-out provisioning job can inadvertently restore access to a deactivated user account in distributed systems. In the described scenario, access was correctly removed from a deactivated account, but an older queued worker woke up and replayed the original group-addition request minutes later, bypassing the deactivation. Each individual system component behaved as designed, yet the combined sequence produced an incorrect and insecure final state. The article argues that queues preserve work but cannot guarantee that queued work remains valid, making generation-based checks and idempotent reconciliation essential safeguards. It also warns that provisioning systems often treat delayed onboarding as more urgent than delayed removal, leaving access-revocation gaps that are harder to detect through standard API success metrics.

0
ProgrammingDEV Community ·

Developer builds preflight scanner to catch MCP tool security flaws before deployment

A developer has created an open-source preflight security scanner targeting Model Context Protocol (MCP) tools, addressing gaps that standard demos fail to reveal. The tool runs static and behavioral checks across four rule categories, flagging issues such as unsafe shell commands, excessive scope declarations, embedded secrets, and unvalidated user inputs. Behavioral tests go further by calling a local fixture server to verify tenant isolation, write approval enforcement, and quota limits. Each finding is assigned a severity level, a remediation step, and a trackable status, turning security observations into actionable engineering tasks. The scanner is positioned as a bounded first-pass filter rather than a full penetration test, with source code available on GitHub at github.com/glatinone/mcp-security-preflight.

0
ProgrammingDEV Community ·

How to Securely Bridge Webhooks to Kafka, Redpanda, and NATS at the Edge

Directly ingesting webhooks into event brokers like Kafka or NATS exposes systems to synchronous timeout failures, replay attacks, and duplicate deliveries. An edge-gateway pattern addresses this by terminating TLS, validating provider-specific HMAC signatures from services like Stripe, GitHub, and Shopify before any payload parsing occurs. Signature checks must use constant-time comparisons and run against the raw request body, while deduplication relies on provider-supplied delivery IDs. Verified events are then normalized into the CloudEvents standard format and routed to the appropriate broker partition based on entity identifiers. Observability metrics and dead-letter queue handling are also essential components of a production-grade implementation.

Int4 Per-Row Quantization Cuts Transformer Size 6x With No Accuracy Loss · ShortSingh