import {useEffect,useRef,useState} from 'react';
import {useMotion} from './Motion';
import {DualScene} from './DualScene';
import {beats,beatIndex,phase,residuePreviewCount} from './dualStory';
import {useScrollStory} from './useScrollStory';
import type {Example} from './types';
import config from '../t5config_large.json';
function MiniBlock({protein=false,decoder=false}:{protein?:boolean;decoder?:boolean}) {
return
;
}
function Vector({protein=false}:{protein?:boolean}) {return {Array.from({length:18},(_,i)=>)};}
function ReadingVisual({index,example}:{index:number;example:Example}) {
if (index===0) return
Follow a function into a protein. Then follow a protein into language.
{flow?'SIX STEPS THROUGH DUAL LEARNING':'SCROLL TO EXPLORE · SCROLL BACK TO REVISIT'} ↓
{flow?
{!small&&!reduced&&}
{beats.map((beat,i)=>
{beat.tag}
{beat.title}
{beat.body}
{beat.note}
)}
:
THE DUAL LEARNING FRAMEWORK
LANGUAGE PROTEINSCHEMATIC · NOT TO SCALE
{paused||pagePaused?'PAUSED · USE CHAPTERS TO STEP':'SCROLL TO ADVANCE OR DRAG'}seek(Number(e.target.value)/1000)} aria-label="Explanation progress" aria-valuetext={`Step ${active+1} of 6: ${beats[active].label}`}/>
}
RECORDED EXAMPLE
Two independent predictions from the reference description and reference sequence. Animation timing is illustrative; training uses paired supervision, not cycle reconstruction.
Inspect the complete example Reference inputs & archived predictions +
01 / TEXT → PROTEIN
Reference description
{example.text}
Generated protein · {example.generatedProtein.length} residues
{example.generatedProtein}
02 / PROTEIN → TEXT
Reference protein · {example.protein.length} residues
{example.protein}
Generated description
{example.generatedText}
Architecture & training notes +
Each large-v5 encoder and decoder contains {config.num_layers} T5-style blocks with hidden size {config.d_model.toLocaleString('en-US')}. Encoders use self-attention and feed-forward layers; decoders add masked self-attention and cross-attention to the projected source states. The diagram expands a representative block, omitting residual connections and layer normalization for clarity. Hidden-state squares illustrate vectors; their values are not measured activations.
The original model jointly optimizes two autoregressive, teacher-forced cross-entropy losses. Corresponding encoder/decoder self-attention parameters are shared within each modality. The two linear projections are initialized as transposes and optimized independently. The displayed predictions are archived inference outputs, not a visualization of teacher forcing. Word chips are readable excerpts, not T5 subword boundaries.