Factoring a 270-Digit Number in 10 Days: Lessons from AI-Assisted NFS Porting on GPU Clusters

    An open 270-digit (896-bit) RSA challenge number was factored in about ten days using roughly 2,048 GPUs and approximately 30 GPU-years of cumulative compute. The work used idle windows between ordinary training jobs on an AI company’s cluster and an AI coding tool that helped port the open-source general number field sieve (NFS) to GPUs. It produced two 135-digit prime factors whose product exactly reproduced the original number. This article explains why NFS is difficult to port, what the AI-assisted rewrite involved, how scheduling handled stage dependencies and preemptible capacity, and what the result implies for cryptography, GPU scientific computing, and elastic cluster operations.

    1. Background: A Cryptographic Milestone Completed in Passing

    The cryptography community has long maintained a series of public RSA challenge numbers: composites formed by multiplying two large primes, used as practical benchmarks for progress in integer factorization. One 270-digit (896-bit) challenge number had for a long time been viewed as a target that would require national-level resources to tackle.

    This time, however, it was factored, and in an unusual way. The work was not carried out by a specialized cryptography team. It was performed by an AI coding tool running on an AI company’s cluster. The job exploited idle compute windows between routine training tasks, together with an AI-assisted GPU port of the open-source general number field sieve (NFS). It ran on approximately 2,048 GPUs for about ten days and consumed roughly 30 GPU-years of cumulative computation. The output was two 135-digit prime factors whose product exactly reproduced the original number.

    The significance goes beyond cryptography itself. The effort demonstrates the convergence of three trends:

    1. AI coding capability is moving from writing business code toward rewriting high-performance computing core software.
    2. General-purpose GPU computing (GPGPU) is encroaching on scientific computing domains traditionally dominated by CPUs.
    3. Fragmented recovery of idle cluster capacity can support very large, long-running compute jobs.

    The sections below break down the technical layers.

    2. Why Integer Factoring Is Hard: A Quick Look at the General Number Field Sieve

    Modern RSA security rests on the assumption that large integer factorization is difficult. The most effective known algorithm for large composite numbers is the general number field sieve (NFS). Its main workflow has five stages:

    Stage Name Compute profile
    1 Polynomial selection Small CPU search with heuristic scoring
    2 Sieving Largest workload; many independent small operations; naturally parallel
    3 Linear algebra Very large sparse matrix solve; communication-intensive
    4 Square root Moderate computation
    5 Verification Lightweight

    The mainstream open-source NFS implementation has been refined by the European academic community for nearly two decades. Historically, several well-known challenge numbers—including factoring records at the 250-digit level—were completed with it. But it has a fundamental limitation: the entire software stack was designed for CPU architectures.

    A useful analogy: a CPU is like a handful of highly skilled craftspeople, each core capable of handling complex, branch-heavy work. A GPU is like thousands of assembly-line workers, each able to perform only simple repetitive tasks, but with strength in numbers. Replacing craftspeople with assembly-line workers is not a simple hardware swap. The entire workflow must be broken down, reordered, and rewritten. That rewriting was the core work the AI tool took on in this effort.

    3. What the AI Did: A Textbook GPU Port

    3.1 Converting the Algorithm for GPUs

    Porting CPU code to GPUs is never just a matter of changing compiler flags. The main difficulties include:

    1. Restructuring data layout. GPUs are extremely sensitive to memory access patterns. The sieving stage performs sieving operations across millions of intervals. The original implementation used CPU-cache-friendly array traversal. The GPU version required redesigning for coalesced memory access and avoiding unaligned reads within a warp that can slow throughput.

    2. Splitting task granularity. A large loop on the CPU must be divided into tens of thousands of thread blocks on the GPU. Each thread block handles a short interval and must also deal with boundary conditions and atomic-operation conflicts. A pseudocode sketch:

    1. # GPU implementation sketch for the sieving stage
    2. grid = (num_intervals + BLOCK - 1) // BLOCK
    3. for each block b in parallel:
    4. interval = ranges[b]
    5. for each prime p in factor_base:
    6. # Compute the sieving start point and mark candidates in the interval divisible by p
    7. sieve_kernel(interval, p)
    8. write_back(results[b])

    3. Precision and integer width. Arithmetic on 270-digit numbers far exceeds the range of 64-bit integers and requires multiprecision arithmetic. Implementing large-number multiplication and addition on GPUs requires careful handling of carry propagation and register pressure. This part often requires hand-written low-level optimization.

    4. The linear algebra stage. Sparse matrix solving is a communication-intensive task. The GPU advantage in this stage is less pronounced than in sieving, so a hybrid CPU/GPU approach is usually needed: GPUs perform local sparse matrix-vector multiplication, while nodes synchronize through collective communication.

    In this task, the AI coding tool’s role was to carry out this “translation” work: understand the mathematical structure of the original algorithm, identify the parts that could be parallelized, rewrite the modules one by one, and validate correctness. That requires not only coding capability but also a deep understanding of algorithm semantics.

    3.2 Scheduling: Coordinating Roughly 2,000 GPUs

    After the port comes a second major challenge: how to organize those GPUs to run the entire pipeline. This involves:

    • Stage dependency management. The relations produced by sieving must accumulate to a sufficient volume before linear algebra can begin. The task scheduler must monitor production rate and dynamically determine when to switch stages.
    • Fault tolerance and checkpoint restart. Because the job runs on idle capacity, it can be preempted at any time by higher-priority training work. Each work unit must therefore be independently retryable and have persistent state. In effect, this is a checkpoint-based elastic computing framework.
    • Heterogeneous node adaptation. Within the cluster, GPUs of different generations have different compute power and memory. The scheduler must assign work slices of different sizes according to capability.

    These are exactly the kinds of problems AI infrastructure teams solve every day, and here they were reused for cryptographic computation. In a sense, this says more about the maturity of AI engineering capability than the algorithm port itself.

    4. The Compute Ledger: What 30 GPU-Years Means

    A cumulative total of 30 GPU-years is a substantial amount of computation if commercial compute is rented in the traditional way. But the cost model in this effort was completely different:

    1. Exploiting idle valleys. Scheduling gaps exist between large-model training jobs, and GPUs are often in an “allocated but idle” state. By filling those gaps with the factoring job as a preemptible low-priority workload, the marginal cost approaches zero.
    2. Sharding a long job. The ten-day total duration was divided into a massive number of independent small units, each occupying only minutes to hours, making it a natural fit for fragmented capacity.
    3. Designing for interruption. If the job is reclaimed at any point, completed work is not lost.

    The implication for enterprises is straightforward: many classical computational problems—Monte Carlo simulation, combinatorial optimization, scientific computing, rendering—can be packaged as preemptible fill-in workloads to consume idle cluster capacity. On container platforms, this can be implemented through generic mechanisms such as low-priority Pod quotas, batch queues, and co-scheduling, without rearchitecting the main business workflow.

    5. Implications for Cryptography and Engineering Practice

    On the cryptography side: factoring a 270-digit number does not directly threaten real-world RSA deployments. Practical systems commonly use keys of 2,048 bits (about 617 decimal digits) or more, and factoring difficulty grows exponentially. Still, milestones like this continuously recalibrate estimates of the security margin, and they remind every system that legacy keys below 1,024 bits should no longer exist.

    On the engineering side, the effort offers three actionable lessons:

    1. Start GPU ports with high-throughput, low-branch kernels, while retaining CPU or hybrid approaches for communication-heavy stages. Full GPU conversion is not always the goal.
    2. Design checkpoints and idempotent retries for long-running computation, treating interruptibility as a first-class property.
    3. Bring AI coding tools into the performance-engineering workflow. They are well suited to rewrites where the pattern is clear but the volume is large, while humans focus on architectural decisions and correctness acceptance.

    6. Conclusion

    A compute job scavenged from idle capacity demonstrated three things at once: the ability of AI to rewrite high-performance software, the expanding reach of GPUs into scientific computing, and the economics of reclaiming idle compute. For developers, the most valuable takeaway is not the number “270 digits” but the engineering paradigm behind it: break complex computation into units that are parallelizable, interruptible, and schedulable, then use intelligent tools to accelerate the porting process. That approach applies to far more than integer factorization.