



  

<!DOCTYPE html>
<html
  lang="en"
  
  data-color-mode="auto" data-light-theme="light" data-dark-theme="dark"
  data-a11y-animated-images="system" data-a11y-link-underlines="true"
  
  >




  <head>
    <meta charset="utf-8">
  <link rel="dns-prefetch" href="https://github.githubassets.com">
  <link rel="dns-prefetch" href="https://avatars.githubusercontent.com">
  <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com">
  <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/">
  <link rel="preconnect" href="https://github.githubassets.com" crossorigin>
  <link rel="preconnect" href="https://avatars.githubusercontent.com">

<script type="importmap">{"imports":{"react":"https://github.githubassets.com/assets/react-e27d1b3e03961e68.js","react-dom":"https://github.githubassets.com/assets/react-dom-e5fd46a22d5c4058.js","react-dom/client":"https://github.githubassets.com/assets/react-dom-client-1b4a3ee065998cea.js","react-is":"https://github.githubassets.com/assets/react-is-e0b593954b4706d8.js","react-reconciler":"https://github.githubassets.com/assets/react-reconciler-8e99e505c4429605.js","react/compiler-runtime":"https://github.githubassets.com/assets/react-compiler-runtime-4610bd6d3de9c049.js","react/jsx-dev-runtime":"https://github.githubassets.com/assets/react-jsx-dev-runtime-ea55d68667d559e5.js","react/jsx-runtime":"https://github.githubassets.com/assets/react-jsx-runtime-4915cb0f5b3aff04.js","scheduler":"https://github.githubassets.com/assets/scheduler-58b860b049ca307c.js"}}</script>
<meta name="react-profiling" content="0" data-turbo-transient="true" />
<meta name="react-import-map" content="react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@777f63f87cd0" data-turbo-track="reload" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-e27d1b3e03961e68.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-compiler-runtime-4610bd6d3de9c049.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/scheduler-58b860b049ca307c.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-dom-e5fd46a22d5c4058.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-dom-client-1b4a3ee065998cea.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-is-e0b593954b4706d8.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-jsx-runtime-4915cb0f5b3aff04.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-reconciler-8e99e505c4429605.js" />

  


  <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light-5c4e9fc574bf49f3.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light_high_contrast-fb37c309e0603a69.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark-afff6c53aef9b9d1.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark_high_contrast-c409873d7987dffa.css" /><link data-color-theme="light" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light-5c4e9fc574bf49f3.css" /><link data-color-theme="light_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_high_contrast-fb37c309e0603a69.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-0f910d8806d5761b.css" /><link data-color-theme="light_colorblind_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind_high_contrast-a7abd4d4c49ac593.css" /><link data-color-theme="light_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia-5fc4c4a9cb41e596.css" /><link data-color-theme="light_tritanopia_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia_high_contrast-ed0cee9214dedabd.css" /><link data-color-theme="dark" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark-afff6c53aef9b9d1.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-c409873d7987dffa.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-78a2491d538dab5a.css" /><link data-color-theme="dark_colorblind_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind_high_contrast-c26b63d7c532d0a2.css" /><link data-color-theme="dark_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia-a6f60cea68c08405.css" /><link data-color-theme="dark_tritanopia_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia_high_contrast-f66faf28b2ea18b6.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-6701f6218c53cf5b.css" /><link data-color-theme="dark_dimmed_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed_high_contrast-7037fa46ae124d97.css" />

  <style type="text/css">
    :root {
      --tab-size-preference: 4;
    }

    pre, code {
      tab-size: var(--tab-size-preference);
    }
  </style>

    <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-primitives-97df7784617ce1ea.css" />
    <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-9be9fe6313f476af.css" />
    <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-62747e27e61258dc.css" />
    <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-b04ca6fccda778e2.css" />
  <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/repository-72bd7d974b5ac1cc.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-4c5c0895f723f870.css" />

  

  <script type="application/json" id="client-env">{"locale":"en","featureFlags":["actions_caches_react_shell","actions_enable_background_steps","actions_new_hosted_runner_image_select_sizes_and_versions","actions_runners_react_shell","agent_author_search_expansion","agent_author_search_expansion_ui_pulls","alternate_user_config_repo","async_conversion_coverage_enabled","billing_billable_licenses_cost_center_bucket_fix","billing_budget_expiration","billing_cost_center_list_assigned_resources","billing_discount_threshold_notification","code_quality_enablement_banner_targeting","code_quality_remove_preview","code_view_raf_sticky_lines","codespaces_prebuild_region_target_update","coding_agent_third_party_model_ui","copilot_agent_snippy","copilot_ahp_tool_call_timing","copilot_api_agentic_issue_marshal_yaml","copilot_automation_repo_mcp_servers","copilot_automations_pagination","copilot_base_model_policy_row","copilot_chat_auto_mode_v2","copilot_chat_clear_model_selection_for_default_change","copilot_chat_early_task_provisioning","copilot_chat_persist_session_drafts","copilot_chat_vision_dotcom_chat_ga_gate","copilot_css_textarea_autosize","copilot_custom_copilots","copilot_custom_copilots_feature_preview","copilot_duplicate_thread","copilot_extensions_removal_on_marketplace","copilot_fix_failed_workflows_all_skus","copilot_hide_hovercard","copilot_immersive_task_hyperlinking","copilot_mc_cli_resume_any_users_task","copilot_mission_control_agent_merge_fix_ci","copilot_mission_control_agent_merge_resolve_conflicts","copilot_mission_control_awps_batching","copilot_mission_control_early_stop","copilot_mission_control_managed_sandbox_environments","copilot_mission_control_needs_attention","copilot_mission_control_reasoning_effort","copilot_mission_control_sandbox_remote_bypass","copilot_mission_control_task_alive_updates","copilot_mission_control_task_sharing","copilot_org_policy_page_focus_mode","copilot_share_active_subthread","copilot_spaces_ga","copilot_spaces_individual_policies_ga","copilot_swe_agent_authorization_status_ui","copilot_swe_agent_automation_resource_scoped_writes","copilot_swe_agent_discussion_comment_trigger","copilot_swe_agent_discussion_opened_trigger","copilot_swe_agent_discussion_updated_trigger","copilot_swe_agent_hide_model_picker_if_only_auto","copilot_swe_agent_issue_assigned_trigger","copilot_swe_agent_issue_comment_trigger","copilot_swe_agent_issue_labeled_trigger","copilot_swe_agent_pr_comment_model_picker","copilot_swe_agent_pull_request_assigned_trigger","copilot_swe_agent_pull_request_comment_trigger","copilot_swe_agent_pull_request_labeled_trigger","copilot_swe_agent_pull_request_merged_trigger","copilot_swe_agent_pull_request_opened_trigger","copilot_swe_agent_pull_request_ready_for_review_trigger","copilot_swe_agent_pull_request_review_requested_trigger","copilot_swe_agent_pull_request_review_submitted_trigger","copilot_swe_agent_pull_request_synchronize_trigger","copilot_swe_agent_sub_issue_added_trigger","copilot_swe_agent_use_subagents","copilot_task_api_github_rest_style","copilot_task_scoped_alive_channel","copilot_token_based_billing","copilot_unconfigured_is_inherited","copilot_user_can_upgrade_plan_field","copilot_web_integration_cutover","copilot_workbench_sunset_redirect","dashboard_agents_module_auth_token_check","dashboard_indexeddb_caching","fgpat_permissions_selector_redesign","glc_code_quality_repo_settings_workflow_config","hyperspace_2025_logged_out_batch_1","hyperspace_2025_logged_out_batch_2","hyperspace_2025_logged_out_batch_3","in_product_messaging_datadog_monitoring","ipm_ubb_individual_budget_banner","issue_fields_multi_select","issue_inline_avatars","issue_pinned_views","issue_pinned_views_team_vs_personal","issue_relative_time_micro","issue_viewer_paved_path","issues_expanded_file_types","issues_hide_closed_sub_issues","issues_lazy_load_comment_box_suggestions","issues_react_chrome_container_query_fix","labels_archiving","labels_archiving_info","landing_pages_ninetailed","lifecycle_label_name_updates","marketing_cookie_consent_banner","marketing_pages_search_explore_provider","memex_default_issue_create_repository","memex_live_update_hovercard","memex_mwl_filter_field_delimiter","memex_remove_deprecated_type_issue","merge_queue_restricted_pushers_warning","merge_status_header_feedback","milestone_closed_issues_prioritization","octocaptcha_origin_optimization","primer_react_css_anchor_positioning","primer_react_merged_forwarded_refs","primer_react_timeline_list_semantics","prs_copilot_app_open_action","prs_css_anchor_positioning","pull_request_copilot_attribution_header","pull_request_overview_merge_control","pull_request_overview_panel_edit_description","pull_request_persister","pull_request_stacks_navigation_shortcuts","pull_request_virtualization_image_estimate","pull_request_virtualization_loader_batching","pull_request_virtualization_scroll_compensation","pull_request_virtualization_scroll_intent","quick_search_lazy_suggestions","react_blob_isolate_code_lines","react_blob_ssr_content_visibility","react_data_router_tanstack_allowed","react_logged_out_repository_header","react_query_props_with_key","react_sandbox_future_tanstack","repo_app_turbo","repo_issues_sidebar_layout","repo_pulls_dashboard_declutter","repo_pulls_dashboard_ga","repo_pulls_dashboard_persistence","repos_contributors_limited_default_range","review_involves_filter","rule_ignored_file_paths","rulesets_actor_list_editor","sample_network_conn_type","security_center_artifact_filters_popover","see_who_reacted","semantic_similarity_duplicate_issue_detection","session_logs_ungroup_reasoning_text","set_sha256_on_repo_creation_form","site_banner_desktop_copilot_app","site_ghca_pixel_mona","site_github_app_ga_page","site_github_app_ga_page_highlight","site_github_app_mobile_native_share","site_global_banner_dev_days_attendee","site_global_nav_spark_models_removed","speculation_rules_ui_service","suggest_custom_property_values_copilot","suppress_automated_browser_vitals","swp_forms_disable_octocaptcha","thread_resolution_reason","update_issue_suggestions","viewscreen_sandbox","warn_inaccessible_attachments","webp_support","workstream_plugin_bootstrap"],"githubDomain":"https://github.com","copilotApiOverrideUrl":"https://api.githubcopilot.com","cmcApiUrl":"https://api.github.com/cmc_internal/api"}</script>
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/high-contrast-cookie-3663bcaacc724f4c.js"></script>
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/wp-runtime-721126455a2225e3.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/app-foundation-156c6259e31cc551.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/app-runtime-f6ce38f47c2e1d56.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/fetch-utilities-804a14996977c014.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ser-fb5d13278eb42203.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/tp-ea613009a991e211.js" />
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/environment-107a7753389a8a2d.js" defer="defer"></script>
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/app-runtime.25915bc98fb322a6.module.css" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/catalyst-52ed81112a548e10.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/selector-observer-e8810f64c443fb9b.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/relative-time-element-fe7e72f699fdf493.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/by-9da36843ba9d191d.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ja9-9a1160b939f2cd52.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/3h-55903cf2303047ad.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/hk-0d35a1220587d888.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/jz5-c964b1a3671f2a92.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/hj-1d800d09e9a8720a.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/j0-1ad12374da9777f2.js" />
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/github-elements-531d35538b61fd0d.js" defer="defer"></script>
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/element-registry-bf5e3b2aee197122.js" defer="defer"></script>
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/runtime-helpers-5e0b3ae3c4036207.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/aria-live-752acdc868e2da64.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/hotkey-e87ffadced20a3c9.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-core-75bc55d9971828b7.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/a9-34620c7b13885011.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ur-643d2814115561a9.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/4t6-5d0869970ac0aac0.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/pb0-a5c5ec36d311aeef.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/6n-afcf86ccabc4cad2.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/zj-f08c728cf00018aa.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/o6-2a1c68d269710ee9.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/h9a-c6405aa090de0e84.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/vy6-3c3e6e96629c2ce4.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/js-4eb97d5803e657c0.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/g7-baf9e817ae102b01.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/unc-96389cade7bad821.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/nu-65322a6997c6c93c.js" />
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/behaviors-5dd3809b5c8bac3c.js" defer="defer"></script>
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/react-core.3792087592bf207a.module.css" />
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/code-menu-4318f0f4c608f3dd.js" defer="defer"></script>
  
  <link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/primer-react-7afef75d393cf294.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/op-acddf38478d45ef9.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ncx-461e4b09f2e67ee5.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/qmp-c7cfba40cf5a93b0.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/j6-148a74299e5a01ab.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/t7l-a52ba56147f77909.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/4u-ec4874f70bfd5d76.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/s0-481bd34f90bc2bd7.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/y5-ed17e73b4c0bd15e.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/n4-be595475cdbf7d4b.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/j8-23a3c5ff8eef412d.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/la-27679061f16e1495.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/iu-9806a0291a782cbe.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ftx-39fb490e3c1d778f.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/zi-32a0c3c081ea5cce.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/sg-7a5d50475874c0e1.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/pd-6a8710840033e042.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/86g-ec28c25ed7d5de06.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/sn-1bab7384818953b7.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/iq-6d4ecf6d2fb6993c.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/p2-7d8e7cee5b46cb45.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/7d-2e3cc25d719f3a95.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/4d-76d8acdf21a33266.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/tsb-e0f6288ab985d9d2.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/lf-910ef220ce85c660.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/2j-2f19c1afd2ceaf93.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/me-f1476ec44a29f34a.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/p2u-e654a57b1a70c47d.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/5d-d97cc006d4da4d9b.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/r5-38f013bc2c0fd298.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/r6s-9039f5619230a653.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/9e-cece06724bf6ea3b.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/x9-3e077a3a37a73f9f.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/pj-87629cb5389d7663.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/eq-3764fd5f66494289.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/13-d889936dff7e5c0f.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/44-8193eea4af825ead.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/v4-9c1327d212e52a0d.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/id-7f39706ba9007db6.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ah-271362a1ed227d03.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/s1g-d434d712bca59d3a.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/vz-d7f4a583896f872e.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/47-c8c0ce2700acc5be.js" />
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/code-view-4118a687d0150749.js" defer="defer"></script>
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react-css.2d881b4d4a503d1c.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/pj.75627bfeb9ceb1da.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/ah.2623f7c6ecbe2ecd.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/47.78770c57a48a810c.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-view.37656c95a9729fb9.module.css" />


  <title>titans-pytorch-mlx/README.md at main · Aedelon/titans-pytorch-mlx · GitHub</title>



  <meta name="route-pattern" content="/:user_id/:repository/blob/*name(/*path)" data-turbo-transient>
  <meta name="route-controller" content="blob" data-turbo-transient>
  <meta name="route-action" content="show" data-turbo-transient>
  <meta name="fetch-nonce" content="v2:3e63eba4-7bb8-742f-f971-dc0d84660623">

    
  <meta name="current-catalog-service-hash" content="f3abb0cc802f3d7b95fc8762b94bdcb13bf39634c40c357301c4aa1d67a256fb">


  <meta name="request-id" content="DA90:256C02:ACEF061:E191D44:6ACA6015" data-pjax-transient="true"/><meta name="html-safe-nonce" content="0f27c68ec9940f34db99312fb34c0cf3418b920e770d45bb8615a3fb01b22c0b" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTkwOjI1NkMwMjpBQ0VGMDYxOkUxOTFENDQ6NkFDQTYwMTUiLCJ2aXNpdG9yX2lkIjoiNjIwNDA0NzQ2MDE5ODQwODIxMyIsInJlZ2lvbl9lZGdlIjoiZnJhIiwicmVnaW9uX3JlbmRlciI6ImZyYSJ9" data-pjax-transient="true"/><meta name="visitor-hmac" content="4731ee77e07037a46a8a776fe0128b88b723113194fda028823a58ba44457693" data-pjax-transient="true"/>


    <meta name="hovercard-subject-tag" content="repository:1135231308" data-turbo-transient>


  <meta name="github-keyboard-shortcuts" content="repository,source-code,file-tree,copilot" data-turbo-transient="true" />
  

  <meta name="selected-link" value="repo_source" data-turbo-transient>
  <link rel="assets" href="https://github.githubassets.com/">

    <meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I">

<meta name="octolytics-url" content="https://collector.github.com/github/collect" />





  <meta name="analytics-location" content="/&lt;user-name&gt;/&lt;repo-name&gt;/blob/show" data-turbo-transient="true" />

  




    <meta name="user-login" content="">

  

    <meta name="viewport" content="width=device-width">

    

      <meta name="description" content="PyTorch implementation of Google Titans: Learning to Memorize at Test Time (arXiv:2501.00663) - titans-pytorch-mlx/README.md at main · Aedelon/titans-pytorch-mlx">

      <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">

    <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
    <meta property="fb:app_id" content="1401488693436528">
    <meta name="apple-itunes-app" content="app-id=1477376905, app-argument=https://github.com/Aedelon/titans-pytorch-mlx/blob/main/README.md" />

      <meta name="twitter:image" content="https://opengraph.githubassets.com/4db2519a9837ed213b165e7357cc2e66c243966047445b77c41ed96c69c1b9fe/Aedelon/titans-pytorch-mlx" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="titans-pytorch-mlx/README.md at main · Aedelon/titans-pytorch-mlx" /><meta name="twitter:description" content="PyTorch implementation of Google Titans: Learning to Memorize at Test Time (arXiv:2501.00663) - Aedelon/titans-pytorch-mlx" />
  <meta property="og:image" content="https://opengraph.githubassets.com/4db2519a9837ed213b165e7357cc2e66c243966047445b77c41ed96c69c1b9fe/Aedelon/titans-pytorch-mlx" /><meta property="og:image:alt" content="PyTorch implementation of Google Titans: Learning to Memorize at Test Time (arXiv:2501.00663) - Aedelon/titans-pytorch-mlx" /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="600" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="titans-pytorch-mlx/README.md at main · Aedelon/titans-pytorch-mlx" /><meta property="og:url" content="https://github.com/Aedelon/titans-pytorch-mlx/blob/main/README.md" /><meta property="og:description" content="PyTorch implementation of Google Titans: Learning to Memorize at Test Time (arXiv:2501.00663) - Aedelon/titans-pytorch-mlx" />
  




      <meta name="hostname" content="github.com">



        <meta name="expected-hostname" content="github.com">


  <meta http-equiv="x-pjax-version" content="d05be8f8b6905b6460fc264e80447721dfee1e32cf9e4291c4bf58f160c9f705" data-turbo-track="reload">
  <meta http-equiv="x-pjax-csp-version" content="c4a65e47b0c850e1157ae8e66298070851d7e3b558038de5a3b4ff7a93e630ed" data-turbo-track="reload">
  <meta http-equiv="x-pjax-css-version" content="a80b0545b169f440b929ce2b977c76b6988f014cca6513fb83c5df6581635fb3" data-turbo-track="reload">
  <meta http-equiv="x-pjax-js-version" content="af51c6f9d659be0324665373df3ee542f817dbd7f66f352a087935f2ceabe545" data-turbo-track="reload">

  <meta name="turbo-cache-control" content="no-preview" data-turbo-transient="">

      <meta name="turbo-cache-control" content="no-cache" data-turbo-transient>

    <meta data-hydrostats="publish">

  <meta name="go-import" content="github.com/Aedelon/titans-pytorch-mlx git https://github.com/Aedelon/titans-pytorch-mlx.git">

  <meta name="octolytics-dimension-user_id" content="1285286" /><meta name="octolytics-dimension-user_login" content="Aedelon" /><meta name="octolytics-dimension-repository_id" content="1135231308" /><meta name="octolytics-dimension-repository_nwo" content="Aedelon/titans-pytorch-mlx" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="1135231308" /><meta name="octolytics-dimension-repository_network_root_nwo" content="Aedelon/titans-pytorch-mlx" />
  



    

    <meta name="turbo-body-classes" content="logged-out env-production page-responsive">
  <meta name="disable-turbo" content="false">


  <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">


  <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">

  <meta name="release" content="3b1bb5b10f5c7fd1769d56e38b15dfddb34052a8" data-turbo-track="reload">
  <meta name="ui-target" content="full">

  <link rel="mask-icon" href="https://github.githubassets.com/assets/pinned-octocat-093da3e6fa40.svg" color="#000000">
  <link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon.png">
  <link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg" data-base-href="https://github.githubassets.com/favicons/favicon">

<meta name="theme-color" content="#1e2327">
<meta name="color-scheme" content="light dark" />


  <link rel="manifest" href="/manifest.json" crossOrigin="use-credentials">

  </head>

  <body class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
    <div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
      <div id="__primerPortalRoot__" style="z-index: 1000; position: absolute; width: 100%;" data-turbo-permanent></div>
      

    <div class="position-relative header-wrapper js-header-wrapper ">
      <a href="#start-of-content" data-skip-target-assigned="false" class="px-2 tmp-py-4 color-bg-accent-emphasis color-fg-on-emphasis show-on-focus js-skip-to-content">Skip to content</a>

      <span data-view-component="true" class="progress-pjax-loader Progress position-fixed width-full">
    <span style="width: 0%;" data-view-component="true" class="Progress-item progress-pjax-loader-bar left-0 top-0 color-bg-accent-emphasis"></span>
</span>      
      <link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/19-c660652a0a1639be.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/keyboard-shortcuts-dialog-47c5223d8d1af8ef.js" fetchpriority="low" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react-css.2d881b4d4a503d1c.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/keyboard-shortcuts-dialog.d53d993320d57e14.module.css" />

<react-partial
  partial-name="keyboard-shortcuts-dialog"
  data-ssr="false"
  data-attempted-ssr="false"
  data-react-profiling="false"
>
  
  <script type="application/json" data-target="react-partial.embeddedData">{"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}</script>
  <div data-target="react-partial.reactRoot"></div>
</react-partial>





      

          <link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/app-install-banner-partial-3c87deb7f0f20434.js" fetchpriority="low" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react-css.2d881b4d4a503d1c.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/app-install-banner-partial.7b357012e82003e7.module.css" />

<react-partial
  partial-name="app-install-banner-partial"
  data-ssr="false"
  data-attempted-ssr="false"
  data-react-profiling="false"
>
  
  <script type="application/json" data-target="react-partial.embeddedData">{"props":{}}</script>
  <div data-target="react-partial.reactRoot"></div>
</react-partial>


          

                <link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/et9-7eeec247c287fca4.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/94v-e20946127faa8f6e.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/fz5-892a9e99cc92858d.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/jag-441e702bfd4c7904.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/hw-8ce7888b57d0a23c.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/rq-0ec82a12cf538a4d.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/1m-a7a4c022483b2713.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/marketing-header-70703fe17422eb58.js" fetchpriority="low" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react-css.2d881b4d4a503d1c.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react-brand-css.fbc35b3d20e988ff.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/1m.fec8b575d0e5234f.module.css" />

<react-partial
  partial-name="marketing-header"
  data-ssr="true"
  data-attempted-ssr="true"
  data-react-profiling="false"
>
  
  <script type="application/json" data-target="react-partial.embeddedData">{"props":{"color_mode":"dark","logged_in":false,"marketing_page":false,"home_path":"/","login_path":"/login?return_to=https%3A%2F%2Fgithub.com%2FAedelon%2Ftitans-pytorch-mlx%2Fblob%2Fmain%2FREADME.md","signup_path":"/signup?ref_cta=Sign+up\u0026ref_loc=header+logged+out\u0026ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fblob%2Fshow\u0026source=header-repo\u0026source_repo=Aedelon%2Ftitans-pytorch-mlx","signup_enabled":true,"is_signup_controller":false,"show_search_and_nav":true,"hide_search":false,"private_mode_enabled":false,"should_use_dotcom_links":true,"auth_hydro_click":"{\"event_type\":\"authentication.click\",\"payload\":{\"location_in_page\":\"site header menu\",\"repository_id\":null,\"auth_type\":\"SIGN_UP\",\"originating_url\":\"https://github.com/Aedelon/titans-pytorch-mlx/blob/main/README.md\",\"user_id\":null}}","auth_hydro_click_hmac":"87a017c25166130f38a5cad6912d9a25d6403dbbe2353bd771a630fac965a3f5","overlay":false,"fixed":false}}</script>
  <div data-target="react-partial.reactRoot"><div data-color-mode="dark" data-light-theme="light" data-dark-theme="dark"><header class="MarketingHeader-module__root__Tk7n3 HeaderMktg header-logged-out" role="banner" data-marketing-header="true" data-color-mode="dark" data-light-theme="light" data-dark-theme="dark" data-is-top="true"><h2 class="MarketingHeader-module__visuallyHidden__sqKsl">Navigation Menu</h2><button type="button" class="MarketingHeader-module__backdrop__sw4RU" aria-label="Close navigation menu"></button><div class="MarketingHeader-module__bar__mBSyE"><div class="MarketingHeader-module__topRow__yeury"><div class="MarketingHeader-module__toggleSlot__hDxbh"><button type="button" class="HeaderMenuToggle-module__toggle__i8EiC" aria-label="Toggle navigation" aria-expanded="false"><span class="HeaderMenuToggle-module__toggleBar__jVN0H"></span><span class="HeaderMenuToggle-module__toggleBar__jVN0H"></span><span class="HeaderMenuToggle-module__toggleBar__jVN0H"></span></button></div><a href="/" aria-label="Homepage" class="HeaderLogo-module__logo__UFyHI" data-analytics-event="{&quot;action&quot;:&quot;homepage&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;logo&quot;,&quot;location&quot;:&quot;header&quot;,&quot;label&quot;:&quot;homepage_link_logo_header&quot;}"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-mark-github" viewBox="0 0 24 24" width="32" height="32" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M10.226 17.284c-2.965-.36-5.054-2.493-5.054-5.256 0-1.123.404-2.336 1.078-3.144-.292-.741-.247-2.314.09-2.965.898-.112 2.111.36 2.83 1.01.853-.269 1.752-.404 2.853-.404 1.1 0 1.999.135 2.807.382.696-.629 1.932-1.1 2.83-.988.315.606.36 2.179.067 2.942.72.854 1.101 2 1.101 3.167 0 2.763-2.089 4.852-5.098 5.234.763.494 1.28 1.572 1.28 2.807v2.336c0 .674.561 1.056 1.235.786 4.066-1.55 7.255-5.615 7.255-10.646C23.5 6.188 18.334 1 11.978 1 5.62 1 .5 6.188.5 12.545c0 4.986 3.167 9.12 7.435 10.669.606.225 1.19-.18 1.19-.786V20.63a2.9 2.9 0 0 1-1.078.224c-1.483 0-2.359-.808-2.987-2.313-.247-.607-.517-.966-1.034-1.033-.27-.023-.359-.135-.359-.27 0-.27.45-.471.898-.471.652 0 1.213.404 1.797 1.235.45.651.921.943 1.483.943.561 0 .92-.202 1.437-.719.382-.381.674-.718.944-.943"></path></svg></a><div class="AuthCTAs-module__mobileActions__NNzeV"><a class="Primer_Brand__Button-module__Button___scH9Z Primer_Brand__Button-module__Button--subtle___F7pEE Primer_Brand__Button-module__Button--size-small___zQrEw AuthCTAs-module__cta__WpwQq" href="/login?return_to=https%3A%2F%2Fgithub.com%2FAedelon%2Ftitans-pytorch-mlx%2Fblob%2Fmain%2FREADME.md" data-analytics-event="{&quot;action&quot;:&quot;sign_in&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;auth_cta&quot;,&quot;location&quot;:&quot;header&quot;,&quot;label&quot;:&quot;sign_in_link_auth_cta_header&quot;}" data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;site header menu&quot;,&quot;repository_id&quot;:null,&quot;auth_type&quot;:&quot;SIGN_UP&quot;,&quot;originating_url&quot;:&quot;https://github.com/Aedelon/titans-pytorch-mlx/blob/main/README.md&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="87a017c25166130f38a5cad6912d9a25d6403dbbe2353bd771a630fac965a3f5"><span class="Primer_Brand__Button-module__Button__text___ED0bX"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ Primer_Brand__Button-module__Button--label___qrkyz Primer_Brand__Button-module__Button--label-subtle___8ndWH">Sign in</span></span></a><button class="Primer_Brand__Button-module__Button___scH9Z Primer_Brand__Button-module__Button--subtle___F7pEE Primer_Brand__Button-module__Button--size-small___zQrEw HeaderAppearanceSettings-module__trigger__hUheK" type="button" aria-haspopup="dialog" aria-labelledby="_R_3dd_"><span class="Primer_Brand__Button-module__Button__leading-visual___jjtTe" data-testid="Button-leading-visual"><svg data-component="Octicon" focusable="false" aria-hidden="true" class="octicon octicon-sliders Primer_Brand__Button-module__Button__icon-visual____qybb" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M15 2.75a.75.75 0 0 1-.75.75h-4a.75.75 0 0 1 0-1.5h4a.75.75 0 0 1 .75.75Zm-8.5.75v1.25a.75.75 0 0 0 1.5 0v-4a.75.75 0 0 0-1.5 0V2H1.75a.75.75 0 0 0 0 1.5H6.5Zm1.25 5.25a.75.75 0 0 0 0-1.5h-6a.75.75 0 0 0 0 1.5h6ZM15 8a.75.75 0 0 1-.75.75H11.5V10a.75.75 0 1 1-1.5 0V6a.75.75 0 0 1 1.5 0v1.25h2.75A.75.75 0 0 1 15 8Zm-9 5.25v-2a.75.75 0 0 0-1.5 0v1.25H1.75a.75.75 0 0 0 0 1.5H4.5v1.25a.75.75 0 0 0 1.5 0v-2Zm9 0a.75.75 0 0 1-.75.75h-6a.75.75 0 0 1 0-1.5h6a.75.75 0 0 1 .75.75Z"></path></svg></span><span class="Primer_Brand__Button-module__Button__text___ED0bX"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ Primer_Brand__Button-module__Button--label___qrkyz Primer_Brand__Button-module__Button--label-subtle___8ndWH"></span></span></button><div class="Primer_Brand__Tooltip-module__Tooltip___0Eipx" data-direction="s" aria-hidden="true" id="_R_3dd_">Appearance settings</div></div></div><div class="MarketingHeader-module__menu__GIy3y"><div class="MarketingHeader-module__menuWrapper__owstH"><nav class="MarketingNavigation-module__nav__W0KYY" aria-label="Global"><ul class="MarketingNavigation-module__list__tFbMb"><li><div class="NavDropdown-module__container__l2YeI"><button type="button" class="NavDropdown-module__button__PEHWX" aria-expanded="false" aria-controls="_R_nd_">Platform<svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-right NavDropdown-module__buttonIcon__Tkl8_" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m6.427 4.427 3.396 3.396a.25.25 0 0 1 0 .354l-3.396 3.396A.25.25 0 0 1 6 11.396V4.604a.25.25 0 0 1 .427-.177Z"></path></svg></button><div id="_R_nd_" class="NavDropdown-module__dropdown__xm1jd"><ul class="NavDropdown-module__list__zuCgG"><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_5knd_">AI CODE CREATION</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_5knd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/copilot" data-analytics-event="{&quot;action&quot;:&quot;github_copilot&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;github_copilot_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-copilot NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M7.998 15.035c-4.562 0-7.873-2.914-7.998-3.749V9.338c.085-.628.677-1.686 1.588-2.065.013-.07.024-.143.036-.218.029-.183.06-.384.126-.612-.201-.508-.254-1.084-.254-1.656 0-.87.128-1.769.693-2.484.579-.733 1.494-1.124 2.724-1.261 1.206-.134 2.262.034 2.944.765.05.053.096.108.139.165.044-.057.094-.112.143-.165.682-.731 1.738-.899 2.944-.765 1.23.137 2.145.528 2.724 1.261.566.715.693 1.614.693 2.484 0 .572-.053 1.148-.254 1.656.066.228.098.429.126.612.012.076.024.148.037.218.924.385 1.522 1.471 1.591 2.095v1.872c0 .766-3.351 3.795-8.002 3.795Zm0-1.485c2.28 0 4.584-1.11 5.002-1.433V7.862l-.023-.116c-.49.21-1.075.291-1.727.291-1.146 0-2.059-.327-2.71-.991A3.222 3.222 0 0 1 8 6.303a3.24 3.24 0 0 1-.544.743c-.65.664-1.563.991-2.71.991-.652 0-1.236-.081-1.727-.291l-.023.116v4.255c.419.323 2.722 1.433 5.002 1.433ZM6.762 2.83c-.193-.206-.637-.413-1.682-.297-1.019.113-1.479.404-1.713.7-.247.312-.369.789-.369 1.554 0 .793.129 1.171.308 1.371.162.181.519.379 1.442.379.853 0 1.339-.235 1.638-.54.315-.322.527-.827.617-1.553.117-.935-.037-1.395-.241-1.614Zm4.155-.297c-1.044-.116-1.488.091-1.681.297-.204.219-.359.679-.242 1.614.091.726.303 1.231.618 1.553.299.305.784.54 1.638.54.922 0 1.28-.198 1.442-.379.179-.2.308-.578.308-1.371 0-.765-.123-1.242-.37-1.554-.233-.296-.693-.587-1.713-.7Z"></path><path d="M6.25 9.037a.75.75 0 0 1 .75.75v1.501a.75.75 0 0 1-1.5 0V9.787a.75.75 0 0 1 .75-.75Zm4.25.75v1.501a.75.75 0 0 1-1.5 0V9.787a.75.75 0 0 1 1.5 0Z"></path></svg>GitHub Copilot</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Write better code with AI</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/ai/github-app" data-analytics-event="{&quot;action&quot;:&quot;github_copilot_app&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;github_copilot_app_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-mark-github NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M6.766 11.328c-2.063-.25-3.516-1.734-3.516-3.656 0-.781.281-1.625.75-2.188-.203-.515-.172-1.609.063-2.062.625-.078 1.468.25 1.968.703.594-.187 1.219-.281 1.985-.281.765 0 1.39.094 1.953.265.484-.437 1.344-.765 1.969-.687.218.422.25 1.515.046 2.047.5.593.766 1.39.766 2.203 0 1.922-1.453 3.375-3.547 3.64.531.344.89 1.094.89 1.954v1.625c0 .468.391.734.86.547C13.781 14.359 16 11.53 16 8.03 16 3.61 12.406 0 7.984 0 3.563 0 0 3.61 0 8.031a7.88 7.88 0 0 0 5.172 7.422c.422.156.828-.125.828-.547v-1.25c-.219.094-.5.156-.75.156-1.031 0-1.64-.562-2.078-1.609-.172-.422-.36-.672-.719-.719-.187-.015-.25-.093-.25-.187 0-.188.313-.328.625-.328.453 0 .844.281 1.25.86.313.452.64.655 1.031.655s.641-.14 1-.5c.266-.265.47-.5.657-.656"></path></svg>GitHub Copilot app</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Direct agents from issue to merge</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/mcp" data-analytics-event="{&quot;action&quot;:&quot;mcp_registry&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;mcp_registry_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-mcp NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M5.52 1.12a3.578 3.578 0 0 1 6.078 2.98 3.578 3.578 0 0 1 2.982 6.08l-3.292 3.293a.252.252 0 0 0 0 .354l.843.843a.749.749 0 1 1-1.06 1.06l-.844-.843a1.75 1.75 0 0 1 0-2.474L13.52 9.12a2.08 2.08 0 0 0 0-2.94 2.08 2.08 0 0 0-2.94 0L7.731 9.03A.75.75 0 0 1 6.67 7.97l2.85-2.85a2.08 2.08 0 0 0 0-2.94 2.08 2.08 0 0 0-2.94 0l-4.799 4.8A.75.75 0 0 1 .72 5.92Z"></path><path d="M7.52 3.12a.749.749 0 1 1 1.06 1.06L5.731 7.03A2.079 2.079 0 0 0 8.67 9.97l2.85-2.85a.749.749 0 1 1 1.06 1.06l-2.849 2.85A3.578 3.578 0 0 1 4.67 5.97Z"></path></svg>MCP Registry</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Integrate external tools</span></span></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_9knd_">DEVELOPER WORKFLOWS</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_9knd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/actions" data-analytics-event="{&quot;action&quot;:&quot;actions&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;actions_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-workflow NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M0 1.75C0 .784.784 0 1.75 0h3.5C6.216 0 7 .784 7 1.75v3.5A1.75 1.75 0 0 1 5.25 7H4v4a1 1 0 0 0 1 1h4v-1.25C9 9.784 9.784 9 10.75 9h3.5c.966 0 1.75.784 1.75 1.75v3.5A1.75 1.75 0 0 1 14.25 16h-3.5A1.75 1.75 0 0 1 9 14.25v-.75H5A2.5 2.5 0 0 1 2.5 11V7h-.75A1.75 1.75 0 0 1 0 5.25Zm1.75-.25a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Zm9 9a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Z"></path></svg>Actions</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Automate any workflow</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/codespaces" data-analytics-event="{&quot;action&quot;:&quot;codespaces&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;codespaces_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-codespaces NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M0 11.25c0-.966.784-1.75 1.75-1.75h12.5c.966 0 1.75.784 1.75 1.75v3A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25Zm2-9.5C2 .784 2.784 0 3.75 0h8.5C13.216 0 14 .784 14 1.75v5a1.75 1.75 0 0 1-1.75 1.75h-8.5A1.75 1.75 0 0 1 2 6.75Zm1.75-.25a.25.25 0 0 0-.25.25v5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-5a.25.25 0 0 0-.25-.25Zm-2 9.5a.25.25 0 0 0-.25.25v3c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-3a.25.25 0 0 0-.25-.25Z"></path><path d="M7 12.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path></svg>Codespaces</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Instant dev environments</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/issues" data-analytics-event="{&quot;action&quot;:&quot;issues&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;issues_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-issue-opened NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path></svg>Issues</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Plan and track work</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/code-review" data-analytics-event="{&quot;action&quot;:&quot;code_review&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;code_review_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-code NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg>Code Review</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Manage code changes</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/code-quality" data-analytics-event="{&quot;action&quot;:&quot;code_quality&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;code_quality_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-codescan-checkmark NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M10.28 6.28a.75.75 0 1 0-1.06-1.06L6.25 8.19l-.97-.97a.75.75 0 0 0-1.06 1.06l1.5 1.5a.75.75 0 0 0 1.06 0l3.5-3.5Z"></path><path d="M7.5 15a7.5 7.5 0 1 1 5.807-2.754l2.473 2.474a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-2.474-2.473A7.472 7.472 0 0 1 7.5 15Zm0-13.5a6 6 0 1 0 4.094 10.386.748.748 0 0 1 .293-.292 6.002 6.002 0 0 0 1.117-6.486A6.002 6.002 0 0 0 7.5 1.5Z"></path></svg>Code Quality</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Enforce quality at merge</span></span></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_dknd_">APPLICATION SECURITY</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_dknd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/security/advanced-security" data-analytics-event="{&quot;action&quot;:&quot;github_advanced_security&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;github_advanced_security_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-shield-check NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m8.533.133 5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667l5.25-1.68a1.748 1.748 0 0 1 1.066 0Zm-.61 1.429.001.001-5.25 1.68a.251.251 0 0 0-.174.237V7c0 1.36.275 2.666 1.057 3.859.784 1.194 2.121 2.342 4.366 3.298a.196.196 0 0 0 .154 0c2.245-.957 3.582-2.103 4.366-3.297C13.225 9.666 13.5 8.358 13.5 7V3.48a.25.25 0 0 0-.174-.238l-5.25-1.68a.25.25 0 0 0-.153 0ZM11.28 6.28l-3.5 3.5a.75.75 0 0 1-1.06 0l-1.5-1.5a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l.97.97 2.97-2.97a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg>GitHub Advanced Security</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Find and fix vulnerabilities</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/security/advanced-security/code-security" data-analytics-event="{&quot;action&quot;:&quot;code_security&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;code_security_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-code-square NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25Zm7.47 3.97a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L10.69 8 9.22 6.53a.75.75 0 0 1 0-1.06ZM6.78 6.53 5.31 8l1.47 1.47a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-2-2a.75.75 0 0 1 0-1.06l2-2a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg>Code security</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Secure your code as you build</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/security/advanced-security/secret-protection" data-analytics-event="{&quot;action&quot;:&quot;secret_protection&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;secret_protection_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-lock NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M4 4a4 4 0 0 1 8 0v2h.25c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 12.25 15h-8.5A1.75 1.75 0 0 1 2 13.25v-5.5C2 6.784 2.784 6 3.75 6H4Zm8.25 3.5h-8.5a.25.25 0 0 0-.25.25v5.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-5.5a.25.25 0 0 0-.25-.25ZM10.5 6V4a2.5 2.5 0 1 0-5 0v2Z"></path></svg>Secret protection</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Stop leaks before they start</span></span></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ NavGroup-module__hasSeparator__FnMrN"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_hknd_">EXPLORE</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_hknd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/why-github" data-analytics-event="{&quot;action&quot;:&quot;why_github&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;why_github_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Why GitHub</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://docs.github.com" data-analytics-event="{&quot;action&quot;:&quot;documentation&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;documentation_link_platform_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Documentation</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://github.blog" data-analytics-event="{&quot;action&quot;:&quot;blog&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;blog_link_platform_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Blog</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://github.blog/changelog" data-analytics-event="{&quot;action&quot;:&quot;changelog&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;changelog_link_platform_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Changelog</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/marketplace" data-analytics-event="{&quot;action&quot;:&quot;marketplace&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;marketplace_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Marketplace</span></a></li></ul></div></li></ul><div class="NavDropdown-module__trailingLinkContainer__VgJGL"><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--arrow-end___esdN8" href="https://github.com/features" data-analytics-event="{&quot;action&quot;:&quot;view_all_features&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;view_all_features_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">View all features</span><svg class="Primer_Brand__ExpandableArrow-module__ExpandableArrow___aaZs9 Primer_Brand__Link-module__Link-arrow___yd78i" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path fill="currentColor" d="M7.28033 3.21967C6.98744 2.92678 6.51256 2.92678 6.21967 3.21967C5.92678 3.51256 5.92678 3.98744 6.21967 4.28033L7.28033 3.21967ZM11 8L11.5303 8.53033C11.8232 8.23744 11.8232 7.76256 11.5303 7.46967L11 8ZM6.21967 11.7197C5.92678 12.0126 5.92678 12.4874 6.21967 12.7803C6.51256 13.0732 6.98744 13.0732 7.28033 12.7803L6.21967 11.7197ZM6.21967 4.28033L10.4697 8.53033L11.5303 7.46967L7.28033 3.21967L6.21967 4.28033ZM10.4697 7.46967L6.21967 11.7197L7.28033 12.7803L11.5303 8.53033L10.4697 7.46967Z"></path><path class="Primer_Brand__ExpandableArrow-module__ExpandableArrow-stem___0K8Hz" stroke="currentColor" d="M1.75 8H11" stroke-width="1.5" stroke-linecap="round"></path></svg></a></div></div></div></li><li><div class="NavDropdown-module__container__l2YeI"><button type="button" class="NavDropdown-module__button__PEHWX" aria-expanded="false" aria-controls="_R_17d_">Solutions<svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-right NavDropdown-module__buttonIcon__Tkl8_" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m6.427 4.427 3.396 3.396a.25.25 0 0 1 0 .354l-3.396 3.396A.25.25 0 0 1 6 11.396V4.604a.25.25 0 0 1 .427-.177Z"></path></svg></button><div id="_R_17d_" class="NavDropdown-module__dropdown__xm1jd"><ul class="NavDropdown-module__list__zuCgG"><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_5l7d_">BY COMPANY SIZE</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_5l7d_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/enterprise" data-analytics-event="{&quot;action&quot;:&quot;enterprises&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;enterprises_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Enterprises</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/team" data-analytics-event="{&quot;action&quot;:&quot;small_and_medium_teams&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;small_and_medium_teams_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Small and medium teams</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/enterprise/startups" data-analytics-event="{&quot;action&quot;:&quot;startups&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;startups_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Startups</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/industry/nonprofits" data-analytics-event="{&quot;action&quot;:&quot;nonprofits&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;nonprofits_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Nonprofits</span></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_9l7d_">BY USE CASE</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_9l7d_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/use-case/app-modernization" data-analytics-event="{&quot;action&quot;:&quot;app_modernization&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;app_modernization_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">App Modernization</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/use-case/devsecops" data-analytics-event="{&quot;action&quot;:&quot;devsecops&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;devsecops_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">DevSecOps</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/use-case/devops" data-analytics-event="{&quot;action&quot;:&quot;devops&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;devops_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">DevOps</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/use-case/ci-cd" data-analytics-event="{&quot;action&quot;:&quot;ci/cd&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;ci/cd_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">CI/CD</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--arrow-end___esdN8" href="https://github.com/solutions/use-case" data-analytics-event="{&quot;action&quot;:&quot;view_all_use_cases&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;view_all_use_cases_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">View all use cases</span><svg class="Primer_Brand__ExpandableArrow-module__ExpandableArrow___aaZs9 Primer_Brand__Link-module__Link-arrow___yd78i" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path fill="currentColor" d="M7.28033 3.21967C6.98744 2.92678 6.51256 2.92678 6.21967 3.21967C5.92678 3.51256 5.92678 3.98744 6.21967 4.28033L7.28033 3.21967ZM11 8L11.5303 8.53033C11.8232 8.23744 11.8232 7.76256 11.5303 7.46967L11 8ZM6.21967 11.7197C5.92678 12.0126 5.92678 12.4874 6.21967 12.7803C6.51256 13.0732 6.98744 13.0732 7.28033 12.7803L6.21967 11.7197ZM6.21967 4.28033L10.4697 8.53033L11.5303 7.46967L7.28033 3.21967L6.21967 4.28033ZM10.4697 7.46967L6.21967 11.7197L7.28033 12.7803L11.5303 8.53033L10.4697 7.46967Z"></path><path class="Primer_Brand__ExpandableArrow-module__ExpandableArrow-stem___0K8Hz" stroke="currentColor" d="M1.75 8H11" stroke-width="1.5" stroke-linecap="round"></path></svg></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_dl7d_">BY INDUSTRY</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_dl7d_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/industry/healthcare" data-analytics-event="{&quot;action&quot;:&quot;healthcare&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;healthcare_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Healthcare</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/industry/financial-services" data-analytics-event="{&quot;action&quot;:&quot;financial_services&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;financial_services_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Financial services</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/industry/manufacturing" data-analytics-event="{&quot;action&quot;:&quot;manufacturing&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;manufacturing_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Manufacturing</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/industry/government" data-analytics-event="{&quot;action&quot;:&quot;government&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;government_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Government</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--arrow-end___esdN8" href="https://github.com/solutions/industry" data-analytics-event="{&quot;action&quot;:&quot;view_all_industries&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;view_all_industries_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">View all industries</span><svg class="Primer_Brand__ExpandableArrow-module__ExpandableArrow___aaZs9 Primer_Brand__Link-module__Link-arrow___yd78i" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path fill="currentColor" d="M7.28033 3.21967C6.98744 2.92678 6.51256 2.92678 6.21967 3.21967C5.92678 3.51256 5.92678 3.98744 6.21967 4.28033L7.28033 3.21967ZM11 8L11.5303 8.53033C11.8232 8.23744 11.8232 7.76256 11.5303 7.46967L11 8ZM6.21967 11.7197C5.92678 12.0126 5.92678 12.4874 6.21967 12.7803C6.51256 13.0732 6.98744 13.0732 7.28033 12.7803L6.21967 11.7197ZM6.21967 4.28033L10.4697 8.53033L11.5303 7.46967L7.28033 3.21967L6.21967 4.28033ZM10.4697 7.46967L6.21967 11.7197L7.28033 12.7803L11.5303 8.53033L10.4697 7.46967Z"></path><path class="Primer_Brand__ExpandableArrow-module__ExpandableArrow-stem___0K8Hz" stroke="currentColor" d="M1.75 8H11" stroke-width="1.5" stroke-linecap="round"></path></svg></a></li></ul></div></li></ul><div class="NavDropdown-module__trailingLinkContainer__VgJGL"><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--arrow-end___esdN8" href="https://github.com/solutions" data-analytics-event="{&quot;action&quot;:&quot;view_all_solutions&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;view_all_solutions_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">View all solutions</span><svg class="Primer_Brand__ExpandableArrow-module__ExpandableArrow___aaZs9 Primer_Brand__Link-module__Link-arrow___yd78i" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path fill="currentColor" d="M7.28033 3.21967C6.98744 2.92678 6.51256 2.92678 6.21967 3.21967C5.92678 3.51256 5.92678 3.98744 6.21967 4.28033L7.28033 3.21967ZM11 8L11.5303 8.53033C11.8232 8.23744 11.8232 7.76256 11.5303 7.46967L11 8ZM6.21967 11.7197C5.92678 12.0126 5.92678 12.4874 6.21967 12.7803C6.51256 13.0732 6.98744 13.0732 7.28033 12.7803L6.21967 11.7197ZM6.21967 4.28033L10.4697 8.53033L11.5303 7.46967L7.28033 3.21967L6.21967 4.28033ZM10.4697 7.46967L6.21967 11.7197L7.28033 12.7803L11.5303 8.53033L10.4697 7.46967Z"></path><path class="Primer_Brand__ExpandableArrow-module__ExpandableArrow-stem___0K8Hz" stroke="currentColor" d="M1.75 8H11" stroke-width="1.5" stroke-linecap="round"></path></svg></a></div></div></div></li><li><div class="NavDropdown-module__container__l2YeI"><button type="button" class="NavDropdown-module__button__PEHWX" aria-expanded="false" aria-controls="_R_1nd_">Resources<svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-right NavDropdown-module__buttonIcon__Tkl8_" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m6.427 4.427 3.396 3.396a.25.25 0 0 1 0 .354l-3.396 3.396A.25.25 0 0 1 6 11.396V4.604a.25.25 0 0 1 .427-.177Z"></path></svg></button><div id="_R_1nd_" class="NavDropdown-module__dropdown__xm1jd"><ul class="NavDropdown-module__list__zuCgG"><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_5lnd_">EXPLORE BY TOPIC</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_5lnd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/resources/articles?topic=ai" data-analytics-event="{&quot;action&quot;:&quot;ai&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;ai_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">AI</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/resources/articles?topic=software-development" data-analytics-event="{&quot;action&quot;:&quot;software_development&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;software_development_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Software Development</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/resources/articles?topic=devops" data-analytics-event="{&quot;action&quot;:&quot;devops&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;devops_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">DevOps</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/resources/articles?topic=security" data-analytics-event="{&quot;action&quot;:&quot;security&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;security_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Security</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--arrow-end___esdN8" href="https://github.com/resources/articles" data-analytics-event="{&quot;action&quot;:&quot;view_all_topics&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;view_all_topics_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">View all topics</span><svg class="Primer_Brand__ExpandableArrow-module__ExpandableArrow___aaZs9 Primer_Brand__Link-module__Link-arrow___yd78i" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path fill="currentColor" d="M7.28033 3.21967C6.98744 2.92678 6.51256 2.92678 6.21967 3.21967C5.92678 3.51256 5.92678 3.98744 6.21967 4.28033L7.28033 3.21967ZM11 8L11.5303 8.53033C11.8232 8.23744 11.8232 7.76256 11.5303 7.46967L11 8ZM6.21967 11.7197C5.92678 12.0126 5.92678 12.4874 6.21967 12.7803C6.51256 13.0732 6.98744 13.0732 7.28033 12.7803L6.21967 11.7197ZM6.21967 4.28033L10.4697 8.53033L11.5303 7.46967L7.28033 3.21967L6.21967 4.28033ZM10.4697 7.46967L6.21967 11.7197L7.28033 12.7803L11.5303 8.53033L10.4697 7.46967Z"></path><path class="Primer_Brand__ExpandableArrow-module__ExpandableArrow-stem___0K8Hz" stroke="currentColor" d="M1.75 8H11" stroke-width="1.5" stroke-linecap="round"></path></svg></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_9lnd_">EXPLORE BY TYPE</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_9lnd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/customer-stories" data-analytics-event="{&quot;action&quot;:&quot;customer_stories&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;customer_stories_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Customer stories</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/resources/events" data-analytics-event="{&quot;action&quot;:&quot;events__webinars&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;events__webinars_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Events &amp; webinars</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/resources/whitepapers" data-analytics-event="{&quot;action&quot;:&quot;ebooks__reports&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;ebooks__reports_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Ebooks &amp; reports</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/executive-insights" data-analytics-event="{&quot;action&quot;:&quot;business_insights&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;business_insights_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Business insights</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://skills.github.com" data-analytics-event="{&quot;action&quot;:&quot;github_skills&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;github_skills_link_resources_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">GitHub Skills</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_dlnd_">SUPPORT &amp; SERVICES</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_dlnd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://docs.github.com" data-analytics-event="{&quot;action&quot;:&quot;documentation&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;documentation_link_resources_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Documentation</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://support.github.com" data-analytics-event="{&quot;action&quot;:&quot;customer_support&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;customer_support_link_resources_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Customer support</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/orgs/community/discussions" data-analytics-event="{&quot;action&quot;:&quot;community_forum&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;community_forum_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Community forum</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/trust-center" data-analytics-event="{&quot;action&quot;:&quot;trust_center&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;trust_center_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Trust center</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/partners" data-analytics-event="{&quot;action&quot;:&quot;partners&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;partners_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Partners</span></a></li></ul></div></li></ul><div class="NavDropdown-module__trailingLinkContainer__VgJGL"><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--arrow-end___esdN8" href="https://github.com/resources" data-analytics-event="{&quot;action&quot;:&quot;view_all_resources&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;view_all_resources_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">View all resources</span><svg class="Primer_Brand__ExpandableArrow-module__ExpandableArrow___aaZs9 Primer_Brand__Link-module__Link-arrow___yd78i" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path fill="currentColor" d="M7.28033 3.21967C6.98744 2.92678 6.51256 2.92678 6.21967 3.21967C5.92678 3.51256 5.92678 3.98744 6.21967 4.28033L7.28033 3.21967ZM11 8L11.5303 8.53033C11.8232 8.23744 11.8232 7.76256 11.5303 7.46967L11 8ZM6.21967 11.7197C5.92678 12.0126 5.92678 12.4874 6.21967 12.7803C6.51256 13.0732 6.98744 13.0732 7.28033 12.7803L6.21967 11.7197ZM6.21967 4.28033L10.4697 8.53033L11.5303 7.46967L7.28033 3.21967L6.21967 4.28033ZM10.4697 7.46967L6.21967 11.7197L7.28033 12.7803L11.5303 8.53033L10.4697 7.46967Z"></path><path class="Primer_Brand__ExpandableArrow-module__ExpandableArrow-stem___0K8Hz" stroke="currentColor" d="M1.75 8H11" stroke-width="1.5" stroke-linecap="round"></path></svg></a></div></div></div></li><li><div class="NavDropdown-module__container__l2YeI"><button type="button" class="NavDropdown-module__button__PEHWX" aria-expanded="false" aria-controls="_R_27d_">Open Source<svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-right NavDropdown-module__buttonIcon__Tkl8_" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m6.427 4.427 3.396 3.396a.25.25 0 0 1 0 .354l-3.396 3.396A.25.25 0 0 1 6 11.396V4.604a.25.25 0 0 1 .427-.177Z"></path></svg></button><div id="_R_27d_" class="NavDropdown-module__dropdown__xm1jd"><ul class="NavDropdown-module__list__zuCgG"><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_5m7d_">COMMUNITY</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_5m7d_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/open-source/sponsors" data-analytics-event="{&quot;action&quot;:&quot;github_sponsors&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;github_sponsors_link_open_source_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-sponsor-tiers NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M10.586 1C12.268 1 13.5 2.37 13.5 4.25c0 1.745-.996 3.359-2.622 4.831-.166.15-.336.297-.509.438l1.116 5.584a.75.75 0 0 1-.991.852l-2.409-.876a.25.25 0 0 0-.17 0l-2.409.876a.75.75 0 0 1-.991-.852L5.63 9.519a13.78 13.78 0 0 1-.51-.438C3.497 7.609 2.5 5.995 2.5 4.25 2.5 2.37 3.732 1 5.414 1c.963 0 1.843.403 2.474 1.073L8 2.198l.112-.125a3.385 3.385 0 0 1 2.283-1.068L10.586 1Zm-3.621 9.495-.718 3.594 1.155-.42a1.75 1.75 0 0 1 1.028-.051l.168.051 1.154.42-.718-3.592c-.199.13-.37.235-.505.314l-.169.097a.75.75 0 0 1-.72 0 9.54 9.54 0 0 1-.515-.308l-.16-.105ZM10.586 2.5c-.863 0-1.611.58-1.866 1.459-.209.721-1.231.721-1.44 0C7.025 3.08 6.277 2.5 5.414 2.5 4.598 2.5 4 3.165 4 4.25c0 1.23.786 2.504 2.128 3.719.49.443 1.018.846 1.546 1.198l.325.21.076-.047.251-.163a13.341 13.341 0 0 0 1.546-1.198C11.214 6.754 12 5.479 12 4.25c0-1.085-.598-1.75-1.414-1.75Z"></path></svg>GitHub Sponsors</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Fund open source developers</span></span></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_9m7d_">PROGRAMS</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_9m7d_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://securitylab.github.com" data-analytics-event="{&quot;action&quot;:&quot;security_lab&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;security_lab_link_open_source_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Security Lab</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://maintainers.github.com" data-analytics-event="{&quot;action&quot;:&quot;maintainer_community&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;maintainer_community_link_open_source_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Maintainer Community</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://stars.github.com" data-analytics-event="{&quot;action&quot;:&quot;github_stars&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;github_stars_link_open_source_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">GitHub Stars</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://archiveprogram.github.com" data-analytics-event="{&quot;action&quot;:&quot;archive_program&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;archive_program_link_open_source_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Archive Program</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_dm7d_">REPOSITORIES</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_dm7d_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/topics" data-analytics-event="{&quot;action&quot;:&quot;topics&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;topics_link_open_source_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Topics</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/trending" data-analytics-event="{&quot;action&quot;:&quot;trending&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;trending_link_open_source_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Trending</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/collections" data-analytics-event="{&quot;action&quot;:&quot;collections&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;collections_link_open_source_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Collections</span></a></li></ul></div></li></ul></div></div></li><li><div class="NavDropdown-module__container__l2YeI"><button type="button" class="NavDropdown-module__button__PEHWX" aria-expanded="false" aria-controls="_R_2nd_">Enterprise<svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-right NavDropdown-module__buttonIcon__Tkl8_" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m6.427 4.427 3.396 3.396a.25.25 0 0 1 0 .354l-3.396 3.396A.25.25 0 0 1 6 11.396V4.604a.25.25 0 0 1 .427-.177Z"></path></svg></button><div id="_R_2nd_" class="NavDropdown-module__dropdown__xm1jd"><ul class="NavDropdown-module__list__zuCgG"><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_5mnd_">ENTERPRISE SOLUTIONS</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_5mnd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/enterprise" data-analytics-event="{&quot;action&quot;:&quot;enterprise_platform&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;enterprise&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;enterprise_platform_link_enterprise_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-stack NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M7.122.392a1.75 1.75 0 0 1 1.756 0l5.003 2.902c.83.481.83 1.68 0 2.162L8.878 8.358a1.75 1.75 0 0 1-1.756 0L2.119 5.456a1.251 1.251 0 0 1 0-2.162ZM8.125 1.69a.248.248 0 0 0-.25 0l-4.63 2.685 4.63 2.685a.248.248 0 0 0 .25 0l4.63-2.685ZM1.601 7.789a.75.75 0 0 1 1.025-.273l5.249 3.044a.248.248 0 0 0 .25 0l5.249-3.044a.75.75 0 0 1 .752 1.298l-5.248 3.044a1.75 1.75 0 0 1-1.756 0L1.874 8.814A.75.75 0 0 1 1.6 7.789Zm0 3.5a.75.75 0 0 1 1.025-.273l5.249 3.044a.248.248 0 0 0 .25 0l5.249-3.044a.75.75 0 0 1 .752 1.298l-5.248 3.044a1.75 1.75 0 0 1-1.756 0l-5.248-3.044a.75.75 0 0 1-.273-1.025Z"></path></svg>Enterprise platform</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">AI-powered developer platform</span></span></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_9mnd_">AVAILABLE ADD-ONS</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_9mnd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/security/advanced-security" data-analytics-event="{&quot;action&quot;:&quot;github_advanced_security&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;enterprise&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;github_advanced_security_link_enterprise_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-shield-check NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m8.533.133 5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667l5.25-1.68a1.748 1.748 0 0 1 1.066 0Zm-.61 1.429.001.001-5.25 1.68a.251.251 0 0 0-.174.237V7c0 1.36.275 2.666 1.057 3.859.784 1.194 2.121 2.342 4.366 3.298a.196.196 0 0 0 .154 0c2.245-.957 3.582-2.103 4.366-3.297C13.225 9.666 13.5 8.358 13.5 7V3.48a.25.25 0 0 0-.174-.238l-5.25-1.68a.25.25 0 0 0-.153 0ZM11.28 6.28l-3.5 3.5a.75.75 0 0 1-1.06 0l-1.5-1.5a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l.97.97 2.97-2.97a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg>GitHub Advanced Security</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Enterprise-grade security features</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/copilot/copilot-business" data-analytics-event="{&quot;action&quot;:&quot;copilot_for_business&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;enterprise&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;copilot_for_business_link_enterprise_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-copilot NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M7.998 15.035c-4.562 0-7.873-2.914-7.998-3.749V9.338c.085-.628.677-1.686 1.588-2.065.013-.07.024-.143.036-.218.029-.183.06-.384.126-.612-.201-.508-.254-1.084-.254-1.656 0-.87.128-1.769.693-2.484.579-.733 1.494-1.124 2.724-1.261 1.206-.134 2.262.034 2.944.765.05.053.096.108.139.165.044-.057.094-.112.143-.165.682-.731 1.738-.899 2.944-.765 1.23.137 2.145.528 2.724 1.261.566.715.693 1.614.693 2.484 0 .572-.053 1.148-.254 1.656.066.228.098.429.126.612.012.076.024.148.037.218.924.385 1.522 1.471 1.591 2.095v1.872c0 .766-3.351 3.795-8.002 3.795Zm0-1.485c2.28 0 4.584-1.11 5.002-1.433V7.862l-.023-.116c-.49.21-1.075.291-1.727.291-1.146 0-2.059-.327-2.71-.991A3.222 3.222 0 0 1 8 6.303a3.24 3.24 0 0 1-.544.743c-.65.664-1.563.991-2.71.991-.652 0-1.236-.081-1.727-.291l-.023.116v4.255c.419.323 2.722 1.433 5.002 1.433ZM6.762 2.83c-.193-.206-.637-.413-1.682-.297-1.019.113-1.479.404-1.713.7-.247.312-.369.789-.369 1.554 0 .793.129 1.171.308 1.371.162.181.519.379 1.442.379.853 0 1.339-.235 1.638-.54.315-.322.527-.827.617-1.553.117-.935-.037-1.395-.241-1.614Zm4.155-.297c-1.044-.116-1.488.091-1.681.297-.204.219-.359.679-.242 1.614.091.726.303 1.231.618 1.553.299.305.784.54 1.638.54.922 0 1.28-.198 1.442-.379.179-.2.308-.578.308-1.371 0-.765-.123-1.242-.37-1.554-.233-.296-.693-.587-1.713-.7Z"></path><path d="M6.25 9.037a.75.75 0 0 1 .75.75v1.501a.75.75 0 0 1-1.5 0V9.787a.75.75 0 0 1 .75-.75Zm4.25.75v1.501a.75.75 0 0 1-1.5 0V9.787a.75.75 0 0 1 1.5 0Z"></path></svg>Copilot for Business</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Enterprise-grade AI features</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/enterprise/premium-support" data-analytics-event="{&quot;action&quot;:&quot;premium_support&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;enterprise&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;premium_support_link_enterprise_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-comment-discussion NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M1.75 1h8.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 10.25 10H7.061l-2.574 2.573A1.458 1.458 0 0 1 2 11.543V10h-.25A1.75 1.75 0 0 1 0 8.25v-5.5C0 1.784.784 1 1.75 1ZM1.5 2.75v5.5c0 .138.112.25.25.25h1a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h3.5a.25.25 0 0 0 .25-.25v-5.5a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25Zm13 2a.25.25 0 0 0-.25-.25h-.5a.75.75 0 0 1 0-1.5h.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 14.25 12H14v1.543a1.458 1.458 0 0 1-2.487 1.03L9.22 12.28a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l2.22 2.22v-2.19a.75.75 0 0 1 .75-.75h1a.25.25 0 0 0 .25-.25Z"></path></svg>Premium Support</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Enterprise-grade 24/7 support</span></span></a></li></ul></div></li></ul></div></div></li><li><a href="https://github.com/pricing" data-analytics-event="{&quot;action&quot;:&quot;pricing&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;pricing&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;pricing_link_pricing_navbar&quot;}" class="MarketingNavigation-module__navLink__hUomM">Pricing</a></li></ul></nav><div class="MarketingHeader-module__ctaContainer__tBmPz"><div class="HeaderSearch-module__searchSlot__oVOUS"><button class="Primer_Brand__Button-module__Button___scH9Z Primer_Brand__Button-module__Button--subtle___F7pEE Primer_Brand__Button-module__Button--size-small___zQrEw HeaderSearch-module__trigger__zsF9q" type="button" aria-haspopup="dialog" aria-expanded="false" aria-label="Search or jump to, type / to search" data-analytics-event="{&quot;action&quot;:&quot;searchbar&quot;,&quot;tag&quot;:&quot;input&quot;,&quot;context&quot;:&quot;global&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;searchbar_input_global_navbar&quot;}"><span class="Primer_Brand__Button-module__Button__text___ED0bX"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ Primer_Brand__Button-module__Button--label___qrkyz Primer_Brand__Button-module__Button--label-subtle___8ndWH"><span class="HeaderSearch-module__content__kMpxU"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-search HeaderSearch-module__icon__wcrHX" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg><span class="HeaderSearch-module__label__d1iWG">Search</span><kbd class="HeaderSearch-module__kbd__HNG0o" aria-hidden="true">/</kbd></span></span></span></button><div class="d-none"></div></div><div class="AuthCTAs-module__signInWrap__q2P60"><a class="Primer_Brand__Button-module__Button___scH9Z Primer_Brand__Button-module__Button--subtle___F7pEE Primer_Brand__Button-module__Button--size-small___zQrEw AuthCTAs-module__cta__WpwQq AuthCTAs-module__desktopActionGap__UZuXT AuthCTAs-module__hiddenBelowLg__BfKBw" href="/login?return_to=https%3A%2F%2Fgithub.com%2FAedelon%2Ftitans-pytorch-mlx%2Fblob%2Fmain%2FREADME.md" data-analytics-event="{&quot;action&quot;:&quot;sign_in&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;auth_cta&quot;,&quot;location&quot;:&quot;header&quot;,&quot;label&quot;:&quot;sign_in_link_auth_cta_header&quot;}" data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;site header menu&quot;,&quot;repository_id&quot;:null,&quot;auth_type&quot;:&quot;SIGN_UP&quot;,&quot;originating_url&quot;:&quot;https://github.com/Aedelon/titans-pytorch-mlx/blob/main/README.md&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="87a017c25166130f38a5cad6912d9a25d6403dbbe2353bd771a630fac965a3f5"><span class="Primer_Brand__Button-module__Button__text___ED0bX"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ Primer_Brand__Button-module__Button--label___qrkyz Primer_Brand__Button-module__Button--label-subtle___8ndWH">Sign in</span></span></a></div><a class="Primer_Brand__Button-module__Button___scH9Z Primer_Brand__Button-module__Button--secondary___gHnw_ Primer_Brand__Button-module__Button--size-small___zQrEw AuthCTAs-module__cta__WpwQq" href="/signup?ref_cta=Sign+up&amp;ref_loc=header+logged+out&amp;ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fblob%2Fshow&amp;source=header-repo&amp;source_repo=Aedelon%2Ftitans-pytorch-mlx" data-analytics-event="{&quot;action&quot;:&quot;sign_up&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;auth_cta&quot;,&quot;location&quot;:&quot;header&quot;,&quot;label&quot;:&quot;sign_up_link_auth_cta_header&quot;}" data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;site header menu&quot;,&quot;repository_id&quot;:null,&quot;auth_type&quot;:&quot;SIGN_UP&quot;,&quot;originating_url&quot;:&quot;https://github.com/Aedelon/titans-pytorch-mlx/blob/main/README.md&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="87a017c25166130f38a5cad6912d9a25d6403dbbe2353bd771a630fac965a3f5"><span class="Primer_Brand__Button-module__Button__text___ED0bX"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ Primer_Brand__Button-module__Button--label___qrkyz Primer_Brand__Button-module__Button--label-secondary___eJ0_a">Sign up</span></span></a><button class="Primer_Brand__Button-module__Button___scH9Z Primer_Brand__Button-module__Button--subtle___F7pEE Primer_Brand__Button-module__Button--size-small___zQrEw HeaderAppearanceSettings-module__trigger__hUheK" type="button" aria-haspopup="dialog" aria-labelledby="_R_fbd_"><span class="Primer_Brand__Button-module__Button__leading-visual___jjtTe" data-testid="Button-leading-visual"><svg data-component="Octicon" focusable="false" aria-hidden="true" class="octicon octicon-sliders Primer_Brand__Button-module__Button__icon-visual____qybb" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M15 2.75a.75.75 0 0 1-.75.75h-4a.75.75 0 0 1 0-1.5h4a.75.75 0 0 1 .75.75Zm-8.5.75v1.25a.75.75 0 0 0 1.5 0v-4a.75.75 0 0 0-1.5 0V2H1.75a.75.75 0 0 0 0 1.5H6.5Zm1.25 5.25a.75.75 0 0 0 0-1.5h-6a.75.75 0 0 0 0 1.5h6ZM15 8a.75.75 0 0 1-.75.75H11.5V10a.75.75 0 1 1-1.5 0V6a.75.75 0 0 1 1.5 0v1.25h2.75A.75.75 0 0 1 15 8Zm-9 5.25v-2a.75.75 0 0 0-1.5 0v1.25H1.75a.75.75 0 0 0 0 1.5H4.5v1.25a.75.75 0 0 0 1.5 0v-2Zm9 0a.75.75 0 0 1-.75.75h-6a.75.75 0 0 1 0-1.5h6a.75.75 0 0 1 .75.75Z"></path></svg></span><span class="Primer_Brand__Button-module__Button__text___ED0bX"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ Primer_Brand__Button-module__Button--label___qrkyz Primer_Brand__Button-module__Button--label-subtle___8ndWH"></span></span></button><div class="Primer_Brand__Tooltip-module__Tooltip___0Eipx" data-direction="s" aria-hidden="true" id="_R_fbd_">Appearance settings</div></div></div></div></div><div class="MarketingHeader-module__bottomBorder__uZT38" aria-hidden="true"></div></header></div></div>
</react-partial>



      <div hidden="hidden" data-view-component="true" class="js-stale-session-flash stale-session-flash flash flash-warn flash-full">
  
        <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert">
    <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>
</svg>
        <span class="js-stale-session-flash-signed-in" hidden>You signed in with another tab or window. <a class="Link--inTextBlock" href="">Reload</a> to refresh your session.</span>
        <span class="js-stale-session-flash-signed-out" hidden>You signed out in another tab or window. <a class="Link--inTextBlock" href="">Reload</a> to refresh your session.</span>
        <span class="js-stale-session-flash-switched" hidden>You switched accounts on another tab or window. <a class="Link--inTextBlock" href="">Reload</a> to refresh your session.</span>

    <button id="icon-button-0aeed074-17d0-4271-b58f-f8245b449cbb" aria-labelledby="tooltip-0887168b-9c51-4c56-a1ef-2b33155b9a9a" type="button" data-view-component="true" class="Button Button--iconOnly Button--invisible Button--medium flash-close js-flash-close">  <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x Button-visual">
    <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path>
</svg>
</button><tool-tip id="tooltip-0887168b-9c51-4c56-a1ef-2b33155b9a9a" for="icon-button-0aeed074-17d0-4271-b58f-f8245b449cbb" popover="manual" data-direction="s" data-type="label" data-view-component="true" class="sr-only position-absolute">Dismiss alert</tool-tip>


  
</div>
    </div>

  <div id="start-of-content" class="show-on-focus"></div>








    <div id="js-flash-container" class="flash-container" data-turbo-replace>






  <template class="js-flash-template">
    
<div class="flash flash-full   {{ className }}">
  <div >
    <button autofocus class="flash-close js-flash-close" type="button" aria-label="Dismiss this message">
      <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x">
    <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path>
</svg>
    </button>
    <div aria-atomic="true" role="alert" class="js-flash-alert">
      
      <div>{{ message }}</div>

    </div>
  </div>
</div>
  </template>
</div>


    






  <div
    class="application-main "
    data-commit-hovercards-enabled
    data-discussion-hovercards-enabled
    data-issue-and-pr-hovercards-enabled
    data-project-hovercards-enabled
  >
        <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class="">
    <main id="js-repo-pjax-container" >
      
      








  

    <link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ym-6bc2c9bf8112c038.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/sk2-8deeef9351be3911.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ni-3e194d222c7770bf.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/7x-71d30cb240cd901f.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/wwk-ad869086822937b1.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/a1-9f79841ecac1da8e.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/wzg-40a3213b3e83400b.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/5f-64f8e7d5bcbd4787.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/z5-b53a93078d026f1e.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/8h-cef26f68c1331011.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/fq-3ce13a77e863807a.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/a7-596b507bd20acddc.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/xfx-c82d8352413aea0a.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/j4-b3a9e87fa7878a98.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/global-nav-bar-29c7aef68ee9db41.js" fetchpriority="low" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react-css.2d881b4d4a503d1c.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/pj.75627bfeb9ceb1da.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-nav-bar.2f2560cba06ab359.module.css" />

<react-partial
  partial-name="global-nav-bar"
  data-ssr="true"
  data-attempted-ssr="true"
  data-react-profiling="false"
>
  
  <script type="application/json" data-target="react-partial.embeddedData">{"props":{"contextRegion":{"crumbs":[{"crumb_type":"user","label":"Aedelon","is_root":false,"href":"/Aedelon"},{"crumb_type":"repository","label":"titans-pytorch-mlx","is_root":false,"href":"/Aedelon/titans-pytorch-mlx"}],"localNavigation":[{"id":"code","icon":"code","label":"Code","href":"/Aedelon/titans-pytorch-mlx","selectedLinks":["repo_source","repo_downloads","repo_commits","repo_releases","repo_tags","repo_branches","repo_packages","repo_deployments","repo_attestations"],"popoverTarget":false,"commandId":"repositories:go-to-code","reactNav":{"appTarget":"code-view","anchor":"code-view-repo-link"},"turboNav":{"frame":"repo-content-turbo-frame"}},{"id":"issues","icon":"issue-opened","label":"Issues","href":"/Aedelon/titans-pytorch-mlx/issues","selectedLinks":["repo_issues","repo_labels","repo_milestones"],"count":0,"popoverTarget":false,"commandId":"repositories:go-to-issues","reactNav":{"appTarget":"repo","anchor":null},"turboNav":{"frame":"repo-content-turbo-frame"}},{"id":"pull-requests","icon":"git-pull-request","label":"Pull requests","href":"/Aedelon/titans-pytorch-mlx/pulls","selectedLinks":["repo_pulls","checks"],"count":0,"popoverTarget":false,"commandId":"repositories:go-to-pull-requests","reactNav":{"appTarget":null,"anchor":null},"turboNav":{"frame":"repo-content-turbo-frame"}},{"id":"actions","icon":"play","label":"Actions","href":"/Aedelon/titans-pytorch-mlx/actions","selectedLinks":["repo_actions"],"popoverTarget":false,"commandId":"repositories:go-to-actions","reactNav":{"appTarget":"actions-workflows","anchor":null},"turboNav":{"frame":"repo-content-turbo-frame"}},{"id":"projects","icon":"table","label":"Projects","href":"/Aedelon/titans-pytorch-mlx/projects","selectedLinks":["repo_projects","new_repo_project","repo_project"],"popoverTarget":false,"commandId":"repositories:go-to-projects","reactNav":{"appTarget":"repo","anchor":null},"turboNav":{"frame":"repo-content-turbo-frame"}},{"id":"security-and-quality","icon":"shield","label":"Security and quality","href":"/Aedelon/titans-pytorch-mlx/security","selectedLinks":["security","overview","alerts","policy","token_scanning","code_scanning"],"count":0,"popoverTarget":false,"commandId":"repositories:go-to-security","reactNav":{"appTarget":null,"anchor":null},"turboNav":{"frame":"repo-content-turbo-frame"}},{"id":"insights","icon":"graph","label":"Insights","href":"/Aedelon/titans-pytorch-mlx/pulse","selectedLinks":["repo_graphs","repo_contributors","dependency_graph","dependabot_updates","pulse","people","community"],"popoverTarget":false,"commandId":"repositories:go-to-insights","reactNav":{"appTarget":null,"anchor":null},"turboNav":{"frame":"repo-content-turbo-frame"}}],"localNavigationUpdateChannel":null,"selectedLink":"repo_source"},"owner":null,"headerLogo":{"href":"/","aria-label":"Homepage "},"notifications":{"indicatorMode":"disabled","websocketChannel":null,"fetchIndicatorSrc":"/notifications/indicator","fetchIndicatorEnabled":false},"issues":{"href":"/issues"},"pulls":{"href":"/pulls"},"contributedRepos":{"href":"/repos"},"copilot":{"show":false,"showAgentsButton":false,"showRelaunchAnnouncement":false,"copilotChatUrl":null,"copilotApiUrl":"https://api.githubcopilot.com"},"search":{"show":true,"showCommandPalette":false,"isSearchPage":false,"isJumpToSearch":false,"searchContext":{"scope":"repo:Aedelon/titans-pytorch-mlx","current_repo_name":"titans-pytorch-mlx","current_repo_nwo":"Aedelon/titans-pytorch-mlx","user_id":"Aedelon"}},"commandPalette":null,"enterpriseBar":{"show":false},"globalTransactionalMessage":[],"payloadsUrl":"/_global-navigation/payloads.json?can_toggle_site_admin_and_employee_status=0\u0026is_admin_mode_on=0\u0026is_ui_opted_out=0\u0026show_ui_opt_out=0\u0026v=7","contextRegionUrl":"/_global-navigation/context-region.json"}}</script>
  <div data-target="react-partial.reactRoot"><header aria-label="Global navigation menu" data-component="Stack" class="GlobalNav styles-module__appHeader__YzYWk prc-Stack-Stack-UQ9k6" data-gap="none" data-direction="vertical" data-align="stretch" data-wrap="nowrap" data-justify="start" data-padding="none"><div data-component="Stack" class="prc-Stack-Stack-UQ9k6" data-direction="horizontal" data-align="center" data-wrap="nowrap" data-justify="center" data-padding="none"><div data-testid="top-nav-center" data-component="Stack" class="styles-module__center__R3QRv styles-module__withLocalNavigation__rjTJ_ GlobalNavBar-module__loggedOut__Jv1rk prc-Stack-Stack-UQ9k6" data-gap="condensed" data-direction="horizontal" data-align="stretch" data-wrap="nowrap" data-justify="start" data-padding="normal"><nav class="styles-module__contextRegion__VbSp2 prc-Breadcrumbs-BreadcrumbsBase-3Gb-B" aria-label="Breadcrumbs" data-overflow="menu" data-variant="normal" data-component="Breadcrumbs"><ol class="prc-Breadcrumbs-BreadcrumbsList-BKjpe"><li class="prc-Breadcrumbs-ItemWrapper-k0NLn"><a class="styles-module__contextCrumb__IzGIq prc-Breadcrumbs-Item-jcraJ" data-component="Breadcrumbs.Item" href="/Aedelon" data-discover="true"><span class="">Aedelon</span></a></li><li class="prc-Breadcrumbs-ItemWrapper-k0NLn"><a class="styles-module__contextCrumb__IzGIq prc-Breadcrumbs-Item-jcraJ" data-component="Breadcrumbs.Item" href="/Aedelon/titans-pytorch-mlx" data-discover="true"><span class="styles-module__contextCrumbLast__tI2e3">titans-pytorch-mlx</span></a></li></ol></nav></div><div data-testid="top-nav-right" data-component="Stack" class="styles-module__right__mlBQg styles-module__withLocalNavigation__rjTJ_ styles-module__rightWithResponsiveCreateButton__SKn2W prc-Stack-Stack-UQ9k6" data-gap="condensed" data-direction="horizontal" data-align="center" data-wrap="nowrap" data-justify="start" data-padding="normal"></div></div><h2 class="prc-src-InternalVisuallyHidden-2YaI6">Repository navigation</h2><nav class="prc-components-UnderlineWrapper-eT-Yj prc-UnderlineNav-UnderlineWrapper-GWONT LocalNavigation-module__LocalNavigation__b0Xc0" aria-label="Repository" data-variant="inset" data-overflow-mode="wrap" data-hide-icons-breakpoint="medium"><ul class="prc-UnderlineNav-ItemsList-oj8gN prc-components-UnderlineItemList-xKlKC" role="list"><li role="presentation" aria-hidden="true" class="prc-UnderlineNav-WrapSpacer--aLgz"></li><li class="prc-UnderlineNav-UnderlineNavItem-syRjR"><a aria-current="page" data-tab-item="code" data-react-nav="code-view" data-react-nav-anchor="code-view-repo-link" data-turbo-frame="repo-content-turbo-frame" class="prc-components-UnderlineItem-7fP-n" href="/Aedelon/titans-pytorch-mlx" data-discover="true"><span data-component="icon"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-code" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg></span><span data-component="text" data-content="Code">Code</span></a></li><li class="prc-UnderlineNav-UnderlineNavItem-syRjR"><a data-tab-item="issues" data-react-nav="repo" data-turbo-frame="repo-content-turbo-frame" class="prc-components-UnderlineItem-7fP-n" href="/Aedelon/titans-pytorch-mlx/issues" data-discover="true"><span data-component="icon"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-issue-opened" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path></svg></span><span data-component="text" data-content="Issues">Issues</span></a></li><li class="prc-UnderlineNav-UnderlineNavItem-syRjR"><a data-tab-item="pull-requests" data-turbo-frame="repo-content-turbo-frame" class="prc-components-UnderlineItem-7fP-n" href="/Aedelon/titans-pytorch-mlx/pulls" data-discover="true"><span data-component="icon"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-git-pull-request" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path></svg></span><span data-component="text" data-content="Pull requests">Pull requests</span></a></li><li class="prc-UnderlineNav-UnderlineNavItem-syRjR"><a data-tab-item="actions" data-react-nav="actions-workflows" data-turbo-frame="repo-content-turbo-frame" class="prc-components-UnderlineItem-7fP-n" href="/Aedelon/titans-pytorch-mlx/actions" data-discover="true"><span data-component="icon"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-play" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg></span><span data-component="text" data-content="Actions">Actions</span></a></li><li class="prc-UnderlineNav-UnderlineNavItem-syRjR"><a data-tab-item="projects" data-react-nav="repo" data-turbo-frame="repo-content-turbo-frame" class="prc-components-UnderlineItem-7fP-n" href="/Aedelon/titans-pytorch-mlx/projects" data-discover="true"><span data-component="icon"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-table" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path></svg></span><span data-component="text" data-content="Projects">Projects</span></a></li><li class="prc-UnderlineNav-UnderlineNavItem-syRjR"><a data-tab-item="security-and-quality" data-turbo-frame="repo-content-turbo-frame" class="prc-components-UnderlineItem-7fP-n" href="/Aedelon/titans-pytorch-mlx/security" data-discover="true"><span data-component="icon"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-shield" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg></span><span data-component="text" data-content="Security and quality">Security and quality</span></a></li><li class="prc-UnderlineNav-UnderlineNavItem-syRjR"><a data-tab-item="insights" data-turbo-frame="repo-content-turbo-frame" class="prc-components-UnderlineItem-7fP-n" href="/Aedelon/titans-pytorch-mlx/pulse" data-discover="true"><span data-component="icon"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-graph" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg></span><span data-component="text" data-content="Insights">Insights</span></a></li></ul><div class="prc-UnderlineNav-MoreButtonContainer-Dnrq6"><div class="prc-UnderlineNav-MoreButtonDivider-dN0a-"></div><button data-component="overflow-menu-button" type="button" aria-haspopup="true" aria-expanded="false" tabindex="0" class="prc-Button-ButtonBase-9n-Xk prc-UnderlineNav-MoreButton-Y8soj" data-loading="false" data-size="medium" data-variant="invisible" id="_R_2ktp_"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="text" class="prc-Button-Label-FWkx3"><span>More<span class="prc-src-InternalVisuallyHidden-2YaI6"> items</span></span></span></span><span data-component="trailingAction" class="prc-Button-Visual-YNt2F prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-down" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></span></button></div></nav><div class="d-none"></div></header></div>
</react-partial>


  



<turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class="">
    <div id="repo-content-pjax-container" class="repository-content " >
    



    
      
    








<react-app
  app-name="code-view"
  initial-path="/Aedelon/titans-pytorch-mlx/blob/main/README.md"
  style="display: block; min-height: calc(100vh - 64px);"
  data-attempted-ssr="true"
  data-ssr="true"
  data-lazy="false"
  data-alternate="false"
  data-data-router-enabled="true"
  data-react-profiling="false"
>
  
  <script type="application/json" data-target="react-app.embeddedData">{"payload":{"codeViewBlobRoute":{"csv":null,"csvError":null,"headerInfo":{"toc":[{"level":1,"text":"Titans: Learning to Memorize at Test Time","anchor":"titans-learning-to-memorize-at-test-time","htmlText":"Titans: Learning to Memorize at Test Time"},{"level":2,"text":"Table of Contents","anchor":"table-of-contents","htmlText":"Table of Contents"},{"level":2,"text":"Paper References","anchor":"paper-references","htmlText":"Paper References"},{"level":2,"text":"Features","anchor":"features","htmlText":"Features"},{"level":3,"text":"Core Features","anchor":"core-features","htmlText":"Core Features"},{"level":3,"text":"Backend-Specific Features","anchor":"backend-specific-features","htmlText":"Backend-Specific Features"},{"level":3,"text":"Test Coverage","anchor":"test-coverage","htmlText":"Test Coverage"},{"level":2,"text":"Architecture Overview","anchor":"architecture-overview","htmlText":"Architecture Overview"},{"level":3,"text":"Memory Perspective","anchor":"memory-perspective","htmlText":"Memory Perspective"},{"level":3,"text":"Architecture Variants","anchor":"architecture-variants","htmlText":"Architecture Variants"},{"level":4,"text":"Quick Comparison","anchor":"quick-comparison","htmlText":"Quick Comparison"},{"level":4,"text":"When to Use Each Variant","anchor":"when-to-use-each-variant","htmlText":"When to Use Each Variant"},{"level":4,"text":"MAC: Memory as Context (Section 4.1)","anchor":"mac-memory-as-context-section-41","htmlText":"MAC: Memory as Context (Section 4.1)"},{"level":4,"text":"MAG: Memory as Gate (Section 4.2)","anchor":"mag-memory-as-gate-section-42","htmlText":"MAG: Memory as Gate (Section 4.2)"},{"level":4,"text":"MAL: Memory as Layer (Section 4.3)","anchor":"mal-memory-as-layer-section-43","htmlText":"MAL: Memory as Layer (Section 4.3)"},{"level":3,"text":"Neural Long-term Memory","anchor":"neural-long-term-memory","htmlText":"Neural Long-term Memory"},{"level":4,"text":"Core Equations (Section 3.1)","anchor":"core-equations-section-31","htmlText":"Core Equations (Section 3.1)"},{"level":4,"text":"Key Innovations","anchor":"key-innovations","htmlText":"Key Innovations"},{"level":2,"text":"Installation","anchor":"installation","htmlText":"Installation"},{"level":3,"text":"Basic Installation (PyTorch)","anchor":"basic-installation-pytorch","htmlText":"Basic Installation (PyTorch)"},{"level":3,"text":"With Training Dependencies","anchor":"with-training-dependencies","htmlText":"With Training Dependencies"},{"level":3,"text":"With All Extras (Development)","anchor":"with-all-extras-development","htmlText":"With All Extras (Development)"},{"level":3,"text":"MLX Requirements","anchor":"mlx-requirements","htmlText":"MLX Requirements"},{"level":2,"text":"Quick Start","anchor":"quick-start","htmlText":"Quick Start"},{"level":3,"text":"PyTorch Quick Start","anchor":"pytorch-quick-start","htmlText":"PyTorch Quick Start"},{"level":3,"text":"MLX Quick Start","anchor":"mlx-quick-start","htmlText":"MLX Quick Start"},{"level":3,"text":"Standalone Neural Memory","anchor":"standalone-neural-memory","htmlText":"Standalone Neural Memory"},{"level":2,"text":"Pretraining","anchor":"pretraining","htmlText":"Pretraining"},{"level":3,"text":"PyTorch Pretraining","anchor":"pytorch-pretraining","htmlText":"PyTorch Pretraining"},{"level":4,"text":"Option 1: HuggingFace Streaming (Simple, No Setup)","anchor":"option-1-huggingface-streaming-simple-no-setup","htmlText":"Option 1: HuggingFace Streaming (Simple, No Setup)"},{"level":4,"text":"Option 2: Pre-tokenized Local Dataset (Fastest)","anchor":"option-2-pre-tokenized-local-dataset-fastest","htmlText":"Option 2: Pre-tokenized Local Dataset (Fastest)"},{"level":4,"text":"Other Options","anchor":"other-options","htmlText":"Other Options"},{"level":4,"text":"PyTorch Training Options","anchor":"pytorch-training-options","htmlText":"PyTorch Training Options"},{"level":4,"text":"CUDA Optimizations","anchor":"cuda-optimizations","htmlText":"CUDA Optimizations"},{"level":3,"text":"Distributed Training (Multi-GPU)","anchor":"distributed-training-multi-gpu","htmlText":"Distributed Training (Multi-GPU)"},{"level":3,"text":"MLX Pretraining","anchor":"mlx-pretraining","htmlText":"MLX Pretraining"},{"level":4,"text":"MLX Training Options","anchor":"mlx-training-options","htmlText":"MLX Training Options"},{"level":2,"text":"Inference","anchor":"inference","htmlText":"Inference"},{"level":3,"text":"PyTorch Inference","anchor":"pytorch-inference","htmlText":"PyTorch Inference"},{"level":4,"text":"PyTorch Inference Options","anchor":"pytorch-inference-options","htmlText":"PyTorch Inference Options"},{"level":3,"text":"MLX Inference","anchor":"mlx-inference","htmlText":"MLX Inference"},{"level":4,"text":"MLX Inference Options","anchor":"mlx-inference-options","htmlText":"MLX Inference Options"},{"level":2,"text":"Benchmarks","anchor":"benchmarks","htmlText":"Benchmarks"},{"level":3,"text":"Model Quality (from Paper Table 1 \u0026 5)","anchor":"model-quality-from-paper-table-1--5","htmlText":"Model Quality (from Paper Table 1 \u0026amp; 5)"},{"level":3,"text":"Inference Speed (Apple M4 Pro)","anchor":"inference-speed-apple-m4-pro","htmlText":"Inference Speed (Apple M4 Pro)"},{"level":3,"text":"Numerical Parity","anchor":"numerical-parity","htmlText":"Numerical Parity"},{"level":2,"text":"Configuration Reference","anchor":"configuration-reference","htmlText":"Configuration Reference"},{"level":3,"text":"TitansConfig Parameters","anchor":"titansconfig-parameters","htmlText":"TitansConfig Parameters"},{"level":2,"text":"API Reference","anchor":"api-reference","htmlText":"API Reference"},{"level":3,"text":"PyTorch API","anchor":"pytorch-api","htmlText":"PyTorch API"},{"level":3,"text":"MLX API","anchor":"mlx-api","htmlText":"MLX API"},{"level":2,"text":"MLX Optimizations","anchor":"mlx-optimizations","htmlText":"MLX Optimizations"},{"level":3,"text":"Gradient Computation","anchor":"gradient-computation","htmlText":"Gradient Computation"},{"level":3,"text":"Why Not mx.compile?","anchor":"why-not-mxcompile","htmlText":"Why Not mx.compile?"},{"level":3,"text":"Metal Kernels","anchor":"metal-kernels","htmlText":"Metal Kernels"},{"level":3,"text":"Recommended Practices","anchor":"recommended-practices","htmlText":"Recommended Practices"},{"level":2,"text":"Troubleshooting","anchor":"troubleshooting","htmlText":"Troubleshooting"},{"level":3,"text":"Common Issues","anchor":"common-issues","htmlText":"Common Issues"},{"level":4,"text":"PyTorch","anchor":"pytorch","htmlText":"PyTorch"},{"level":4,"text":"MLX","anchor":"mlx","htmlText":"MLX"},{"level":3,"text":"Numerical Differences","anchor":"numerical-differences","htmlText":"Numerical Differences"},{"level":2,"text":"Development","anchor":"development","htmlText":"Development"},{"level":3,"text":"Project Structure","anchor":"project-structure","htmlText":"Project Structure"},{"level":3,"text":"Running Tests","anchor":"running-tests","htmlText":"Running Tests"},{"level":3,"text":"Linting","anchor":"linting","htmlText":"Linting"},{"level":2,"text":"Citation","anchor":"citation","htmlText":"Citation"},{"level":2,"text":"License","anchor":"license","htmlText":"License"}]},"issueTemplate":null,"discussionTemplate":null,"richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch1 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTitans: Learning to Memorize at Test Time\u003c/h1\u003e\u003ca id=\"user-content-titans-learning-to-memorize-at-test-time\" class=\"anchor\" aria-label=\"Permalink: Titans: Learning to Memorize at Test Time\" href=\"#titans-learning-to-memorize-at-test-time\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\n\u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"/Aedelon/titans-pytorch-mlx/blob/main/assets/hero.png\"\u003e\u003cimg src=\"/Aedelon/titans-pytorch-mlx/raw/main/assets/hero.png\" alt=\"Titans Hero\" width=\"100%\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://www.python.org/downloads/\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/93a33cfc2339ec3fa9be792576576fbaafc42b0c7031285662b02f3aca1e1c59/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f707974686f6e2d332e31302b2d626c75652e737667\" alt=\"Python 3.10+\" data-canonical-src=\"https://img.shields.io/badge/python-3.10+-blue.svg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pytorch.org/\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/e86e9e588f0db00271725db6303a01edadb6d91afe605553c99d5b774aac5f44/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7079746f7263682d322e302b2d6565346332632e737667\" alt=\"PyTorch 2.0+\" data-canonical-src=\"https://img.shields.io/badge/pytorch-2.0+-ee4c2c.svg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003ca href=\"https://ml-explore.github.io/mlx/\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/1390539ed67b92382a0db4279a792f46ef4237a32ca643ded937e10f505d419e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d6c782d6170706c6525323073696c69636f6e2d626c61636b2e737667\" alt=\"MLX\" data-canonical-src=\"https://img.shields.io/badge/mlx-apple%20silicon-black.svg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003ca href=\"/Aedelon/titans-pytorch-mlx/blob/main/LICENSE\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/48c3918479c6ea40d65216332adbf6c7a89400e32b69faf50a750b905d214b76/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d677265656e2e737667\" alt=\"License\" data-canonical-src=\"https://img.shields.io/badge/license-Apache%202.0-green.svg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003ca href=\"/Aedelon/titans-pytorch-mlx/blob/main/tests\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/1635f21b99b9b5a5d1d223259daa54974e0606c49331d50262d2294d1a8b3ef1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d3130352532307061737365642d627269676874677265656e2e737667\" alt=\"Tests\" data-canonical-src=\"https://img.shields.io/badge/tests-105%20passed-brightgreen.svg\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eA complete \u003cstrong\u003ePyTorch\u003c/strong\u003e and \u003cstrong\u003eMLX\u003c/strong\u003e (Apple Silicon) implementation of the Titans architecture from Google Research.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eTitans introduce a \u003cstrong\u003eNeural Long-term Memory (LMM)\u003c/strong\u003e module that learns to memorize historical context at test time using gradient descent with momentum and weight decay. This enables attention mechanisms to focus on local context while utilizing long-range information through neural memory.\u003c/p\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTable of Contents\u003c/h2\u003e\u003ca id=\"user-content-table-of-contents\" class=\"anchor\" aria-label=\"Permalink: Table of Contents\" href=\"#table-of-contents\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"#paper-references\"\u003ePaper References\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#features\"\u003eFeatures\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#architecture-overview\"\u003eArchitecture Overview\u003c/a\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"#memory-perspective\"\u003eMemory Perspective\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#architecture-variants\"\u003eArchitecture Variants\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#neural-long-term-memory\"\u003eNeural Long-term Memory\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#quick-start\"\u003eQuick Start\u003c/a\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"#pytorch-quick-start\"\u003ePyTorch\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#mlx-quick-start\"\u003eMLX (Apple Silicon)\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#pretraining\"\u003ePretraining\u003c/a\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"#pytorch-pretraining\"\u003ePyTorch Pretraining\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#mlx-pretraining\"\u003eMLX Pretraining\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#inference\"\u003eInference\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#benchmarks\"\u003eBenchmarks\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#configuration-reference\"\u003eConfiguration Reference\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#api-reference\"\u003eAPI Reference\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#mlx-optimizations\"\u003eMLX Optimizations\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#troubleshooting\"\u003eTroubleshooting\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#development\"\u003eDevelopment\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#citation\"\u003eCitation\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePaper References\u003c/h2\u003e\u003ca id=\"user-content-paper-references\" class=\"anchor\" aria-label=\"Permalink: Paper References\" href=\"#paper-references\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eOriginal Paper\u003c/strong\u003e: Behrouz, A., Zhong, P., \u0026amp; Mirrokni, V. (2024). \u003cem\u003eTitans: Learning to Memorize at Test Time\u003c/em\u003e. arXiv preprint arXiv:2501.00663\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eAnalysis Paper\u003c/strong\u003e: Di Nepi, G., Siciliano, F., \u0026amp; Silvestri, F. (2025). \u003cem\u003eTitans Revisited: A Lightweight Reimplementation and Critical Analysis of a Test-Time Memory Model\u003c/em\u003e. arXiv preprint arXiv:2510.09551\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eFeatures\u003c/h2\u003e\u003ca id=\"user-content-features\" class=\"anchor\" aria-label=\"Permalink: Features\" href=\"#features\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCore Features\u003c/h3\u003e\u003ca id=\"user-content-core-features\" class=\"anchor\" aria-label=\"Permalink: Core Features\" href=\"#core-features\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eFeature\u003c/th\u003e\n\u003cth\u003ePyTorch\u003c/th\u003e\n\u003cth\u003eMLX\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eMAC (Memory as Context)\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMAG (Memory as Gate)\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMAL (Memory as Layer)\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eLMM (Memory Only)\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eDeep Memory (L_M \u0026gt;= 1)\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eData-dependent Gating\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eRoPE (Rotary Embeddings)\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e1D Depthwise Convolution\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMixed Precision Training\u003c/td\u003e\n\u003ctd\u003e✅ bf16/fp16\u003c/td\u003e\n\u003ctd\u003e✅ fp16/bf16\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eGradient Accumulation\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eStreaming Datasets\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eW\u0026amp;B Logging\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eBackend-Specific Features\u003c/h3\u003e\u003ca id=\"user-content-backend-specific-features\" class=\"anchor\" aria-label=\"Permalink: Backend-Specific Features\" href=\"#backend-specific-features\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eFeature\u003c/th\u003e\n\u003cth\u003ePyTorch\u003c/th\u003e\n\u003cth\u003eMLX\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eFlash Attention 2\u003c/td\u003e\n\u003ctd\u003e✅ (CUDA)\u003c/td\u003e\n\u003ctd\u003eN/A\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eTriton Kernels\u003c/td\u003e\n\u003ctd\u003e✅ (CUDA)\u003c/td\u003e\n\u003ctd\u003eN/A\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMetal Kernels\u003c/td\u003e\n\u003ctd\u003eN/A\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMPS Backend\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003ctd\u003eN/A\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eUnified Memory\u003c/td\u003e\n\u003ctd\u003eN/A\u003c/td\u003e\n\u003ctd\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eNumerical Parity\u003c/td\u003e\n\u003ctd\u003eReference\u003c/td\u003e\n\u003ctd\u003e✅ \u0026lt; 1e-4\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTest Coverage\u003c/h3\u003e\u003ca id=\"user-content-test-coverage\" class=\"anchor\" aria-label=\"Permalink: Test Coverage\" href=\"#test-coverage\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003cstrong\u003e105 unit tests\u003c/strong\u003e covering all modules\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eNumerical parity tests\u003c/strong\u003e ensuring MLX matches PyTorch outputs\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eIntegration tests\u003c/strong\u003e for all model variants\u003c/li\u003e\n\u003c/ul\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eArchitecture Overview\u003c/h2\u003e\u003ca id=\"user-content-architecture-overview\" class=\"anchor\" aria-label=\"Permalink: Architecture Overview\" href=\"#architecture-overview\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\n\u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"/Aedelon/titans-pytorch-mlx/blob/main/assets/figures/fig1_memory_training.png\"\u003e\u003cimg src=\"/Aedelon/titans-pytorch-mlx/raw/main/assets/figures/fig1_memory_training.png\" alt=\"Neural Memory Training\" width=\"600\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\u003cem\u003eFigure 1: Neural memory training with efficient parallelization via matmul operations (from paper)\u003c/em\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMemory Perspective\u003c/h3\u003e\u003ca id=\"user-content-memory-perspective\" class=\"anchor\" aria-label=\"Permalink: Memory Perspective\" href=\"#memory-perspective\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTitans are designed around a \u003cstrong\u003ememory perspective\u003c/strong\u003e inspired by human cognition (Section 1 of paper):\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eMemory Type\u003c/th\u003e\n\u003cth\u003eModule\u003c/th\u003e\n\u003cth\u003eBehavior at Test Time\u003c/th\u003e\n\u003cth\u003eCharacteristics\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eShort-term\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eAttention (limited window)\u003c/td\u003e\n\u003ctd\u003eIn-context learning (fixed weights)\u003c/td\u003e\n\u003ctd\u003ePrecise, limited capacity\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eLong-term\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eNeural Memory (LMM)\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003eStill learning\u003c/strong\u003e (weight updates via gradient descent)\u003c/td\u003e\n\u003ctd\u003eFading, unlimited capacity\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003ePersistent\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eLearnable tokens\u003c/td\u003e\n\u003ctd\u003eFixed (task knowledge)\u003c/td\u003e\n\u003ctd\u003eStable, task-specific\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eArchitecture Variants\u003c/h3\u003e\u003ca id=\"user-content-architecture-variants\" class=\"anchor\" aria-label=\"Permalink: Architecture Variants\" href=\"#architecture-variants\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eQuick Comparison\u003c/h4\u003e\u003ca id=\"user-content-quick-comparison\" class=\"anchor\" aria-label=\"Permalink: Quick Comparison\" href=\"#quick-comparison\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eAspect\u003c/th\u003e\n\u003cth\u003eMAC\u003c/th\u003e\n\u003cth\u003eMAG\u003c/th\u003e\n\u003cth\u003eMAL\u003c/th\u003e\n\u003cth\u003eLMM\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eArchitecture\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eMemory → Attention → Memory\u003c/td\u003e\n\u003ctd\u003eAttention ⊗ Memory\u003c/td\u003e\n\u003ctd\u003eMemory → Attention\u003c/td\u003e\n\u003ctd\u003eMemory only\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eAttention Type\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eSegmented (full causal per chunk)\u003c/td\u003e\n\u003ctd\u003eSliding Window\u003c/td\u003e\n\u003ctd\u003eSliding Window\u003c/td\u003e\n\u003ctd\u003eNone\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eMemory-Attention\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eBidirectional\u003c/td\u003e\n\u003ctd\u003eParallel (gating)\u003c/td\u003e\n\u003ctd\u003eSequential\u003c/td\u003e\n\u003ctd\u003eN/A\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eChunking Required\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eYes\u003c/td\u003e\n\u003ctd\u003eNo\u003c/td\u003e\n\u003ctd\u003eNo\u003c/td\u003e\n\u003ctd\u003eNo\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eLong-context\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e⭐⭐⭐ Best\u003c/td\u003e\n\u003ctd\u003e⭐⭐ Good\u003c/td\u003e\n\u003ctd\u003e⭐ Baseline\u003c/td\u003e\n\u003ctd\u003e⭐⭐ Good\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eTraining Speed\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eMedium\u003c/td\u003e\n\u003ctd\u003eFast\u003c/td\u003e\n\u003ctd\u003eFastest\u003c/td\u003e\n\u003ctd\u003eFast\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWhen to Use Each Variant\u003c/h4\u003e\u003ca id=\"user-content-when-to-use-each-variant\" class=\"anchor\" aria-label=\"Permalink: When to Use Each Variant\" href=\"#when-to-use-each-variant\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eUse Case\u003c/th\u003e\n\u003cth\u003eRecommended\u003c/th\u003e\n\u003cth\u003eWhy\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eNeedle-in-haystack retrieval\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003eMAC\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eAttention decides when to query long-term memory\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eLong document QA (\u0026gt;100K tokens)\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003eMAC\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eBest BABILong benchmark results (97.95%)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eLanguage modeling (perplexity)\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003eMAG\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eSlightly better perplexity than MAC\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eReal-time / streaming inference\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003eMAG\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eNo chunking, constant memory footprint\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMaximum training throughput\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003eMAL\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eLeverages FlashAttention optimizations\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eExisting hybrid model replacement\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003eMAL\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eSame architecture as Griffin/Samba\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003ePure sequence modeling\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003eLMM\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003eTests memory capability alone\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMAC: Memory as Context (Section 4.1)\u003c/h4\u003e\u003ca id=\"user-content-mac-memory-as-context-section-41\" class=\"anchor\" aria-label=\"Permalink: MAC: Memory as Context (Section 4.1)\" href=\"#mac-memory-as-context-section-41\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\n\u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"/Aedelon/titans-pytorch-mlx/blob/main/assets/figures/fig2_mac.png\"\u003e\u003cimg src=\"/Aedelon/titans-pytorch-mlx/raw/main/assets/figures/fig2_mac.png\" alt=\"MAC Architecture\" width=\"700\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\u003cem\u003eFigure 2: MAC (Memory as Context) - Bidirectional interaction between memory and attention\u003c/em\u003e\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"h_t = M*_{t-1}(q_t)                              # Eq. 21: Retrieve from memory\nS̃^(t) = [persistent] || h_t || x                # Eq. 22: Concatenate\ny_t = Attn(S̃^(t))                               # Eq. 23: Segmented attention\nM_t = M_{t-1}(y_t)                               # Eq. 24: Update memory\no_t = y_t ⊗ M*_t(y_t)                            # Eq. 25: Output gating\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003eh_t = M*_{t-1}(q_t)                              # Eq. 21: Retrieve from memory\nS̃^(t) = [persistent] || h_t || x                # Eq. 22: Concatenate\ny_t = Attn(S̃^(t))                               # Eq. 23: Segmented attention\nM_t = M_{t-1}(y_t)                               # Eq. 24: Update memory\no_t = y_t ⊗ M*_t(y_t)                            # Eq. 25: Output gating\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eAdvantages\u003c/strong\u003e: Best long-context performance, bidirectional memory-attention interaction\n\u003cstrong\u003eDisadvantages\u003c/strong\u003e: Requires chunking, slightly slower training\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMAG: Memory as Gate (Section 4.2)\u003c/h4\u003e\u003ca id=\"user-content-mag-memory-as-gate-section-42\" class=\"anchor\" aria-label=\"Permalink: MAG: Memory as Gate (Section 4.2)\" href=\"#mag-memory-as-gate-section-42\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\n\u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"/Aedelon/titans-pytorch-mlx/blob/main/assets/figures/fig4_mag_mal.png\"\u003e\u003cimg src=\"/Aedelon/titans-pytorch-mlx/raw/main/assets/figures/fig4_mag_mal.png\" alt=\"MAG and MAL Architecture\" width=\"700\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\u003cem\u003eFigure 4-5: MAG (Memory as Gate) and MAL (Memory as Layer) architectures\u003c/em\u003e\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"x̃ = [persistent] || x                           # Eq. 26: Add persistent tokens\ny = SW-Attn*(x̃)                                  # Eq. 27: Sliding window attention\no = y ⊗ M(x̃)                                     # Eq. 28: Element-wise gating\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003ex̃ = [persistent] || x                           # Eq. 26: Add persistent tokens\ny = SW-Attn*(x̃)                                  # Eq. 27: Sliding window attention\no = y ⊗ M(x̃)                                     # Eq. 28: Element-wise gating\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eAdvantages\u003c/strong\u003e: No chunking, best perplexity, good balance\n\u003cstrong\u003eDisadvantages\u003c/strong\u003e: Memory and attention don't directly communicate\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMAL: Memory as Layer (Section 4.3)\u003c/h4\u003e\u003ca id=\"user-content-mal-memory-as-layer-section-43\" class=\"anchor\" aria-label=\"Permalink: MAL: Memory as Layer (Section 4.3)\" href=\"#mal-memory-as-layer-section-43\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"x̃ = [persistent] || x                           # Eq. 29: Add persistent tokens\ny = M(x̃)                                         # Eq. 30: Memory layer\no = SW-Attn(y)                                   # Eq. 31: Attention on memory output\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003ex̃ = [persistent] || x                           # Eq. 29: Add persistent tokens\ny = M(x̃)                                         # Eq. 30: Memory layer\no = SW-Attn(y)                                   # Eq. 31: Attention on memory output\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eAdvantages\u003c/strong\u003e: Fastest training, simplest architecture\n\u003cstrong\u003eDisadvantages\u003c/strong\u003e: Weaker long-context performance\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eNeural Long-term Memory\u003c/h3\u003e\u003ca id=\"user-content-neural-long-term-memory\" class=\"anchor\" aria-label=\"Permalink: Neural Long-term Memory\" href=\"#neural-long-term-memory\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\n\u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"/Aedelon/titans-pytorch-mlx/blob/main/assets/figures/fig3a_lstm_forget.png\"\u003e\u003cimg src=\"/Aedelon/titans-pytorch-mlx/raw/main/assets/figures/fig3a_lstm_forget.png\" alt=\"LSTM-inspired Gating\" width=\"400\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"/Aedelon/titans-pytorch-mlx/blob/main/assets/figures/fig3b_lstm_update.png\"\u003e\u003cimg src=\"/Aedelon/titans-pytorch-mlx/raw/main/assets/figures/fig3b_lstm_update.png\" alt=\"Memory Update\" width=\"400\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\u003cem\u003eFigure 3: LSTM-inspired gating mechanism for memory forgetting (left) and update (right)\u003c/em\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCore Equations (Section 3.1)\u003c/h4\u003e\u003ca id=\"user-content-core-equations-section-31\" class=\"anchor\" aria-label=\"Permalink: Core Equations (Section 3.1)\" href=\"#core-equations-section-31\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eAssociative Memory Loss\u003c/strong\u003e (Eq. 12):\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"ℓ(M; x_t) = ||M(k_t) - v_t||²\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003eℓ(M; x_t) = ||M(k_t) - v_t||²\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eMemory Update with Forgetting\u003c/strong\u003e (Eq. 13):\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"M_t = (1 - α_t) · M_{t-1} + S_t\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003eM_t = (1 - α_t) · M_{t-1} + S_t\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eSurprise with Momentum\u003c/strong\u003e (Eq. 14):\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"S_t = η_t · S_{t-1} - θ_t · ∇ℓ(M_{t-1}; x_t)\n      \\_________/   \\____________________/\n      Past Surprise   Momentary Surprise\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003eS_t = η_t · S_{t-1} - θ_t · ∇ℓ(M_{t-1}; x_t)\n      \\_________/   \\____________________/\n      Past Surprise   Momentary Surprise\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWhere:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003eα_t\u003c/code\u003e ∈ [0,1]: Forgetting/decay factor (data-dependent)\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003eη_t\u003c/code\u003e ∈ [0,1): Surprise decay / momentum coefficient (data-dependent)\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003eθ_t\u003c/code\u003e \u0026gt; 0: Learning rate for momentary surprise (data-dependent)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eKey Innovations\u003c/h4\u003e\u003ca id=\"user-content-key-innovations\" class=\"anchor\" aria-label=\"Permalink: Key Innovations\" href=\"#key-innovations\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003e\u003cstrong\u003eMomentum-based surprise\u003c/strong\u003e: Unlike DeltaNet/TTT which use momentary surprise only\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eForgetting mechanism\u003c/strong\u003e: Weight decay for memory management on long sequences\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eDeep memory\u003c/strong\u003e: MLP with L_M \u0026gt;= 2 layers for more expressive power\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eData-dependent gates\u003c/strong\u003e: α, η, θ are functions of input, not fixed hyperparameters\u003c/li\u003e\n\u003c/ol\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eInstallation\u003c/h2\u003e\u003ca id=\"user-content-installation\" class=\"anchor\" aria-label=\"Permalink: Installation\" href=\"#installation\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eBasic Installation (PyTorch)\u003c/h3\u003e\u003ca id=\"user-content-basic-installation-pytorch\" class=\"anchor\" aria-label=\"Permalink: Basic Installation (PyTorch)\" href=\"#basic-installation-pytorch\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"git clone https://github.com/yourusername/Google-Titans-replication.git\ncd Google-Titans-replication\nuv sync\"\u003e\u003cpre\u003egit clone https://github.com/yourusername/Google-Titans-replication.git\n\u003cspan class=\"pl-c1\"\u003ecd\u003c/span\u003e Google-Titans-replication\nuv sync\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWith Training Dependencies\u003c/h3\u003e\u003ca id=\"user-content-with-training-dependencies\" class=\"anchor\" aria-label=\"Permalink: With Training Dependencies\" href=\"#with-training-dependencies\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"uv sync --extra train\"\u003e\u003cpre\u003euv sync --extra train\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWith All Extras (Development)\u003c/h3\u003e\u003ca id=\"user-content-with-all-extras-development\" class=\"anchor\" aria-label=\"Permalink: With All Extras (Development)\" href=\"#with-all-extras-development\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"uv sync --all-extras\"\u003e\u003cpre\u003euv sync --all-extras\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMLX Requirements\u003c/h3\u003e\u003ca id=\"user-content-mlx-requirements\" class=\"anchor\" aria-label=\"Permalink: MLX Requirements\" href=\"#mlx-requirements\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eMLX requires macOS 13.5+ and Apple Silicon (M1/M2/M3/M4):\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# MLX is included in default dependencies\nuv sync\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e MLX is included in default dependencies\u003c/span\u003e\nuv sync\u003c/pre\u003e\u003c/div\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eQuick Start\u003c/h2\u003e\u003ca id=\"user-content-quick-start\" class=\"anchor\" aria-label=\"Permalink: Quick Start\" href=\"#quick-start\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePyTorch Quick Start\u003c/h3\u003e\u003ca id=\"user-content-pytorch-quick-start\" class=\"anchor\" aria-label=\"Permalink: PyTorch Quick Start\" href=\"#pytorch-quick-start\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"import torch\nfrom titans import TitansConfig, TitansMAC, TitansMAG, TitansMAL\n\n# Configuration\nconfig = TitansConfig(\n    dim=512,\n    num_heads=8,\n    num_layers=6,\n    vocab_size=32000,\n    chunk_size=512,           # For MAC\n    window_size=512,          # For MAG/MAL\n    num_persistent_tokens=16,\n    num_memory_layers=2,      # Deep memory\n)\n\n# Create model\nmodel = TitansMAC(config)  # or TitansMAG, TitansMAL\n\n# Forward pass\ninput_ids = torch.randint(0, config.vocab_size, (2, 1024))\nlogits, states = model(input_ids)\n\n# Continue with states for next segment\ninput_ids_next = torch.randint(0, config.vocab_size, (2, 512))\nlogits_next, states = model(input_ids_next, states=states)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etorch\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etitans\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eTitansConfig\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eTitansMAC\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eTitansMAG\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eTitansMAL\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# Configuration\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eTitansConfig\u003c/span\u003e(\n    \u003cspan class=\"pl-s1\"\u003edim\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e512\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003enum_heads\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e8\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003enum_layers\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e6\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003evocab_size\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e32000\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003echunk_size\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e512\u003c/span\u003e,           \u003cspan class=\"pl-c\"\u003e# For MAC\u003c/span\u003e\n    \u003cspan class=\"pl-s1\"\u003ewindow_size\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e512\u003c/span\u003e,          \u003cspan class=\"pl-c\"\u003e# For MAG/MAL\u003c/span\u003e\n    \u003cspan class=\"pl-s1\"\u003enum_persistent_tokens\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e16\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003enum_memory_layers\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e,      \u003cspan class=\"pl-c\"\u003e# Deep memory\u003c/span\u003e\n)\n\n\u003cspan class=\"pl-c\"\u003e# Create model\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eTitansMAC\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e)  \u003cspan class=\"pl-c\"\u003e# or TitansMAG, TitansMAL\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# Forward pass\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003einput_ids\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etorch\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003erandint\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003evocab_size\u003c/span\u003e, (\u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e1024\u003c/span\u003e))\n\u003cspan class=\"pl-s1\"\u003elogits\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estates\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emodel\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003einput_ids\u003c/span\u003e)\n\n\u003cspan class=\"pl-c\"\u003e# Continue with states for next segment\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003einput_ids_next\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etorch\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003erandint\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003evocab_size\u003c/span\u003e, (\u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e512\u003c/span\u003e))\n\u003cspan class=\"pl-s1\"\u003elogits_next\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estates\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emodel\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003einput_ids_next\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estates\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003estates\u003c/span\u003e)\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMLX Quick Start\u003c/h3\u003e\u003ca id=\"user-content-mlx-quick-start\" class=\"anchor\" aria-label=\"Permalink: MLX Quick Start\" href=\"#mlx-quick-start\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"import mlx.core as mx\nfrom titans_mlx import TitansConfig, TitansMAC, TitansMAG, TitansMAL\n\n# Configuration (same as PyTorch)\nconfig = TitansConfig(\n    dim=512,\n    num_heads=8,\n    num_layers=6,\n    vocab_size=32000,\n    chunk_size=512,\n    window_size=512,\n    num_persistent_tokens=16,\n    num_memory_layers=2,\n)\n\n# Create model\nmodel = TitansMAC(config)\nmx.eval(model.parameters())  # Evaluate parameters\n\n# Forward pass\ninput_ids = mx.random.randint(0, config.vocab_size, (2, 1024))\nlogits, states = model(input_ids)\nmx.eval(logits)  # Force evaluation\n\n# Continue with states\ninput_ids_next = mx.random.randint(0, config.vocab_size, (2, 512))\nlogits_next, states = model(input_ids_next, states=states)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emlx\u003c/span\u003e.\u003cspan class=\"pl-s1\"\u003ecore\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eas\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emx\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etitans_mlx\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eTitansConfig\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eTitansMAC\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eTitansMAG\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eTitansMAL\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# Configuration (same as PyTorch)\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eTitansConfig\u003c/span\u003e(\n    \u003cspan class=\"pl-s1\"\u003edim\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e512\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003enum_heads\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e8\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003enum_layers\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e6\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003evocab_size\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e32000\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003echunk_size\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e512\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003ewindow_size\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e512\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003enum_persistent_tokens\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e16\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003enum_memory_layers\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e,\n)\n\n\u003cspan class=\"pl-c\"\u003e# Create model\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eTitansMAC\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003emx\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eparameters\u003c/span\u003e())  \u003cspan class=\"pl-c\"\u003e# Evaluate parameters\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# Forward pass\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003einput_ids\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emx\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003erandom\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003erandint\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003evocab_size\u003c/span\u003e, (\u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e1024\u003c/span\u003e))\n\u003cspan class=\"pl-s1\"\u003elogits\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estates\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emodel\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003einput_ids\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003emx\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003elogits\u003c/span\u003e)  \u003cspan class=\"pl-c\"\u003e# Force evaluation\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# Continue with states\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003einput_ids_next\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emx\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003erandom\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003erandint\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003evocab_size\u003c/span\u003e, (\u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e512\u003c/span\u003e))\n\u003cspan class=\"pl-s1\"\u003elogits_next\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estates\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emodel\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003einput_ids_next\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estates\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003estates\u003c/span\u003e)\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eStandalone Neural Memory\u003c/h3\u003e\u003ca id=\"user-content-standalone-neural-memory\" class=\"anchor\" aria-label=\"Permalink: Standalone Neural Memory\" href=\"#standalone-neural-memory\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# PyTorch\nfrom titans import TitansConfig, NeuralLongTermMemory\nimport torch\n\nconfig = TitansConfig(dim=512, num_memory_layers=2)\nmemory = NeuralLongTermMemory(config)\n\nx = torch.randn(2, 100, 512)\noutput, state = memory(x)\noutput2, state2 = memory(x, state=state)  # Continue with state\n\n# MLX\nfrom titans_mlx import TitansConfig, NeuralLongTermMemory\nimport mlx.core as mx\n\nconfig = TitansConfig(dim=512, num_memory_layers=2)\nmemory = NeuralLongTermMemory(config)\nmx.eval(memory.parameters())\n\nx = mx.random.normal((2, 100, 512))\noutput, state = memory(x)\nmx.eval(output)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e# PyTorch\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etitans\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eTitansConfig\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eNeuralLongTermMemory\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etorch\u003c/span\u003e\n\n\u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eTitansConfig\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003edim\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e512\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003enum_memory_layers\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003ememory\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eNeuralLongTermMemory\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e)\n\n\u003cspan class=\"pl-s1\"\u003ex\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etorch\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003erandn\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e100\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e512\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003eoutput\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estate\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ememory\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ex\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003eoutput2\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estate2\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ememory\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ex\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estate\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003estate\u003c/span\u003e)  \u003cspan class=\"pl-c\"\u003e# Continue with state\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# MLX\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etitans_mlx\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eTitansConfig\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eNeuralLongTermMemory\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emlx\u003c/span\u003e.\u003cspan class=\"pl-s1\"\u003ecore\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eas\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emx\u003c/span\u003e\n\n\u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eTitansConfig\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003edim\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e512\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003enum_memory_layers\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003ememory\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eNeuralLongTermMemory\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003emx\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ememory\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eparameters\u003c/span\u003e())\n\n\u003cspan class=\"pl-s1\"\u003ex\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emx\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003erandom\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003enormal\u003c/span\u003e((\u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e100\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e512\u003c/span\u003e))\n\u003cspan class=\"pl-s1\"\u003eoutput\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estate\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ememory\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ex\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003emx\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eoutput\u003c/span\u003e)\u003c/pre\u003e\u003c/div\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePretraining\u003c/h2\u003e\u003ca id=\"user-content-pretraining\" class=\"anchor\" aria-label=\"Permalink: Pretraining\" href=\"#pretraining\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePyTorch Pretraining\u003c/h3\u003e\u003ca id=\"user-content-pytorch-pretraining\" class=\"anchor\" aria-label=\"Permalink: PyTorch Pretraining\" href=\"#pytorch-pretraining\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eOption 1: HuggingFace Streaming (Simple, No Setup)\u003c/h4\u003e\u003ca id=\"user-content-option-1-huggingface-streaming-simple-no-setup\" class=\"anchor\" aria-label=\"Permalink: Option 1: HuggingFace Streaming (Simple, No Setup)\" href=\"#option-1-huggingface-streaming-simple-no-setup\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eStream directly from HuggingFace - tokenization happens on-the-fly:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Train with FineWeb-Edu streaming\nuv run python scripts/pretrain.py --model mac \\\n    --dataset HuggingFaceFW/fineweb-edu \\\n    --dataset-subset sample-10BT \\\n    --tokenizer NousResearch/Llama-2-7b-hf \\\n    --dim 512 --num-layers 12 \\\n    --mixed-precision bf16\n\n# Full training (340M params)\nuv run python scripts/pretrain.py --model mac \\\n    --dataset HuggingFaceFW/fineweb-edu \\\n    --dataset-subset sample-10BT \\\n    --tokenizer NousResearch/Llama-2-7b-hf \\\n    --dim 1024 --num-layers 24 --num-heads 16 \\\n    --batch-size 8 --gradient-accumulation-steps 32 \\\n    --lr 4e-4 --mixed-precision bf16 --wandb\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Train with FineWeb-Edu streaming\u003c/span\u003e\nuv run python scripts/pretrain.py --model mac \\\n    --dataset HuggingFaceFW/fineweb-edu \\\n    --dataset-subset sample-10BT \\\n    --tokenizer NousResearch/Llama-2-7b-hf \\\n    --dim 512 --num-layers 12 \\\n    --mixed-precision bf16\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Full training (340M params)\u003c/span\u003e\nuv run python scripts/pretrain.py --model mac \\\n    --dataset HuggingFaceFW/fineweb-edu \\\n    --dataset-subset sample-10BT \\\n    --tokenizer NousResearch/Llama-2-7b-hf \\\n    --dim 1024 --num-layers 24 --num-heads 16 \\\n    --batch-size 8 --gradient-accumulation-steps 32 \\\n    --lr 4e-4 --mixed-precision bf16 --wandb\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eOption 2: Pre-tokenized Local Dataset (Fastest)\u003c/h4\u003e\u003ca id=\"user-content-option-2-pre-tokenized-local-dataset-fastest\" class=\"anchor\" aria-label=\"Permalink: Option 2: Pre-tokenized Local Dataset (Fastest)\" href=\"#option-2-pre-tokenized-local-dataset-fastest\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003ePre-tokenize once, then train without tokenization overhead:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Step 1: Pre-tokenize (one time)\nuv run python scripts/pretokenize.py \\\n    --dataset HuggingFaceFW/fineweb-edu \\\n    --subset sample-10BT \\\n    --tokenizer NousResearch/Llama-2-7b-hf \\\n    --output data/fineweb-tokenized \\\n    --seq-len 4096 \\\n    --num-proc 8\n\n# Step 2: Train with pre-tokenized data\nuv run python scripts/pretrain.py --model mac \\\n    --local-dataset data/fineweb-tokenized \\\n    --tokenizer NousResearch/Llama-2-7b-hf \\\n    --dim 512 --num-layers 12 \\\n    --mixed-precision bf16\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Step 1: Pre-tokenize (one time)\u003c/span\u003e\nuv run python scripts/pretokenize.py \\\n    --dataset HuggingFaceFW/fineweb-edu \\\n    --subset sample-10BT \\\n    --tokenizer NousResearch/Llama-2-7b-hf \\\n    --output data/fineweb-tokenized \\\n    --seq-len 4096 \\\n    --num-proc 8\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Step 2: Train with pre-tokenized data\u003c/span\u003e\nuv run python scripts/pretrain.py --model mac \\\n    --local-dataset data/fineweb-tokenized \\\n    --tokenizer NousResearch/Llama-2-7b-hf \\\n    --dim 512 --num-layers 12 \\\n    --mixed-precision bf16\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eOther Options\u003c/h4\u003e\u003ca id=\"user-content-other-options\" class=\"anchor\" aria-label=\"Permalink: Other Options\" href=\"#other-options\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Demo with synthetic data (quick test)\nuv run python scripts/pretrain.py --model mac --dim 256 --epochs 10\n\n# Train with local text file\nuv run python scripts/pretrain.py --model mag \\\n    --data path/to/corpus.txt \\\n    --tokenizer gpt2\n\n# Resume from checkpoint\nuv run python scripts/pretrain.py --model mac \\\n    --resume checkpoints/latest.pt\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Demo with synthetic data (quick test)\u003c/span\u003e\nuv run python scripts/pretrain.py --model mac --dim 256 --epochs 10\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Train with local text file\u003c/span\u003e\nuv run python scripts/pretrain.py --model mag \\\n    --data path/to/corpus.txt \\\n    --tokenizer gpt2\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Resume from checkpoint\u003c/span\u003e\nuv run python scripts/pretrain.py --model mac \\\n    --resume checkpoints/latest.pt\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePyTorch Training Options\u003c/h4\u003e\u003ca id=\"user-content-pytorch-training-options\" class=\"anchor\" aria-label=\"Permalink: PyTorch Training Options\" href=\"#pytorch-training-options\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eOption\u003c/th\u003e\n\u003cth\u003eDefault\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eModel Architecture\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--model\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003emac\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eModel variant: mac, mag, mal, lmm\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--dim\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e512\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eModel dimension\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--num-heads\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e8\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eAttention heads\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--num-layers\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e12\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eNumber of layers\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--vocab-size\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e32000\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eVocabulary size\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--chunk-size\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e512\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eChunk size for MAC\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--window-size\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e512\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eWindow size for MAG/MAL\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eData\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--dataset\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003eHuggingFace dataset name (streaming)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--dataset-subset\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003eDataset subset (e.g., sample-10BT)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--local-dataset\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003ePre-tokenized local dataset (Arrow format)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--data\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003eLocal text file path\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--tokenizer\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003egpt2\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eHuggingFace tokenizer\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--seq-len\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e4096\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eSequence length\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eTraining\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--epochs\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e1\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eNumber of epochs\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--max-steps\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e-1\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eMax steps (-1 = use epochs)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--batch-size\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e4\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003ePer-device batch size\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--gradient-accumulation-steps\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e32\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eGradient accumulation steps\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--lr\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e4e-4\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eLearning rate\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--weight-decay\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e0.1\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eWeight decay\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--grad-clip\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e1.0\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eGradient clipping\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--warmup-ratio\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e0.03\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eWarmup ratio\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--mixed-precision\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003ebf16\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003enone, fp16, bf16\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eOptimization\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--torch-compile\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eFalse\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eEnable torch.compile (PyTorch 2.0+)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--compile-mode\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003edefault, reduce-overhead, max-autotune\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--gradient-checkpointing\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eFalse\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eEnable gradient checkpointing\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--num-workers\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e4\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eDataLoader workers\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eCheckpointing\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--checkpoint-dir\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003echeckpoints/\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eCheckpoint directory\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--save-every\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e1000\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eSave every N steps\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--eval-every\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e500\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eEval every N steps\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--resume\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003eResume from checkpoint\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eLogging\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--log-every\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e10\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eLog every N steps\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--wandb\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eFalse\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eEnable W\u0026amp;B logging\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--wandb-project\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003etitans\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eW\u0026amp;B project name\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--wandb-run-name\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003eW\u0026amp;B run name\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--seed\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e42\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eRandom seed\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCUDA Optimizations\u003c/h4\u003e\u003ca id=\"user-content-cuda-optimizations\" class=\"anchor\" aria-label=\"Permalink: CUDA Optimizations\" href=\"#cuda-optimizations\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe training scripts include automatic CUDA optimizations:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003cstrong\u003eTF32 Precision\u003c/strong\u003e: Enabled by default on Ampere+ GPUs for faster matmul\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003ecuDNN Benchmark\u003c/strong\u003e: Auto-tunes convolution algorithms\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eFused AdamW\u003c/strong\u003e: Optimizer runs entirely on GPU\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eBFloat16 Native\u003c/strong\u003e: Model initialized in bf16 (no autocast overhead)\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eNon-blocking Transfers\u003c/strong\u003e: CPU→GPU transfers overlap with computation\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDistributed Training (Multi-GPU)\u003c/h3\u003e\u003ca id=\"user-content-distributed-training-multi-gpu\" class=\"anchor\" aria-label=\"Permalink: Distributed Training (Multi-GPU)\" href=\"#distributed-training-multi-gpu\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Multi-GPU with DDP (auto-detects GPUs)\nuv run accelerate launch scripts/pretrain_distributed.py \\\n    --model mac --dim 512 \\\n    --local-dataset data/fineweb-tokenized\n\n# Multi-GPU with custom config\nuv run accelerate launch --config_file configs/fsdp_config.yaml \\\n    scripts/pretrain_distributed.py --model mac --dim 1024\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Multi-GPU with DDP (auto-detects GPUs)\u003c/span\u003e\nuv run accelerate launch scripts/pretrain_distributed.py \\\n    --model mac --dim 512 \\\n    --local-dataset data/fineweb-tokenized\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Multi-GPU with custom config\u003c/span\u003e\nuv run accelerate launch --config_file configs/fsdp_config.yaml \\\n    scripts/pretrain_distributed.py --model mac --dim 1024\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMLX Pretraining\u003c/h3\u003e\u003ca id=\"user-content-mlx-pretraining\" class=\"anchor\" aria-label=\"Permalink: MLX Pretraining\" href=\"#mlx-pretraining\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Demo with synthetic data\nuv run python scripts/pretrain_mlx.py --model mac --dim 256 --epochs 10\n\n# Train with FineWeb-Edu\nuv run python scripts/pretrain_mlx.py --model mac \\\n    --dataset HuggingFaceFW/fineweb-edu \\\n    --tokenizer meta-llama/Llama-2-7b-hf \\\n    --dim 512 --num-layers 12\n\n# Full training\nuv run python scripts/pretrain_mlx.py --model mac \\\n    --dataset HuggingFaceFW/fineweb-edu \\\n    --tokenizer meta-llama/Llama-2-7b-hf \\\n    --dim 1024 --num-layers 24 --num-heads 16 \\\n    --batch-size 4 --gradient-accumulation-steps 32 \\\n    --dtype float16 --wandb\n\n# Train with local text\nuv run python scripts/pretrain_mlx.py --model mag \\\n    --data path/to/corpus.txt\n\n# Resume from checkpoint\nuv run python scripts/pretrain_mlx.py --model mac \\\n    --resume checkpoints_mlx/latest.safetensors\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Demo with synthetic data\u003c/span\u003e\nuv run python scripts/pretrain_mlx.py --model mac --dim 256 --epochs 10\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Train with FineWeb-Edu\u003c/span\u003e\nuv run python scripts/pretrain_mlx.py --model mac \\\n    --dataset HuggingFaceFW/fineweb-edu \\\n    --tokenizer meta-llama/Llama-2-7b-hf \\\n    --dim 512 --num-layers 12\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Full training\u003c/span\u003e\nuv run python scripts/pretrain_mlx.py --model mac \\\n    --dataset HuggingFaceFW/fineweb-edu \\\n    --tokenizer meta-llama/Llama-2-7b-hf \\\n    --dim 1024 --num-layers 24 --num-heads 16 \\\n    --batch-size 4 --gradient-accumulation-steps 32 \\\n    --dtype float16 --wandb\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Train with local text\u003c/span\u003e\nuv run python scripts/pretrain_mlx.py --model mag \\\n    --data path/to/corpus.txt\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Resume from checkpoint\u003c/span\u003e\nuv run python scripts/pretrain_mlx.py --model mac \\\n    --resume checkpoints_mlx/latest.safetensors\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMLX Training Options\u003c/h4\u003e\u003ca id=\"user-content-mlx-training-options\" class=\"anchor\" aria-label=\"Permalink: MLX Training Options\" href=\"#mlx-training-options\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eOption\u003c/th\u003e\n\u003cth\u003eDefault\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eModel Architecture\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--model\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003emac\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eModel variant: mac, mag, mal, lmm\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--dim\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e512\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eModel dimension\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--num-heads\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e8\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eAttention heads\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--num-layers\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e12\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eNumber of layers\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--vocab-size\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e32000\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eVocabulary size\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--chunk-size\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e512\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eChunk size for MAC\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--window-size\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e512\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eWindow size for MAG/MAL\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eData\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--dataset\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003eHuggingFace dataset name (streaming)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--dataset-subset\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003eDataset subset (e.g., sample-10BT)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--data\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003eLocal text file path\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--tokenizer\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003egpt2\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eHuggingFace tokenizer\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--seq-len\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e4096\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eSequence length\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eTraining\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--epochs\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e1\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eNumber of epochs\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--max-steps\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e-1\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eMax steps (-1 = use epochs)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--batch-size\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e4\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eBatch size\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--gradient-accumulation-steps\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e32\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eGradient accumulation steps\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--lr\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e4e-4\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eLearning rate\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--weight-decay\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e0.1\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eWeight decay\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--grad-clip\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e1.0\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eGradient clipping\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--warmup-ratio\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e0.03\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eWarmup ratio\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--dtype\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003efloat16\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003efloat32, float16, bfloat16\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eCheckpointing\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--checkpoint-dir\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003echeckpoints_mlx/\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eCheckpoint directory\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--save-every\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e1000\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eSave every N steps\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--eval-every\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e500\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eEval every N steps\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--resume\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003eResume from checkpoint (.safetensors)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eLogging\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--log-every\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e10\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eLog every N steps\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--wandb\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eFalse\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eEnable W\u0026amp;B logging\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--wandb-project\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003etitans-mlx\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eW\u0026amp;B project name\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--wandb-run-name\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003eW\u0026amp;B run name\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--seed\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e42\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eRandom seed\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eInference\u003c/h2\u003e\u003ca id=\"user-content-inference\" class=\"anchor\" aria-label=\"Permalink: Inference\" href=\"#inference\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePyTorch Inference\u003c/h3\u003e\u003ca id=\"user-content-pytorch-inference\" class=\"anchor\" aria-label=\"Permalink: PyTorch Inference\" href=\"#pytorch-inference\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Generate text\nuv run python scripts/inference.py \\\n    --checkpoint checkpoints/best_model.pt \\\n    --prompt \u0026quot;Once upon a time\u0026quot; \\\n    --max-tokens 100\n\n# Interactive mode\nuv run python scripts/inference.py \\\n    --checkpoint checkpoints/best_model.pt \\\n    --interactive\n\n# With sampling parameters\nuv run python scripts/inference.py \\\n    --checkpoint checkpoints/best_model.pt \\\n    --prompt \u0026quot;The meaning of life is\u0026quot; \\\n    --temperature 0.8 \\\n    --top-p 0.9 \\\n    --max-tokens 200\n\n# With quantization\nuv run python scripts/inference.py \\\n    --checkpoint checkpoints/best_model.pt \\\n    --prompt \u0026quot;Hello\u0026quot; \\\n    --quantize int8\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Generate text\u003c/span\u003e\nuv run python scripts/inference.py \\\n    --checkpoint checkpoints/best_model.pt \\\n    --prompt \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eOnce upon a time\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \\\n    --max-tokens 100\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Interactive mode\u003c/span\u003e\nuv run python scripts/inference.py \\\n    --checkpoint checkpoints/best_model.pt \\\n    --interactive\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e With sampling parameters\u003c/span\u003e\nuv run python scripts/inference.py \\\n    --checkpoint checkpoints/best_model.pt \\\n    --prompt \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eThe meaning of life is\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \\\n    --temperature 0.8 \\\n    --top-p 0.9 \\\n    --max-tokens 200\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e With quantization\u003c/span\u003e\nuv run python scripts/inference.py \\\n    --checkpoint checkpoints/best_model.pt \\\n    --prompt \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eHello\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \\\n    --quantize int8\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePyTorch Inference Options\u003c/h4\u003e\u003ca id=\"user-content-pytorch-inference-options\" class=\"anchor\" aria-label=\"Permalink: PyTorch Inference Options\" href=\"#pytorch-inference-options\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eOption\u003c/th\u003e\n\u003cth\u003eDefault\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--checkpoint\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003erequired\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003ePath to model checkpoint (.pt)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--tokenizer\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003egpt2\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eHuggingFace tokenizer\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--prompt\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003eInput prompt\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--max-tokens\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e100\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eMax tokens to generate\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--temperature\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e1.0\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eSampling temperature\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--top-k\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e50\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eTop-k sampling\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--top-p\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e0.9\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eTop-p (nucleus) sampling\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--repetition-penalty\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e1.0\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eRepetition penalty\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--interactive\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eFalse\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eInteractive mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--stream\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eFalse\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eStream output token by token\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--quantize\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003eQuantization: int8, int4, fp16\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--device\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eauto\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eDevice: auto, cpu, cuda, mps\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMLX Inference\u003c/h3\u003e\u003ca id=\"user-content-mlx-inference\" class=\"anchor\" aria-label=\"Permalink: MLX Inference\" href=\"#mlx-inference\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Generate text\nuv run python scripts/inference_mlx.py \\\n    --checkpoint checkpoints_mlx/best_model.safetensors \\\n    --prompt \u0026quot;Once upon a time\u0026quot; \\\n    --max-tokens 100\n\n# Interactive mode\nuv run python scripts/inference_mlx.py \\\n    --checkpoint checkpoints_mlx/best_model.safetensors \\\n    --interactive\n\n# With quantization and benchmark\nuv run python scripts/inference_mlx.py \\\n    --checkpoint checkpoints_mlx/best_model.safetensors \\\n    --prompt \u0026quot;Hello\u0026quot; \\\n    --quantize 8 \\\n    --benchmark\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Generate text\u003c/span\u003e\nuv run python scripts/inference_mlx.py \\\n    --checkpoint checkpoints_mlx/best_model.safetensors \\\n    --prompt \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eOnce upon a time\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \\\n    --max-tokens 100\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Interactive mode\u003c/span\u003e\nuv run python scripts/inference_mlx.py \\\n    --checkpoint checkpoints_mlx/best_model.safetensors \\\n    --interactive\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e With quantization and benchmark\u003c/span\u003e\nuv run python scripts/inference_mlx.py \\\n    --checkpoint checkpoints_mlx/best_model.safetensors \\\n    --prompt \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eHello\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \\\n    --quantize 8 \\\n    --benchmark\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMLX Inference Options\u003c/h4\u003e\u003ca id=\"user-content-mlx-inference-options\" class=\"anchor\" aria-label=\"Permalink: MLX Inference Options\" href=\"#mlx-inference-options\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eOption\u003c/th\u003e\n\u003cth\u003eDefault\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--checkpoint\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003erequired\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003ePath to model checkpoint (.safetensors)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--tokenizer\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003egpt2\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eHuggingFace tokenizer\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--prompt\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003eInput prompt\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--max-tokens\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e100\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eMax tokens to generate\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--temperature\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e1.0\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eSampling temperature\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--top-k\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e50\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eTop-k sampling\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--top-p\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e0.9\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eTop-p (nucleus) sampling\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--repetition-penalty\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003e1.0\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eRepetition penalty\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--interactive\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eFalse\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eInteractive mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--stream\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eFalse\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eStream output token by token\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--quantize\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003ctd\u003eQuantization bits: 4 or 8\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e--benchmark\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eFalse\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eRun generation benchmark\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eBenchmarks\u003c/h2\u003e\u003ca id=\"user-content-benchmarks\" class=\"anchor\" aria-label=\"Permalink: Benchmarks\" href=\"#benchmarks\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eModel Quality (from Paper Table 1 \u0026amp; 5)\u003c/h3\u003e\u003ca id=\"user-content-model-quality-from-paper-table-1--5\" class=\"anchor\" aria-label=\"Permalink: Model Quality (from Paper Table 1 \u0026amp; 5)\" href=\"#model-quality-from-paper-table-1--5\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eLanguage Modeling (340M params, 15B tokens)\u003c/strong\u003e:\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eModel\u003c/th\u003e\n\u003cth\u003eWiki ppl ↓\u003c/th\u003e\n\u003cth\u003eAvg Accuracy ↑\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eMAC\u003c/td\u003e\n\u003ctd\u003e25.43\u003c/td\u003e\n\u003ctd\u003e47.36\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMAG\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003e25.07\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003e47.54\u003c/strong\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMAL\u003c/td\u003e\n\u003ctd\u003e24.69\u003c/td\u003e\n\u003ctd\u003e46.55\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eLMM\u003c/td\u003e\n\u003ctd\u003e26.18\u003c/td\u003e\n\u003ctd\u003e46.17\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eLong Context (BABILong benchmark)\u003c/strong\u003e:\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eModel\u003c/th\u003e\n\u003cth\u003eAccuracy ↑\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eMAC\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003e97.95\u003c/strong\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMAG\u003c/td\u003e\n\u003ctd\u003e96.70\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMAL\u003c/td\u003e\n\u003ctd\u003e96.91\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eLMM\u003c/td\u003e\n\u003ctd\u003e92.68\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eInference Speed (Apple M4 Pro)\u003c/h3\u003e\u003ca id=\"user-content-inference-speed-apple-m4-pro\" class=\"anchor\" aria-label=\"Permalink: Inference Speed (Apple M4 Pro)\" href=\"#inference-speed-apple-m4-pro\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eConfiguration: batch=4, seq_len=256, dim=256, 4 layers\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eModel\u003c/th\u003e\n\u003cth\u003eMLX (ms)\u003c/th\u003e\n\u003cth\u003ePyTorch MPS (ms)\u003c/th\u003e\n\u003cth\u003ePyTorch CPU (ms)\u003c/th\u003e\n\u003cth\u003eMLX Speedup vs MPS\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eMAC\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003e19.89\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e24.94\u003c/td\u003e\n\u003ctd\u003e90.30\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003e1.25x\u003c/strong\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMAG\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003e9.72\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e16.66\u003c/td\u003e\n\u003ctd\u003e43.45\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003e1.71x\u003c/strong\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMAL\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003e9.75\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e16.89\u003c/td\u003e\n\u003ctd\u003e45.05\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003e1.73x\u003c/strong\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eLMM\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003e7.11\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e11.88\u003c/td\u003e\n\u003ctd\u003e28.73\u003c/td\u003e\n\u003ctd\u003e\u003cstrong\u003e1.67x\u003c/strong\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eAll MLX implementations are faster than PyTorch MPS on Apple Silicon.\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eNumerical Parity\u003c/h3\u003e\u003ca id=\"user-content-numerical-parity\" class=\"anchor\" aria-label=\"Permalink: Numerical Parity\" href=\"#numerical-parity\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eMLX and PyTorch implementations produce identical outputs:\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eModel\u003c/th\u003e\n\u003cth\u003eMax Difference\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eMemory\u003c/td\u003e\n\u003ctd\u003e\u0026lt; 1e-5\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eLMM\u003c/td\u003e\n\u003ctd\u003e\u0026lt; 1e-4\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMAG\u003c/td\u003e\n\u003ctd\u003e\u0026lt; 1e-4\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMAC\u003c/td\u003e\n\u003ctd\u003e\u0026lt; 1e-4\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eConfiguration Reference\u003c/h2\u003e\u003ca id=\"user-content-configuration-reference\" class=\"anchor\" aria-label=\"Permalink: Configuration Reference\" href=\"#configuration-reference\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTitansConfig Parameters\u003c/h3\u003e\u003ca id=\"user-content-titansconfig-parameters\" class=\"anchor\" aria-label=\"Permalink: TitansConfig Parameters\" href=\"#titansconfig-parameters\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eParameter\u003c/th\u003e\n\u003cth\u003eDefault\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003cth\u003ePaper Reference\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eModel Architecture\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003edim\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e512\u003c/td\u003e\n\u003ctd\u003eModel dimension (d_in)\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003enum_heads\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e8\u003c/td\u003e\n\u003ctd\u003eNumber of attention heads\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003enum_layers\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e12\u003c/td\u003e\n\u003ctd\u003eNumber of Titans blocks\u003c/td\u003e\n\u003ctd\u003eStackable\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003evocab_size\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e32000\u003c/td\u003e\n\u003ctd\u003eVocabulary size\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003emax_seq_len\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e8192\u003c/td\u003e\n\u003ctd\u003eMaximum sequence length\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eMemory\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003enum_memory_layers\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e2\u003c/td\u003e\n\u003ctd\u003eMemory MLP depth (L_M \u0026gt;= 1)\u003c/td\u003e\n\u003ctd\u003eSection 3.1\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ememory_hidden_mult\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e4.0\u003c/td\u003e\n\u003ctd\u003eMemory hidden dim multiplier\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ememory_lr\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e0.1\u003c/td\u003e\n\u003ctd\u003eLearning rate θ_t (scaled by gate)\u003c/td\u003e\n\u003ctd\u003eEq. 14\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ememory_momentum\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e0.9\u003c/td\u003e\n\u003ctd\u003eMomentum η_t (scaled by gate)\u003c/td\u003e\n\u003ctd\u003eEq. 14\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ememory_decay\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e0.01\u003c/td\u003e\n\u003ctd\u003eForgetting α_t (scaled by gate)\u003c/td\u003e\n\u003ctd\u003eEq. 13\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eAttention\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003enum_persistent_tokens\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e16\u003c/td\u003e\n\u003ctd\u003ePersistent memory tokens (N_p)\u003c/td\u003e\n\u003ctd\u003eEq. 19\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003echunk_size\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e512\u003c/td\u003e\n\u003ctd\u003eSegment size for MAC\u003c/td\u003e\n\u003ctd\u003eSection 4.1\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ewindow_size\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e512\u003c/td\u003e\n\u003ctd\u003eSliding window for MAG/MAL\u003c/td\u003e\n\u003ctd\u003eSection 4.2-4.3\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eArchitecture Options\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003euse_conv\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eTrue\u003c/td\u003e\n\u003ctd\u003e1D depthwise convolution\u003c/td\u003e\n\u003ctd\u003eSection 4.4\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003econv_kernel_size\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e4\u003c/td\u003e\n\u003ctd\u003eConvolution kernel size\u003c/td\u003e\n\u003ctd\u003eSection 4.4\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003euse_rope\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eTrue\u003c/td\u003e\n\u003ctd\u003eRotary Position Embeddings\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eactivation\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\"silu\"\u003c/td\u003e\n\u003ctd\u003eActivation function\u003c/td\u003e\n\u003ctd\u003eSection 4.4\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003edropout\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e0.0\u003c/td\u003e\n\u003ctd\u003eDropout rate\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cstrong\u003eFFN\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003effn_mult\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e4.0\u003c/td\u003e\n\u003ctd\u003eFFN hidden dim multiplier\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003einit_std\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e0.02\u003c/td\u003e\n\u003ctd\u003eWeight initialization std\u003c/td\u003e\n\u003ctd\u003e-\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAPI Reference\u003c/h2\u003e\u003ca id=\"user-content-api-reference\" class=\"anchor\" aria-label=\"Permalink: API Reference\" href=\"#api-reference\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePyTorch API\u003c/h3\u003e\u003ca id=\"user-content-pytorch-api\" class=\"anchor\" aria-label=\"Permalink: PyTorch API\" href=\"#pytorch-api\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"from titans import (\n    # Configuration\n    TitansConfig,\n\n    # Models\n    TitansMAC,\n    TitansMAG,\n    TitansMAL,\n    TitansLMM,\n\n    # Components\n    NeuralLongTermMemory,\n    MemoryState,\n    SlidingWindowAttention,\n    SegmentedAttention,\n    PersistentMemory,\n)\n\n# Model forward signature\nlogits, states = model(input_ids, states=None)\n# input_ids: (batch, seq_len) - Token IDs\n# states: Optional list of MemoryState\n# Returns: logits (batch, seq_len, vocab_size), new states\n\n# Memory forward signature\noutput, state = memory(x, state=None, return_state=True)\n# x: (batch, seq_len, dim)\n# state: Optional MemoryState\n# Returns: output (batch, seq_len, dim), new state\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etitans\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e (\n    \u003cspan class=\"pl-c\"\u003e# Configuration\u003c/span\u003e\n    \u003cspan class=\"pl-v\"\u003eTitansConfig\u003c/span\u003e,\n\n    \u003cspan class=\"pl-c\"\u003e# Models\u003c/span\u003e\n    \u003cspan class=\"pl-v\"\u003eTitansMAC\u003c/span\u003e,\n    \u003cspan class=\"pl-v\"\u003eTitansMAG\u003c/span\u003e,\n    \u003cspan class=\"pl-v\"\u003eTitansMAL\u003c/span\u003e,\n    \u003cspan class=\"pl-v\"\u003eTitansLMM\u003c/span\u003e,\n\n    \u003cspan class=\"pl-c\"\u003e# Components\u003c/span\u003e\n    \u003cspan class=\"pl-v\"\u003eNeuralLongTermMemory\u003c/span\u003e,\n    \u003cspan class=\"pl-v\"\u003eMemoryState\u003c/span\u003e,\n    \u003cspan class=\"pl-v\"\u003eSlidingWindowAttention\u003c/span\u003e,\n    \u003cspan class=\"pl-v\"\u003eSegmentedAttention\u003c/span\u003e,\n    \u003cspan class=\"pl-v\"\u003ePersistentMemory\u003c/span\u003e,\n)\n\n\u003cspan class=\"pl-c\"\u003e# Model forward signature\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003elogits\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estates\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emodel\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003einput_ids\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estates\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eNone\u003c/span\u003e)\n\u003cspan class=\"pl-c\"\u003e# input_ids: (batch, seq_len) - Token IDs\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# states: Optional list of MemoryState\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# Returns: logits (batch, seq_len, vocab_size), new states\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# Memory forward signature\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003eoutput\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estate\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ememory\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ex\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estate\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eNone\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003ereturn_state\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e)\n\u003cspan class=\"pl-c\"\u003e# x: (batch, seq_len, dim)\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# state: Optional MemoryState\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# Returns: output (batch, seq_len, dim), new state\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMLX API\u003c/h3\u003e\u003ca id=\"user-content-mlx-api\" class=\"anchor\" aria-label=\"Permalink: MLX API\" href=\"#mlx-api\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"from titans_mlx import (\n    # Configuration\n    TitansConfig,\n\n    # Models\n    TitansMAC,\n    TitansMAG,\n    TitansMAL,\n    TitansLMM,\n\n    # Components\n    NeuralLongTermMemory,\n    MemoryState,\n    SlidingWindowAttention,\n    SegmentedAttention,\n    PersistentMemory,\n\n    # Optimizations\n    compile_model,      # Note: Limited support\n    compile_function,\n    get_device_info,\n\n    # Metal Kernels (benchmarking only)\n    metal_silu_gate,\n    metal_memory_update,\n    metal_rope,\n)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etitans_mlx\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e (\n    \u003cspan class=\"pl-c\"\u003e# Configuration\u003c/span\u003e\n    \u003cspan class=\"pl-v\"\u003eTitansConfig\u003c/span\u003e,\n\n    \u003cspan class=\"pl-c\"\u003e# Models\u003c/span\u003e\n    \u003cspan class=\"pl-v\"\u003eTitansMAC\u003c/span\u003e,\n    \u003cspan class=\"pl-v\"\u003eTitansMAG\u003c/span\u003e,\n    \u003cspan class=\"pl-v\"\u003eTitansMAL\u003c/span\u003e,\n    \u003cspan class=\"pl-v\"\u003eTitansLMM\u003c/span\u003e,\n\n    \u003cspan class=\"pl-c\"\u003e# Components\u003c/span\u003e\n    \u003cspan class=\"pl-v\"\u003eNeuralLongTermMemory\u003c/span\u003e,\n    \u003cspan class=\"pl-v\"\u003eMemoryState\u003c/span\u003e,\n    \u003cspan class=\"pl-v\"\u003eSlidingWindowAttention\u003c/span\u003e,\n    \u003cspan class=\"pl-v\"\u003eSegmentedAttention\u003c/span\u003e,\n    \u003cspan class=\"pl-v\"\u003ePersistentMemory\u003c/span\u003e,\n\n    \u003cspan class=\"pl-c\"\u003e# Optimizations\u003c/span\u003e\n    \u003cspan class=\"pl-s1\"\u003ecompile_model\u003c/span\u003e,      \u003cspan class=\"pl-c\"\u003e# Note: Limited support\u003c/span\u003e\n    \u003cspan class=\"pl-s1\"\u003ecompile_function\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003eget_device_info\u003c/span\u003e,\n\n    \u003cspan class=\"pl-c\"\u003e# Metal Kernels (benchmarking only)\u003c/span\u003e\n    \u003cspan class=\"pl-s1\"\u003emetal_silu_gate\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003emetal_memory_update\u003c/span\u003e,\n    \u003cspan class=\"pl-s1\"\u003emetal_rope\u003c/span\u003e,\n)\u003c/pre\u003e\u003c/div\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMLX Optimizations\u003c/h2\u003e\u003ca id=\"user-content-mlx-optimizations\" class=\"anchor\" aria-label=\"Permalink: MLX Optimizations\" href=\"#mlx-optimizations\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eGradient Computation\u003c/h3\u003e\u003ca id=\"user-content-gradient-computation\" class=\"anchor\" aria-label=\"Permalink: Gradient Computation\" href=\"#gradient-computation\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe MLX implementation uses \u003cstrong\u003eanalytical gradients\u003c/strong\u003e instead of \u003ccode\u003emx.grad\u003c/code\u003e for the memory update:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Efficient gradient via matmul (avoids huge intermediate tensors)\n# Instead of: expand_dims + outer product + sum\n# We use: reshape + matmul\n\ndelta_flat = delta.reshape(batch_seq, -1)  # (B*S, D_out)\nact_flat = act.reshape(batch_seq, -1)      # (B*S, D_in)\ngrad_w = delta_flat.T @ act_flat           # (D_out, D_in)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e# Efficient gradient via matmul (avoids huge intermediate tensors)\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# Instead of: expand_dims + outer product + sum\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# We use: reshape + matmul\u003c/span\u003e\n\n\u003cspan class=\"pl-s1\"\u003edelta_flat\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003edelta\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003ereshape\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ebatch_seq\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e)  \u003cspan class=\"pl-c\"\u003e# (B*S, D_out)\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003eact_flat\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eact\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003ereshape\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ebatch_seq\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e)      \u003cspan class=\"pl-c\"\u003e# (B*S, D_in)\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003egrad_w\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003edelta_flat\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eT\u003c/span\u003e @ \u003cspan class=\"pl-s1\"\u003eact_flat\u003c/span\u003e           \u003cspan class=\"pl-c\"\u003e# (D_out, D_in)\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis optimization provides \u003cstrong\u003e5x speedup\u003c/strong\u003e for MAC.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWhy Not mx.compile?\u003c/h3\u003e\u003ca id=\"user-content-why-not-mxcompile\" class=\"anchor\" aria-label=\"Permalink: Why Not mx.compile?\" href=\"#why-not-mxcompile\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003emx.compile\u003c/code\u003e cannot compile full Titans models because:\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003e\u003cstrong\u003eMemoryState\u003c/strong\u003e: Dataclasses are not supported\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eDynamic loops\u003c/strong\u003e: Python for-loops for chunk processing\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eMutable state\u003c/strong\u003e: Memory state updates\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp dir=\"auto\"\u003eIndividual components (FFN, attention) can be compiled for marginal gains.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMetal Kernels\u003c/h3\u003e\u003ca id=\"user-content-metal-kernels\" class=\"anchor\" aria-label=\"Permalink: Metal Kernels\" href=\"#metal-kernels\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eCustom Metal kernels are available but \u003cstrong\u003enot faster\u003c/strong\u003e than native MLX for typical tensor sizes:\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eOperation\u003c/th\u003e\n\u003cth\u003eMetal Kernel\u003c/th\u003e\n\u003cth\u003eNative MLX\u003c/th\u003e\n\u003cth\u003eVerdict\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eSiLU Gate\u003c/td\u003e\n\u003ctd\u003e0.44ms\u003c/td\u003e\n\u003ctd\u003e0.26ms\u003c/td\u003e\n\u003ctd\u003eNative faster\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMemory Update\u003c/td\u003e\n\u003ctd\u003e0.20ms\u003c/td\u003e\n\u003ctd\u003e0.23ms\u003c/td\u003e\n\u003ctd\u003e~Equal\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eRoPE\u003c/td\u003e\n\u003ctd\u003e0.23ms\u003c/td\u003e\n\u003ctd\u003e0.23ms\u003c/td\u003e\n\u003ctd\u003e~Equal\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003eMLX already optimizes well for Apple Silicon. Use native operations.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRecommended Practices\u003c/h3\u003e\u003ca id=\"user-content-recommended-practices\" class=\"anchor\" aria-label=\"Permalink: Recommended Practices\" href=\"#recommended-practices\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"import mlx.core as mx\nfrom titans_mlx import TitansConfig, TitansMAC\n\n# 1. Use float16 for training (default)\n# Saves memory, marginal speed difference on Apple Silicon\n\n# 2. Evaluate parameters after creation\nmodel = TitansMAC(config)\nmx.eval(model.parameters())\n\n# 3. Evaluate outputs when needed\nlogits, states = model(input_ids)\nmx.eval(logits)  # Force computation\n\n# 4. Use larger batches to amortize overhead\n# batch_size=4 or higher recommended\n\n# 5. Disable convolution if dimensions mismatch\nconfig = TitansConfig(..., use_conv=False)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emlx\u003c/span\u003e.\u003cspan class=\"pl-s1\"\u003ecore\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eas\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003emx\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etitans_mlx\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eTitansConfig\u003c/span\u003e, \u003cspan class=\"pl-v\"\u003eTitansMAC\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# 1. Use float16 for training (default)\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# Saves memory, marginal speed difference on Apple Silicon\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# 2. Evaluate parameters after creation\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eTitansMAC\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003emx\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003emodel\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eparameters\u003c/span\u003e())\n\n\u003cspan class=\"pl-c\"\u003e# 3. Evaluate outputs when needed\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003elogits\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003estates\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emodel\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003einput_ids\u003c/span\u003e)\n\u003cspan class=\"pl-s1\"\u003emx\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eeval\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003elogits\u003c/span\u003e)  \u003cspan class=\"pl-c\"\u003e# Force computation\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# 4. Use larger batches to amortize overhead\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# batch_size=4 or higher recommended\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e# 5. Disable convolution if dimensions mismatch\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eTitansConfig\u003c/span\u003e(..., \u003cspan class=\"pl-s1\"\u003euse_conv\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eFalse\u003c/span\u003e)\u003c/pre\u003e\u003c/div\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTroubleshooting\u003c/h2\u003e\u003ca id=\"user-content-troubleshooting\" class=\"anchor\" aria-label=\"Permalink: Troubleshooting\" href=\"#troubleshooting\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCommon Issues\u003c/h3\u003e\u003ca id=\"user-content-common-issues\" class=\"anchor\" aria-label=\"Permalink: Common Issues\" href=\"#common-issues\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePyTorch\u003c/h4\u003e\u003ca id=\"user-content-pytorch\" class=\"anchor\" aria-label=\"Permalink: PyTorch\" href=\"#pytorch\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eIssue\u003c/strong\u003e: Out of memory on GPU\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Reduce batch size or use gradient accumulation\n--batch-size 2 --gradient-accumulation-steps 64\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Reduce batch size or use gradient accumulation\u003c/span\u003e\n--batch-size 2 --gradient-accumulation-steps 64\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eIssue\u003c/strong\u003e: NaN loss during training\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Use bf16 instead of fp16, or reduce learning rate\n--mixed-precision bf16 --lr 2e-4\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Use bf16 instead of fp16, or reduce learning rate\u003c/span\u003e\n--mixed-precision bf16 --lr 2e-4\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMLX\u003c/h4\u003e\u003ca id=\"user-content-mlx\" class=\"anchor\" aria-label=\"Permalink: MLX\" href=\"#mlx\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eIssue\u003c/strong\u003e: \u003ccode\u003eValueError: conv1d groups\u003c/code\u003e error\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Disable convolution\nconfig = TitansConfig(..., use_conv=False)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e# Disable convolution\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003econfig\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eTitansConfig\u003c/span\u003e(..., \u003cspan class=\"pl-s1\"\u003euse_conv\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eFalse\u003c/span\u003e)\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eIssue\u003c/strong\u003e: Slow first iteration\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Normal - MLX compiles on first call\n# Subsequent iterations will be faster\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e# Normal - MLX compiles on first call\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e# Subsequent iterations will be faster\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eIssue\u003c/strong\u003e: Memory not releasing\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# Force garbage collection\nimport gc\ngc.collect()\nmx.metal.clear_cache()  # If available\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e# Force garbage collection\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003egc\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003egc\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003ecollect\u003c/span\u003e()\n\u003cspan class=\"pl-s1\"\u003emx\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003emetal\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eclear_cache\u003c/span\u003e()  \u003cspan class=\"pl-c\"\u003e# If available\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eNumerical Differences\u003c/h3\u003e\u003ca id=\"user-content-numerical-differences\" class=\"anchor\" aria-label=\"Permalink: Numerical Differences\" href=\"#numerical-differences\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eSmall numerical differences (\u0026lt; 1e-4) between PyTorch and MLX are expected due to:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eDifferent floating-point implementations\u003c/li\u003e\n\u003cli\u003eDifferent reduction orders\u003c/li\u003e\n\u003cli\u003ePlatform-specific optimizations\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eFor exact reproducibility, use the same backend.\u003c/p\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDevelopment\u003c/h2\u003e\u003ca id=\"user-content-development\" class=\"anchor\" aria-label=\"Permalink: Development\" href=\"#development\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eProject Structure\u003c/h3\u003e\u003ca id=\"user-content-project-structure\" class=\"anchor\" aria-label=\"Permalink: Project Structure\" href=\"#project-structure\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"titans-pytorch/\n├── src/\n│   ├── titans/                 # PyTorch implementation\n│   │   ├── __init__.py\n│   │   ├── config.py           # TitansConfig\n│   │   ├── memory.py           # Neural Long-term Memory\n│   │   ├── attention.py        # Attention modules\n│   │   ├── persistent.py       # Persistent Memory\n│   │   ├── models.py           # MAC, MAG, MAL, LMM\n│   │   └── triton_kernels.py   # Triton optimizations\n│   │\n│   └── titans_mlx/             # MLX implementation\n│       ├── __init__.py\n│       ├── config.py\n│       ├── memory.py\n│       ├── attention.py\n│       ├── persistent.py\n│       ├── models.py\n│       ├── optimizations.py    # MLX optimizations\n│       └── metal_kernels.py    # Metal kernels\n│\n├── scripts/\n│   ├── pretrain.py             # PyTorch training (optimized)\n│   ├── pretrain_distributed.py # Multi-GPU training (Accelerate)\n│   ├── pretrain_mlx.py         # MLX training\n│   ├── pretokenize.py          # Dataset pre-tokenization\n│   ├── inference.py            # PyTorch inference\n│   └── inference_mlx.py        # MLX inference\n│\n├── tests/\n│   ├── test_memory.py\n│   ├── test_attention.py\n│   ├── test_models.py\n│   ├── test_persistent.py\n│   └── test_numerical_parity.py  # MLX vs PyTorch\n│\n├── examples/\n│   ├── basic_usage.py\n│   └── long_sequence.py\n│\n└── pyproject.toml\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003etitans-pytorch/\n├── src/\n│   ├── titans/                 # PyTorch implementation\n│   │   ├── __init__.py\n│   │   ├── config.py           # TitansConfig\n│   │   ├── memory.py           # Neural Long-term Memory\n│   │   ├── attention.py        # Attention modules\n│   │   ├── persistent.py       # Persistent Memory\n│   │   ├── models.py           # MAC, MAG, MAL, LMM\n│   │   └── triton_kernels.py   # Triton optimizations\n│   │\n│   └── titans_mlx/             # MLX implementation\n│       ├── __init__.py\n│       ├── config.py\n│       ├── memory.py\n│       ├── attention.py\n│       ├── persistent.py\n│       ├── models.py\n│       ├── optimizations.py    # MLX optimizations\n│       └── metal_kernels.py    # Metal kernels\n│\n├── scripts/\n│   ├── pretrain.py             # PyTorch training (optimized)\n│   ├── pretrain_distributed.py # Multi-GPU training (Accelerate)\n│   ├── pretrain_mlx.py         # MLX training\n│   ├── pretokenize.py          # Dataset pre-tokenization\n│   ├── inference.py            # PyTorch inference\n│   └── inference_mlx.py        # MLX inference\n│\n├── tests/\n│   ├── test_memory.py\n│   ├── test_attention.py\n│   ├── test_models.py\n│   ├── test_persistent.py\n│   └── test_numerical_parity.py  # MLX vs PyTorch\n│\n├── examples/\n│   ├── basic_usage.py\n│   └── long_sequence.py\n│\n└── pyproject.toml\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRunning Tests\u003c/h3\u003e\u003ca id=\"user-content-running-tests\" class=\"anchor\" aria-label=\"Permalink: Running Tests\" href=\"#running-tests\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# All tests\nuv run pytest tests/ -v\n\n# Specific test file\nuv run pytest tests/test_numerical_parity.py -v\n\n# With coverage\nuv run pytest tests/ --cov=titans --cov=titans_mlx --cov-report=term-missing\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e All tests\u003c/span\u003e\nuv run pytest tests/ -v\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Specific test file\u003c/span\u003e\nuv run pytest tests/test_numerical_parity.py -v\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e With coverage\u003c/span\u003e\nuv run pytest tests/ --cov=titans --cov=titans_mlx --cov-report=term-missing\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eLinting\u003c/h3\u003e\u003ca id=\"user-content-linting\" class=\"anchor\" aria-label=\"Permalink: Linting\" href=\"#linting\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"uv run ruff check src/ tests/ scripts/\nuv run ruff format src/ tests/ scripts/\"\u003e\u003cpre\u003euv run ruff check src/ tests/ scripts/\nuv run ruff format src/ tests/ scripts/\u003c/pre\u003e\u003c/div\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCitation\u003c/h2\u003e\u003ca id=\"user-content-citation\" class=\"anchor\" aria-label=\"Permalink: Citation\" href=\"#citation\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-text-bibtex notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"@article{behrouz2024titans,\n  title={Titans: Learning to Memorize at Test Time},\n  author={Behrouz, Ali and Zhong, Peilin and Mirrokni, Vahab},\n  journal={arXiv preprint arXiv:2501.00663},\n  year={2024}\n}\n\n@article{dinepi2025titans,\n  title={Titans Revisited: A Lightweight Reimplementation and Critical Analysis of a Test-Time Memory Model},\n  author={Di Nepi, Gavriel and Siciliano, Federico and Silvestri, Fabrizio},\n  journal={arXiv preprint arXiv:2510.09551},\n  year={2025}\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003e@article\u003c/span\u003e{\u003cspan class=\"pl-en\"\u003ebehrouz2024titans\u003c/span\u003e,\n  \u003cspan class=\"pl-s\"\u003etitle\u003c/span\u003e=\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e{\u003c/span\u003eTitans: Learning to Memorize at Test Time\u003cspan class=\"pl-pds\"\u003e}\u003c/span\u003e\u003c/span\u003e,\n  \u003cspan class=\"pl-s\"\u003eauthor\u003c/span\u003e=\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e{\u003c/span\u003eBehrouz, Ali and Zhong, Peilin and Mirrokni, Vahab\u003cspan class=\"pl-pds\"\u003e}\u003c/span\u003e\u003c/span\u003e,\n  \u003cspan class=\"pl-s\"\u003ejournal\u003c/span\u003e=\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e{\u003c/span\u003earXiv preprint arXiv:2501.00663\u003cspan class=\"pl-pds\"\u003e}\u003c/span\u003e\u003c/span\u003e,\n  \u003cspan class=\"pl-s\"\u003eyear\u003c/span\u003e=\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e{\u003c/span\u003e2024\u003cspan class=\"pl-pds\"\u003e}\u003c/span\u003e\u003c/span\u003e\n}\n\n\u003cspan class=\"pl-k\"\u003e@article\u003c/span\u003e{\u003cspan class=\"pl-en\"\u003edinepi2025titans\u003c/span\u003e,\n  \u003cspan class=\"pl-s\"\u003etitle\u003c/span\u003e=\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e{\u003c/span\u003eTitans Revisited: A Lightweight Reimplementation and Critical Analysis of a Test-Time Memory Model\u003cspan class=\"pl-pds\"\u003e}\u003c/span\u003e\u003c/span\u003e,\n  \u003cspan class=\"pl-s\"\u003eauthor\u003c/span\u003e=\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e{\u003c/span\u003eDi Nepi, Gavriel and Siciliano, Federico and Silvestri, Fabrizio\u003cspan class=\"pl-pds\"\u003e}\u003c/span\u003e\u003c/span\u003e,\n  \u003cspan class=\"pl-s\"\u003ejournal\u003c/span\u003e=\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e{\u003c/span\u003earXiv preprint arXiv:2510.09551\u003cspan class=\"pl-pds\"\u003e}\u003c/span\u003e\u003c/span\u003e,\n  \u003cspan class=\"pl-s\"\u003eyear\u003c/span\u003e=\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e{\u003c/span\u003e2025\u003cspan class=\"pl-pds\"\u003e}\u003c/span\u003e\u003c/span\u003e\n}\u003c/pre\u003e\u003c/div\u003e\n\u003chr\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eLicense\u003c/h2\u003e\u003ca id=\"user-content-license\" class=\"anchor\" aria-label=\"Permalink: License\" href=\"#license\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eApache License 2.0\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eCopyright (c) 2026 Delanoe Pirard / Aedelon\u003c/p\u003e\n\u003c/article\u003e","richTextTruncated":false,"renderedFileInfo":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"Titans: Learning to Memorize at Test Time","fully_qualified_name":"Titans: Learning to Memorize at Test Time","kind":"section_1","ident_start":2,"ident_end":43,"extent_start":0,"extent_end":30285,"ident_utf16":{"start":{"line_number":0,"utf16_col":2},"end":{"line_number":0,"utf16_col":43}},"extent_utf16":{"start":{"line_number":0,"utf16_col":0},"end":{"line_number":1003,"utf16_col":0}}},{"name":"Table of Contents","fully_qualified_name":"Table of Contents","kind":"section_2","ident_start":1019,"ident_end":1036,"extent_start":1016,"extent_end":1870,"ident_utf16":{"start":{"line_number":18,"utf16_col":3},"end":{"line_number":18,"utf16_col":20}},"extent_utf16":{"start":{"line_number":18,"utf16_col":0},"end":{"line_number":45,"utf16_col":0}}},{"name":"Paper References","fully_qualified_name":"Paper References","kind":"section_2","ident_start":1873,"ident_end":1889,"extent_start":1870,"extent_end":2252,"ident_utf16":{"start":{"line_number":45,"utf16_col":3},"end":{"line_number":45,"utf16_col":19}},"extent_utf16":{"start":{"line_number":45,"utf16_col":0},"end":{"line_number":53,"utf16_col":0}}},{"name":"Features","fully_qualified_name":"Features","kind":"section_2","ident_start":2255,"ident_end":2263,"extent_start":2252,"extent_end":3293,"ident_utf16":{"start":{"line_number":53,"utf16_col":3},"end":{"line_number":53,"utf16_col":11}},"extent_utf16":{"start":{"line_number":53,"utf16_col":0},"end":{"line_number":91,"utf16_col":0}}},{"name":"Core Features","fully_qualified_name":"Core Features","kind":"section_3","ident_start":2269,"ident_end":2282,"extent_start":2265,"extent_end":2811,"ident_utf16":{"start":{"line_number":55,"utf16_col":4},"end":{"line_number":55,"utf16_col":17}},"extent_utf16":{"start":{"line_number":55,"utf16_col":0},"end":{"line_number":72,"utf16_col":0}}},{"name":"Backend-Specific Features","fully_qualified_name":"Backend-Specific Features","kind":"section_3","ident_start":2815,"ident_end":2840,"extent_start":2811,"extent_end":3113,"ident_utf16":{"start":{"line_number":72,"utf16_col":4},"end":{"line_number":72,"utf16_col":29}},"extent_utf16":{"start":{"line_number":72,"utf16_col":0},"end":{"line_number":83,"utf16_col":0}}},{"name":"Test Coverage","fully_qualified_name":"Test Coverage","kind":"section_3","ident_start":3117,"ident_end":3130,"extent_start":3113,"extent_end":3293,"ident_utf16":{"start":{"line_number":83,"utf16_col":4},"end":{"line_number":83,"utf16_col":17}},"extent_utf16":{"start":{"line_number":83,"utf16_col":0},"end":{"line_number":91,"utf16_col":0}}},{"name":"Architecture Overview","fully_qualified_name":"Architecture Overview","kind":"section_2","ident_start":3296,"ident_end":3317,"extent_start":3293,"extent_end":8598,"ident_utf16":{"start":{"line_number":91,"utf16_col":3},"end":{"line_number":91,"utf16_col":24}},"extent_utf16":{"start":{"line_number":91,"utf16_col":0},"end":{"line_number":219,"utf16_col":0}}},{"name":"Memory Perspective","fully_qualified_name":"Memory Perspective","kind":"section_3","ident_start":3572,"ident_end":3590,"extent_start":3568,"extent_end":4158,"ident_utf16":{"start":{"line_number":98,"utf16_col":4},"end":{"line_number":98,"utf16_col":22}},"extent_utf16":{"start":{"line_number":98,"utf16_col":0},"end":{"line_number":108,"utf16_col":0}}},{"name":"Architecture Variants","fully_qualified_name":"Architecture Variants","kind":"section_3","ident_start":4162,"ident_end":4183,"extent_start":4158,"extent_end":7299,"ident_utf16":{"start":{"line_number":108,"utf16_col":4},"end":{"line_number":108,"utf16_col":25}},"extent_utf16":{"start":{"line_number":108,"utf16_col":0},"end":{"line_number":178,"utf16_col":0}}},{"name":"Quick Comparison","fully_qualified_name":"Quick Comparison","kind":"section_4","ident_start":4190,"ident_end":4206,"extent_start":4185,"extent_end":4758,"ident_utf16":{"start":{"line_number":110,"utf16_col":5},"end":{"line_number":110,"utf16_col":21}},"extent_utf16":{"start":{"line_number":110,"utf16_col":0},"end":{"line_number":121,"utf16_col":0}}},{"name":"When to Use Each Variant","fully_qualified_name":"When to Use Each Variant","kind":"section_4","ident_start":4763,"ident_end":4787,"extent_start":4758,"extent_end":5446,"ident_utf16":{"start":{"line_number":121,"utf16_col":5},"end":{"line_number":121,"utf16_col":29}},"extent_utf16":{"start":{"line_number":121,"utf16_col":0},"end":{"line_number":133,"utf16_col":0}}},{"name":"MAC: Memory as Context (Section 4.1)","fully_qualified_name":"MAC: Memory as Context (Section 4.1)","kind":"section_4","ident_start":5451,"ident_end":5487,"extent_start":5446,"extent_end":6255,"ident_utf16":{"start":{"line_number":133,"utf16_col":5},"end":{"line_number":133,"utf16_col":41}},"extent_utf16":{"start":{"line_number":133,"utf16_col":0},"end":{"line_number":151,"utf16_col":0}}},{"name":"MAG: Memory as Gate (Section 4.2)","fully_qualified_name":"MAG: Memory as Gate (Section 4.2)","kind":"section_4","ident_start":6260,"ident_end":6293,"extent_start":6255,"extent_end":6899,"ident_utf16":{"start":{"line_number":151,"utf16_col":5},"end":{"line_number":151,"utf16_col":38}},"extent_utf16":{"start":{"line_number":151,"utf16_col":0},"end":{"line_number":167,"utf16_col":0}}},{"name":"MAL: Memory as Layer (Section 4.3)","fully_qualified_name":"MAL: Memory as Layer (Section 4.3)","kind":"section_4","ident_start":6904,"ident_end":6938,"extent_start":6899,"extent_end":7299,"ident_utf16":{"start":{"line_number":167,"utf16_col":5},"end":{"line_number":167,"utf16_col":39}},"extent_utf16":{"start":{"line_number":167,"utf16_col":0},"end":{"line_number":178,"utf16_col":0}}},{"name":"Neural Long-term Memory","fully_qualified_name":"Neural Long-term Memory","kind":"section_3","ident_start":7303,"ident_end":7326,"extent_start":7299,"extent_end":8598,"ident_utf16":{"start":{"line_number":178,"utf16_col":4},"end":{"line_number":178,"utf16_col":27}},"extent_utf16":{"start":{"line_number":178,"utf16_col":0},"end":{"line_number":219,"utf16_col":0}}},{"name":"Core Equations (Section 3.1)","fully_qualified_name":"Core Equations (Section 3.1)","kind":"section_4","ident_start":7649,"ident_end":7677,"extent_start":7644,"extent_end":8241,"ident_utf16":{"start":{"line_number":186,"utf16_col":5},"end":{"line_number":186,"utf16_col":33}},"extent_utf16":{"start":{"line_number":186,"utf16_col":0},"end":{"line_number":210,"utf16_col":0}}},{"name":"Key Innovations","fully_qualified_name":"Key Innovations","kind":"section_4","ident_start":8246,"ident_end":8261,"extent_start":8241,"extent_end":8598,"ident_utf16":{"start":{"line_number":210,"utf16_col":5},"end":{"line_number":210,"utf16_col":20}},"extent_utf16":{"start":{"line_number":210,"utf16_col":0},"end":{"line_number":219,"utf16_col":0}}},{"name":"Installation","fully_qualified_name":"Installation","kind":"section_2","ident_start":8601,"ident_end":8613,"extent_start":8598,"extent_end":9056,"ident_utf16":{"start":{"line_number":219,"utf16_col":3},"end":{"line_number":219,"utf16_col":15}},"extent_utf16":{"start":{"line_number":219,"utf16_col":0},"end":{"line_number":252,"utf16_col":0}}},{"name":"Basic Installation (PyTorch)","fully_qualified_name":"Basic Installation (PyTorch)","kind":"section_3","ident_start":8619,"ident_end":8647,"extent_start":8615,"extent_end":8771,"ident_utf16":{"start":{"line_number":221,"utf16_col":4},"end":{"line_number":221,"utf16_col":32}},"extent_utf16":{"start":{"line_number":221,"utf16_col":0},"end":{"line_number":229,"utf16_col":0}}},{"name":"With Training Dependencies","fully_qualified_name":"With Training Dependencies","kind":"section_3","ident_start":8775,"ident_end":8801,"extent_start":8771,"extent_end":8838,"ident_utf16":{"start":{"line_number":229,"utf16_col":4},"end":{"line_number":229,"utf16_col":30}},"extent_utf16":{"start":{"line_number":229,"utf16_col":0},"end":{"line_number":235,"utf16_col":0}}},{"name":"With All Extras (Development)","fully_qualified_name":"With All Extras (Development)","kind":"section_3","ident_start":8842,"ident_end":8871,"extent_start":8838,"extent_end":8907,"ident_utf16":{"start":{"line_number":235,"utf16_col":4},"end":{"line_number":235,"utf16_col":33}},"extent_utf16":{"start":{"line_number":235,"utf16_col":0},"end":{"line_number":241,"utf16_col":0}}},{"name":"MLX Requirements","fully_qualified_name":"MLX Requirements","kind":"section_3","ident_start":8911,"ident_end":8927,"extent_start":8907,"extent_end":9056,"ident_utf16":{"start":{"line_number":241,"utf16_col":4},"end":{"line_number":241,"utf16_col":20}},"extent_utf16":{"start":{"line_number":241,"utf16_col":0},"end":{"line_number":252,"utf16_col":0}}},{"name":"Quick Start","fully_qualified_name":"Quick Start","kind":"section_2","ident_start":9059,"ident_end":9070,"extent_start":9056,"extent_end":11170,"ident_utf16":{"start":{"line_number":252,"utf16_col":3},"end":{"line_number":252,"utf16_col":14}},"extent_utf16":{"start":{"line_number":252,"utf16_col":0},"end":{"line_number":345,"utf16_col":0}}},{"name":"PyTorch Quick Start","fully_qualified_name":"PyTorch Quick Start","kind":"section_3","ident_start":9076,"ident_end":9095,"extent_start":9072,"extent_end":9801,"ident_utf16":{"start":{"line_number":254,"utf16_col":4},"end":{"line_number":254,"utf16_col":23}},"extent_utf16":{"start":{"line_number":254,"utf16_col":0},"end":{"line_number":284,"utf16_col":0}}},{"name":"MLX Quick Start","fully_qualified_name":"MLX Quick Start","kind":"section_3","ident_start":9805,"ident_end":9820,"extent_start":9801,"extent_end":10546,"ident_utf16":{"start":{"line_number":284,"utf16_col":4},"end":{"line_number":284,"utf16_col":19}},"extent_utf16":{"start":{"line_number":284,"utf16_col":0},"end":{"line_number":316,"utf16_col":0}}},{"name":"Standalone Neural Memory","fully_qualified_name":"Standalone Neural Memory","kind":"section_3","ident_start":10550,"ident_end":10574,"extent_start":10546,"extent_end":11170,"ident_utf16":{"start":{"line_number":316,"utf16_col":4},"end":{"line_number":316,"utf16_col":28}},"extent_utf16":{"start":{"line_number":316,"utf16_col":0},"end":{"line_number":345,"utf16_col":0}}},{"name":"Pretraining","fully_qualified_name":"Pretraining","kind":"section_2","ident_start":11173,"ident_end":11184,"extent_start":11170,"extent_end":18278,"ident_utf16":{"start":{"line_number":345,"utf16_col":3},"end":{"line_number":345,"utf16_col":14}},"extent_utf16":{"start":{"line_number":345,"utf16_col":0},"end":{"line_number":550,"utf16_col":0}}},{"name":"PyTorch Pretraining","fully_qualified_name":"PyTorch Pretraining","kind":"section_3","ident_start":11190,"ident_end":11209,"extent_start":11186,"extent_end":15392,"ident_utf16":{"start":{"line_number":347,"utf16_col":4},"end":{"line_number":347,"utf16_col":23}},"extent_utf16":{"start":{"line_number":347,"utf16_col":0},"end":{"line_number":466,"utf16_col":0}}},{"name":"Option 1: HuggingFace Streaming (Simple, No Setup)","fully_qualified_name":"Option 1: HuggingFace Streaming (Simple, No Setup)","kind":"section_4","ident_start":11216,"ident_end":11266,"extent_start":11211,"extent_end":11962,"ident_utf16":{"start":{"line_number":349,"utf16_col":5},"end":{"line_number":349,"utf16_col":55}},"extent_utf16":{"start":{"line_number":349,"utf16_col":0},"end":{"line_number":372,"utf16_col":0}}},{"name":"Option 2: Pre-tokenized Local Dataset (Fastest)","fully_qualified_name":"Option 2: Pre-tokenized Local Dataset (Fastest)","kind":"section_4","ident_start":11967,"ident_end":12014,"extent_start":11962,"extent_end":12592,"ident_utf16":{"start":{"line_number":372,"utf16_col":5},"end":{"line_number":372,"utf16_col":52}},"extent_utf16":{"start":{"line_number":372,"utf16_col":0},"end":{"line_number":394,"utf16_col":0}}},{"name":"Other Options","fully_qualified_name":"Other Options","kind":"section_4","ident_start":12597,"ident_end":12610,"extent_start":12592,"extent_end":12973,"ident_utf16":{"start":{"line_number":394,"utf16_col":5},"end":{"line_number":394,"utf16_col":18}},"extent_utf16":{"start":{"line_number":394,"utf16_col":0},"end":{"line_number":410,"utf16_col":0}}},{"name":"PyTorch Training Options","fully_qualified_name":"PyTorch Training Options","kind":"section_4","ident_start":12978,"ident_end":13002,"extent_start":12973,"extent_end":14977,"ident_utf16":{"start":{"line_number":410,"utf16_col":5},"end":{"line_number":410,"utf16_col":29}},"extent_utf16":{"start":{"line_number":410,"utf16_col":0},"end":{"line_number":456,"utf16_col":0}}},{"name":"CUDA Optimizations","fully_qualified_name":"CUDA Optimizations","kind":"section_4","ident_start":14982,"ident_end":15000,"extent_start":14977,"extent_end":15392,"ident_utf16":{"start":{"line_number":456,"utf16_col":5},"end":{"line_number":456,"utf16_col":23}},"extent_utf16":{"start":{"line_number":456,"utf16_col":0},"end":{"line_number":466,"utf16_col":0}}},{"name":"Distributed Training (Multi-GPU)","fully_qualified_name":"Distributed Training (Multi-GPU)","kind":"section_3","ident_start":15396,"ident_end":15428,"extent_start":15392,"extent_end":15771,"ident_utf16":{"start":{"line_number":466,"utf16_col":4},"end":{"line_number":466,"utf16_col":36}},"extent_utf16":{"start":{"line_number":466,"utf16_col":0},"end":{"line_number":479,"utf16_col":0}}},{"name":"MLX Pretraining","fully_qualified_name":"MLX Pretraining","kind":"section_3","ident_start":15775,"ident_end":15790,"extent_start":15771,"extent_end":18278,"ident_utf16":{"start":{"line_number":479,"utf16_col":4},"end":{"line_number":479,"utf16_col":19}},"extent_utf16":{"start":{"line_number":479,"utf16_col":0},"end":{"line_number":550,"utf16_col":0}}},{"name":"MLX Training Options","fully_qualified_name":"MLX Training Options","kind":"section_4","ident_start":16619,"ident_end":16639,"extent_start":16614,"extent_end":18278,"ident_utf16":{"start":{"line_number":508,"utf16_col":5},"end":{"line_number":508,"utf16_col":25}},"extent_utf16":{"start":{"line_number":508,"utf16_col":0},"end":{"line_number":550,"utf16_col":0}}},{"name":"Inference","fully_qualified_name":"Inference","kind":"section_2","ident_start":18281,"ident_end":18290,"extent_start":18278,"extent_end":20926,"ident_utf16":{"start":{"line_number":550,"utf16_col":3},"end":{"line_number":550,"utf16_col":12}},"extent_utf16":{"start":{"line_number":550,"utf16_col":0},"end":{"line_number":639,"utf16_col":0}}},{"name":"PyTorch Inference","fully_qualified_name":"PyTorch Inference","kind":"section_3","ident_start":18296,"ident_end":18313,"extent_start":18292,"extent_end":19675,"ident_utf16":{"start":{"line_number":552,"utf16_col":4},"end":{"line_number":552,"utf16_col":21}},"extent_utf16":{"start":{"line_number":552,"utf16_col":0},"end":{"line_number":598,"utf16_col":0}}},{"name":"PyTorch Inference Options","fully_qualified_name":"PyTorch Inference Options","kind":"section_4","ident_start":18965,"ident_end":18990,"extent_start":18960,"extent_end":19675,"ident_utf16":{"start":{"line_number":581,"utf16_col":5},"end":{"line_number":581,"utf16_col":30}},"extent_utf16":{"start":{"line_number":581,"utf16_col":0},"end":{"line_number":598,"utf16_col":0}}},{"name":"MLX Inference","fully_qualified_name":"MLX Inference","kind":"section_3","ident_start":19679,"ident_end":19692,"extent_start":19675,"extent_end":20926,"ident_utf16":{"start":{"line_number":598,"utf16_col":4},"end":{"line_number":598,"utf16_col":17}},"extent_utf16":{"start":{"line_number":598,"utf16_col":0},"end":{"line_number":639,"utf16_col":0}}},{"name":"MLX Inference Options","fully_qualified_name":"MLX Inference Options","kind":"section_4","ident_start":20211,"ident_end":20232,"extent_start":20206,"extent_end":20926,"ident_utf16":{"start":{"line_number":620,"utf16_col":5},"end":{"line_number":620,"utf16_col":26}},"extent_utf16":{"start":{"line_number":620,"utf16_col":0},"end":{"line_number":639,"utf16_col":0}}},{"name":"Benchmarks","fully_qualified_name":"Benchmarks","kind":"section_2","ident_start":20929,"ident_end":20939,"extent_start":20926,"extent_end":22109,"ident_utf16":{"start":{"line_number":639,"utf16_col":3},"end":{"line_number":639,"utf16_col":13}},"extent_utf16":{"start":{"line_number":639,"utf16_col":0},"end":{"line_number":687,"utf16_col":0}}},{"name":"Model Quality (from Paper Table 1 \u0026 5)","fully_qualified_name":"Model Quality (from Paper Table 1 \u0026 5)","kind":"section_3","ident_start":20945,"ident_end":20983,"extent_start":20941,"extent_end":21381,"ident_utf16":{"start":{"line_number":641,"utf16_col":4},"end":{"line_number":641,"utf16_col":42}},"extent_utf16":{"start":{"line_number":641,"utf16_col":0},"end":{"line_number":661,"utf16_col":0}}},{"name":"Inference Speed (Apple M4 Pro)","fully_qualified_name":"Inference Speed (Apple M4 Pro)","kind":"section_3","ident_start":21385,"ident_end":21415,"extent_start":21381,"extent_end":21897,"ident_utf16":{"start":{"line_number":661,"utf16_col":4},"end":{"line_number":661,"utf16_col":34}},"extent_utf16":{"start":{"line_number":661,"utf16_col":0},"end":{"line_number":674,"utf16_col":0}}},{"name":"Numerical Parity","fully_qualified_name":"Numerical Parity","kind":"section_3","ident_start":21901,"ident_end":21917,"extent_start":21897,"extent_end":22109,"ident_utf16":{"start":{"line_number":674,"utf16_col":4},"end":{"line_number":674,"utf16_col":20}},"extent_utf16":{"start":{"line_number":674,"utf16_col":0},"end":{"line_number":687,"utf16_col":0}}},{"name":"Configuration Reference","fully_qualified_name":"Configuration Reference","kind":"section_2","ident_start":22112,"ident_end":22135,"extent_start":22109,"extent_end":23590,"ident_utf16":{"start":{"line_number":687,"utf16_col":3},"end":{"line_number":687,"utf16_col":26}},"extent_utf16":{"start":{"line_number":687,"utf16_col":0},"end":{"line_number":721,"utf16_col":0}}},{"name":"TitansConfig Parameters","fully_qualified_name":"TitansConfig Parameters","kind":"section_3","ident_start":22141,"ident_end":22164,"extent_start":22137,"extent_end":23590,"ident_utf16":{"start":{"line_number":689,"utf16_col":4},"end":{"line_number":689,"utf16_col":27}},"extent_utf16":{"start":{"line_number":689,"utf16_col":0},"end":{"line_number":721,"utf16_col":0}}},{"name":"API Reference","fully_qualified_name":"API Reference","kind":"section_2","ident_start":23593,"ident_end":23606,"extent_start":23590,"extent_end":24839,"ident_utf16":{"start":{"line_number":721,"utf16_col":3},"end":{"line_number":721,"utf16_col":16}},"extent_utf16":{"start":{"line_number":721,"utf16_col":0},"end":{"line_number":791,"utf16_col":0}}},{"name":"PyTorch API","fully_qualified_name":"PyTorch API","kind":"section_3","ident_start":23612,"ident_end":23623,"extent_start":23608,"extent_end":24317,"ident_utf16":{"start":{"line_number":723,"utf16_col":4},"end":{"line_number":723,"utf16_col":15}},"extent_utf16":{"start":{"line_number":723,"utf16_col":0},"end":{"line_number":757,"utf16_col":0}}},{"name":"MLX API","fully_qualified_name":"MLX API","kind":"section_3","ident_start":24321,"ident_end":24328,"extent_start":24317,"extent_end":24839,"ident_utf16":{"start":{"line_number":757,"utf16_col":4},"end":{"line_number":757,"utf16_col":11}},"extent_utf16":{"start":{"line_number":757,"utf16_col":0},"end":{"line_number":791,"utf16_col":0}}},{"name":"MLX Optimizations","fully_qualified_name":"MLX Optimizations","kind":"section_2","ident_start":24842,"ident_end":24859,"extent_start":24839,"extent_end":26693,"ident_utf16":{"start":{"line_number":791,"utf16_col":3},"end":{"line_number":791,"utf16_col":20}},"extent_utf16":{"start":{"line_number":791,"utf16_col":0},"end":{"line_number":857,"utf16_col":0}}},{"name":"Gradient Computation","fully_qualified_name":"Gradient Computation","kind":"section_3","ident_start":24865,"ident_end":24885,"extent_start":24861,"extent_end":25369,"ident_utf16":{"start":{"line_number":793,"utf16_col":4},"end":{"line_number":793,"utf16_col":24}},"extent_utf16":{"start":{"line_number":793,"utf16_col":0},"end":{"line_number":809,"utf16_col":0}}},{"name":"Why Not mx.compile?","fully_qualified_name":"Why Not mx.compile?","kind":"section_3","ident_start":25373,"ident_end":25392,"extent_start":25369,"extent_end":25681,"ident_utf16":{"start":{"line_number":809,"utf16_col":4},"end":{"line_number":809,"utf16_col":23}},"extent_utf16":{"start":{"line_number":809,"utf16_col":0},"end":{"line_number":819,"utf16_col":0}}},{"name":"Metal Kernels","fully_qualified_name":"Metal Kernels","kind":"section_3","ident_start":25685,"ident_end":25698,"extent_start":25681,"extent_end":26101,"ident_utf16":{"start":{"line_number":819,"utf16_col":4},"end":{"line_number":819,"utf16_col":17}},"extent_utf16":{"start":{"line_number":819,"utf16_col":0},"end":{"line_number":831,"utf16_col":0}}},{"name":"Recommended Practices","fully_qualified_name":"Recommended Practices","kind":"section_3","ident_start":26105,"ident_end":26126,"extent_start":26101,"extent_end":26693,"ident_utf16":{"start":{"line_number":831,"utf16_col":4},"end":{"line_number":831,"utf16_col":25}},"extent_utf16":{"start":{"line_number":831,"utf16_col":0},"end":{"line_number":857,"utf16_col":0}}},{"name":"Troubleshooting","fully_qualified_name":"Troubleshooting","kind":"section_2","ident_start":26696,"ident_end":26711,"extent_start":26693,"extent_end":27688,"ident_utf16":{"start":{"line_number":857,"utf16_col":3},"end":{"line_number":857,"utf16_col":18}},"extent_utf16":{"start":{"line_number":857,"utf16_col":0},"end":{"line_number":908,"utf16_col":0}}},{"name":"Common Issues","fully_qualified_name":"Common Issues","kind":"section_3","ident_start":26717,"ident_end":26730,"extent_start":26713,"extent_end":27417,"ident_utf16":{"start":{"line_number":859,"utf16_col":4},"end":{"line_number":859,"utf16_col":17}},"extent_utf16":{"start":{"line_number":859,"utf16_col":0},"end":{"line_number":897,"utf16_col":0}}},{"name":"PyTorch","fully_qualified_name":"PyTorch","kind":"section_4","ident_start":26737,"ident_end":26744,"extent_start":26732,"extent_end":27022,"ident_utf16":{"start":{"line_number":861,"utf16_col":5},"end":{"line_number":861,"utf16_col":12}},"extent_utf16":{"start":{"line_number":861,"utf16_col":0},"end":{"line_number":875,"utf16_col":0}}},{"name":"MLX","fully_qualified_name":"MLX","kind":"section_4","ident_start":27027,"ident_end":27030,"extent_start":27022,"extent_end":27417,"ident_utf16":{"start":{"line_number":875,"utf16_col":5},"end":{"line_number":875,"utf16_col":8}},"extent_utf16":{"start":{"line_number":875,"utf16_col":0},"end":{"line_number":897,"utf16_col":0}}},{"name":"Numerical Differences","fully_qualified_name":"Numerical Differences","kind":"section_3","ident_start":27421,"ident_end":27442,"extent_start":27417,"extent_end":27688,"ident_utf16":{"start":{"line_number":897,"utf16_col":4},"end":{"line_number":897,"utf16_col":25}},"extent_utf16":{"start":{"line_number":897,"utf16_col":0},"end":{"line_number":908,"utf16_col":0}}},{"name":"Development","fully_qualified_name":"Development","kind":"section_2","ident_start":27691,"ident_end":27702,"extent_start":27688,"extent_end":29695,"ident_utf16":{"start":{"line_number":908,"utf16_col":3},"end":{"line_number":908,"utf16_col":14}},"extent_utf16":{"start":{"line_number":908,"utf16_col":0},"end":{"line_number":978,"utf16_col":0}}},{"name":"Project Structure","fully_qualified_name":"Project Structure","kind":"section_3","ident_start":27708,"ident_end":27725,"extent_start":27704,"extent_end":29353,"ident_utf16":{"start":{"line_number":910,"utf16_col":4},"end":{"line_number":910,"utf16_col":21}},"extent_utf16":{"start":{"line_number":910,"utf16_col":0},"end":{"line_number":956,"utf16_col":0}}},{"name":"Running Tests","fully_qualified_name":"Running Tests","kind":"section_3","ident_start":29357,"ident_end":29370,"extent_start":29353,"extent_end":29585,"ident_utf16":{"start":{"line_number":956,"utf16_col":4},"end":{"line_number":956,"utf16_col":17}},"extent_utf16":{"start":{"line_number":956,"utf16_col":0},"end":{"line_number":969,"utf16_col":0}}},{"name":"Linting","fully_qualified_name":"Linting","kind":"section_3","ident_start":29589,"ident_end":29596,"extent_start":29585,"extent_end":29695,"ident_utf16":{"start":{"line_number":969,"utf16_col":4},"end":{"line_number":969,"utf16_col":11}},"extent_utf16":{"start":{"line_number":969,"utf16_col":0},"end":{"line_number":978,"utf16_col":0}}},{"name":"Citation","fully_qualified_name":"Citation","kind":"section_2","ident_start":29698,"ident_end":29706,"extent_start":29695,"extent_end":30209,"ident_utf16":{"start":{"line_number":978,"utf16_col":3},"end":{"line_number":978,"utf16_col":11}},"extent_utf16":{"start":{"line_number":978,"utf16_col":0},"end":{"line_number":998,"utf16_col":0}}},{"name":"License","fully_qualified_name":"License","kind":"section_2","ident_start":30212,"ident_end":30219,"extent_start":30209,"extent_end":30285,"ident_utf16":{"start":{"line_number":998,"utf16_col":3},"end":{"line_number":998,"utf16_col":10}},"extent_utf16":{"start":{"line_number":998,"utf16_col":0},"end":{"line_number":1003,"utf16_col":0}}}]}},"codeViewLayoutRoute":{"repo":{"id":1135231308,"defaultBranch":"main","name":"titans-pytorch-mlx","ownerLogin":"Aedelon","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2026-01-15T20:23:39.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/1285286?v=4","public":true,"private":false,"isOrgOwned":false,"isArchived":false},"currentUser":null,"uploadToken":"g-icrw8qSyET5AqVSRItVeaYHzahRrFuhIYhIeB6UiLzSBFPp4gvmb83pI50yokvaYDxrfRZvcRN-ei2PrHPIQ","allShortcutsEnabled":false,"treeExpanded":true,"path":"README.md","symbolsExpanded":false,"refInfo":{"name":"main","listCacheKey":"v0:1768508622.0","canEdit":false,"currentOid":"0dc7a4d2829df55d221f67bf56c0603e9ac7c6f4"},"helpUrl":"https://docs.github.com","githubDevUrl":null},"codeViewFileTreeLayoutRoute":{"fileTree":{"":{"items":[{"name":"assets","path":"assets","contentType":"directory"},{"name":"examples","path":"examples","contentType":"directory"},{"name":"scripts","path":"scripts","contentType":"directory"},{"name":"src","path":"src","contentType":"directory"},{"name":"tests","path":"tests","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"pyproject.toml","path":"pyproject.toml","contentType":"file"},{"name":"uv.lock","path":"uv.lock","contentType":"file"}],"totalCount":10}},"fileTreeProcessingTime":42.689509,"foldersToFetch":[]},"codeViewBlobLayoutRoute":{"codeLineWrapEnabled":false,"refInfo":{"name":"main","listCacheKey":"v0:1768508622.0","canEdit":false,"refType":"branch","currentOid":"0dc7a4d2829df55d221f67bf56c0603e9ac7c6f4","canEditOnDefaultBranch":false,"fileExistsOnDefault":true},"path":"README.md","blob":{"copilotSWEAgentEnabled":false,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/Aedelon/titans-pytorch-mlx/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"README.md","displayUrl":"https://github.com/Aedelon/titans-pytorch-mlx/blob/main/README.md?raw=true","headerInfo":{"blobSize":"29.6 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"601c516","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2FAedelon%2Ftitans-pytorch-mlx%2Fblob%2Fmain%2FREADME.md","isCSV":false,"isRichtext":true,"lineInfo":{"truncatedLoc":"1003","truncatedSloc":"790"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"isIssueTemplate":false,"isDiscussionTemplate":false,"language":"Markdown","languageID":222,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/Aedelon/titans-pytorch-mlx/blob/main/README.md","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/Aedelon/titans-pytorch-mlx/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/Aedelon/titans-pytorch-mlx/raw/refs/heads/main/README.md","renderImageOrRaw":false,"shortPath":null,"symbolsEnabled":true,"tabSize":4,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null},"copilotInfo":null,"copilotAccessAllowed":false,"copilotSpacesEnabled":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"isMarketplaceEnabled":true},"codeViewBlobLayoutRoute.StyledBlob":{"rawLines":["# Titans: Learning to Memorize at Test Time","","\u003cp align=\"center\"\u003e","\u003cimg src=\"assets/hero.png\" alt=\"Titans Hero\" width=\"100%\"/\u003e","\u003c/p\u003e","","[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)","[![PyTorch 2.0+](https://img.shields.io/badge/pytorch-2.0+-ee4c2c.svg)](https://pytorch.org/)","[![MLX](https://img.shields.io/badge/mlx-apple%20silicon-black.svg)](https://ml-explore.github.io/mlx/)","[![License](https://img.shields.io/badge/license-Apache%202.0-green.svg)](LICENSE)","[![Tests](https://img.shields.io/badge/tests-105%20passed-brightgreen.svg)](tests/)","","A complete **PyTorch** and **MLX** (Apple Silicon) implementation of the Titans architecture from Google Research.","","Titans introduce a **Neural Long-term Memory (LMM)** module that learns to memorize historical context at test time using gradient descent with momentum and weight decay. This enables attention mechanisms to focus on local context while utilizing long-range information through neural memory.","","---","","## Table of Contents","","- [Paper References](#paper-references)","- [Features](#features)","- [Architecture Overview](#architecture-overview)","  - [Memory Perspective](#memory-perspective)","  - [Architecture Variants](#architecture-variants)","  - [Neural Long-term Memory](#neural-long-term-memory)","- [Installation](#installation)","- [Quick Start](#quick-start)","  - [PyTorch](#pytorch-quick-start)","  - [MLX (Apple Silicon)](#mlx-quick-start)","- [Pretraining](#pretraining)","  - [PyTorch Pretraining](#pytorch-pretraining)","  - [MLX Pretraining](#mlx-pretraining)","- [Inference](#inference)","- [Benchmarks](#benchmarks)","- [Configuration Reference](#configuration-reference)","- [API Reference](#api-reference)","- [MLX Optimizations](#mlx-optimizations)","- [Troubleshooting](#troubleshooting)","- [Development](#development)","- [Citation](#citation)","- [License](#license)","","---","","## Paper References","","\u003e **Original Paper**: Behrouz, A., Zhong, P., \u0026 Mirrokni, V. (2024). *Titans: Learning to Memorize at Test Time*. arXiv preprint arXiv:2501.00663","","\u003e **Analysis Paper**: Di Nepi, G., Siciliano, F., \u0026 Silvestri, F. (2025). *Titans Revisited: A Lightweight Reimplementation and Critical Analysis of a Test-Time Memory Model*. arXiv preprint arXiv:2510.09551","","---","","## Features","","### Core Features","","| Feature | PyTorch | MLX |","|---------|---------|-----|","| MAC (Memory as Context) | ✅ | ✅ |","| MAG (Memory as Gate) | ✅ | ✅ |","| MAL (Memory as Layer) | ✅ | ✅ |","| LMM (Memory Only) | ✅ | ✅ |","| Deep Memory (L_M \u003e= 1) | ✅ | ✅ |","| Data-dependent Gating | ✅ | ✅ |","| RoPE (Rotary Embeddings) | ✅ | ✅ |","| 1D Depthwise Convolution | ✅ | ✅ |","| Mixed Precision Training | ✅ bf16/fp16 | ✅ fp16/bf16 |","| Gradient Accumulation | ✅ | ✅ |","| Streaming Datasets | ✅ | ✅ |","| W\u0026B Logging | ✅ | ✅ |","","### Backend-Specific Features","","| Feature | PyTorch | MLX |","|---------|---------|-----|","| Flash Attention 2 | ✅ (CUDA) | N/A |","| Triton Kernels | ✅ (CUDA) | N/A |","| Metal Kernels | N/A | ✅ |","| MPS Backend | ✅ | N/A |","| Unified Memory | N/A | ✅ |","| Numerical Parity | Reference | ✅ \u003c 1e-4 |","","### Test Coverage","","- **105 unit tests** covering all modules","- **Numerical parity tests** ensuring MLX matches PyTorch outputs","- **Integration tests** for all model variants","","---","","## Architecture Overview","","\u003cp align=\"center\"\u003e","\u003cimg src=\"assets/figures/fig1_memory_training.png\" alt=\"Neural Memory Training\" width=\"600\"/\u003e","\u003c/p\u003e","\u003cp align=\"center\"\u003e\u003cem\u003eFigure 1: Neural memory training with efficient parallelization via matmul operations (from paper)\u003c/em\u003e\u003c/p\u003e","","### Memory Perspective","","Titans are designed around a **memory perspective** inspired by human cognition (Section 1 of paper):","","| Memory Type | Module | Behavior at Test Time | Characteristics |","|-------------|--------|----------------------|-----------------|","| **Short-term** | Attention (limited window) | In-context learning (fixed weights) | Precise, limited capacity |","| **Long-term** | Neural Memory (LMM) | **Still learning** (weight updates via gradient descent) | Fading, unlimited capacity |","| **Persistent** | Learnable tokens | Fixed (task knowledge) | Stable, task-specific |","","### Architecture Variants","","#### Quick Comparison","","| Aspect | MAC | MAG | MAL | LMM |","|--------|-----|-----|-----|-----|","| **Architecture** | Memory → Attention → Memory | Attention ⊗ Memory | Memory → Attention | Memory only |","| **Attention Type** | Segmented (full causal per chunk) | Sliding Window | Sliding Window | None |","| **Memory-Attention** | Bidirectional | Parallel (gating) | Sequential | N/A |","| **Chunking Required** | Yes | No | No | No |","| **Long-context** | ⭐⭐⭐ Best | ⭐⭐ Good | ⭐ Baseline | ⭐⭐ Good |","| **Training Speed** | Medium | Fast | Fastest | Fast |","","#### When to Use Each Variant","","| Use Case | Recommended | Why |","|----------|-------------|-----|","| Needle-in-haystack retrieval | **MAC** | Attention decides when to query long-term memory |","| Long document QA (\u003e100K tokens) | **MAC** | Best BABILong benchmark results (97.95%) |","| Language modeling (perplexity) | **MAG** | Slightly better perplexity than MAC |","| Real-time / streaming inference | **MAG** | No chunking, constant memory footprint |","| Maximum training throughput | **MAL** | Leverages FlashAttention optimizations |","| Existing hybrid model replacement | **MAL** | Same architecture as Griffin/Samba |","| Pure sequence modeling | **LMM** | Tests memory capability alone |","","#### MAC: Memory as Context (Section 4.1)","","\u003cp align=\"center\"\u003e","\u003cimg src=\"assets/figures/fig2_mac.png\" alt=\"MAC Architecture\" width=\"700\"/\u003e","\u003c/p\u003e","\u003cp align=\"center\"\u003e\u003cem\u003eFigure 2: MAC (Memory as Context) - Bidirectional interaction between memory and attention\u003c/em\u003e\u003c/p\u003e","","```","h_t = M*_{t-1}(q_t)                              # Eq. 21: Retrieve from memory","S̃^(t) = [persistent] || h_t || x                # Eq. 22: Concatenate","y_t = Attn(S̃^(t))                               # Eq. 23: Segmented attention","M_t = M_{t-1}(y_t)                               # Eq. 24: Update memory","o_t = y_t ⊗ M*_t(y_t)                            # Eq. 25: Output gating","```","","**Advantages**: Best long-context performance, bidirectional memory-attention interaction","**Disadvantages**: Requires chunking, slightly slower training","","#### MAG: Memory as Gate (Section 4.2)","","\u003cp align=\"center\"\u003e","\u003cimg src=\"assets/figures/fig4_mag_mal.png\" alt=\"MAG and MAL Architecture\" width=\"700\"/\u003e","\u003c/p\u003e","\u003cp align=\"center\"\u003e\u003cem\u003eFigure 4-5: MAG (Memory as Gate) and MAL (Memory as Layer) architectures\u003c/em\u003e\u003c/p\u003e","","```","x̃ = [persistent] || x                           # Eq. 26: Add persistent tokens","y = SW-Attn*(x̃)                                  # Eq. 27: Sliding window attention","o = y ⊗ M(x̃)                                     # Eq. 28: Element-wise gating","```","","**Advantages**: No chunking, best perplexity, good balance","**Disadvantages**: Memory and attention don't directly communicate","","#### MAL: Memory as Layer (Section 4.3)","","```","x̃ = [persistent] || x                           # Eq. 29: Add persistent tokens","y = M(x̃)                                         # Eq. 30: Memory layer","o = SW-Attn(y)                                   # Eq. 31: Attention on memory output","```","","**Advantages**: Fastest training, simplest architecture","**Disadvantages**: Weaker long-context performance","","### Neural Long-term Memory","","\u003cp align=\"center\"\u003e","\u003cimg src=\"assets/figures/fig3a_lstm_forget.png\" alt=\"LSTM-inspired Gating\" width=\"400\"/\u003e","\u003cimg src=\"assets/figures/fig3b_lstm_update.png\" alt=\"Memory Update\" width=\"400\"/\u003e","\u003c/p\u003e","\u003cp align=\"center\"\u003e\u003cem\u003eFigure 3: LSTM-inspired gating mechanism for memory forgetting (left) and update (right)\u003c/em\u003e\u003c/p\u003e","","#### Core Equations (Section 3.1)","","**Associative Memory Loss** (Eq. 12):","```","ℓ(M; x_t) = ||M(k_t) - v_t||²","```","","**Memory Update with Forgetting** (Eq. 13):","```","M_t = (1 - α_t) · M_{t-1} + S_t","```","","**Surprise with Momentum** (Eq. 14):","```","S_t = η_t · S_{t-1} - θ_t · ∇ℓ(M_{t-1}; x_t)","      \\_________/   \\____________________/","      Past Surprise   Momentary Surprise","```","","Where:","- `α_t` ∈ [0,1]: Forgetting/decay factor (data-dependent)","- `η_t` ∈ [0,1): Surprise decay / momentum coefficient (data-dependent)","- `θ_t` \u003e 0: Learning rate for momentary surprise (data-dependent)","","#### Key Innovations","","1. **Momentum-based surprise**: Unlike DeltaNet/TTT which use momentary surprise only","2. **Forgetting mechanism**: Weight decay for memory management on long sequences","3. **Deep memory**: MLP with L_M \u003e= 2 layers for more expressive power","4. **Data-dependent gates**: α, η, θ are functions of input, not fixed hyperparameters","","---","","## Installation","","### Basic Installation (PyTorch)","","```bash","git clone https://github.com/yourusername/Google-Titans-replication.git","cd Google-Titans-replication","uv sync","```","","### With Training Dependencies","","```bash","uv sync --extra train","```","","### With All Extras (Development)","","```bash","uv sync --all-extras","```","","### MLX Requirements","","MLX requires macOS 13.5+ and Apple Silicon (M1/M2/M3/M4):","","```bash","# MLX is included in default dependencies","uv sync","```","","---","","## Quick Start","","### PyTorch Quick Start","","```python","import torch","from titans import TitansConfig, TitansMAC, TitansMAG, TitansMAL","","# Configuration","config = TitansConfig(","    dim=512,","    num_heads=8,","    num_layers=6,","    vocab_size=32000,","    chunk_size=512,           # For MAC","    window_size=512,          # For MAG/MAL","    num_persistent_tokens=16,","    num_memory_layers=2,      # Deep memory",")","","# Create model","model = TitansMAC(config)  # or TitansMAG, TitansMAL","","# Forward pass","input_ids = torch.randint(0, config.vocab_size, (2, 1024))","logits, states = model(input_ids)","","# Continue with states for next segment","input_ids_next = torch.randint(0, config.vocab_size, (2, 512))","logits_next, states = model(input_ids_next, states=states)","```","","### MLX Quick Start","","```python","import mlx.core as mx","from titans_mlx import TitansConfig, TitansMAC, TitansMAG, TitansMAL","","# Configuration (same as PyTorch)","config = TitansConfig(","    dim=512,","    num_heads=8,","    num_layers=6,","    vocab_size=32000,","    chunk_size=512,","    window_size=512,","    num_persistent_tokens=16,","    num_memory_layers=2,",")","","# Create model","model = TitansMAC(config)","mx.eval(model.parameters())  # Evaluate parameters","","# Forward pass","input_ids = mx.random.randint(0, config.vocab_size, (2, 1024))","logits, states = model(input_ids)","mx.eval(logits)  # Force evaluation","","# Continue with states","input_ids_next = mx.random.randint(0, config.vocab_size, (2, 512))","logits_next, states = model(input_ids_next, states=states)","```","","### Standalone Neural Memory","","```python","# PyTorch","from titans import TitansConfig, NeuralLongTermMemory","import torch","","config = TitansConfig(dim=512, num_memory_layers=2)","memory = NeuralLongTermMemory(config)","","x = torch.randn(2, 100, 512)","output, state = memory(x)","output2, state2 = memory(x, state=state)  # Continue with state","","# MLX","from titans_mlx import TitansConfig, NeuralLongTermMemory","import mlx.core as mx","","config = TitansConfig(dim=512, num_memory_layers=2)","memory = NeuralLongTermMemory(config)","mx.eval(memory.parameters())","","x = mx.random.normal((2, 100, 512))","output, state = memory(x)","mx.eval(output)","```","","---","","## Pretraining","","### PyTorch Pretraining","","#### Option 1: HuggingFace Streaming (Simple, No Setup)","","Stream directly from HuggingFace - tokenization happens on-the-fly:","","```bash","# Train with FineWeb-Edu streaming","uv run python scripts/pretrain.py --model mac \\","    --dataset HuggingFaceFW/fineweb-edu \\","    --dataset-subset sample-10BT \\","    --tokenizer NousResearch/Llama-2-7b-hf \\","    --dim 512 --num-layers 12 \\","    --mixed-precision bf16","","# Full training (340M params)","uv run python scripts/pretrain.py --model mac \\","    --dataset HuggingFaceFW/fineweb-edu \\","    --dataset-subset sample-10BT \\","    --tokenizer NousResearch/Llama-2-7b-hf \\","    --dim 1024 --num-layers 24 --num-heads 16 \\","    --batch-size 8 --gradient-accumulation-steps 32 \\","    --lr 4e-4 --mixed-precision bf16 --wandb","```","","#### Option 2: Pre-tokenized Local Dataset (Fastest)","","Pre-tokenize once, then train without tokenization overhead:","","```bash","# Step 1: Pre-tokenize (one time)","uv run python scripts/pretokenize.py \\","    --dataset HuggingFaceFW/fineweb-edu \\","    --subset sample-10BT \\","    --tokenizer NousResearch/Llama-2-7b-hf \\","    --output data/fineweb-tokenized \\","    --seq-len 4096 \\","    --num-proc 8","","# Step 2: Train with pre-tokenized data","uv run python scripts/pretrain.py --model mac \\","    --local-dataset data/fineweb-tokenized \\","    --tokenizer NousResearch/Llama-2-7b-hf \\","    --dim 512 --num-layers 12 \\","    --mixed-precision bf16","```","","#### Other Options","","```bash","# Demo with synthetic data (quick test)","uv run python scripts/pretrain.py --model mac --dim 256 --epochs 10","","# Train with local text file","uv run python scripts/pretrain.py --model mag \\","    --data path/to/corpus.txt \\","    --tokenizer gpt2","","# Resume from checkpoint","uv run python scripts/pretrain.py --model mac \\","    --resume checkpoints/latest.pt","```","","#### PyTorch Training Options","","| Option | Default | Description |","|--------|---------|-------------|","| **Model Architecture** |","| `--model` | `mac` | Model variant: mac, mag, mal, lmm |","| `--dim` | `512` | Model dimension |","| `--num-heads` | `8` | Attention heads |","| `--num-layers` | `12` | Number of layers |","| `--vocab-size` | `32000` | Vocabulary size |","| `--chunk-size` | `512` | Chunk size for MAC |","| `--window-size` | `512` | Window size for MAG/MAL |","| **Data** |","| `--dataset` | - | HuggingFace dataset name (streaming) |","| `--dataset-subset` | - | Dataset subset (e.g., sample-10BT) |","| `--local-dataset` | - | Pre-tokenized local dataset (Arrow format) |","| `--data` | - | Local text file path |","| `--tokenizer` | `gpt2` | HuggingFace tokenizer |","| `--seq-len` | `4096` | Sequence length |","| **Training** |","| `--epochs` | `1` | Number of epochs |","| `--max-steps` | `-1` | Max steps (-1 = use epochs) |","| `--batch-size` | `4` | Per-device batch size |","| `--gradient-accumulation-steps` | `32` | Gradient accumulation steps |","| `--lr` | `4e-4` | Learning rate |","| `--weight-decay` | `0.1` | Weight decay |","| `--grad-clip` | `1.0` | Gradient clipping |","| `--warmup-ratio` | `0.03` | Warmup ratio |","| `--mixed-precision` | `bf16` | none, fp16, bf16 |","| **Optimization** |","| `--torch-compile` | `False` | Enable torch.compile (PyTorch 2.0+) |","| `--compile-mode` | `default` | default, reduce-overhead, max-autotune |","| `--gradient-checkpointing` | `False` | Enable gradient checkpointing |","| `--num-workers` | `4` | DataLoader workers |","| **Checkpointing** |","| `--checkpoint-dir` | `checkpoints/` | Checkpoint directory |","| `--save-every` | `1000` | Save every N steps |","| `--eval-every` | `500` | Eval every N steps |","| `--resume` | - | Resume from checkpoint |","| **Logging** |","| `--log-every` | `10` | Log every N steps |","| `--wandb` | `False` | Enable W\u0026B logging |","| `--wandb-project` | `titans` | W\u0026B project name |","| `--wandb-run-name` | - | W\u0026B run name |","| `--seed` | `42` | Random seed |","","#### CUDA Optimizations","","The training scripts include automatic CUDA optimizations:","","- **TF32 Precision**: Enabled by default on Ampere+ GPUs for faster matmul","- **cuDNN Benchmark**: Auto-tunes convolution algorithms","- **Fused AdamW**: Optimizer runs entirely on GPU","- **BFloat16 Native**: Model initialized in bf16 (no autocast overhead)","- **Non-blocking Transfers**: CPU→GPU transfers overlap with computation","","### Distributed Training (Multi-GPU)","","```bash","# Multi-GPU with DDP (auto-detects GPUs)","uv run accelerate launch scripts/pretrain_distributed.py \\","    --model mac --dim 512 \\","    --local-dataset data/fineweb-tokenized","","# Multi-GPU with custom config","uv run accelerate launch --config_file configs/fsdp_config.yaml \\","    scripts/pretrain_distributed.py --model mac --dim 1024","```","","### MLX Pretraining","","```bash","# Demo with synthetic data","uv run python scripts/pretrain_mlx.py --model mac --dim 256 --epochs 10","","# Train with FineWeb-Edu","uv run python scripts/pretrain_mlx.py --model mac \\","    --dataset HuggingFaceFW/fineweb-edu \\","    --tokenizer meta-llama/Llama-2-7b-hf \\","    --dim 512 --num-layers 12","","# Full training","uv run python scripts/pretrain_mlx.py --model mac \\","    --dataset HuggingFaceFW/fineweb-edu \\","    --tokenizer meta-llama/Llama-2-7b-hf \\","    --dim 1024 --num-layers 24 --num-heads 16 \\","    --batch-size 4 --gradient-accumulation-steps 32 \\","    --dtype float16 --wandb","","# Train with local text","uv run python scripts/pretrain_mlx.py --model mag \\","    --data path/to/corpus.txt","","# Resume from checkpoint","uv run python scripts/pretrain_mlx.py --model mac \\","    --resume checkpoints_mlx/latest.safetensors","```","","#### MLX Training Options","","| Option | Default | Description |","|--------|---------|-------------|","| **Model Architecture** |","| `--model` | `mac` | Model variant: mac, mag, mal, lmm |","| `--dim` | `512` | Model dimension |","| `--num-heads` | `8` | Attention heads |","| `--num-layers` | `12` | Number of layers |","| `--vocab-size` | `32000` | Vocabulary size |","| `--chunk-size` | `512` | Chunk size for MAC |","| `--window-size` | `512` | Window size for MAG/MAL |","| **Data** |","| `--dataset` | - | HuggingFace dataset name (streaming) |","| `--dataset-subset` | - | Dataset subset (e.g., sample-10BT) |","| `--data` | - | Local text file path |","| `--tokenizer` | `gpt2` | HuggingFace tokenizer |","| `--seq-len` | `4096` | Sequence length |","| **Training** |","| `--epochs` | `1` | Number of epochs |","| `--max-steps` | `-1` | Max steps (-1 = use epochs) |","| `--batch-size` | `4` | Batch size |","| `--gradient-accumulation-steps` | `32` | Gradient accumulation steps |","| `--lr` | `4e-4` | Learning rate |","| `--weight-decay` | `0.1` | Weight decay |","| `--grad-clip` | `1.0` | Gradient clipping |","| `--warmup-ratio` | `0.03` | Warmup ratio |","| `--dtype` | `float16` | float32, float16, bfloat16 |","| **Checkpointing** |","| `--checkpoint-dir` | `checkpoints_mlx/` | Checkpoint directory |","| `--save-every` | `1000` | Save every N steps |","| `--eval-every` | `500` | Eval every N steps |","| `--resume` | - | Resume from checkpoint (.safetensors) |","| **Logging** |","| `--log-every` | `10` | Log every N steps |","| `--wandb` | `False` | Enable W\u0026B logging |","| `--wandb-project` | `titans-mlx` | W\u0026B project name |","| `--wandb-run-name` | - | W\u0026B run name |","| `--seed` | `42` | Random seed |","","---","","## Inference","","### PyTorch Inference","","```bash","# Generate text","uv run python scripts/inference.py \\","    --checkpoint checkpoints/best_model.pt \\","    --prompt \"Once upon a time\" \\","    --max-tokens 100","","# Interactive mode","uv run python scripts/inference.py \\","    --checkpoint checkpoints/best_model.pt \\","    --interactive","","# With sampling parameters","uv run python scripts/inference.py \\","    --checkpoint checkpoints/best_model.pt \\","    --prompt \"The meaning of life is\" \\","    --temperature 0.8 \\","    --top-p 0.9 \\","    --max-tokens 200","","# With quantization","uv run python scripts/inference.py \\","    --checkpoint checkpoints/best_model.pt \\","    --prompt \"Hello\" \\","    --quantize int8","```","","#### PyTorch Inference Options","","| Option | Default | Description |","|--------|---------|-------------|","| `--checkpoint` | **required** | Path to model checkpoint (.pt) |","| `--tokenizer` | `gpt2` | HuggingFace tokenizer |","| `--prompt` | - | Input prompt |","| `--max-tokens` | `100` | Max tokens to generate |","| `--temperature` | `1.0` | Sampling temperature |","| `--top-k` | `50` | Top-k sampling |","| `--top-p` | `0.9` | Top-p (nucleus) sampling |","| `--repetition-penalty` | `1.0` | Repetition penalty |","| `--interactive` | `False` | Interactive mode |","| `--stream` | `False` | Stream output token by token |","| `--quantize` | - | Quantization: int8, int4, fp16 |","| `--device` | `auto` | Device: auto, cpu, cuda, mps |","","### MLX Inference","","```bash","# Generate text","uv run python scripts/inference_mlx.py \\","    --checkpoint checkpoints_mlx/best_model.safetensors \\","    --prompt \"Once upon a time\" \\","    --max-tokens 100","","# Interactive mode","uv run python scripts/inference_mlx.py \\","    --checkpoint checkpoints_mlx/best_model.safetensors \\","    --interactive","","# With quantization and benchmark","uv run python scripts/inference_mlx.py \\","    --checkpoint checkpoints_mlx/best_model.safetensors \\","    --prompt \"Hello\" \\","    --quantize 8 \\","    --benchmark","```","","#### MLX Inference Options","","| Option | Default | Description |","|--------|---------|-------------|","| `--checkpoint` | **required** | Path to model checkpoint (.safetensors) |","| `--tokenizer` | `gpt2` | HuggingFace tokenizer |","| `--prompt` | - | Input prompt |","| `--max-tokens` | `100` | Max tokens to generate |","| `--temperature` | `1.0` | Sampling temperature |","| `--top-k` | `50` | Top-k sampling |","| `--top-p` | `0.9` | Top-p (nucleus) sampling |","| `--repetition-penalty` | `1.0` | Repetition penalty |","| `--interactive` | `False` | Interactive mode |","| `--stream` | `False` | Stream output token by token |","| `--quantize` | - | Quantization bits: 4 or 8 |","| `--benchmark` | `False` | Run generation benchmark |","","---","","## Benchmarks","","### Model Quality (from Paper Table 1 \u0026 5)","","**Language Modeling (340M params, 15B tokens)**:","","| Model | Wiki ppl ↓ | Avg Accuracy ↑ |","|-------|------------|----------------|","| MAC | 25.43 | 47.36 |","| MAG | **25.07** | **47.54** |","| MAL | 24.69 | 46.55 |","| LMM | 26.18 | 46.17 |","","**Long Context (BABILong benchmark)**:","","| Model | Accuracy ↑ |","|-------|------------|","| MAC | **97.95** |","| MAG | 96.70 |","| MAL | 96.91 |","| LMM | 92.68 |","","### Inference Speed (Apple M4 Pro)","","Configuration: batch=4, seq_len=256, dim=256, 4 layers","","| Model | MLX (ms) | PyTorch MPS (ms) | PyTorch CPU (ms) | MLX Speedup vs MPS |","|-------|----------|------------------|------------------|-------------------|","| MAC | **19.89** | 24.94 | 90.30 | **1.25x** |","| MAG | **9.72** | 16.66 | 43.45 | **1.71x** |","| MAL | **9.75** | 16.89 | 45.05 | **1.73x** |","| LMM | **7.11** | 11.88 | 28.73 | **1.67x** |","","**All MLX implementations are faster than PyTorch MPS on Apple Silicon.**","","### Numerical Parity","","MLX and PyTorch implementations produce identical outputs:","","| Model | Max Difference |","|-------|---------------|","| Memory | \u003c 1e-5 |","| LMM | \u003c 1e-4 |","| MAG | \u003c 1e-4 |","| MAC | \u003c 1e-4 |","","---","","## Configuration Reference","","### TitansConfig Parameters","","| Parameter | Default | Description | Paper Reference |","|-----------|---------|-------------|-----------------|","| **Model Architecture** |","| `dim` | 512 | Model dimension (d_in) | - |","| `num_heads` | 8 | Number of attention heads | - |","| `num_layers` | 12 | Number of Titans blocks | Stackable |","| `vocab_size` | 32000 | Vocabulary size | - |","| `max_seq_len` | 8192 | Maximum sequence length | - |","| **Memory** |","| `num_memory_layers` | 2 | Memory MLP depth (L_M \u003e= 1) | Section 3.1 |","| `memory_hidden_mult` | 4.0 | Memory hidden dim multiplier | - |","| `memory_lr` | 0.1 | Learning rate θ_t (scaled by gate) | Eq. 14 |","| `memory_momentum` | 0.9 | Momentum η_t (scaled by gate) | Eq. 14 |","| `memory_decay` | 0.01 | Forgetting α_t (scaled by gate) | Eq. 13 |","| **Attention** |","| `num_persistent_tokens` | 16 | Persistent memory tokens (N_p) | Eq. 19 |","| `chunk_size` | 512 | Segment size for MAC | Section 4.1 |","| `window_size` | 512 | Sliding window for MAG/MAL | Section 4.2-4.3 |","| **Architecture Options** |","| `use_conv` | True | 1D depthwise convolution | Section 4.4 |","| `conv_kernel_size` | 4 | Convolution kernel size | Section 4.4 |","| `use_rope` | True | Rotary Position Embeddings | - |","| `activation` | \"silu\" | Activation function | Section 4.4 |","| `dropout` | 0.0 | Dropout rate | - |","| **FFN** |","| `ffn_mult` | 4.0 | FFN hidden dim multiplier | - |","| `init_std` | 0.02 | Weight initialization std | - |","","---","","## API Reference","","### PyTorch API","","```python","from titans import (","    # Configuration","    TitansConfig,","","    # Models","    TitansMAC,","    TitansMAG,","    TitansMAL,","    TitansLMM,","","    # Components","    NeuralLongTermMemory,","    MemoryState,","    SlidingWindowAttention,","    SegmentedAttention,","    PersistentMemory,",")","","# Model forward signature","logits, states = model(input_ids, states=None)","# input_ids: (batch, seq_len) - Token IDs","# states: Optional list of MemoryState","# Returns: logits (batch, seq_len, vocab_size), new states","","# Memory forward signature","output, state = memory(x, state=None, return_state=True)","# x: (batch, seq_len, dim)","# state: Optional MemoryState","# Returns: output (batch, seq_len, dim), new state","```","","### MLX API","","```python","from titans_mlx import (","    # Configuration","    TitansConfig,","","    # Models","    TitansMAC,","    TitansMAG,","    TitansMAL,","    TitansLMM,","","    # Components","    NeuralLongTermMemory,","    MemoryState,","    SlidingWindowAttention,","    SegmentedAttention,","    PersistentMemory,","","    # Optimizations","    compile_model,      # Note: Limited support","    compile_function,","    get_device_info,","","    # Metal Kernels (benchmarking only)","    metal_silu_gate,","    metal_memory_update,","    metal_rope,",")","```","","---","","## MLX Optimizations","","### Gradient Computation","","The MLX implementation uses **analytical gradients** instead of `mx.grad` for the memory update:","","```python","# Efficient gradient via matmul (avoids huge intermediate tensors)","# Instead of: expand_dims + outer product + sum","# We use: reshape + matmul","","delta_flat = delta.reshape(batch_seq, -1)  # (B*S, D_out)","act_flat = act.reshape(batch_seq, -1)      # (B*S, D_in)","grad_w = delta_flat.T @ act_flat           # (D_out, D_in)","```","","This optimization provides **5x speedup** for MAC.","","### Why Not mx.compile?","","`mx.compile` cannot compile full Titans models because:","","1. **MemoryState**: Dataclasses are not supported","2. **Dynamic loops**: Python for-loops for chunk processing","3. **Mutable state**: Memory state updates","","Individual components (FFN, attention) can be compiled for marginal gains.","","### Metal Kernels","","Custom Metal kernels are available but **not faster** than native MLX for typical tensor sizes:","","| Operation | Metal Kernel | Native MLX | Verdict |","|-----------|--------------|------------|---------|","| SiLU Gate | 0.44ms | 0.26ms | Native faster |","| Memory Update | 0.20ms | 0.23ms | ~Equal |","| RoPE | 0.23ms | 0.23ms | ~Equal |","","MLX already optimizes well for Apple Silicon. Use native operations.","","### Recommended Practices","","```python","import mlx.core as mx","from titans_mlx import TitansConfig, TitansMAC","","# 1. Use float16 for training (default)","# Saves memory, marginal speed difference on Apple Silicon","","# 2. Evaluate parameters after creation","model = TitansMAC(config)","mx.eval(model.parameters())","","# 3. Evaluate outputs when needed","logits, states = model(input_ids)","mx.eval(logits)  # Force computation","","# 4. Use larger batches to amortize overhead","# batch_size=4 or higher recommended","","# 5. Disable convolution if dimensions mismatch","config = TitansConfig(..., use_conv=False)","```","","---","","## Troubleshooting","","### Common Issues","","#### PyTorch","","**Issue**: Out of memory on GPU","```bash","# Reduce batch size or use gradient accumulation","--batch-size 2 --gradient-accumulation-steps 64","```","","**Issue**: NaN loss during training","```bash","# Use bf16 instead of fp16, or reduce learning rate","--mixed-precision bf16 --lr 2e-4","```","","#### MLX","","**Issue**: `ValueError: conv1d groups` error","```python","# Disable convolution","config = TitansConfig(..., use_conv=False)","```","","**Issue**: Slow first iteration","```python","# Normal - MLX compiles on first call","# Subsequent iterations will be faster","```","","**Issue**: Memory not releasing","```python","# Force garbage collection","import gc","gc.collect()","mx.metal.clear_cache()  # If available","```","","### Numerical Differences","","Small numerical differences (\u003c 1e-4) between PyTorch and MLX are expected due to:","- Different floating-point implementations","- Different reduction orders","- Platform-specific optimizations","","For exact reproducibility, use the same backend.","","---","","## Development","","### Project Structure","","```","titans-pytorch/","├── src/","│   ├── titans/                 # PyTorch implementation","│   │   ├── __init__.py","│   │   ├── config.py           # TitansConfig","│   │   ├── memory.py           # Neural Long-term Memory","│   │   ├── attention.py        # Attention modules","│   │   ├── persistent.py       # Persistent Memory","│   │   ├── models.py           # MAC, MAG, MAL, LMM","│   │   └── triton_kernels.py   # Triton optimizations","│   │","│   └── titans_mlx/             # MLX implementation","│       ├── __init__.py","│       ├── config.py","│       ├── memory.py","│       ├── attention.py","│       ├── persistent.py","│       ├── models.py","│       ├── optimizations.py    # MLX optimizations","│       └── metal_kernels.py    # Metal kernels","│","├── scripts/","│   ├── pretrain.py             # PyTorch training (optimized)","│   ├── pretrain_distributed.py # Multi-GPU training (Accelerate)","│   ├── pretrain_mlx.py         # MLX training","│   ├── pretokenize.py          # Dataset pre-tokenization","│   ├── inference.py            # PyTorch inference","│   └── inference_mlx.py        # MLX inference","│","├── tests/","│   ├── test_memory.py","│   ├── test_attention.py","│   ├── test_models.py","│   ├── test_persistent.py","│   └── test_numerical_parity.py  # MLX vs PyTorch","│","├── examples/","│   ├── basic_usage.py","│   └── long_sequence.py","│","└── pyproject.toml","```","","### Running Tests","","```bash","# All tests","uv run pytest tests/ -v","","# Specific test file","uv run pytest tests/test_numerical_parity.py -v","","# With coverage","uv run pytest tests/ --cov=titans --cov=titans_mlx --cov-report=term-missing","```","","### Linting","","```bash","uv run ruff check src/ tests/ scripts/","uv run ruff format src/ tests/ scripts/","```","","---","","## Citation","","```bibtex","@article{behrouz2024titans,","  title={Titans: Learning to Memorize at Test Time},","  author={Behrouz, Ali and Zhong, Peilin and Mirrokni, Vahab},","  journal={arXiv preprint arXiv:2501.00663},","  year={2024}","}","","@article{dinepi2025titans,","  title={Titans Revisited: A Lightweight Reimplementation and Critical Analysis of a Test-Time Memory Model},","  author={Di Nepi, Gavriel and Siciliano, Federico and Silvestri, Fabrizio},","  journal={arXiv preprint arXiv:2510.09551},","  year={2025}","}","```","","---","","## License","","Apache License 2.0","","Copyright (c) 2026 Delanoe Pirard / Aedelon"],"stylingDirectives":[[[0,43,"pl-mh"],[2,43,"pl-en"]],[],[[1,2,"pl-ent"],[3,8,"pl-e"],[9,10,"pl-s"],[10,16,"pl-s"],[16,17,"pl-s"]],[[1,4,"pl-ent"],[5,8,"pl-e"],[9,10,"pl-s"],[10,25,"pl-s"],[25,26,"pl-s"],[27,30,"pl-e"],[31,32,"pl-s"],[32,43,"pl-s"],[43,44,"pl-s"],[45,50,"pl-e"],[51,52,"pl-s"],[52,56,"pl-s"],[56,57,"pl-s"]],[[2,3,"pl-ent"]],[],[[0,1,"pl-s"],[1,3,"pl-s"],[15,16,"pl-s"],[16,17,"pl-s"],[17,67,"pl-corl"],[67,69,"pl-s"],[69,70,"pl-s"],[70,103,"pl-corl"],[103,104,"pl-s"]],[[0,1,"pl-s"],[1,3,"pl-s"],[15,16,"pl-s"],[16,17,"pl-s"],[17,69,"pl-corl"],[69,71,"pl-s"],[71,72,"pl-s"],[72,92,"pl-corl"],[92,93,"pl-s"]],[[0,1,"pl-s"],[1,3,"pl-s"],[6,7,"pl-s"],[7,8,"pl-s"],[8,66,"pl-corl"],[66,68,"pl-s"],[68,69,"pl-s"],[69,102,"pl-corl"],[102,103,"pl-s"]],[[0,1,"pl-s"],[1,3,"pl-s"],[10,11,"pl-s"],[11,12,"pl-s"],[12,71,"pl-corl"],[71,73,"pl-s"],[73,74,"pl-s"],[74,81,"pl-corl"],[81,82,"pl-s"]],[[0,1,"pl-s"],[1,3,"pl-s"],[8,9,"pl-s"],[9,10,"pl-s"],[10,73,"pl-corl"],[73,75,"pl-s"],[75,76,"pl-s"],[76,82,"pl-corl"],[82,83,"pl-s"]],[],[[11,13,"pl-s"],[20,22,"pl-s"],[27,29,"pl-s"],[32,34,"pl-s"]],[],[[19,21,"pl-s"],[50,52,"pl-s"]],[],[[0,3,"pl-ms"]],[],[[0,20,"pl-mh"],[3,20,"pl-en"]],[],[[0,1,"pl-v"],[2,3,"pl-s"],[19,20,"pl-s"],[20,21,"pl-s"],[21,38,"pl-corl"],[38,39,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[11,12,"pl-s"],[12,13,"pl-s"],[13,22,"pl-corl"],[22,23,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[24,25,"pl-s"],[25,26,"pl-s"],[26,48,"pl-corl"],[48,49,"pl-s"]],[[2,3,"pl-v"],[4,5,"pl-s"],[23,24,"pl-s"],[24,25,"pl-s"],[25,44,"pl-corl"],[44,45,"pl-s"]],[[2,3,"pl-v"],[4,5,"pl-s"],[26,27,"pl-s"],[27,28,"pl-s"],[28,50,"pl-corl"],[50,51,"pl-s"]],[[2,3,"pl-v"],[4,5,"pl-s"],[28,29,"pl-s"],[29,30,"pl-s"],[30,54,"pl-corl"],[54,55,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[15,16,"pl-s"],[16,17,"pl-s"],[17,30,"pl-corl"],[30,31,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[14,15,"pl-s"],[15,16,"pl-s"],[16,28,"pl-corl"],[28,29,"pl-s"]],[[2,3,"pl-v"],[4,5,"pl-s"],[12,13,"pl-s"],[13,14,"pl-s"],[14,34,"pl-corl"],[34,35,"pl-s"]],[[2,3,"pl-v"],[4,5,"pl-s"],[24,25,"pl-s"],[25,26,"pl-s"],[26,42,"pl-corl"],[42,43,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[14,15,"pl-s"],[15,16,"pl-s"],[16,28,"pl-corl"],[28,29,"pl-s"]],[[2,3,"pl-v"],[4,5,"pl-s"],[24,25,"pl-s"],[25,26,"pl-s"],[26,46,"pl-corl"],[46,47,"pl-s"]],[[2,3,"pl-v"],[4,5,"pl-s"],[20,21,"pl-s"],[21,22,"pl-s"],[22,38,"pl-corl"],[38,39,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[12,13,"pl-s"],[13,14,"pl-s"],[14,24,"pl-corl"],[24,25,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[13,14,"pl-s"],[14,15,"pl-s"],[15,26,"pl-corl"],[26,27,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[26,27,"pl-s"],[27,28,"pl-s"],[28,52,"pl-corl"],[52,53,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[16,17,"pl-s"],[17,18,"pl-s"],[18,32,"pl-corl"],[32,33,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[20,21,"pl-s"],[21,22,"pl-s"],[22,40,"pl-corl"],[40,41,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[18,19,"pl-s"],[19,20,"pl-s"],[20,36,"pl-corl"],[36,37,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[14,15,"pl-s"],[15,16,"pl-s"],[16,28,"pl-corl"],[28,29,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[11,12,"pl-s"],[12,13,"pl-s"],[13,22,"pl-corl"],[22,23,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[10,11,"pl-s"],[11,12,"pl-s"],[12,20,"pl-corl"],[20,21,"pl-s"]],[],[[0,3,"pl-ms"]],[],[[0,19,"pl-mh"],[3,19,"pl-en"]],[],[[0,145,"pl-ent"],[0,2,"pl-ent"],[2,4,"pl-s"],[18,20,"pl-s"],[69,70,"pl-s"],[111,112,"pl-s"]],[[0,0,"pl-ent"]],[[0,207,"pl-ent"],[0,2,"pl-ent"],[2,4,"pl-s"],[18,20,"pl-s"],[74,75,"pl-s"],[173,174,"pl-s"]],[[0,0,"pl-ent"]],[[0,3,"pl-ms"]],[],[[0,11,"pl-mh"],[3,11,"pl-en"]],[],[[0,17,"pl-mh"],[4,17,"pl-en"]],[],[[0,1,"pl-ml"],[10,11,"pl-ml"],[20,21,"pl-ml"],[26,27,"pl-ml"]],[[0,1,"pl-ml"],[10,11,"pl-ml"],[20,21,"pl-ml"],[26,27,"pl-ml"]],[[0,1,"pl-ml"],[26,27,"pl-ml"],[30,31,"pl-ml"],[34,35,"pl-ml"]],[[0,1,"pl-ml"],[23,24,"pl-ml"],[27,28,"pl-ml"],[31,32,"pl-ml"]],[[0,1,"pl-ml"],[24,25,"pl-ml"],[28,29,"pl-ml"],[32,33,"pl-ml"]],[[0,1,"pl-ml"],[20,21,"pl-ml"],[24,25,"pl-ml"],[28,29,"pl-ml"]],[[0,1,"pl-ml"],[25,26,"pl-ml"],[29,30,"pl-ml"],[33,34,"pl-ml"]],[[0,1,"pl-ml"],[24,25,"pl-ml"],[28,29,"pl-ml"],[32,33,"pl-ml"]],[[0,1,"pl-ml"],[27,28,"pl-ml"],[31,32,"pl-ml"],[35,36,"pl-ml"]],[[0,1,"pl-ml"],[27,28,"pl-ml"],[31,32,"pl-ml"],[35,36,"pl-ml"]],[[0,1,"pl-ml"],[27,28,"pl-ml"],[41,42,"pl-ml"],[55,56,"pl-ml"]],[[0,1,"pl-ml"],[24,25,"pl-ml"],[28,29,"pl-ml"],[32,33,"pl-ml"]],[[0,1,"pl-ml"],[21,22,"pl-ml"],[25,26,"pl-ml"],[29,30,"pl-ml"]],[[0,1,"pl-ml"],[14,15,"pl-ml"],[18,19,"pl-ml"],[22,23,"pl-ml"]],[],[[0,29,"pl-mh"],[4,29,"pl-en"]],[],[[0,1,"pl-ml"],[10,11,"pl-ml"],[20,21,"pl-ml"],[26,27,"pl-ml"]],[[0,1,"pl-ml"],[10,11,"pl-ml"],[20,21,"pl-ml"],[26,27,"pl-ml"]],[[0,1,"pl-ml"],[20,21,"pl-ml"],[31,32,"pl-ml"],[37,38,"pl-ml"]],[[0,1,"pl-ml"],[17,18,"pl-ml"],[28,29,"pl-ml"],[34,35,"pl-ml"]],[[0,1,"pl-ml"],[16,17,"pl-ml"],[22,23,"pl-ml"],[26,27,"pl-ml"]],[[0,1,"pl-ml"],[14,15,"pl-ml"],[18,19,"pl-ml"],[24,25,"pl-ml"]],[[0,1,"pl-ml"],[17,18,"pl-ml"],[23,24,"pl-ml"],[27,28,"pl-ml"]],[[0,1,"pl-ml"],[19,20,"pl-ml"],[31,32,"pl-ml"],[42,43,"pl-ml"]],[],[[0,17,"pl-mh"],[4,17,"pl-en"]],[],[[0,1,"pl-v"],[2,4,"pl-s"],[18,20,"pl-s"]],[[0,1,"pl-v"],[2,4,"pl-s"],[26,28,"pl-s"]],[[0,1,"pl-v"],[2,4,"pl-s"],[21,23,"pl-s"]],[],[[0,3,"pl-ms"]],[],[[0,24,"pl-mh"],[3,24,"pl-en"]],[],[[1,2,"pl-ent"],[3,8,"pl-e"],[9,10,"pl-s"],[10,16,"pl-s"],[16,17,"pl-s"]],[[1,4,"pl-ent"],[5,8,"pl-e"],[9,10,"pl-s"],[10,49,"pl-s"],[49,50,"pl-s"],[51,54,"pl-e"],[55,56,"pl-s"],[56,78,"pl-s"],[78,79,"pl-s"],[80,85,"pl-e"],[86,87,"pl-s"],[87,90,"pl-s"],[90,91,"pl-s"]],[[2,3,"pl-ent"]],[[1,2,"pl-ent"],[3,8,"pl-e"],[9,10,"pl-s"],[10,16,"pl-s"],[16,17,"pl-s"],[19,21,"pl-ent"],[122,124,"pl-ent"],[127,128,"pl-ent"]],[],[[0,22,"pl-mh"],[4,22,"pl-en"]],[],[[29,31,"pl-s"],[49,51,"pl-s"]],[],[[0,1,"pl-ml"],[14,15,"pl-ml"],[23,24,"pl-ml"],[47,48,"pl-ml"],[65,66,"pl-ml"]],[[0,1,"pl-ml"],[14,15,"pl-ml"],[23,24,"pl-ml"],[46,47,"pl-ml"],[64,65,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[14,16,"pl-s"],[17,18,"pl-ml"],[46,47,"pl-ml"],[84,85,"pl-ml"],[112,113,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[13,15,"pl-s"],[16,17,"pl-ml"],[38,39,"pl-ml"],[40,42,"pl-s"],[56,58,"pl-s"],[97,98,"pl-ml"],[126,127,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[14,16,"pl-s"],[17,18,"pl-ml"],[36,37,"pl-ml"],[61,62,"pl-ml"],[85,86,"pl-ml"]],[],[[0,25,"pl-mh"],[4,25,"pl-en"]],[],[[0,21,"pl-mh"],[5,21,"pl-en"]],[],[[0,1,"pl-ml"],[9,10,"pl-ml"],[15,16,"pl-ml"],[21,22,"pl-ml"],[27,28,"pl-ml"],[33,34,"pl-ml"]],[[0,1,"pl-ml"],[9,10,"pl-ml"],[15,16,"pl-ml"],[21,22,"pl-ml"],[27,28,"pl-ml"],[33,34,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[16,18,"pl-s"],[19,20,"pl-ml"],[49,50,"pl-ml"],[70,71,"pl-ml"],[91,92,"pl-ml"],[105,106,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[18,20,"pl-s"],[21,22,"pl-ml"],[57,58,"pl-ml"],[74,75,"pl-ml"],[91,92,"pl-ml"],[98,99,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[20,22,"pl-s"],[23,24,"pl-ml"],[39,40,"pl-ml"],[59,60,"pl-ml"],[72,73,"pl-ml"],[78,79,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[21,23,"pl-s"],[24,25,"pl-ml"],[30,31,"pl-ml"],[35,36,"pl-ml"],[40,41,"pl-ml"],[45,46,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[16,18,"pl-s"],[19,20,"pl-ml"],[30,31,"pl-ml"],[40,41,"pl-ml"],[53,54,"pl-ml"],[63,64,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[18,20,"pl-s"],[21,22,"pl-ml"],[30,31,"pl-ml"],[37,38,"pl-ml"],[47,48,"pl-ml"],[54,55,"pl-ml"]],[],[[0,29,"pl-mh"],[5,29,"pl-en"]],[],[[0,1,"pl-ml"],[11,12,"pl-ml"],[25,26,"pl-ml"],[31,32,"pl-ml"]],[[0,1,"pl-ml"],[11,12,"pl-ml"],[25,26,"pl-ml"],[31,32,"pl-ml"]],[[0,1,"pl-ml"],[31,32,"pl-ml"],[33,35,"pl-s"],[38,40,"pl-s"],[41,42,"pl-ml"],[92,93,"pl-ml"]],[[0,1,"pl-ml"],[34,35,"pl-ml"],[36,38,"pl-s"],[41,43,"pl-s"],[44,45,"pl-ml"],[87,88,"pl-ml"]],[[0,1,"pl-ml"],[33,34,"pl-ml"],[35,37,"pl-s"],[40,42,"pl-s"],[43,44,"pl-ml"],[81,82,"pl-ml"]],[[0,1,"pl-ml"],[34,35,"pl-ml"],[36,38,"pl-s"],[41,43,"pl-s"],[44,45,"pl-ml"],[85,86,"pl-ml"]],[[0,1,"pl-ml"],[30,31,"pl-ml"],[32,34,"pl-s"],[37,39,"pl-s"],[40,41,"pl-ml"],[81,82,"pl-ml"]],[[0,1,"pl-ml"],[36,37,"pl-ml"],[38,40,"pl-s"],[43,45,"pl-s"],[46,47,"pl-ml"],[83,84,"pl-ml"]],[[0,1,"pl-ml"],[25,26,"pl-ml"],[27,29,"pl-s"],[32,34,"pl-s"],[35,36,"pl-ml"],[67,68,"pl-ml"]],[],[[0,41,"pl-mh"],[5,41,"pl-en"]],[],[[1,2,"pl-ent"],[3,8,"pl-e"],[9,10,"pl-s"],[10,16,"pl-s"],[16,17,"pl-s"]],[[1,4,"pl-ent"],[5,8,"pl-e"],[9,10,"pl-s"],[10,37,"pl-s"],[37,38,"pl-s"],[39,42,"pl-e"],[43,44,"pl-s"],[44,60,"pl-s"],[60,61,"pl-s"],[62,67,"pl-e"],[68,69,"pl-s"],[69,72,"pl-s"],[72,73,"pl-s"]],[[2,3,"pl-ent"]],[[1,2,"pl-ent"],[3,8,"pl-e"],[9,10,"pl-s"],[10,16,"pl-s"],[16,17,"pl-s"],[19,21,"pl-ent"],[114,116,"pl-ent"],[119,120,"pl-ent"]],[],[[0,3,"pl-s"],[3,3,"pl-c1"]],[[0,79,"pl-c1"]],[[0,70,"pl-c1"]],[[0,78,"pl-c1"]],[[0,72,"pl-c1"]],[[0,72,"pl-c1"]],[[0,0,"pl-c1"],[0,3,"pl-s"]],[],[[0,2,"pl-s"],[12,14,"pl-s"]],[[0,2,"pl-s"],[15,17,"pl-s"]],[],[[0,38,"pl-mh"],[5,38,"pl-en"]],[],[[1,2,"pl-ent"],[3,8,"pl-e"],[9,10,"pl-s"],[10,16,"pl-s"],[16,17,"pl-s"]],[[1,4,"pl-ent"],[5,8,"pl-e"],[9,10,"pl-s"],[10,41,"pl-s"],[41,42,"pl-s"],[43,46,"pl-e"],[47,48,"pl-s"],[48,72,"pl-s"],[72,73,"pl-s"],[74,79,"pl-e"],[80,81,"pl-s"],[81,84,"pl-s"],[84,85,"pl-s"]],[[2,3,"pl-ent"]],[[1,2,"pl-ent"],[3,8,"pl-e"],[9,10,"pl-s"],[10,16,"pl-s"],[16,17,"pl-s"],[19,21,"pl-ent"],[96,98,"pl-ent"],[101,102,"pl-ent"]],[],[[0,3,"pl-s"],[3,3,"pl-c1"]],[[0,80,"pl-c1"]],[[0,84,"pl-c1"]],[[0,79,"pl-c1"]],[[0,0,"pl-c1"],[0,3,"pl-s"]],[],[[0,2,"pl-s"],[12,14,"pl-s"]],[[0,2,"pl-s"],[15,17,"pl-s"]],[],[[0,39,"pl-mh"],[5,39,"pl-en"]],[],[[0,3,"pl-s"],[3,3,"pl-c1"]],[[0,80,"pl-c1"]],[[0,72,"pl-c1"]],[[0,85,"pl-c1"]],[[0,0,"pl-c1"],[0,3,"pl-s"]],[],[[0,2,"pl-s"],[12,14,"pl-s"]],[[0,2,"pl-s"],[15,17,"pl-s"]],[],[[0,27,"pl-mh"],[4,27,"pl-en"]],[],[[1,2,"pl-ent"],[3,8,"pl-e"],[9,10,"pl-s"],[10,16,"pl-s"],[16,17,"pl-s"]],[[1,4,"pl-ent"],[5,8,"pl-e"],[9,10,"pl-s"],[10,46,"pl-s"],[46,47,"pl-s"],[48,51,"pl-e"],[52,53,"pl-s"],[53,73,"pl-s"],[73,74,"pl-s"],[75,80,"pl-e"],[81,82,"pl-s"],[82,85,"pl-s"],[85,86,"pl-s"]],[[1,4,"pl-ent"],[5,8,"pl-e"],[9,10,"pl-s"],[10,46,"pl-s"],[46,47,"pl-s"],[48,51,"pl-e"],[52,53,"pl-s"],[53,66,"pl-s"],[66,67,"pl-s"],[68,73,"pl-e"],[74,75,"pl-s"],[75,78,"pl-s"],[78,79,"pl-s"]],[[2,3,"pl-ent"]],[[1,2,"pl-ent"],[3,8,"pl-e"],[9,10,"pl-s"],[10,16,"pl-s"],[16,17,"pl-s"],[19,21,"pl-ent"],[112,114,"pl-ent"],[117,118,"pl-ent"]],[],[[0,33,"pl-mh"],[5,33,"pl-en"]],[],[[0,2,"pl-s"],[25,27,"pl-s"]],[[0,3,"pl-s"],[3,3,"pl-c1"]],[[0,29,"pl-c1"]],[[0,0,"pl-c1"],[0,3,"pl-s"]],[],[[0,2,"pl-s"],[31,33,"pl-s"]],[[0,3,"pl-s"],[3,3,"pl-c1"]],[[0,31,"pl-c1"]],[[0,0,"pl-c1"],[0,3,"pl-s"]],[],[[0,2,"pl-s"],[24,26,"pl-s"]],[[0,3,"pl-s"],[3,3,"pl-c1"]],[[0,44,"pl-c1"]],[[0,42,"pl-c1"]],[[0,40,"pl-c1"]],[[0,0,"pl-c1"],[0,3,"pl-s"]],[],[],[[0,1,"pl-v"],[2,3,"pl-s"],[3,6,"pl-c1"],[6,7,"pl-s"],[10,11,"pl-s"],[14,15,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[3,6,"pl-c1"],[6,7,"pl-s"],[10,11,"pl-s"]],[[0,1,"pl-v"],[2,3,"pl-s"],[3,6,"pl-c1"],[6,7,"pl-s"]],[],[[0,20,"pl-mh"],[5,20,"pl-en"]],[],[[0,1,"pl-s"],[1,2,"pl-v"],[3,5,"pl-s"],[28,30,"pl-s"]],[[0,1,"pl-s"],[1,2,"pl-v"],[3,5,"pl-s"],[25,27,"pl-s"]],[[0,1,"pl-s"],[1,2,"pl-v"],[3,5,"pl-s"],[16,18,"pl-s"]],[[0,1,"pl-s"],[1,2,"pl-v"],[3,5,"pl-s"],[25,27,"pl-s"]],[],[[0,3,"pl-ms"]],[],[[0,15,"pl-mh"],[3,15,"pl-en"]],[],[[0,32,"pl-mh"],[4,32,"pl-en"]],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[],[[0,2,"pl-c1"]],[],[[0,3,"pl-s"]],[],[[0,30,"pl-mh"],[4,30,"pl-en"]],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[],[[0,3,"pl-s"]],[],[[0,33,"pl-mh"],[4,33,"pl-en"]],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[],[[0,3,"pl-s"]],[],[[0,20,"pl-mh"],[4,20,"pl-en"]],[],[],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,41,"pl-c"],[0,1,"pl-c"]],[],[[0,3,"pl-s"]],[],[[0,3,"pl-ms"]],[],[[0,14,"pl-mh"],[3,14,"pl-en"]],[],[[0,23,"pl-mh"],[4,23,"pl-en"]],[],[[0,3,"pl-s"],[3,9,"pl-en"]],[[0,6,"pl-k"]],[[0,4,"pl-k"],[12,18,"pl-k"]],[],[[0,15,"pl-c"],[0,1,"pl-c"]],[[7,8,"pl-k"]],[[4,7,"pl-v"],[7,8,"pl-k"],[8,11,"pl-c1"]],[[4,13,"pl-v"],[13,14,"pl-k"],[14,15,"pl-c1"]],[[4,14,"pl-v"],[14,15,"pl-k"],[15,16,"pl-c1"]],[[4,14,"pl-v"],[14,15,"pl-k"],[15,20,"pl-c1"]],[[4,14,"pl-v"],[14,15,"pl-k"],[15,18,"pl-c1"],[30,39,"pl-c"],[30,31,"pl-c"]],[[4,15,"pl-v"],[15,16,"pl-k"],[16,19,"pl-c1"],[30,43,"pl-c"],[30,31,"pl-c"]],[[4,25,"pl-v"],[25,26,"pl-k"],[26,28,"pl-c1"]],[[4,21,"pl-v"],[21,22,"pl-k"],[22,23,"pl-c1"],[30,43,"pl-c"],[30,31,"pl-c"]],[],[],[[0,14,"pl-c"],[0,1,"pl-c"]],[[6,7,"pl-k"],[27,52,"pl-c"],[27,28,"pl-c"]],[],[[0,14,"pl-c"],[0,1,"pl-c"]],[[10,11,"pl-k"],[26,27,"pl-c1"],[49,50,"pl-c1"],[52,56,"pl-c1"]],[[15,16,"pl-k"]],[],[[0,39,"pl-c"],[0,1,"pl-c"]],[[15,16,"pl-k"],[31,32,"pl-c1"],[54,55,"pl-c1"],[57,60,"pl-c1"]],[[20,21,"pl-k"],[44,50,"pl-v"],[50,51,"pl-k"]],[[0,3,"pl-s"]],[],[[0,19,"pl-mh"],[4,19,"pl-en"]],[],[[0,3,"pl-s"],[3,9,"pl-en"]],[[0,6,"pl-k"],[16,18,"pl-k"]],[[0,4,"pl-k"],[16,22,"pl-k"]],[],[[0,33,"pl-c"],[0,1,"pl-c"]],[[7,8,"pl-k"]],[[4,7,"pl-v"],[7,8,"pl-k"],[8,11,"pl-c1"]],[[4,13,"pl-v"],[13,14,"pl-k"],[14,15,"pl-c1"]],[[4,14,"pl-v"],[14,15,"pl-k"],[15,16,"pl-c1"]],[[4,14,"pl-v"],[14,15,"pl-k"],[15,20,"pl-c1"]],[[4,14,"pl-v"],[14,15,"pl-k"],[15,18,"pl-c1"]],[[4,15,"pl-v"],[15,16,"pl-k"],[16,19,"pl-c1"]],[[4,25,"pl-v"],[25,26,"pl-k"],[26,28,"pl-c1"]],[[4,21,"pl-v"],[21,22,"pl-k"],[22,23,"pl-c1"]],[],[],[[0,14,"pl-c"],[0,1,"pl-c"]],[[6,7,"pl-k"]],[[29,50,"pl-c"],[29,30,"pl-c"]],[],[[0,14,"pl-c"],[0,1,"pl-c"]],[[10,11,"pl-k"],[30,31,"pl-c1"],[53,54,"pl-c1"],[56,60,"pl-c1"]],[[15,16,"pl-k"]],[[17,35,"pl-c"],[17,18,"pl-c"]],[],[[0,22,"pl-c"],[0,1,"pl-c"]],[[15,16,"pl-k"],[35,36,"pl-c1"],[58,59,"pl-c1"],[61,64,"pl-c1"]],[[20,21,"pl-k"],[44,50,"pl-v"],[50,51,"pl-k"]],[[0,3,"pl-s"]],[],[[0,28,"pl-mh"],[4,28,"pl-en"]],[],[[0,3,"pl-s"],[3,9,"pl-en"]],[[0,9,"pl-c"],[0,1,"pl-c"]],[[0,4,"pl-k"],[12,18,"pl-k"]],[[0,6,"pl-k"]],[],[[7,8,"pl-k"],[22,25,"pl-v"],[25,26,"pl-k"],[26,29,"pl-c1"],[31,48,"pl-v"],[48,49,"pl-k"],[49,50,"pl-c1"]],[[7,8,"pl-k"]],[],[[2,3,"pl-k"],[16,17,"pl-c1"],[19,22,"pl-c1"],[24,27,"pl-c1"]],[[14,15,"pl-k"]],[[16,17,"pl-k"],[28,33,"pl-v"],[33,34,"pl-k"],[42,63,"pl-c"],[42,43,"pl-c"]],[],[[0,5,"pl-c"],[0,1,"pl-c"]],[[0,4,"pl-k"],[16,22,"pl-k"]],[[0,6,"pl-k"],[16,18,"pl-k"]],[],[[7,8,"pl-k"],[22,25,"pl-v"],[25,26,"pl-k"],[26,29,"pl-c1"],[31,48,"pl-v"],[48,49,"pl-k"],[49,50,"pl-c1"]],[[7,8,"pl-k"]],[],[],[[2,3,"pl-k"],[22,23,"pl-c1"],[25,28,"pl-c1"],[30,33,"pl-c1"]],[[14,15,"pl-k"]],[],[[0,3,"pl-s"]],[],[[0,3,"pl-ms"]],[],[[0,14,"pl-mh"],[3,14,"pl-en"]],[],[[0,23,"pl-mh"],[4,23,"pl-en"]],[],[[0,55,"pl-mh"],[5,55,"pl-en"]],[],[],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,34,"pl-c"],[0,1,"pl-c"]],[],[],[],[],[],[],[],[[0,29,"pl-c"],[0,1,"pl-c"]],[],[],[],[],[],[],[],[[0,3,"pl-s"]],[],[[0,52,"pl-mh"],[5,52,"pl-en"]],[],[],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,33,"pl-c"],[0,1,"pl-c"]],[],[],[],[],[],[],[],[],[[0,39,"pl-c"],[0,1,"pl-c"]],[],[],[],[],[],[[0,3,"pl-s"]],[],[[0,18,"pl-mh"],[5,18,"pl-en"]],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,39,"pl-c"],[0,1,"pl-c"]],[],[],[[0,28,"pl-c"],[0,1,"pl-c"]],[],[],[],[],[[0,24,"pl-c"],[0,1,"pl-c"]],[],[],[[0,3,"pl-s"]],[],[[0,29,"pl-mh"],[5,29,"pl-en"]],[],[[0,1,"pl-ml"],[9,10,"pl-ml"],[19,20,"pl-ml"],[33,34,"pl-ml"]],[[0,1,"pl-ml"],[9,10,"pl-ml"],[19,20,"pl-ml"],[33,34,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[22,24,"pl-s"],[25,26,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,10,"pl-c1"],[10,11,"pl-s"],[12,13,"pl-ml"],[14,15,"pl-s"],[15,18,"pl-c1"],[18,19,"pl-s"],[20,21,"pl-ml"],[56,57,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,8,"pl-c1"],[8,9,"pl-s"],[10,11,"pl-ml"],[12,13,"pl-s"],[13,16,"pl-c1"],[16,17,"pl-s"],[18,19,"pl-ml"],[36,37,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[18,19,"pl-s"],[19,20,"pl-c1"],[20,21,"pl-s"],[22,23,"pl-ml"],[40,41,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,20,"pl-s"],[20,22,"pl-c1"],[22,23,"pl-s"],[24,25,"pl-ml"],[43,44,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,20,"pl-s"],[20,25,"pl-c1"],[25,26,"pl-s"],[27,28,"pl-ml"],[45,46,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,20,"pl-s"],[20,23,"pl-c1"],[23,24,"pl-s"],[25,26,"pl-ml"],[46,47,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,16,"pl-c1"],[16,17,"pl-s"],[18,19,"pl-ml"],[20,21,"pl-s"],[21,24,"pl-c1"],[24,25,"pl-s"],[26,27,"pl-ml"],[52,53,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[8,10,"pl-s"],[11,12,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,12,"pl-c1"],[12,13,"pl-s"],[14,15,"pl-ml"],[18,19,"pl-ml"],[57,58,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,19,"pl-c1"],[19,20,"pl-s"],[21,22,"pl-ml"],[25,26,"pl-ml"],[62,63,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,18,"pl-c1"],[18,19,"pl-s"],[20,21,"pl-ml"],[24,25,"pl-ml"],[69,70,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,9,"pl-c1"],[9,10,"pl-s"],[11,12,"pl-ml"],[15,16,"pl-ml"],[38,39,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[18,19,"pl-s"],[19,23,"pl-c1"],[23,24,"pl-s"],[25,26,"pl-ml"],[49,50,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,12,"pl-c1"],[12,13,"pl-s"],[14,15,"pl-ml"],[16,17,"pl-s"],[17,21,"pl-c1"],[21,22,"pl-s"],[23,24,"pl-ml"],[41,42,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[12,14,"pl-s"],[15,16,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,11,"pl-c1"],[11,12,"pl-s"],[13,14,"pl-ml"],[15,16,"pl-s"],[16,17,"pl-c1"],[17,18,"pl-s"],[19,20,"pl-ml"],[38,39,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[18,19,"pl-s"],[19,21,"pl-c1"],[21,22,"pl-s"],[23,24,"pl-ml"],[53,54,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,20,"pl-s"],[20,21,"pl-c1"],[21,22,"pl-s"],[23,24,"pl-ml"],[47,48,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,32,"pl-c1"],[32,33,"pl-s"],[34,35,"pl-ml"],[36,37,"pl-s"],[37,39,"pl-c1"],[39,40,"pl-s"],[41,42,"pl-ml"],[71,72,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,7,"pl-c1"],[7,8,"pl-s"],[9,10,"pl-ml"],[11,12,"pl-s"],[12,16,"pl-c1"],[16,17,"pl-s"],[18,19,"pl-ml"],[34,35,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,17,"pl-c1"],[17,18,"pl-s"],[19,20,"pl-ml"],[21,22,"pl-s"],[22,25,"pl-c1"],[25,26,"pl-s"],[27,28,"pl-ml"],[42,43,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[18,19,"pl-s"],[19,22,"pl-c1"],[22,23,"pl-s"],[24,25,"pl-ml"],[44,45,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,17,"pl-c1"],[17,18,"pl-s"],[19,20,"pl-ml"],[21,22,"pl-s"],[22,26,"pl-c1"],[26,27,"pl-s"],[28,29,"pl-ml"],[43,44,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,20,"pl-c1"],[20,21,"pl-s"],[22,23,"pl-ml"],[24,25,"pl-s"],[25,29,"pl-c1"],[29,30,"pl-s"],[31,32,"pl-ml"],[50,51,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[16,18,"pl-s"],[19,20,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,18,"pl-c1"],[18,19,"pl-s"],[20,21,"pl-ml"],[22,23,"pl-s"],[23,28,"pl-c1"],[28,29,"pl-s"],[30,31,"pl-ml"],[68,69,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,17,"pl-c1"],[17,18,"pl-s"],[19,20,"pl-ml"],[21,22,"pl-s"],[22,29,"pl-c1"],[29,30,"pl-s"],[31,32,"pl-ml"],[72,73,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,27,"pl-c1"],[27,28,"pl-s"],[29,30,"pl-ml"],[31,32,"pl-s"],[32,37,"pl-c1"],[37,38,"pl-s"],[39,40,"pl-ml"],[71,72,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,16,"pl-c1"],[16,17,"pl-s"],[18,19,"pl-ml"],[20,21,"pl-s"],[21,22,"pl-c1"],[22,23,"pl-s"],[24,25,"pl-ml"],[45,46,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[17,19,"pl-s"],[20,21,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,19,"pl-c1"],[19,20,"pl-s"],[21,22,"pl-ml"],[23,24,"pl-s"],[24,36,"pl-c1"],[36,37,"pl-s"],[38,39,"pl-ml"],[61,62,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,20,"pl-s"],[20,24,"pl-c1"],[24,25,"pl-s"],[26,27,"pl-ml"],[47,48,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,20,"pl-s"],[20,23,"pl-c1"],[23,24,"pl-s"],[25,26,"pl-ml"],[46,47,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,11,"pl-c1"],[11,12,"pl-s"],[13,14,"pl-ml"],[17,18,"pl-ml"],[42,43,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[11,13,"pl-s"],[14,15,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[18,19,"pl-s"],[19,21,"pl-c1"],[21,22,"pl-s"],[23,24,"pl-ml"],[43,44,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,10,"pl-c1"],[10,11,"pl-s"],[12,13,"pl-ml"],[14,15,"pl-s"],[15,20,"pl-c1"],[20,21,"pl-s"],[22,23,"pl-ml"],[43,44,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,18,"pl-c1"],[18,19,"pl-s"],[20,21,"pl-ml"],[22,23,"pl-s"],[23,29,"pl-c1"],[29,30,"pl-s"],[31,32,"pl-ml"],[50,51,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,19,"pl-c1"],[19,20,"pl-s"],[21,22,"pl-ml"],[25,26,"pl-ml"],[40,41,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,9,"pl-c1"],[9,10,"pl-s"],[11,12,"pl-ml"],[13,14,"pl-s"],[14,16,"pl-c1"],[16,17,"pl-s"],[18,19,"pl-ml"],[32,33,"pl-ml"]],[],[[0,23,"pl-mh"],[5,23,"pl-en"]],[],[],[],[[0,1,"pl-v"],[2,4,"pl-s"],[18,20,"pl-s"]],[[0,1,"pl-v"],[2,4,"pl-s"],[19,21,"pl-s"]],[[0,1,"pl-v"],[2,4,"pl-s"],[15,17,"pl-s"]],[[0,1,"pl-v"],[2,4,"pl-s"],[19,21,"pl-s"]],[[0,1,"pl-v"],[2,4,"pl-s"],[26,28,"pl-s"]],[],[[0,36,"pl-mh"],[4,36,"pl-en"]],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,40,"pl-c"],[0,1,"pl-c"]],[],[],[],[],[[0,30,"pl-c"],[0,1,"pl-c"]],[],[],[[0,3,"pl-s"]],[],[[0,19,"pl-mh"],[4,19,"pl-en"]],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,26,"pl-c"],[0,1,"pl-c"]],[],[],[[0,24,"pl-c"],[0,1,"pl-c"]],[],[],[],[],[],[[0,15,"pl-c"],[0,1,"pl-c"]],[],[],[],[],[],[],[],[[0,23,"pl-c"],[0,1,"pl-c"]],[],[],[],[[0,24,"pl-c"],[0,1,"pl-c"]],[],[],[[0,3,"pl-s"]],[],[[0,25,"pl-mh"],[5,25,"pl-en"]],[],[[0,1,"pl-ml"],[9,10,"pl-ml"],[19,20,"pl-ml"],[33,34,"pl-ml"]],[[0,1,"pl-ml"],[9,10,"pl-ml"],[19,20,"pl-ml"],[33,34,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[22,24,"pl-s"],[25,26,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,10,"pl-c1"],[10,11,"pl-s"],[12,13,"pl-ml"],[14,15,"pl-s"],[15,18,"pl-c1"],[18,19,"pl-s"],[20,21,"pl-ml"],[56,57,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,8,"pl-c1"],[8,9,"pl-s"],[10,11,"pl-ml"],[12,13,"pl-s"],[13,16,"pl-c1"],[16,17,"pl-s"],[18,19,"pl-ml"],[36,37,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[18,19,"pl-s"],[19,20,"pl-c1"],[20,21,"pl-s"],[22,23,"pl-ml"],[40,41,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,20,"pl-s"],[20,22,"pl-c1"],[22,23,"pl-s"],[24,25,"pl-ml"],[43,44,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,20,"pl-s"],[20,25,"pl-c1"],[25,26,"pl-s"],[27,28,"pl-ml"],[45,46,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,20,"pl-s"],[20,23,"pl-c1"],[23,24,"pl-s"],[25,26,"pl-ml"],[46,47,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,16,"pl-c1"],[16,17,"pl-s"],[18,19,"pl-ml"],[20,21,"pl-s"],[21,24,"pl-c1"],[24,25,"pl-s"],[26,27,"pl-ml"],[52,53,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[8,10,"pl-s"],[11,12,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,12,"pl-c1"],[12,13,"pl-s"],[14,15,"pl-ml"],[18,19,"pl-ml"],[57,58,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,19,"pl-c1"],[19,20,"pl-s"],[21,22,"pl-ml"],[25,26,"pl-ml"],[62,63,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,9,"pl-c1"],[9,10,"pl-s"],[11,12,"pl-ml"],[15,16,"pl-ml"],[38,39,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[18,19,"pl-s"],[19,23,"pl-c1"],[23,24,"pl-s"],[25,26,"pl-ml"],[49,50,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,12,"pl-c1"],[12,13,"pl-s"],[14,15,"pl-ml"],[16,17,"pl-s"],[17,21,"pl-c1"],[21,22,"pl-s"],[23,24,"pl-ml"],[41,42,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[12,14,"pl-s"],[15,16,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,11,"pl-c1"],[11,12,"pl-s"],[13,14,"pl-ml"],[15,16,"pl-s"],[16,17,"pl-c1"],[17,18,"pl-s"],[19,20,"pl-ml"],[38,39,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[18,19,"pl-s"],[19,21,"pl-c1"],[21,22,"pl-s"],[23,24,"pl-ml"],[53,54,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,20,"pl-s"],[20,21,"pl-c1"],[21,22,"pl-s"],[23,24,"pl-ml"],[36,37,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,32,"pl-c1"],[32,33,"pl-s"],[34,35,"pl-ml"],[36,37,"pl-s"],[37,39,"pl-c1"],[39,40,"pl-s"],[41,42,"pl-ml"],[71,72,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,7,"pl-c1"],[7,8,"pl-s"],[9,10,"pl-ml"],[11,12,"pl-s"],[12,16,"pl-c1"],[16,17,"pl-s"],[18,19,"pl-ml"],[34,35,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,17,"pl-c1"],[17,18,"pl-s"],[19,20,"pl-ml"],[21,22,"pl-s"],[22,25,"pl-c1"],[25,26,"pl-s"],[27,28,"pl-ml"],[42,43,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[18,19,"pl-s"],[19,22,"pl-c1"],[22,23,"pl-s"],[24,25,"pl-ml"],[44,45,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,17,"pl-c1"],[17,18,"pl-s"],[19,20,"pl-ml"],[21,22,"pl-s"],[22,26,"pl-c1"],[26,27,"pl-s"],[28,29,"pl-ml"],[43,44,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,10,"pl-c1"],[10,11,"pl-s"],[12,13,"pl-ml"],[14,15,"pl-s"],[15,22,"pl-c1"],[22,23,"pl-s"],[24,25,"pl-ml"],[53,54,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[17,19,"pl-s"],[20,21,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,19,"pl-c1"],[19,20,"pl-s"],[21,22,"pl-ml"],[23,24,"pl-s"],[24,40,"pl-c1"],[40,41,"pl-s"],[42,43,"pl-ml"],[65,66,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,20,"pl-s"],[20,24,"pl-c1"],[24,25,"pl-s"],[26,27,"pl-ml"],[47,48,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,20,"pl-s"],[20,23,"pl-c1"],[23,24,"pl-s"],[25,26,"pl-ml"],[46,47,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,11,"pl-c1"],[11,12,"pl-s"],[13,14,"pl-ml"],[17,18,"pl-ml"],[57,58,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[11,13,"pl-s"],[14,15,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[18,19,"pl-s"],[19,21,"pl-c1"],[21,22,"pl-s"],[23,24,"pl-ml"],[43,44,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,10,"pl-c1"],[10,11,"pl-s"],[12,13,"pl-ml"],[14,15,"pl-s"],[15,20,"pl-c1"],[20,21,"pl-s"],[22,23,"pl-ml"],[43,44,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,18,"pl-c1"],[18,19,"pl-s"],[20,21,"pl-ml"],[22,23,"pl-s"],[23,33,"pl-c1"],[33,34,"pl-s"],[35,36,"pl-ml"],[54,55,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,19,"pl-c1"],[19,20,"pl-s"],[21,22,"pl-ml"],[25,26,"pl-ml"],[40,41,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,9,"pl-c1"],[9,10,"pl-s"],[11,12,"pl-ml"],[13,14,"pl-s"],[14,16,"pl-c1"],[16,17,"pl-s"],[18,19,"pl-ml"],[32,33,"pl-ml"]],[],[[0,3,"pl-ms"]],[],[[0,12,"pl-mh"],[3,12,"pl-en"]],[],[[0,21,"pl-mh"],[4,21,"pl-en"]],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,15,"pl-c"],[0,1,"pl-c"]],[],[],[[13,31,"pl-s"],[13,14,"pl-pds"],[30,31,"pl-pds"]],[],[],[[0,18,"pl-c"],[0,1,"pl-c"]],[],[],[],[],[[0,26,"pl-c"],[0,1,"pl-c"]],[],[],[[13,37,"pl-s"],[13,14,"pl-pds"],[36,37,"pl-pds"]],[],[],[],[],[[0,19,"pl-c"],[0,1,"pl-c"]],[],[],[[13,20,"pl-s"],[13,14,"pl-pds"],[19,20,"pl-pds"]],[],[[0,3,"pl-s"]],[],[[0,30,"pl-mh"],[5,30,"pl-en"]],[],[[0,1,"pl-ml"],[9,10,"pl-ml"],[19,20,"pl-ml"],[33,34,"pl-ml"]],[[0,1,"pl-ml"],[9,10,"pl-ml"],[19,20,"pl-ml"],[33,34,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,21,"pl-s"],[29,31,"pl-s"],[32,33,"pl-ml"],[65,66,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[18,19,"pl-s"],[19,23,"pl-c1"],[23,24,"pl-s"],[25,26,"pl-ml"],[49,50,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,11,"pl-c1"],[11,12,"pl-s"],[13,14,"pl-ml"],[17,18,"pl-ml"],[32,33,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,20,"pl-s"],[20,23,"pl-c1"],[23,24,"pl-s"],[25,26,"pl-ml"],[50,51,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,16,"pl-c1"],[16,17,"pl-s"],[18,19,"pl-ml"],[20,21,"pl-s"],[21,24,"pl-c1"],[24,25,"pl-s"],[26,27,"pl-ml"],[49,50,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,10,"pl-c1"],[10,11,"pl-s"],[12,13,"pl-ml"],[14,15,"pl-s"],[15,17,"pl-c1"],[17,18,"pl-s"],[19,20,"pl-ml"],[36,37,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,10,"pl-c1"],[10,11,"pl-s"],[12,13,"pl-ml"],[14,15,"pl-s"],[15,18,"pl-c1"],[18,19,"pl-s"],[20,21,"pl-ml"],[47,48,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,23,"pl-c1"],[23,24,"pl-s"],[25,26,"pl-ml"],[27,28,"pl-s"],[28,31,"pl-c1"],[31,32,"pl-s"],[33,34,"pl-ml"],[54,55,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,16,"pl-c1"],[16,17,"pl-s"],[18,19,"pl-ml"],[20,21,"pl-s"],[21,26,"pl-c1"],[26,27,"pl-s"],[28,29,"pl-ml"],[47,48,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,11,"pl-c1"],[11,12,"pl-s"],[13,14,"pl-ml"],[15,16,"pl-s"],[16,21,"pl-c1"],[21,22,"pl-s"],[23,24,"pl-ml"],[54,55,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,13,"pl-c1"],[13,14,"pl-s"],[15,16,"pl-ml"],[19,20,"pl-ml"],[52,53,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,11,"pl-c1"],[11,12,"pl-s"],[13,14,"pl-ml"],[15,16,"pl-s"],[16,20,"pl-c1"],[20,21,"pl-s"],[22,23,"pl-ml"],[53,54,"pl-ml"]],[],[[0,17,"pl-mh"],[4,17,"pl-en"]],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,15,"pl-c"],[0,1,"pl-c"]],[],[],[[13,31,"pl-s"],[13,14,"pl-pds"],[30,31,"pl-pds"]],[],[],[[0,18,"pl-c"],[0,1,"pl-c"]],[],[],[],[],[[0,33,"pl-c"],[0,1,"pl-c"]],[],[],[[13,20,"pl-s"],[13,14,"pl-pds"],[19,20,"pl-pds"]],[],[],[[0,3,"pl-s"]],[],[[0,26,"pl-mh"],[5,26,"pl-en"]],[],[[0,1,"pl-ml"],[9,10,"pl-ml"],[19,20,"pl-ml"],[33,34,"pl-ml"]],[[0,1,"pl-ml"],[9,10,"pl-ml"],[19,20,"pl-ml"],[33,34,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,21,"pl-s"],[29,31,"pl-s"],[32,33,"pl-ml"],[74,75,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[18,19,"pl-s"],[19,23,"pl-c1"],[23,24,"pl-s"],[25,26,"pl-ml"],[49,50,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,11,"pl-c1"],[11,12,"pl-s"],[13,14,"pl-ml"],[17,18,"pl-ml"],[32,33,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[19,20,"pl-s"],[20,23,"pl-c1"],[23,24,"pl-s"],[25,26,"pl-ml"],[50,51,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,16,"pl-c1"],[16,17,"pl-s"],[18,19,"pl-ml"],[20,21,"pl-s"],[21,24,"pl-c1"],[24,25,"pl-s"],[26,27,"pl-ml"],[49,50,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,10,"pl-c1"],[10,11,"pl-s"],[12,13,"pl-ml"],[14,15,"pl-s"],[15,17,"pl-c1"],[17,18,"pl-s"],[19,20,"pl-ml"],[36,37,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,10,"pl-c1"],[10,11,"pl-s"],[12,13,"pl-ml"],[14,15,"pl-s"],[15,18,"pl-c1"],[18,19,"pl-s"],[20,21,"pl-ml"],[47,48,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,23,"pl-c1"],[23,24,"pl-s"],[25,26,"pl-ml"],[27,28,"pl-s"],[28,31,"pl-c1"],[31,32,"pl-s"],[33,34,"pl-ml"],[54,55,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,16,"pl-c1"],[16,17,"pl-s"],[18,19,"pl-ml"],[20,21,"pl-s"],[21,26,"pl-c1"],[26,27,"pl-s"],[28,29,"pl-ml"],[47,48,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,11,"pl-c1"],[11,12,"pl-s"],[13,14,"pl-ml"],[15,16,"pl-s"],[16,21,"pl-c1"],[21,22,"pl-s"],[23,24,"pl-ml"],[54,55,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,13,"pl-c1"],[13,14,"pl-s"],[15,16,"pl-ml"],[19,20,"pl-ml"],[47,48,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[18,19,"pl-s"],[19,24,"pl-c1"],[24,25,"pl-s"],[26,27,"pl-ml"],[53,54,"pl-ml"]],[],[[0,3,"pl-ms"]],[],[[0,13,"pl-mh"],[3,13,"pl-en"]],[],[[0,42,"pl-mh"],[4,42,"pl-en"]],[],[[0,2,"pl-s"],[45,47,"pl-s"]],[],[[0,1,"pl-ml"],[8,9,"pl-ml"],[21,22,"pl-ml"],[38,39,"pl-ml"]],[[0,1,"pl-ml"],[8,9,"pl-ml"],[21,22,"pl-ml"],[38,39,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[14,15,"pl-ml"],[22,23,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[8,10,"pl-s"],[15,17,"pl-s"],[18,19,"pl-ml"],[20,22,"pl-s"],[27,29,"pl-s"],[30,31,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[14,15,"pl-ml"],[22,23,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[14,15,"pl-ml"],[22,23,"pl-ml"]],[],[[0,2,"pl-s"],[35,37,"pl-s"]],[],[[0,1,"pl-ml"],[8,9,"pl-ml"],[21,22,"pl-ml"]],[[0,1,"pl-ml"],[8,9,"pl-ml"],[21,22,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[8,10,"pl-s"],[15,17,"pl-s"],[18,19,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[14,15,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[14,15,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[14,15,"pl-ml"]],[],[[0,34,"pl-mh"],[4,34,"pl-en"]],[],[],[],[[0,1,"pl-ml"],[8,9,"pl-ml"],[19,20,"pl-ml"],[38,39,"pl-ml"],[57,58,"pl-ml"],[78,79,"pl-ml"]],[[0,1,"pl-ml"],[8,9,"pl-ml"],[19,20,"pl-ml"],[38,39,"pl-ml"],[57,58,"pl-ml"],[77,78,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[8,10,"pl-s"],[15,17,"pl-s"],[18,19,"pl-ml"],[26,27,"pl-ml"],[34,35,"pl-ml"],[36,38,"pl-s"],[43,45,"pl-s"],[46,47,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[8,10,"pl-s"],[14,16,"pl-s"],[17,18,"pl-ml"],[25,26,"pl-ml"],[33,34,"pl-ml"],[35,37,"pl-s"],[42,44,"pl-s"],[45,46,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[8,10,"pl-s"],[14,16,"pl-s"],[17,18,"pl-ml"],[25,26,"pl-ml"],[33,34,"pl-ml"],[35,37,"pl-s"],[42,44,"pl-s"],[45,46,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[8,10,"pl-s"],[14,16,"pl-s"],[17,18,"pl-ml"],[25,26,"pl-ml"],[33,34,"pl-ml"],[35,37,"pl-s"],[42,44,"pl-s"],[45,46,"pl-ml"]],[],[[0,2,"pl-s"],[71,73,"pl-s"]],[],[[0,20,"pl-mh"],[4,20,"pl-en"]],[],[],[],[[0,1,"pl-ml"],[8,9,"pl-ml"],[25,26,"pl-ml"]],[[0,1,"pl-ml"],[8,9,"pl-ml"],[24,25,"pl-ml"]],[[0,1,"pl-ml"],[9,10,"pl-ml"],[18,19,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[15,16,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[15,16,"pl-ml"]],[[0,1,"pl-ml"],[6,7,"pl-ml"],[15,16,"pl-ml"]],[],[[0,3,"pl-ms"]],[],[[0,26,"pl-mh"],[3,26,"pl-en"]],[],[[0,27,"pl-mh"],[4,27,"pl-en"]],[],[[0,1,"pl-ml"],[12,13,"pl-ml"],[22,23,"pl-ml"],[36,37,"pl-ml"],[54,55,"pl-ml"]],[[0,1,"pl-ml"],[12,13,"pl-ml"],[22,23,"pl-ml"],[36,37,"pl-ml"],[54,55,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[22,24,"pl-s"],[25,26,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,6,"pl-c1"],[6,7,"pl-s"],[8,9,"pl-ml"],[14,15,"pl-ml"],[39,40,"pl-ml"],[43,44,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,12,"pl-c1"],[12,13,"pl-s"],[14,15,"pl-ml"],[18,19,"pl-ml"],[46,47,"pl-ml"],[50,51,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,13,"pl-c1"],[13,14,"pl-s"],[15,16,"pl-ml"],[20,21,"pl-ml"],[46,47,"pl-ml"],[58,59,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,13,"pl-c1"],[13,14,"pl-s"],[15,16,"pl-ml"],[23,24,"pl-ml"],[41,42,"pl-ml"],[45,46,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[23,24,"pl-ml"],[49,50,"pl-ml"],[53,54,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[10,12,"pl-s"],[13,14,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,20,"pl-c1"],[20,21,"pl-s"],[22,23,"pl-ml"],[26,27,"pl-ml"],[56,57,"pl-ml"],[70,71,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,21,"pl-c1"],[21,22,"pl-s"],[23,24,"pl-ml"],[29,30,"pl-ml"],[60,61,"pl-ml"],[64,65,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,12,"pl-c1"],[12,13,"pl-s"],[14,15,"pl-ml"],[20,21,"pl-ml"],[57,58,"pl-ml"],[66,67,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,18,"pl-c1"],[18,19,"pl-s"],[20,21,"pl-ml"],[26,27,"pl-ml"],[58,59,"pl-ml"],[67,68,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,15,"pl-c1"],[15,16,"pl-s"],[17,18,"pl-ml"],[24,25,"pl-ml"],[58,59,"pl-ml"],[67,68,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[13,15,"pl-s"],[16,17,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,24,"pl-c1"],[24,25,"pl-s"],[26,27,"pl-ml"],[31,32,"pl-ml"],[64,65,"pl-ml"],[73,74,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,13,"pl-c1"],[13,14,"pl-s"],[15,16,"pl-ml"],[21,22,"pl-ml"],[44,45,"pl-ml"],[58,59,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,14,"pl-c1"],[14,15,"pl-s"],[16,17,"pl-ml"],[22,23,"pl-ml"],[51,52,"pl-ml"],[69,70,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[24,26,"pl-s"],[27,28,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,11,"pl-c1"],[11,12,"pl-s"],[13,14,"pl-ml"],[20,21,"pl-ml"],[47,48,"pl-ml"],[61,62,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,19,"pl-c1"],[19,20,"pl-s"],[21,22,"pl-ml"],[25,26,"pl-ml"],[51,52,"pl-ml"],[65,66,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,11,"pl-c1"],[11,12,"pl-s"],[13,14,"pl-ml"],[20,21,"pl-ml"],[49,50,"pl-ml"],[53,54,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,13,"pl-c1"],[13,14,"pl-s"],[15,16,"pl-ml"],[24,25,"pl-ml"],[46,47,"pl-ml"],[60,61,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,10,"pl-c1"],[10,11,"pl-s"],[12,13,"pl-ml"],[18,19,"pl-ml"],[33,34,"pl-ml"],[37,38,"pl-ml"]],[[0,1,"pl-ml"],[2,4,"pl-s"],[7,9,"pl-s"],[10,11,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,11,"pl-c1"],[11,12,"pl-s"],[13,14,"pl-ml"],[19,20,"pl-ml"],[47,48,"pl-ml"],[51,52,"pl-ml"]],[[0,1,"pl-ml"],[2,3,"pl-s"],[3,11,"pl-c1"],[11,12,"pl-s"],[13,14,"pl-ml"],[20,21,"pl-ml"],[48,49,"pl-ml"],[52,53,"pl-ml"]],[],[[0,3,"pl-ms"]],[],[[0,16,"pl-mh"],[3,16,"pl-en"]],[],[[0,15,"pl-mh"],[4,15,"pl-en"]],[],[[0,3,"pl-s"],[3,9,"pl-en"]],[[0,4,"pl-k"],[12,18,"pl-k"]],[[4,19,"pl-c"],[4,5,"pl-c"]],[],[],[[4,12,"pl-c"],[4,5,"pl-c"]],[],[],[],[],[],[[4,16,"pl-c"],[4,5,"pl-c"]],[],[],[],[],[],[],[],[[0,25,"pl-c"],[0,1,"pl-c"]],[[15,16,"pl-k"],[34,40,"pl-v"],[40,41,"pl-k"],[41,45,"pl-c1"]],[[0,41,"pl-c"],[0,1,"pl-c"]],[[0,38,"pl-c"],[0,1,"pl-c"]],[[0,58,"pl-c"],[0,1,"pl-c"]],[],[[0,26,"pl-c"],[0,1,"pl-c"]],[[14,15,"pl-k"],[26,31,"pl-v"],[31,32,"pl-k"],[32,36,"pl-c1"],[38,50,"pl-v"],[50,51,"pl-k"],[51,55,"pl-c1"]],[[0,26,"pl-c"],[0,1,"pl-c"]],[[0,29,"pl-c"],[0,1,"pl-c"]],[[0,50,"pl-c"],[0,1,"pl-c"]],[[0,3,"pl-s"]],[],[[0,11,"pl-mh"],[4,11,"pl-en"]],[],[[0,3,"pl-s"],[3,9,"pl-en"]],[[0,4,"pl-k"],[16,22,"pl-k"]],[[4,19,"pl-c"],[4,5,"pl-c"]],[],[],[[4,12,"pl-c"],[4,5,"pl-c"]],[],[],[],[],[],[[4,16,"pl-c"],[4,5,"pl-c"]],[],[],[],[],[],[],[[4,19,"pl-c"],[4,5,"pl-c"]],[[24,47,"pl-c"],[24,25,"pl-c"]],[],[],[],[[4,39,"pl-c"],[4,5,"pl-c"]],[],[],[],[],[[0,3,"pl-s"]],[],[[0,3,"pl-ms"]],[],[[0,20,"pl-mh"],[3,20,"pl-en"]],[],[[0,24,"pl-mh"],[4,24,"pl-en"]],[],[[28,30,"pl-s"],[50,52,"pl-s"],[64,65,"pl-s"],[65,72,"pl-c1"],[72,73,"pl-s"]],[],[[0,3,"pl-s"],[3,9,"pl-en"]],[[0,66,"pl-c"],[0,1,"pl-c"]],[[0,47,"pl-c"],[0,1,"pl-c"]],[[0,26,"pl-c"],[0,1,"pl-c"]],[],[[11,12,"pl-k"],[38,39,"pl-k"],[39,40,"pl-c1"],[43,57,"pl-c"],[43,44,"pl-c"]],[[9,10,"pl-k"],[34,35,"pl-k"],[35,36,"pl-c1"],[43,56,"pl-c"],[43,44,"pl-c"]],[[7,8,"pl-k"],[22,23,"pl-k"],[43,58,"pl-c"],[43,44,"pl-c"]],[[0,3,"pl-s"]],[],[[27,29,"pl-s"],[39,41,"pl-s"]],[],[[0,23,"pl-mh"],[4,23,"pl-en"]],[],[[0,1,"pl-s"],[1,11,"pl-c1"],[11,12,"pl-s"]],[],[[0,1,"pl-s"],[1,2,"pl-v"],[3,5,"pl-s"],[16,18,"pl-s"]],[[0,1,"pl-s"],[1,2,"pl-v"],[3,5,"pl-s"],[18,20,"pl-s"]],[[0,1,"pl-s"],[1,2,"pl-v"],[3,5,"pl-s"],[18,20,"pl-s"]],[],[],[],[[0,17,"pl-mh"],[4,17,"pl-en"]],[],[[39,41,"pl-s"],[51,53,"pl-s"]],[],[[0,1,"pl-ml"],[12,13,"pl-ml"],[27,28,"pl-ml"],[40,41,"pl-ml"],[50,51,"pl-ml"]],[[0,1,"pl-ml"],[12,13,"pl-ml"],[27,28,"pl-ml"],[40,41,"pl-ml"],[50,51,"pl-ml"]],[[0,1,"pl-ml"],[12,13,"pl-ml"],[21,22,"pl-ml"],[30,31,"pl-ml"],[46,47,"pl-ml"]],[[0,1,"pl-ml"],[16,17,"pl-ml"],[25,26,"pl-ml"],[34,35,"pl-ml"],[36,37,"pl-s"],[43,44,"pl-ml"]],[[0,1,"pl-ml"],[7,8,"pl-ml"],[16,17,"pl-ml"],[25,26,"pl-ml"],[27,28,"pl-s"],[34,35,"pl-ml"]],[],[],[],[[0,25,"pl-mh"],[4,25,"pl-en"]],[],[[0,3,"pl-s"],[3,9,"pl-en"]],[[0,6,"pl-k"],[16,18,"pl-k"]],[[0,4,"pl-k"],[16,22,"pl-k"]],[],[[0,39,"pl-c"],[0,1,"pl-c"]],[[0,58,"pl-c"],[0,1,"pl-c"]],[],[[0,39,"pl-c"],[0,1,"pl-c"]],[[6,7,"pl-k"]],[],[],[[0,33,"pl-c"],[0,1,"pl-c"]],[[15,16,"pl-k"]],[[17,36,"pl-c"],[17,18,"pl-c"]],[],[[0,44,"pl-c"],[0,1,"pl-c"]],[[0,36,"pl-c"],[0,1,"pl-c"]],[],[[0,47,"pl-c"],[0,1,"pl-c"]],[[7,8,"pl-k"],[22,25,"pl-c1"],[27,35,"pl-v"],[35,36,"pl-k"],[36,41,"pl-c1"]],[[0,3,"pl-s"]],[],[[0,3,"pl-ms"]],[],[[0,18,"pl-mh"],[3,18,"pl-en"]],[],[[0,17,"pl-mh"],[4,17,"pl-en"]],[],[[0,12,"pl-mh"],[5,12,"pl-en"]],[],[[0,2,"pl-s"],[7,9,"pl-s"]],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,48,"pl-c"],[0,1,"pl-c"]],[],[[0,3,"pl-s"]],[],[[0,2,"pl-s"],[7,9,"pl-s"]],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,51,"pl-c"],[0,1,"pl-c"]],[],[[0,3,"pl-s"]],[],[[0,8,"pl-mh"],[5,8,"pl-en"]],[],[[0,2,"pl-s"],[7,9,"pl-s"],[11,12,"pl-s"],[12,37,"pl-c1"],[37,38,"pl-s"]],[[0,3,"pl-s"],[3,9,"pl-en"]],[[0,21,"pl-c"],[0,1,"pl-c"]],[[7,8,"pl-k"],[22,25,"pl-c1"],[27,35,"pl-v"],[35,36,"pl-k"],[36,41,"pl-c1"]],[[0,3,"pl-s"]],[],[[0,2,"pl-s"],[7,9,"pl-s"]],[[0,3,"pl-s"],[3,9,"pl-en"]],[[0,37,"pl-c"],[0,1,"pl-c"]],[[0,38,"pl-c"],[0,1,"pl-c"]],[[0,3,"pl-s"]],[],[[0,2,"pl-s"],[7,9,"pl-s"]],[[0,3,"pl-s"],[3,9,"pl-en"]],[[0,26,"pl-c"],[0,1,"pl-c"]],[[0,6,"pl-k"]],[],[[24,38,"pl-c"],[24,25,"pl-c"]],[[0,3,"pl-s"]],[],[[0,25,"pl-mh"],[4,25,"pl-en"]],[],[],[[0,1,"pl-v"]],[[0,1,"pl-v"]],[[0,1,"pl-v"]],[],[],[],[[0,3,"pl-ms"]],[],[[0,14,"pl-mh"],[3,14,"pl-en"]],[],[[0,21,"pl-mh"],[4,21,"pl-en"]],[],[[0,3,"pl-s"],[3,3,"pl-c1"]],[[0,15,"pl-c1"]],[[0,8,"pl-c1"]],[[0,56,"pl-c1"]],[[0,23,"pl-c1"]],[[0,46,"pl-c1"]],[[0,57,"pl-c1"]],[[0,51,"pl-c1"]],[[0,51,"pl-c1"]],[[0,52,"pl-c1"]],[[0,54,"pl-c1"]],[[0,5,"pl-c1"]],[[0,52,"pl-c1"]],[[0,23,"pl-c1"]],[[0,21,"pl-c1"]],[[0,21,"pl-c1"]],[[0,24,"pl-c1"]],[[0,25,"pl-c1"]],[[0,21,"pl-c1"]],[[0,51,"pl-c1"]],[[0,47,"pl-c1"]],[[0,1,"pl-c1"]],[[0,12,"pl-c1"]],[[0,62,"pl-c1"]],[[0,65,"pl-c1"]],[[0,46,"pl-c1"]],[[0,58,"pl-c1"]],[[0,51,"pl-c1"]],[[0,47,"pl-c1"]],[[0,1,"pl-c1"]],[[0,10,"pl-c1"]],[[0,22,"pl-c1"]],[[0,25,"pl-c1"]],[[0,22,"pl-c1"]],[[0,26,"pl-c1"]],[[0,50,"pl-c1"]],[[0,1,"pl-c1"]],[[0,13,"pl-c1"]],[[0,22,"pl-c1"]],[[0,24,"pl-c1"]],[[0,1,"pl-c1"]],[[0,18,"pl-c1"]],[[0,0,"pl-c1"],[0,3,"pl-s"]],[],[[0,17,"pl-mh"],[4,17,"pl-en"]],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,11,"pl-c"],[0,1,"pl-c"]],[],[],[[0,20,"pl-c"],[0,1,"pl-c"]],[],[],[[0,15,"pl-c"],[0,1,"pl-c"]],[],[[0,3,"pl-s"]],[],[[0,11,"pl-mh"],[4,11,"pl-en"]],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[],[],[[0,3,"pl-s"]],[],[[0,3,"pl-ms"]],[],[[0,11,"pl-mh"],[3,11,"pl-en"]],[],[[0,3,"pl-s"],[3,9,"pl-en"],[9,9,"pl-c1"]],[[0,27,"pl-c1"]],[[0,52,"pl-c1"]],[[0,62,"pl-c1"]],[[0,44,"pl-c1"]],[[0,13,"pl-c1"]],[[0,1,"pl-c1"]],[[0,0,"pl-c1"]],[[0,26,"pl-c1"]],[[0,109,"pl-c1"]],[[0,76,"pl-c1"]],[[0,44,"pl-c1"]],[[0,13,"pl-c1"]],[[0,1,"pl-c1"]],[[0,0,"pl-c1"],[0,3,"pl-s"]],[],[[0,3,"pl-ms"]],[],[[0,10,"pl-mh"],[3,10,"pl-en"]],[],[],[],[]],"colorizedLines":null}},"title":"titans-pytorch-mlx/README.md at main · Aedelon/titans-pytorch-mlx","appPayload":{},"meta":{"title":"titans-pytorch-mlx/README.md at main · Aedelon/titans-pytorch-mlx"}}</script>
  <div data-target="react-app.reactRoot"><meta name="github-code-view-meta-stats" id="github-code-view-meta-stats" data-hydrostats="publish"/> <!-- --> <a hidden="" id="code-view-repo-link" href="/Aedelon/titans-pytorch-mlx" data-discover="true"></a> <div class="d-none"></div><div><div style="--spacing:var(--spacing-none)" class="prc-PageLayout-PageLayoutRoot--KH-d" data-component="SplitPageLayout" data-has-sidebar="true"><div class="prc-PageLayout-SidebarWrapper-kLG4B CopilotSidePanelSidebar-module__SidePanel__L3O0C CopilotSidePanelSidebar-module__HiddenSidePanel__TBRGn" style="--spacing-column:var(--spacing-none)" data-is-hidden="false" data-position="end" data-sticky="true" data-responsive-variant="fullscreen"><div class="prc-PageLayout-VerticalDivider-9QRmK prc-PageLayout-SidebarVerticalDivider-0Rl0V" data-component="PageLayout.VerticalDivider" data-variant="line" data-position="end" style="--spacing:var(--spacing-none)"><div class="prc-PageLayout-DraggableHandle-9s6B4" data-component="PageLayout.DragHandle" role="slider" aria-label="Draggable pane splitter" aria-valuemin="450" aria-valuemax="768" aria-valuenow="544" aria-valuetext="Pane width 544 pixels" tabindex="0"></div></div><div class="prc-PageLayout-Sidebar-iciWg" data-component="SplitPageLayout.Sidebar" data-resizable="true" style="--spacing:var(--spacing-normal);--pane-min-width:450px;--pane-max-width:768px;--pane-width-custom:544px;--pane-width-size:var(--pane-width-custom);--pane-width:544px"><div class="height-full" data-testid="copilot-code-view-side-panel"><div id="copilot-side-panel-content" class="height-full"></div></div></div></div><div class="prc-PageLayout-PageLayoutWrapper-2BhU2" data-width="full"><div class="prc-PageLayout-PageLayoutContent-BneH9"><div id="repos-file-tree-sidebar" class="CodeViewFileTreeLayout-module__sidebar__n_Aau" tabindex="0"><div class="prc-PageLayout-PaneWrapper-pHPop ReposFileTreePane-module__Pane__rBZpI ReposFileTreePane-module__HideTree__AYZnm ReposFileTreePane-module__HidePane__VHAVt" style="--offset-header:0px;--spacing-row:var(--spacing-none);--spacing-column:var(--spacing-none)" data-is-hidden="false" data-position="start" data-sticky="true"><div class="prc-PageLayout-HorizontalDivider-JLVqp prc-PageLayout-PaneHorizontalDivider-9tbnE" data-component="PageLayout.HorizontalDivider" data-variant-regular="none" data-variant-narrow="none" data-position="start" style="--spacing-divider:var(--spacing-none);--spacing:var(--spacing-none)"></div><div class="prc-PageLayout-Pane-AyzHK" data-component="SplitPageLayout.Pane" data-resizable="true" style="--spacing:var(--spacing-none);--pane-min-width:256px;--pane-max-width:calc(100vw - var(--pane-max-width-diff));--pane-width-size:var(--pane-width-large);--pane-width:320px"></div><div class="prc-PageLayout-VerticalDivider-9QRmK prc-PageLayout-PaneVerticalDivider-le57g" data-component="PageLayout.VerticalDivider" data-variant-narrow="none" data-variant-regular="line" data-variant-wide="line" data-position="start" style="--spacing:var(--spacing-none)"><div class="prc-PageLayout-DraggableHandle-9s6B4" data-component="PageLayout.DragHandle" role="slider" aria-label="Draggable pane splitter" aria-valuemin="256" aria-valuemax="600" aria-valuenow="320" aria-valuetext="Pane width 320 pixels" tabindex="0"></div></div></div></div><div data-component="SplitPageLayout.Content" class="prc-PageLayout-ContentWrapper-gR9eG"><div class="prc-PageLayout-Content-xWL-A" data-width="full" style="--spacing:var(--spacing-none)"><div class="SharedPageLayout-module__content__IwGAp" data-selector="repos-split-pane-content" id="repos-split-pane-content" tabindex="0"> <!-- --> <div class="container CodeViewHeader-module__Box__JkPOb"><div class="CodeViewHeader-module__StickyHeader__Qn7UN" id="StickyHeader"><div class="CodeViewHeader-module__Box_1__SbNDV"><div class="CodeViewHeader-module__Box_2__TB46f"><div class="react-code-view-header-wrap--narrow CodeViewHeader-module__Box_3__q1zUL"><div class="CodeViewHeader-module__treeToggleWrapper__RQ__9"><h2 class="use-tree-pane-module__Heading__s4QbZ prc-Heading-Heading-MtWFE" data-component="Heading"><button data-component="Button" type="button" aria-label="Expand file tree" data-testid="expand-file-tree-button-mobile" class="prc-Button-ButtonBase-9n-Xk ExpandFileTreeButton-module__Button_1__Svs95" data-loading="false" data-size="medium" data-variant="invisible"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="leadingVisual" class="prc-Button-Visual-YNt2F prc-Button-LeadingVisual-UySKu prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-arrow-left" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M7.78 12.53a.75.75 0 0 1-1.06 0L2.47 8.28a.75.75 0 0 1 0-1.06l4.25-4.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L4.81 7h7.44a.75.75 0 0 1 0 1.5H4.81l2.97 2.97a.75.75 0 0 1 0 1.06Z"></path></svg></span><span data-component="text" class="prc-Button-Label-FWkx3">Files</span></span></button><button data-component="IconButton" type="button" data-testid="expand-file-tree-button" aria-controls="repos-file-tree" class="prc-Button-ButtonBase-9n-Xk position-relative ExpandFileTreeButton-module__expandButton__hDOcv ExpandFileTreeButton-module__filesButtonBreakpoint__zEvz3 fgColor-muted prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="invisible" aria-labelledby="_R_4lla9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-sidebar-collapse" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M6.823 7.823a.25.25 0 0 1 0 .354l-2.396 2.396A.25.25 0 0 1 4 10.396V5.604a.25.25 0 0 1 .427-.177Z"></path><path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25H9.5v-13H1.75a.25.25 0 0 0-.25.25ZM11 14.5h3.25a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H11Z"></path></svg></button><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="se" data-component="Tooltip" aria-hidden="true" id="_R_4lla9lik5_">Expand file tree</span><div class="d-none"></div></h2></div><div class="react-code-view-header-mb--narrow mr-2"><button data-component="Button" type="button" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-label="main branch" data-testid="anchor-button" data-icv-name="Switch branches/tags" class="prc-Button-ButtonBase-9n-Xk ref-selector-class RefSelectorAnchoredOverlay-module__RefSelectorOverlayBtn__a3WK3" data-loading="false" data-size="medium" data-variant="default" id="ref-picker-repos-header-ref-selector-wide"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="leadingVisual" class="prc-Button-Visual-YNt2F prc-Button-LeadingVisual-UySKu prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-git-branch" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg></span><span data-component="text" class="prc-Button-Label-FWkx3"><div class="RefSelectorAnchoredOverlay-module__RefSelectorOverlayContainer__yaf4p"><div style="max-width:125px" class="ref-selector-button-text-container RefSelectorAnchoredOverlay-module__RefSelectorBtnTextContainer__Di3rk"><span class="RefSelectorAnchoredOverlay-module__RefSelectorText__w_fmP">main</span></div></div></span><span data-component="trailingVisual" class="prc-Button-Visual-YNt2F prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-down" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></span></span></button><div class="d-none"></div></div><div class="react-code-view-header-mb--narrow CodeViewHeader-module__Box_5__MQ0hL"><div class="Breadcrumb-module__container__Vxvev Breadcrumb-module__lg__Rjz0A"><nav data-testid="breadcrumbs" aria-labelledby="repos-header-breadcrumb-heading" id="repos-header-breadcrumb" class="Breadcrumb-module__nav__rQFDj"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone__rwWIk prc-Heading-Heading-MtWFE" data-component="Heading" data-testid="screen-reader-heading" id="repos-header-breadcrumb-heading">Breadcrumbs</h2><ol class="Breadcrumb-module__list__ZH6zr"><li class="Breadcrumb-module__listItem__Ib0x_"><a class="Breadcrumb-module__repoLink__O2Nbs prc-Link-Link-9ZwDx" data-component="Link" data-testid="breadcrumbs-repo-link" href="/Aedelon/titans-pytorch-mlx/tree/main" data-discover="true">titans-pytorch-mlx</a></li></ol></nav><div data-testid="breadcrumbs-filename" class="Breadcrumb-module__filename__equZR"><span class="Breadcrumb-module__separator__eNwsI Breadcrumb-module__lg__Rjz0A" aria-hidden="true">/</span><h1 class="Breadcrumb-module__filenameHeading__MNMtw Breadcrumb-module__lg__Rjz0A prc-Heading-Heading-MtWFE" data-component="Heading" tabindex="-1" id="file-name-id">README.md</h1></div><button data-component="IconButton" type="button" class="prc-Button-ButtonBase-9n-Xk ml-2 prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="small" data-variant="invisible" aria-labelledby="_R_7lla9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-copy" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button><span class="CopyToClipboardIconButton-module__tooltip__WyiwL prc-TooltipV2-Tooltip-tLeuB" data-direction="nw" data-component="Tooltip" aria-label="Copy path" aria-hidden="true" id="_R_7lla9lik5_">Copy path</span></div></div></div><div class="react-code-view-header-element--wide"><div class="CodeViewHeader-module__Box_7___0R6c"><div class="d-flex gap-2"><div><div class="CodeViewHeader-module__FileResultsList__JDzUy"><span class="d-flex FileResultsList-module__FilesSearchBox__ivVkc TextInput-wrapper prc-components-TextInputWrapper-Hpdqi prc-components-TextInputBaseWrapper-wY-n0" data-no-trailing-action="true" data-component="TextInput" data-leading-visual="true" data-trailing-visual="true" aria-busy="false"><span class="TextInput-icon" id="_R_1cpla9lik5_" aria-hidden="true" data-component="TextInput.LeadingVisual"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-search" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg></span><input type="text" aria-label="Go to file" role="combobox" aria-controls="file-results-list" aria-expanded="false" aria-haspopup="dialog" autoCorrect="off" spellCheck="false" placeholder="Go to file" aria-describedby="_R_1cpla9lik5_ _R_1cpla9lik5H1_" data-component="input" class="prc-components-Input-IwWrt" value=""/><span class="TextInput-icon" id="_R_1cpla9lik5H1_" aria-hidden="true" data-component="TextInput.TrailingVisual"></span></span></div><div class="d-none"></div></div><button data-component="Button" type="button" style="display:none" class="prc-Button-ButtonBase-9n-Xk NavigationMenu-module__Button__LpKgm" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="default"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="text" class="prc-Button-Label-FWkx3">Blame</span></span></button><div class="d-none"></div><button data-component="IconButton" type="button" data-testid="more-file-actions-button-nav-menu-wide" aria-haspopup="true" aria-expanded="false" tabindex="0" class="prc-Button-ButtonBase-9n-Xk js-blob-dropdown-click NavigationMenu-module__IconButton__HpX3G prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="default" aria-labelledby="_R_7p9la9lik5_" id="_R_99la9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-kebab-horizontal" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg></button><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="nw" data-component="Tooltip" aria-hidden="true" id="_R_7p9la9lik5_">More file actions</span></div></div></div><div class="react-code-view-header-element--narrow"><div class="CodeViewHeader-module__Box_7___0R6c"><div class="d-flex gap-2"><button data-component="Button" type="button" style="display:none" class="prc-Button-ButtonBase-9n-Xk NavigationMenu-module__Button__LpKgm" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="default"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="text" class="prc-Button-Label-FWkx3">Blame</span></span></button><div class="d-none"></div><button data-component="IconButton" type="button" data-testid="more-file-actions-button-nav-menu-narrow" aria-haspopup="true" aria-expanded="false" tabindex="0" class="prc-Button-ButtonBase-9n-Xk js-blob-dropdown-click NavigationMenu-module__IconButton__HpX3G prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="default" aria-labelledby="_R_7pdla9lik5_" id="_R_9dla9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-kebab-horizontal" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg></button><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="nw" data-component="Tooltip" aria-hidden="true" id="_R_7pdla9lik5_">More file actions</span></div></div></div></div></div></div></div><div class="CodeView-module__contentWrapper__cG2JH"><div class="react-code-view-bottom-padding"><div class="BlobTopBanners-module__Box__v_nvx"></div></div> <div class="d-none"></div><div class="d-flex flex-column border rounded-2 tmp-mb-3 pl-1"><div class="LatestCommit-module__Box__B25ZT"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone__rwWIk prc-Heading-Heading-MtWFE" data-component="Heading" data-testid="screen-reader-heading">Latest commit</h2><div style="width:120px" class="Skeleton Skeleton--text" data-testid="loading"> </div><div class="d-flex flex-shrink-0 gap-2"><div data-testid="latest-commit-details" class="d-none d-sm-flex flex-items-center"></div><div class="d-flex gap-2"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone__rwWIk prc-Heading-Heading-MtWFE" data-component="Heading" data-testid="screen-reader-heading">History</h2><a data-component="LinkButton" href="/Aedelon/titans-pytorch-mlx/commits/main/README.md" class="prc-Button-ButtonBase-9n-Xk d-none d-lg-flex LinkButton-module__linkButton__nFnov flex-items-center fgColor-default" data-loading="false" data-size="small" data-variant="invisible"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="leadingVisual" class="prc-Button-Visual-YNt2F prc-Button-LeadingVisual-UySKu prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-history" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg></span><span data-component="text" class="prc-Button-Label-FWkx3"><span class="fgColor-default">History</span></span></span></a><div class="d-sm-none"></div><div class="d-flex d-lg-none"><a data-component="LinkButton" aria-label="View commit history for this file." href="/Aedelon/titans-pytorch-mlx/commits/main/README.md" class="prc-Button-ButtonBase-9n-Xk LinkButton-module__linkButton__nFnov flex-items-center fgColor-default" data-loading="false" data-size="small" data-variant="invisible" aria-describedby="_R_4mlala9lik5_"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="leadingVisual" class="prc-Button-Visual-YNt2F prc-Button-LeadingVisual-UySKu prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-history" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg></span></span></a><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="s" data-component="Tooltip" role="tooltip" aria-hidden="true" id="_R_4mlala9lik5_">History</span></div></div></div></div></div><div class="d-flex flex-row"><div class="container BlobViewContent-module__blobContainer__DtH2d"><div class="react-code-size-details-banner BlobViewContent-module__codeSizeDetails__e5sUw"><div class="react-code-size-details-banner CodeSizeDetails-module__Box__VcD6l"><div class="text-mono CodeSizeDetails-module__Box_1__GVxQL"><div data-testid="blob-size" class="CodeSizeDetails-module__Truncate_1__lE93V prc-Truncate-Truncate-2G1eo" data-inline="true" title="29.6 KB" style="--truncate-max-width:100%"><span>1003 lines (790 loc) · 29.6 KB</span></div></div></div></div><div class="react-blob-view-header-sticky BlobViewContent-module__stickyHeader__VwxB5" id="repos-sticky-header"><div class="BlobViewHeader-module__Box__yhm9u"><div class="react-blob-sticky-header"><div class="FileNameStickyHeader-module__outerWrapper__ZL4Xc FileNameStickyHeader-module__outerWrapperHidden__Zpynk"><div class="FileNameStickyHeader-module__Box_1__Hazu5"><div class="FileNameStickyHeader-module__Box_2__hoolP"><div class="FileNameStickyHeader-module__Box_3__MVKsk"><button data-component="Button" type="button" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-label="main branch" data-testid="anchor-button" data-icv-name="Switch branches/tags" class="prc-Button-ButtonBase-9n-Xk ref-selector-class RefSelectorAnchoredOverlay-module__RefSelectorOverlayBtn__a3WK3" data-loading="false" data-size="medium" data-variant="default" id="ref-picker-repos-header-ref-selector"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="leadingVisual" class="prc-Button-Visual-YNt2F prc-Button-LeadingVisual-UySKu prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-git-branch" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg></span><span data-component="text" class="prc-Button-Label-FWkx3"><div class="RefSelectorAnchoredOverlay-module__RefSelectorOverlayContainer__yaf4p"><div style="max-width:125px" class="ref-selector-button-text-container RefSelectorAnchoredOverlay-module__RefSelectorBtnTextContainer__Di3rk"><span class="RefSelectorAnchoredOverlay-module__RefSelectorText__w_fmP">main</span></div></div></span><span data-component="trailingVisual" class="prc-Button-Visual-YNt2F prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-down" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></span></span></button><div class="d-none"></div></div><div class="FileNameStickyHeader-module__Box_4__FLhtt"><div class="Breadcrumb-module__container__Vxvev Breadcrumb-module__md__Wb1Gs"><nav data-testid="breadcrumbs" aria-labelledby="sticky-breadcrumb-heading" id="sticky-breadcrumb" class="Breadcrumb-module__nav__rQFDj"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone__rwWIk prc-Heading-Heading-MtWFE" data-component="Heading" data-testid="screen-reader-heading" id="sticky-breadcrumb-heading">Breadcrumbs</h2><ol class="Breadcrumb-module__list__ZH6zr"><li class="Breadcrumb-module__listItem__Ib0x_"><a class="Breadcrumb-module__repoLink__O2Nbs prc-Link-Link-9ZwDx" data-component="Link" data-testid="breadcrumbs-repo-link" href="/Aedelon/titans-pytorch-mlx/tree/main" data-discover="true">titans-pytorch-mlx</a></li></ol></nav><div data-testid="breadcrumbs-filename" class="Breadcrumb-module__filename__equZR"><span class="Breadcrumb-module__separator__eNwsI Breadcrumb-module__md__Wb1Gs" aria-hidden="true">/</span><h1 class="Breadcrumb-module__filenameHeading__MNMtw Breadcrumb-module__md__Wb1Gs prc-Heading-Heading-MtWFE" data-component="Heading" tabindex="-1" id="sticky-file-name-id">README.md</h1></div><button data-component="IconButton" type="button" class="prc-Button-ButtonBase-9n-Xk ml-2 prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="small" data-variant="invisible" aria-labelledby="_R_7lcpala9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-copy" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button><span class="CopyToClipboardIconButton-module__tooltip__WyiwL prc-TooltipV2-Tooltip-tLeuB" data-direction="s" data-component="Tooltip" aria-label="Copy path" aria-hidden="true" id="_R_7lcpala9lik5_">Copy path</span></div></div></div><button data-component="Button" type="button" class="prc-Button-ButtonBase-9n-Xk FileNameStickyHeader-module__Button__LSEU_ FileNameStickyHeader-module__GoToTopButton__nxAFn" data-loading="false" data-size="small" data-variant="invisible"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="leadingVisual" class="prc-Button-Visual-YNt2F prc-Button-LeadingVisual-UySKu prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-arrow-up" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.47 7.78a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0l4.25 4.25a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018L9 4.81v7.44a.75.75 0 0 1-1.5 0V4.81L4.53 7.78a.75.75 0 0 1-1.06 0Z"></path></svg></span><span data-component="text" class="prc-Button-Label-FWkx3">Top</span></span></button></div></div></div><div class="BlobViewHeader-module__Box_1__VEmuQ"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone__rwWIk prc-Heading-Heading-MtWFE" data-component="Heading" data-testid="screen-reader-heading">File metadata and controls</h2><div class="BlobViewHeader-module__Box_2__icUs2"><ul aria-label="File view" class="prc-SegmentedControl-SegmentedControl-lqIXp BlobTabButtons-module__SegmentedControl__jen2u" data-variant="default" data-size="small" data-component="SegmentedControl"><li class="prc-SegmentedControl-Item-tSCQh" data-selected="" data-component="SegmentedControl.Button"><button aria-pressed="true" class="prc-SegmentedControl-Button-E48xz" type="button" style="--separator-color:transparent"><span class="prc-SegmentedControl-Content-1COlk segmentedControl-content"><div class="prc-SegmentedControl-Text-7S2y2 segmentedControl-text" data-text="Preview">Preview</div></span></button></li><li class="prc-SegmentedControl-Item-tSCQh" data-component="SegmentedControl.Button"><button aria-pressed="false" class="prc-SegmentedControl-Button-E48xz" type="button" style="--separator-color:var(--borderColor-default)"><span class="prc-SegmentedControl-Content-1COlk segmentedControl-content"><div class="prc-SegmentedControl-Text-7S2y2 segmentedControl-text" data-text="Code">Code</div></span></button></li><li class="prc-SegmentedControl-Item-tSCQh" data-component="SegmentedControl.Button"><button aria-pressed="false" class="prc-SegmentedControl-Button-E48xz" type="button" style="--separator-color:var(--borderColor-default)"><span class="prc-SegmentedControl-Content-1COlk segmentedControl-content"><div class="prc-SegmentedControl-Text-7S2y2 segmentedControl-text" data-text="Blame">Blame</div></span></button></li></ul><div class="d-none"></div><div class="react-code-size-details-in-header CodeSizeDetails-module__Box__VcD6l"><div class="text-mono CodeSizeDetails-module__Box_1__GVxQL"><div data-testid="blob-size" class="CodeSizeDetails-module__Truncate_1__lE93V prc-Truncate-Truncate-2G1eo" data-inline="true" title="29.6 KB" style="--truncate-max-width:100%"><span>1003 lines (790 loc) · 29.6 KB</span></div></div></div></div><div class="BlobViewHeader-module__Box_3__ng6v2"><div class="d-none"></div><div class="react-blob-header-edit-and-raw-actions BlobViewHeader-module__Box_4__J4Y4W"><div class="d-none"></div><div class="prc-ButtonGroup-ButtonGroup-vFUrY" data-component="ButtonGroup"><div class="prc-ButtonGroup-Item-PqvDl"><a data-component="LinkButton" href="https://github.com/Aedelon/titans-pytorch-mlx/raw/refs/heads/main/README.md" data-testid="raw-button" class="prc-Button-ButtonBase-9n-Xk LinkButton-module__linkButton__nFnov BlobViewHeader-module__LinkButton__X9kx2" data-loading="false" data-no-visuals="true" data-size="small" data-variant="default"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="text" class="prc-Button-Label-FWkx3">Raw</span></span></a></div><div class="prc-ButtonGroup-Item-PqvDl"><button data-component="IconButton" type="button" data-testid="copy-raw-button" class="prc-Button-ButtonBase-9n-Xk prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="small" data-variant="default" aria-labelledby="_R_qaucpala9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-copy" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="n" data-component="Tooltip" aria-hidden="true" id="_R_qaucpala9lik5_">Copy raw file</span></div><div class="prc-ButtonGroup-Item-PqvDl"><button data-component="IconButton" type="button" data-testid="download-raw-button" class="prc-Button-ButtonBase-9n-Xk BlobViewHeader-module__downloadButton__ef459 prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="small" data-variant="default" aria-labelledby="_R_eaucpala9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-download" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M2.75 14A1.75 1.75 0 0 1 1 12.25v-2.5a.75.75 0 0 1 1.5 0v2.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25v-2.5a.75.75 0 0 1 1.5 0v2.5A1.75 1.75 0 0 1 13.25 14Z"></path><path d="M7.25 7.689V2a.75.75 0 0 1 1.5 0v5.689l1.97-1.969a.749.749 0 1 1 1.06 1.06l-3.25 3.25a.749.749 0 0 1-1.06 0L4.22 6.78a.749.749 0 1 1 1.06-1.06l1.97 1.969Z"></path></svg></button><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="n" data-component="Tooltip" aria-hidden="true" id="_R_eaucpala9lik5_">Download raw file</span></div></div></div><button data-component="IconButton" type="button" aria-pressed="false" class="prc-Button-ButtonBase-9n-Xk tmp-mr-2 TableOfContents-module__IconButton__jrlNM prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="small" data-variant="invisible" aria-labelledby="_R_3ucpala9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-list-unordered" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M5.75 2.5h8.5a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5Zm0 5h8.5a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5Zm0 5h8.5a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5ZM2 14a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm1-6a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM2 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg></button><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="n" data-component="Tooltip" aria-hidden="true" id="_R_3ucpala9lik5_">Outline</span><div class="react-blob-header-edit-and-raw-actions-combined"><button data-component="IconButton" type="button" title="More file actions" data-testid="more-file-actions-button" aria-haspopup="true" aria-expanded="false" tabindex="0" class="prc-Button-ButtonBase-9n-Xk js-blob-dropdown-click BlobViewHeader-module__IconButton__XrMQY prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="small" data-variant="invisible" aria-labelledby="_R_fkecpala9lik5_" id="_R_kecpala9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-kebab-horizontal" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg></button><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="nw" data-component="Tooltip" aria-hidden="true" id="_R_fkecpala9lik5_">Edit and raw actions</span></div></div></div></div><div></div></div><div class="BlobViewContent-module__blobContentWrapper__JS0W6"><section aria-labelledby="file-name-id-wide file-name-id-mobile" class="BlobContent-module__blobContentSection__VOgZq BlobContent-module__blobContentSectionMarkdown__mPLOK" style="margin-top:46px"><div class="js-snippet-clipboard-copy-unpositioned BlobContent-module__markdownBlob__T8jpG" data-hpc="true" containertiming="hpc"><article class="markdown-body entry-content container-lg" itemprop="text"><div class="markdown-heading" dir="auto"><h1 tabindex="-1" class="heading-element" dir="auto">Titans: Learning to Memorize at Test Time</h1><a id="user-content-titans-learning-to-memorize-at-test-time" class="anchor" aria-label="Permalink: Titans: Learning to Memorize at Test Time" href="#titans-learning-to-memorize-at-test-time"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p align="center" dir="auto">
<a target="_blank" rel="noopener noreferrer" href="/Aedelon/titans-pytorch-mlx/blob/main/assets/hero.png"><img src="/Aedelon/titans-pytorch-mlx/raw/main/assets/hero.png" alt="Titans Hero" width="100%" style="max-width: 100%;"></a>
</p>
<p dir="auto"><a href="https://www.python.org/downloads/" rel="nofollow"><img src="https://camo.githubusercontent.com/93a33cfc2339ec3fa9be792576576fbaafc42b0c7031285662b02f3aca1e1c59/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f707974686f6e2d332e31302b2d626c75652e737667" alt="Python 3.10+" data-canonical-src="https://img.shields.io/badge/python-3.10+-blue.svg" style="max-width: 100%;"></a>
<a href="https://pytorch.org/" rel="nofollow"><img src="https://camo.githubusercontent.com/e86e9e588f0db00271725db6303a01edadb6d91afe605553c99d5b774aac5f44/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7079746f7263682d322e302b2d6565346332632e737667" alt="PyTorch 2.0+" data-canonical-src="https://img.shields.io/badge/pytorch-2.0+-ee4c2c.svg" style="max-width: 100%;"></a>
<a href="https://ml-explore.github.io/mlx/" rel="nofollow"><img src="https://camo.githubusercontent.com/1390539ed67b92382a0db4279a792f46ef4237a32ca643ded937e10f505d419e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d6c782d6170706c6525323073696c69636f6e2d626c61636b2e737667" alt="MLX" data-canonical-src="https://img.shields.io/badge/mlx-apple%20silicon-black.svg" style="max-width: 100%;"></a>
<a href="/Aedelon/titans-pytorch-mlx/blob/main/LICENSE"><img src="https://camo.githubusercontent.com/48c3918479c6ea40d65216332adbf6c7a89400e32b69faf50a750b905d214b76/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d677265656e2e737667" alt="License" data-canonical-src="https://img.shields.io/badge/license-Apache%202.0-green.svg" style="max-width: 100%;"></a>
<a href="/Aedelon/titans-pytorch-mlx/blob/main/tests"><img src="https://camo.githubusercontent.com/1635f21b99b9b5a5d1d223259daa54974e0606c49331d50262d2294d1a8b3ef1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d3130352532307061737365642d627269676874677265656e2e737667" alt="Tests" data-canonical-src="https://img.shields.io/badge/tests-105%20passed-brightgreen.svg" style="max-width: 100%;"></a></p>
<p dir="auto">A complete <strong>PyTorch</strong> and <strong>MLX</strong> (Apple Silicon) implementation of the Titans architecture from Google Research.</p>
<p dir="auto">Titans introduce a <strong>Neural Long-term Memory (LMM)</strong> module that learns to memorize historical context at test time using gradient descent with momentum and weight decay. This enables attention mechanisms to focus on local context while utilizing long-range information through neural memory.</p>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Table of Contents</h2><a id="user-content-table-of-contents" class="anchor" aria-label="Permalink: Table of Contents" href="#table-of-contents"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<ul dir="auto">
<li><a href="#paper-references">Paper References</a></li>
<li><a href="#features">Features</a></li>
<li><a href="#architecture-overview">Architecture Overview</a>
<ul dir="auto">
<li><a href="#memory-perspective">Memory Perspective</a></li>
<li><a href="#architecture-variants">Architecture Variants</a></li>
<li><a href="#neural-long-term-memory">Neural Long-term Memory</a></li>
</ul>
</li>
<li><a href="#installation">Installation</a></li>
<li><a href="#quick-start">Quick Start</a>
<ul dir="auto">
<li><a href="#pytorch-quick-start">PyTorch</a></li>
<li><a href="#mlx-quick-start">MLX (Apple Silicon)</a></li>
</ul>
</li>
<li><a href="#pretraining">Pretraining</a>
<ul dir="auto">
<li><a href="#pytorch-pretraining">PyTorch Pretraining</a></li>
<li><a href="#mlx-pretraining">MLX Pretraining</a></li>
</ul>
</li>
<li><a href="#inference">Inference</a></li>
<li><a href="#benchmarks">Benchmarks</a></li>
<li><a href="#configuration-reference">Configuration Reference</a></li>
<li><a href="#api-reference">API Reference</a></li>
<li><a href="#mlx-optimizations">MLX Optimizations</a></li>
<li><a href="#troubleshooting">Troubleshooting</a></li>
<li><a href="#development">Development</a></li>
<li><a href="#citation">Citation</a></li>
<li><a href="#license">License</a></li>
</ul>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Paper References</h2><a id="user-content-paper-references" class="anchor" aria-label="Permalink: Paper References" href="#paper-references"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<blockquote>
<p dir="auto"><strong>Original Paper</strong>: Behrouz, A., Zhong, P., &amp; Mirrokni, V. (2024). <em>Titans: Learning to Memorize at Test Time</em>. arXiv preprint arXiv:2501.00663</p>
</blockquote>
<blockquote>
<p dir="auto"><strong>Analysis Paper</strong>: Di Nepi, G., Siciliano, F., &amp; Silvestri, F. (2025). <em>Titans Revisited: A Lightweight Reimplementation and Critical Analysis of a Test-Time Memory Model</em>. arXiv preprint arXiv:2510.09551</p>
</blockquote>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Features</h2><a id="user-content-features" class="anchor" aria-label="Permalink: Features" href="#features"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Core Features</h3><a id="user-content-core-features" class="anchor" aria-label="Permalink: Core Features" href="#core-features"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Feature</th>
<th>PyTorch</th>
<th>MLX</th>
</tr>
</thead>
<tbody>
<tr>
<td>MAC (Memory as Context)</td>
<td>✅</td>
<td>✅</td>
</tr>
<tr>
<td>MAG (Memory as Gate)</td>
<td>✅</td>
<td>✅</td>
</tr>
<tr>
<td>MAL (Memory as Layer)</td>
<td>✅</td>
<td>✅</td>
</tr>
<tr>
<td>LMM (Memory Only)</td>
<td>✅</td>
<td>✅</td>
</tr>
<tr>
<td>Deep Memory (L_M &gt;= 1)</td>
<td>✅</td>
<td>✅</td>
</tr>
<tr>
<td>Data-dependent Gating</td>
<td>✅</td>
<td>✅</td>
</tr>
<tr>
<td>RoPE (Rotary Embeddings)</td>
<td>✅</td>
<td>✅</td>
</tr>
<tr>
<td>1D Depthwise Convolution</td>
<td>✅</td>
<td>✅</td>
</tr>
<tr>
<td>Mixed Precision Training</td>
<td>✅ bf16/fp16</td>
<td>✅ fp16/bf16</td>
</tr>
<tr>
<td>Gradient Accumulation</td>
<td>✅</td>
<td>✅</td>
</tr>
<tr>
<td>Streaming Datasets</td>
<td>✅</td>
<td>✅</td>
</tr>
<tr>
<td>W&amp;B Logging</td>
<td>✅</td>
<td>✅</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Backend-Specific Features</h3><a id="user-content-backend-specific-features" class="anchor" aria-label="Permalink: Backend-Specific Features" href="#backend-specific-features"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Feature</th>
<th>PyTorch</th>
<th>MLX</th>
</tr>
</thead>
<tbody>
<tr>
<td>Flash Attention 2</td>
<td>✅ (CUDA)</td>
<td>N/A</td>
</tr>
<tr>
<td>Triton Kernels</td>
<td>✅ (CUDA)</td>
<td>N/A</td>
</tr>
<tr>
<td>Metal Kernels</td>
<td>N/A</td>
<td>✅</td>
</tr>
<tr>
<td>MPS Backend</td>
<td>✅</td>
<td>N/A</td>
</tr>
<tr>
<td>Unified Memory</td>
<td>N/A</td>
<td>✅</td>
</tr>
<tr>
<td>Numerical Parity</td>
<td>Reference</td>
<td>✅ &lt; 1e-4</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Test Coverage</h3><a id="user-content-test-coverage" class="anchor" aria-label="Permalink: Test Coverage" href="#test-coverage"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<ul dir="auto">
<li><strong>105 unit tests</strong> covering all modules</li>
<li><strong>Numerical parity tests</strong> ensuring MLX matches PyTorch outputs</li>
<li><strong>Integration tests</strong> for all model variants</li>
</ul>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Architecture Overview</h2><a id="user-content-architecture-overview" class="anchor" aria-label="Permalink: Architecture Overview" href="#architecture-overview"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p align="center" dir="auto">
<a target="_blank" rel="noopener noreferrer" href="/Aedelon/titans-pytorch-mlx/blob/main/assets/figures/fig1_memory_training.png"><img src="/Aedelon/titans-pytorch-mlx/raw/main/assets/figures/fig1_memory_training.png" alt="Neural Memory Training" width="600" style="max-width: 100%;"></a>
</p>
<p align="center" dir="auto"><em>Figure 1: Neural memory training with efficient parallelization via matmul operations (from paper)</em></p>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Memory Perspective</h3><a id="user-content-memory-perspective" class="anchor" aria-label="Permalink: Memory Perspective" href="#memory-perspective"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">Titans are designed around a <strong>memory perspective</strong> inspired by human cognition (Section 1 of paper):</p>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Memory Type</th>
<th>Module</th>
<th>Behavior at Test Time</th>
<th>Characteristics</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Short-term</strong></td>
<td>Attention (limited window)</td>
<td>In-context learning (fixed weights)</td>
<td>Precise, limited capacity</td>
</tr>
<tr>
<td><strong>Long-term</strong></td>
<td>Neural Memory (LMM)</td>
<td><strong>Still learning</strong> (weight updates via gradient descent)</td>
<td>Fading, unlimited capacity</td>
</tr>
<tr>
<td><strong>Persistent</strong></td>
<td>Learnable tokens</td>
<td>Fixed (task knowledge)</td>
<td>Stable, task-specific</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Architecture Variants</h3><a id="user-content-architecture-variants" class="anchor" aria-label="Permalink: Architecture Variants" href="#architecture-variants"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Quick Comparison</h4><a id="user-content-quick-comparison" class="anchor" aria-label="Permalink: Quick Comparison" href="#quick-comparison"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Aspect</th>
<th>MAC</th>
<th>MAG</th>
<th>MAL</th>
<th>LMM</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Architecture</strong></td>
<td>Memory → Attention → Memory</td>
<td>Attention ⊗ Memory</td>
<td>Memory → Attention</td>
<td>Memory only</td>
</tr>
<tr>
<td><strong>Attention Type</strong></td>
<td>Segmented (full causal per chunk)</td>
<td>Sliding Window</td>
<td>Sliding Window</td>
<td>None</td>
</tr>
<tr>
<td><strong>Memory-Attention</strong></td>
<td>Bidirectional</td>
<td>Parallel (gating)</td>
<td>Sequential</td>
<td>N/A</td>
</tr>
<tr>
<td><strong>Chunking Required</strong></td>
<td>Yes</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td><strong>Long-context</strong></td>
<td>⭐⭐⭐ Best</td>
<td>⭐⭐ Good</td>
<td>⭐ Baseline</td>
<td>⭐⭐ Good</td>
</tr>
<tr>
<td><strong>Training Speed</strong></td>
<td>Medium</td>
<td>Fast</td>
<td>Fastest</td>
<td>Fast</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">When to Use Each Variant</h4><a id="user-content-when-to-use-each-variant" class="anchor" aria-label="Permalink: When to Use Each Variant" href="#when-to-use-each-variant"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Use Case</th>
<th>Recommended</th>
<th>Why</th>
</tr>
</thead>
<tbody>
<tr>
<td>Needle-in-haystack retrieval</td>
<td><strong>MAC</strong></td>
<td>Attention decides when to query long-term memory</td>
</tr>
<tr>
<td>Long document QA (&gt;100K tokens)</td>
<td><strong>MAC</strong></td>
<td>Best BABILong benchmark results (97.95%)</td>
</tr>
<tr>
<td>Language modeling (perplexity)</td>
<td><strong>MAG</strong></td>
<td>Slightly better perplexity than MAC</td>
</tr>
<tr>
<td>Real-time / streaming inference</td>
<td><strong>MAG</strong></td>
<td>No chunking, constant memory footprint</td>
</tr>
<tr>
<td>Maximum training throughput</td>
<td><strong>MAL</strong></td>
<td>Leverages FlashAttention optimizations</td>
</tr>
<tr>
<td>Existing hybrid model replacement</td>
<td><strong>MAL</strong></td>
<td>Same architecture as Griffin/Samba</td>
</tr>
<tr>
<td>Pure sequence modeling</td>
<td><strong>LMM</strong></td>
<td>Tests memory capability alone</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">MAC: Memory as Context (Section 4.1)</h4><a id="user-content-mac-memory-as-context-section-41" class="anchor" aria-label="Permalink: MAC: Memory as Context (Section 4.1)" href="#mac-memory-as-context-section-41"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p align="center" dir="auto">
<a target="_blank" rel="noopener noreferrer" href="/Aedelon/titans-pytorch-mlx/blob/main/assets/figures/fig2_mac.png"><img src="/Aedelon/titans-pytorch-mlx/raw/main/assets/figures/fig2_mac.png" alt="MAC Architecture" width="700" style="max-width: 100%;"></a>
</p>
<p align="center" dir="auto"><em>Figure 2: MAC (Memory as Context) - Bidirectional interaction between memory and attention</em></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="h_t = M*_{t-1}(q_t)                              # Eq. 21: Retrieve from memory
S̃^(t) = [persistent] || h_t || x                # Eq. 22: Concatenate
y_t = Attn(S̃^(t))                               # Eq. 23: Segmented attention
M_t = M_{t-1}(y_t)                               # Eq. 24: Update memory
o_t = y_t ⊗ M*_t(y_t)                            # Eq. 25: Output gating"><pre class="notranslate"><code>h_t = M*_{t-1}(q_t)                              # Eq. 21: Retrieve from memory
S̃^(t) = [persistent] || h_t || x                # Eq. 22: Concatenate
y_t = Attn(S̃^(t))                               # Eq. 23: Segmented attention
M_t = M_{t-1}(y_t)                               # Eq. 24: Update memory
o_t = y_t ⊗ M*_t(y_t)                            # Eq. 25: Output gating
</code></pre></div>
<p dir="auto"><strong>Advantages</strong>: Best long-context performance, bidirectional memory-attention interaction
<strong>Disadvantages</strong>: Requires chunking, slightly slower training</p>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">MAG: Memory as Gate (Section 4.2)</h4><a id="user-content-mag-memory-as-gate-section-42" class="anchor" aria-label="Permalink: MAG: Memory as Gate (Section 4.2)" href="#mag-memory-as-gate-section-42"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p align="center" dir="auto">
<a target="_blank" rel="noopener noreferrer" href="/Aedelon/titans-pytorch-mlx/blob/main/assets/figures/fig4_mag_mal.png"><img src="/Aedelon/titans-pytorch-mlx/raw/main/assets/figures/fig4_mag_mal.png" alt="MAG and MAL Architecture" width="700" style="max-width: 100%;"></a>
</p>
<p align="center" dir="auto"><em>Figure 4-5: MAG (Memory as Gate) and MAL (Memory as Layer) architectures</em></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="x̃ = [persistent] || x                           # Eq. 26: Add persistent tokens
y = SW-Attn*(x̃)                                  # Eq. 27: Sliding window attention
o = y ⊗ M(x̃)                                     # Eq. 28: Element-wise gating"><pre class="notranslate"><code>x̃ = [persistent] || x                           # Eq. 26: Add persistent tokens
y = SW-Attn*(x̃)                                  # Eq. 27: Sliding window attention
o = y ⊗ M(x̃)                                     # Eq. 28: Element-wise gating
</code></pre></div>
<p dir="auto"><strong>Advantages</strong>: No chunking, best perplexity, good balance
<strong>Disadvantages</strong>: Memory and attention don't directly communicate</p>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">MAL: Memory as Layer (Section 4.3)</h4><a id="user-content-mal-memory-as-layer-section-43" class="anchor" aria-label="Permalink: MAL: Memory as Layer (Section 4.3)" href="#mal-memory-as-layer-section-43"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="x̃ = [persistent] || x                           # Eq. 29: Add persistent tokens
y = M(x̃)                                         # Eq. 30: Memory layer
o = SW-Attn(y)                                   # Eq. 31: Attention on memory output"><pre class="notranslate"><code>x̃ = [persistent] || x                           # Eq. 29: Add persistent tokens
y = M(x̃)                                         # Eq. 30: Memory layer
o = SW-Attn(y)                                   # Eq. 31: Attention on memory output
</code></pre></div>
<p dir="auto"><strong>Advantages</strong>: Fastest training, simplest architecture
<strong>Disadvantages</strong>: Weaker long-context performance</p>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Neural Long-term Memory</h3><a id="user-content-neural-long-term-memory" class="anchor" aria-label="Permalink: Neural Long-term Memory" href="#neural-long-term-memory"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p align="center" dir="auto">
<a target="_blank" rel="noopener noreferrer" href="/Aedelon/titans-pytorch-mlx/blob/main/assets/figures/fig3a_lstm_forget.png"><img src="/Aedelon/titans-pytorch-mlx/raw/main/assets/figures/fig3a_lstm_forget.png" alt="LSTM-inspired Gating" width="400" style="max-width: 100%;"></a>
<a target="_blank" rel="noopener noreferrer" href="/Aedelon/titans-pytorch-mlx/blob/main/assets/figures/fig3b_lstm_update.png"><img src="/Aedelon/titans-pytorch-mlx/raw/main/assets/figures/fig3b_lstm_update.png" alt="Memory Update" width="400" style="max-width: 100%;"></a>
</p>
<p align="center" dir="auto"><em>Figure 3: LSTM-inspired gating mechanism for memory forgetting (left) and update (right)</em></p>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Core Equations (Section 3.1)</h4><a id="user-content-core-equations-section-31" class="anchor" aria-label="Permalink: Core Equations (Section 3.1)" href="#core-equations-section-31"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto"><strong>Associative Memory Loss</strong> (Eq. 12):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ℓ(M; x_t) = ||M(k_t) - v_t||²"><pre class="notranslate"><code>ℓ(M; x_t) = ||M(k_t) - v_t||²
</code></pre></div>
<p dir="auto"><strong>Memory Update with Forgetting</strong> (Eq. 13):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="M_t = (1 - α_t) · M_{t-1} + S_t"><pre class="notranslate"><code>M_t = (1 - α_t) · M_{t-1} + S_t
</code></pre></div>
<p dir="auto"><strong>Surprise with Momentum</strong> (Eq. 14):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="S_t = η_t · S_{t-1} - θ_t · ∇ℓ(M_{t-1}; x_t)
      \_________/   \____________________/
      Past Surprise   Momentary Surprise"><pre class="notranslate"><code>S_t = η_t · S_{t-1} - θ_t · ∇ℓ(M_{t-1}; x_t)
      \_________/   \____________________/
      Past Surprise   Momentary Surprise
</code></pre></div>
<p dir="auto">Where:</p>
<ul dir="auto">
<li><code>α_t</code> ∈ [0,1]: Forgetting/decay factor (data-dependent)</li>
<li><code>η_t</code> ∈ [0,1): Surprise decay / momentum coefficient (data-dependent)</li>
<li><code>θ_t</code> &gt; 0: Learning rate for momentary surprise (data-dependent)</li>
</ul>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Key Innovations</h4><a id="user-content-key-innovations" class="anchor" aria-label="Permalink: Key Innovations" href="#key-innovations"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<ol dir="auto">
<li><strong>Momentum-based surprise</strong>: Unlike DeltaNet/TTT which use momentary surprise only</li>
<li><strong>Forgetting mechanism</strong>: Weight decay for memory management on long sequences</li>
<li><strong>Deep memory</strong>: MLP with L_M &gt;= 2 layers for more expressive power</li>
<li><strong>Data-dependent gates</strong>: α, η, θ are functions of input, not fixed hyperparameters</li>
</ol>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Installation</h2><a id="user-content-installation" class="anchor" aria-label="Permalink: Installation" href="#installation"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Basic Installation (PyTorch)</h3><a id="user-content-basic-installation-pytorch" class="anchor" aria-label="Permalink: Basic Installation (PyTorch)" href="#basic-installation-pytorch"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="git clone https://github.com/yourusername/Google-Titans-replication.git
cd Google-Titans-replication
uv sync"><pre>git clone https://github.com/yourusername/Google-Titans-replication.git
<span class="pl-c1">cd</span> Google-Titans-replication
uv sync</pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">With Training Dependencies</h3><a id="user-content-with-training-dependencies" class="anchor" aria-label="Permalink: With Training Dependencies" href="#with-training-dependencies"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="uv sync --extra train"><pre>uv sync --extra train</pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">With All Extras (Development)</h3><a id="user-content-with-all-extras-development" class="anchor" aria-label="Permalink: With All Extras (Development)" href="#with-all-extras-development"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="uv sync --all-extras"><pre>uv sync --all-extras</pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">MLX Requirements</h3><a id="user-content-mlx-requirements" class="anchor" aria-label="Permalink: MLX Requirements" href="#mlx-requirements"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">MLX requires macOS 13.5+ and Apple Silicon (M1/M2/M3/M4):</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# MLX is included in default dependencies
uv sync"><pre><span class="pl-c"><span class="pl-c">#</span> MLX is included in default dependencies</span>
uv sync</pre></div>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Quick Start</h2><a id="user-content-quick-start" class="anchor" aria-label="Permalink: Quick Start" href="#quick-start"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">PyTorch Quick Start</h3><a id="user-content-pytorch-quick-start" class="anchor" aria-label="Permalink: PyTorch Quick Start" href="#pytorch-quick-start"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import torch
from titans import TitansConfig, TitansMAC, TitansMAG, TitansMAL

# Configuration
config = TitansConfig(
    dim=512,
    num_heads=8,
    num_layers=6,
    vocab_size=32000,
    chunk_size=512,           # For MAC
    window_size=512,          # For MAG/MAL
    num_persistent_tokens=16,
    num_memory_layers=2,      # Deep memory
)

# Create model
model = TitansMAC(config)  # or TitansMAG, TitansMAL

# Forward pass
input_ids = torch.randint(0, config.vocab_size, (2, 1024))
logits, states = model(input_ids)

# Continue with states for next segment
input_ids_next = torch.randint(0, config.vocab_size, (2, 512))
logits_next, states = model(input_ids_next, states=states)"><pre><span class="pl-k">import</span> <span class="pl-s1">torch</span>
<span class="pl-k">from</span> <span class="pl-s1">titans</span> <span class="pl-k">import</span> <span class="pl-v">TitansConfig</span>, <span class="pl-v">TitansMAC</span>, <span class="pl-v">TitansMAG</span>, <span class="pl-v">TitansMAL</span>

<span class="pl-c"># Configuration</span>
<span class="pl-s1">config</span> <span class="pl-c1">=</span> <span class="pl-en">TitansConfig</span>(
    <span class="pl-s1">dim</span><span class="pl-c1">=</span><span class="pl-c1">512</span>,
    <span class="pl-s1">num_heads</span><span class="pl-c1">=</span><span class="pl-c1">8</span>,
    <span class="pl-s1">num_layers</span><span class="pl-c1">=</span><span class="pl-c1">6</span>,
    <span class="pl-s1">vocab_size</span><span class="pl-c1">=</span><span class="pl-c1">32000</span>,
    <span class="pl-s1">chunk_size</span><span class="pl-c1">=</span><span class="pl-c1">512</span>,           <span class="pl-c"># For MAC</span>
    <span class="pl-s1">window_size</span><span class="pl-c1">=</span><span class="pl-c1">512</span>,          <span class="pl-c"># For MAG/MAL</span>
    <span class="pl-s1">num_persistent_tokens</span><span class="pl-c1">=</span><span class="pl-c1">16</span>,
    <span class="pl-s1">num_memory_layers</span><span class="pl-c1">=</span><span class="pl-c1">2</span>,      <span class="pl-c"># Deep memory</span>
)

<span class="pl-c"># Create model</span>
<span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-en">TitansMAC</span>(<span class="pl-s1">config</span>)  <span class="pl-c"># or TitansMAG, TitansMAL</span>

<span class="pl-c"># Forward pass</span>
<span class="pl-s1">input_ids</span> <span class="pl-c1">=</span> <span class="pl-s1">torch</span>.<span class="pl-c1">randint</span>(<span class="pl-c1">0</span>, <span class="pl-s1">config</span>.<span class="pl-c1">vocab_size</span>, (<span class="pl-c1">2</span>, <span class="pl-c1">1024</span>))
<span class="pl-s1">logits</span>, <span class="pl-s1">states</span> <span class="pl-c1">=</span> <span class="pl-en">model</span>(<span class="pl-s1">input_ids</span>)

<span class="pl-c"># Continue with states for next segment</span>
<span class="pl-s1">input_ids_next</span> <span class="pl-c1">=</span> <span class="pl-s1">torch</span>.<span class="pl-c1">randint</span>(<span class="pl-c1">0</span>, <span class="pl-s1">config</span>.<span class="pl-c1">vocab_size</span>, (<span class="pl-c1">2</span>, <span class="pl-c1">512</span>))
<span class="pl-s1">logits_next</span>, <span class="pl-s1">states</span> <span class="pl-c1">=</span> <span class="pl-en">model</span>(<span class="pl-s1">input_ids_next</span>, <span class="pl-s1">states</span><span class="pl-c1">=</span><span class="pl-s1">states</span>)</pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">MLX Quick Start</h3><a id="user-content-mlx-quick-start" class="anchor" aria-label="Permalink: MLX Quick Start" href="#mlx-quick-start"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import mlx.core as mx
from titans_mlx import TitansConfig, TitansMAC, TitansMAG, TitansMAL

# Configuration (same as PyTorch)
config = TitansConfig(
    dim=512,
    num_heads=8,
    num_layers=6,
    vocab_size=32000,
    chunk_size=512,
    window_size=512,
    num_persistent_tokens=16,
    num_memory_layers=2,
)

# Create model
model = TitansMAC(config)
mx.eval(model.parameters())  # Evaluate parameters

# Forward pass
input_ids = mx.random.randint(0, config.vocab_size, (2, 1024))
logits, states = model(input_ids)
mx.eval(logits)  # Force evaluation

# Continue with states
input_ids_next = mx.random.randint(0, config.vocab_size, (2, 512))
logits_next, states = model(input_ids_next, states=states)"><pre><span class="pl-k">import</span> <span class="pl-s1">mlx</span>.<span class="pl-s1">core</span> <span class="pl-k">as</span> <span class="pl-s1">mx</span>
<span class="pl-k">from</span> <span class="pl-s1">titans_mlx</span> <span class="pl-k">import</span> <span class="pl-v">TitansConfig</span>, <span class="pl-v">TitansMAC</span>, <span class="pl-v">TitansMAG</span>, <span class="pl-v">TitansMAL</span>

<span class="pl-c"># Configuration (same as PyTorch)</span>
<span class="pl-s1">config</span> <span class="pl-c1">=</span> <span class="pl-en">TitansConfig</span>(
    <span class="pl-s1">dim</span><span class="pl-c1">=</span><span class="pl-c1">512</span>,
    <span class="pl-s1">num_heads</span><span class="pl-c1">=</span><span class="pl-c1">8</span>,
    <span class="pl-s1">num_layers</span><span class="pl-c1">=</span><span class="pl-c1">6</span>,
    <span class="pl-s1">vocab_size</span><span class="pl-c1">=</span><span class="pl-c1">32000</span>,
    <span class="pl-s1">chunk_size</span><span class="pl-c1">=</span><span class="pl-c1">512</span>,
    <span class="pl-s1">window_size</span><span class="pl-c1">=</span><span class="pl-c1">512</span>,
    <span class="pl-s1">num_persistent_tokens</span><span class="pl-c1">=</span><span class="pl-c1">16</span>,
    <span class="pl-s1">num_memory_layers</span><span class="pl-c1">=</span><span class="pl-c1">2</span>,
)

<span class="pl-c"># Create model</span>
<span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-en">TitansMAC</span>(<span class="pl-s1">config</span>)
<span class="pl-s1">mx</span>.<span class="pl-c1">eval</span>(<span class="pl-s1">model</span>.<span class="pl-c1">parameters</span>())  <span class="pl-c"># Evaluate parameters</span>

<span class="pl-c"># Forward pass</span>
<span class="pl-s1">input_ids</span> <span class="pl-c1">=</span> <span class="pl-s1">mx</span>.<span class="pl-c1">random</span>.<span class="pl-c1">randint</span>(<span class="pl-c1">0</span>, <span class="pl-s1">config</span>.<span class="pl-c1">vocab_size</span>, (<span class="pl-c1">2</span>, <span class="pl-c1">1024</span>))
<span class="pl-s1">logits</span>, <span class="pl-s1">states</span> <span class="pl-c1">=</span> <span class="pl-en">model</span>(<span class="pl-s1">input_ids</span>)
<span class="pl-s1">mx</span>.<span class="pl-c1">eval</span>(<span class="pl-s1">logits</span>)  <span class="pl-c"># Force evaluation</span>

<span class="pl-c"># Continue with states</span>
<span class="pl-s1">input_ids_next</span> <span class="pl-c1">=</span> <span class="pl-s1">mx</span>.<span class="pl-c1">random</span>.<span class="pl-c1">randint</span>(<span class="pl-c1">0</span>, <span class="pl-s1">config</span>.<span class="pl-c1">vocab_size</span>, (<span class="pl-c1">2</span>, <span class="pl-c1">512</span>))
<span class="pl-s1">logits_next</span>, <span class="pl-s1">states</span> <span class="pl-c1">=</span> <span class="pl-en">model</span>(<span class="pl-s1">input_ids_next</span>, <span class="pl-s1">states</span><span class="pl-c1">=</span><span class="pl-s1">states</span>)</pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Standalone Neural Memory</h3><a id="user-content-standalone-neural-memory" class="anchor" aria-label="Permalink: Standalone Neural Memory" href="#standalone-neural-memory"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# PyTorch
from titans import TitansConfig, NeuralLongTermMemory
import torch

config = TitansConfig(dim=512, num_memory_layers=2)
memory = NeuralLongTermMemory(config)

x = torch.randn(2, 100, 512)
output, state = memory(x)
output2, state2 = memory(x, state=state)  # Continue with state

# MLX
from titans_mlx import TitansConfig, NeuralLongTermMemory
import mlx.core as mx

config = TitansConfig(dim=512, num_memory_layers=2)
memory = NeuralLongTermMemory(config)
mx.eval(memory.parameters())

x = mx.random.normal((2, 100, 512))
output, state = memory(x)
mx.eval(output)"><pre><span class="pl-c"># PyTorch</span>
<span class="pl-k">from</span> <span class="pl-s1">titans</span> <span class="pl-k">import</span> <span class="pl-v">TitansConfig</span>, <span class="pl-v">NeuralLongTermMemory</span>
<span class="pl-k">import</span> <span class="pl-s1">torch</span>

<span class="pl-s1">config</span> <span class="pl-c1">=</span> <span class="pl-en">TitansConfig</span>(<span class="pl-s1">dim</span><span class="pl-c1">=</span><span class="pl-c1">512</span>, <span class="pl-s1">num_memory_layers</span><span class="pl-c1">=</span><span class="pl-c1">2</span>)
<span class="pl-s1">memory</span> <span class="pl-c1">=</span> <span class="pl-en">NeuralLongTermMemory</span>(<span class="pl-s1">config</span>)

<span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">torch</span>.<span class="pl-c1">randn</span>(<span class="pl-c1">2</span>, <span class="pl-c1">100</span>, <span class="pl-c1">512</span>)
<span class="pl-s1">output</span>, <span class="pl-s1">state</span> <span class="pl-c1">=</span> <span class="pl-en">memory</span>(<span class="pl-s1">x</span>)
<span class="pl-s1">output2</span>, <span class="pl-s1">state2</span> <span class="pl-c1">=</span> <span class="pl-en">memory</span>(<span class="pl-s1">x</span>, <span class="pl-s1">state</span><span class="pl-c1">=</span><span class="pl-s1">state</span>)  <span class="pl-c"># Continue with state</span>

<span class="pl-c"># MLX</span>
<span class="pl-k">from</span> <span class="pl-s1">titans_mlx</span> <span class="pl-k">import</span> <span class="pl-v">TitansConfig</span>, <span class="pl-v">NeuralLongTermMemory</span>
<span class="pl-k">import</span> <span class="pl-s1">mlx</span>.<span class="pl-s1">core</span> <span class="pl-k">as</span> <span class="pl-s1">mx</span>

<span class="pl-s1">config</span> <span class="pl-c1">=</span> <span class="pl-en">TitansConfig</span>(<span class="pl-s1">dim</span><span class="pl-c1">=</span><span class="pl-c1">512</span>, <span class="pl-s1">num_memory_layers</span><span class="pl-c1">=</span><span class="pl-c1">2</span>)
<span class="pl-s1">memory</span> <span class="pl-c1">=</span> <span class="pl-en">NeuralLongTermMemory</span>(<span class="pl-s1">config</span>)
<span class="pl-s1">mx</span>.<span class="pl-c1">eval</span>(<span class="pl-s1">memory</span>.<span class="pl-c1">parameters</span>())

<span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">mx</span>.<span class="pl-c1">random</span>.<span class="pl-c1">normal</span>((<span class="pl-c1">2</span>, <span class="pl-c1">100</span>, <span class="pl-c1">512</span>))
<span class="pl-s1">output</span>, <span class="pl-s1">state</span> <span class="pl-c1">=</span> <span class="pl-en">memory</span>(<span class="pl-s1">x</span>)
<span class="pl-s1">mx</span>.<span class="pl-c1">eval</span>(<span class="pl-s1">output</span>)</pre></div>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Pretraining</h2><a id="user-content-pretraining" class="anchor" aria-label="Permalink: Pretraining" href="#pretraining"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">PyTorch Pretraining</h3><a id="user-content-pytorch-pretraining" class="anchor" aria-label="Permalink: PyTorch Pretraining" href="#pytorch-pretraining"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Option 1: HuggingFace Streaming (Simple, No Setup)</h4><a id="user-content-option-1-huggingface-streaming-simple-no-setup" class="anchor" aria-label="Permalink: Option 1: HuggingFace Streaming (Simple, No Setup)" href="#option-1-huggingface-streaming-simple-no-setup"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">Stream directly from HuggingFace - tokenization happens on-the-fly:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Train with FineWeb-Edu streaming
uv run python scripts/pretrain.py --model mac \
    --dataset HuggingFaceFW/fineweb-edu \
    --dataset-subset sample-10BT \
    --tokenizer NousResearch/Llama-2-7b-hf \
    --dim 512 --num-layers 12 \
    --mixed-precision bf16

# Full training (340M params)
uv run python scripts/pretrain.py --model mac \
    --dataset HuggingFaceFW/fineweb-edu \
    --dataset-subset sample-10BT \
    --tokenizer NousResearch/Llama-2-7b-hf \
    --dim 1024 --num-layers 24 --num-heads 16 \
    --batch-size 8 --gradient-accumulation-steps 32 \
    --lr 4e-4 --mixed-precision bf16 --wandb"><pre><span class="pl-c"><span class="pl-c">#</span> Train with FineWeb-Edu streaming</span>
uv run python scripts/pretrain.py --model mac \
    --dataset HuggingFaceFW/fineweb-edu \
    --dataset-subset sample-10BT \
    --tokenizer NousResearch/Llama-2-7b-hf \
    --dim 512 --num-layers 12 \
    --mixed-precision bf16

<span class="pl-c"><span class="pl-c">#</span> Full training (340M params)</span>
uv run python scripts/pretrain.py --model mac \
    --dataset HuggingFaceFW/fineweb-edu \
    --dataset-subset sample-10BT \
    --tokenizer NousResearch/Llama-2-7b-hf \
    --dim 1024 --num-layers 24 --num-heads 16 \
    --batch-size 8 --gradient-accumulation-steps 32 \
    --lr 4e-4 --mixed-precision bf16 --wandb</pre></div>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Option 2: Pre-tokenized Local Dataset (Fastest)</h4><a id="user-content-option-2-pre-tokenized-local-dataset-fastest" class="anchor" aria-label="Permalink: Option 2: Pre-tokenized Local Dataset (Fastest)" href="#option-2-pre-tokenized-local-dataset-fastest"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">Pre-tokenize once, then train without tokenization overhead:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Step 1: Pre-tokenize (one time)
uv run python scripts/pretokenize.py \
    --dataset HuggingFaceFW/fineweb-edu \
    --subset sample-10BT \
    --tokenizer NousResearch/Llama-2-7b-hf \
    --output data/fineweb-tokenized \
    --seq-len 4096 \
    --num-proc 8

# Step 2: Train with pre-tokenized data
uv run python scripts/pretrain.py --model mac \
    --local-dataset data/fineweb-tokenized \
    --tokenizer NousResearch/Llama-2-7b-hf \
    --dim 512 --num-layers 12 \
    --mixed-precision bf16"><pre><span class="pl-c"><span class="pl-c">#</span> Step 1: Pre-tokenize (one time)</span>
uv run python scripts/pretokenize.py \
    --dataset HuggingFaceFW/fineweb-edu \
    --subset sample-10BT \
    --tokenizer NousResearch/Llama-2-7b-hf \
    --output data/fineweb-tokenized \
    --seq-len 4096 \
    --num-proc 8

<span class="pl-c"><span class="pl-c">#</span> Step 2: Train with pre-tokenized data</span>
uv run python scripts/pretrain.py --model mac \
    --local-dataset data/fineweb-tokenized \
    --tokenizer NousResearch/Llama-2-7b-hf \
    --dim 512 --num-layers 12 \
    --mixed-precision bf16</pre></div>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Other Options</h4><a id="user-content-other-options" class="anchor" aria-label="Permalink: Other Options" href="#other-options"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Demo with synthetic data (quick test)
uv run python scripts/pretrain.py --model mac --dim 256 --epochs 10

# Train with local text file
uv run python scripts/pretrain.py --model mag \
    --data path/to/corpus.txt \
    --tokenizer gpt2

# Resume from checkpoint
uv run python scripts/pretrain.py --model mac \
    --resume checkpoints/latest.pt"><pre><span class="pl-c"><span class="pl-c">#</span> Demo with synthetic data (quick test)</span>
uv run python scripts/pretrain.py --model mac --dim 256 --epochs 10

<span class="pl-c"><span class="pl-c">#</span> Train with local text file</span>
uv run python scripts/pretrain.py --model mag \
    --data path/to/corpus.txt \
    --tokenizer gpt2

<span class="pl-c"><span class="pl-c">#</span> Resume from checkpoint</span>
uv run python scripts/pretrain.py --model mac \
    --resume checkpoints/latest.pt</pre></div>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">PyTorch Training Options</h4><a id="user-content-pytorch-training-options" class="anchor" aria-label="Permalink: PyTorch Training Options" href="#pytorch-training-options"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Option</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Model Architecture</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>--model</code></td>
<td><code>mac</code></td>
<td>Model variant: mac, mag, mal, lmm</td>
</tr>
<tr>
<td><code>--dim</code></td>
<td><code>512</code></td>
<td>Model dimension</td>
</tr>
<tr>
<td><code>--num-heads</code></td>
<td><code>8</code></td>
<td>Attention heads</td>
</tr>
<tr>
<td><code>--num-layers</code></td>
<td><code>12</code></td>
<td>Number of layers</td>
</tr>
<tr>
<td><code>--vocab-size</code></td>
<td><code>32000</code></td>
<td>Vocabulary size</td>
</tr>
<tr>
<td><code>--chunk-size</code></td>
<td><code>512</code></td>
<td>Chunk size for MAC</td>
</tr>
<tr>
<td><code>--window-size</code></td>
<td><code>512</code></td>
<td>Window size for MAG/MAL</td>
</tr>
<tr>
<td><strong>Data</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>--dataset</code></td>
<td>-</td>
<td>HuggingFace dataset name (streaming)</td>
</tr>
<tr>
<td><code>--dataset-subset</code></td>
<td>-</td>
<td>Dataset subset (e.g., sample-10BT)</td>
</tr>
<tr>
<td><code>--local-dataset</code></td>
<td>-</td>
<td>Pre-tokenized local dataset (Arrow format)</td>
</tr>
<tr>
<td><code>--data</code></td>
<td>-</td>
<td>Local text file path</td>
</tr>
<tr>
<td><code>--tokenizer</code></td>
<td><code>gpt2</code></td>
<td>HuggingFace tokenizer</td>
</tr>
<tr>
<td><code>--seq-len</code></td>
<td><code>4096</code></td>
<td>Sequence length</td>
</tr>
<tr>
<td><strong>Training</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>--epochs</code></td>
<td><code>1</code></td>
<td>Number of epochs</td>
</tr>
<tr>
<td><code>--max-steps</code></td>
<td><code>-1</code></td>
<td>Max steps (-1 = use epochs)</td>
</tr>
<tr>
<td><code>--batch-size</code></td>
<td><code>4</code></td>
<td>Per-device batch size</td>
</tr>
<tr>
<td><code>--gradient-accumulation-steps</code></td>
<td><code>32</code></td>
<td>Gradient accumulation steps</td>
</tr>
<tr>
<td><code>--lr</code></td>
<td><code>4e-4</code></td>
<td>Learning rate</td>
</tr>
<tr>
<td><code>--weight-decay</code></td>
<td><code>0.1</code></td>
<td>Weight decay</td>
</tr>
<tr>
<td><code>--grad-clip</code></td>
<td><code>1.0</code></td>
<td>Gradient clipping</td>
</tr>
<tr>
<td><code>--warmup-ratio</code></td>
<td><code>0.03</code></td>
<td>Warmup ratio</td>
</tr>
<tr>
<td><code>--mixed-precision</code></td>
<td><code>bf16</code></td>
<td>none, fp16, bf16</td>
</tr>
<tr>
<td><strong>Optimization</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>--torch-compile</code></td>
<td><code>False</code></td>
<td>Enable torch.compile (PyTorch 2.0+)</td>
</tr>
<tr>
<td><code>--compile-mode</code></td>
<td><code>default</code></td>
<td>default, reduce-overhead, max-autotune</td>
</tr>
<tr>
<td><code>--gradient-checkpointing</code></td>
<td><code>False</code></td>
<td>Enable gradient checkpointing</td>
</tr>
<tr>
<td><code>--num-workers</code></td>
<td><code>4</code></td>
<td>DataLoader workers</td>
</tr>
<tr>
<td><strong>Checkpointing</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>--checkpoint-dir</code></td>
<td><code>checkpoints/</code></td>
<td>Checkpoint directory</td>
</tr>
<tr>
<td><code>--save-every</code></td>
<td><code>1000</code></td>
<td>Save every N steps</td>
</tr>
<tr>
<td><code>--eval-every</code></td>
<td><code>500</code></td>
<td>Eval every N steps</td>
</tr>
<tr>
<td><code>--resume</code></td>
<td>-</td>
<td>Resume from checkpoint</td>
</tr>
<tr>
<td><strong>Logging</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>--log-every</code></td>
<td><code>10</code></td>
<td>Log every N steps</td>
</tr>
<tr>
<td><code>--wandb</code></td>
<td><code>False</code></td>
<td>Enable W&amp;B logging</td>
</tr>
<tr>
<td><code>--wandb-project</code></td>
<td><code>titans</code></td>
<td>W&amp;B project name</td>
</tr>
<tr>
<td><code>--wandb-run-name</code></td>
<td>-</td>
<td>W&amp;B run name</td>
</tr>
<tr>
<td><code>--seed</code></td>
<td><code>42</code></td>
<td>Random seed</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">CUDA Optimizations</h4><a id="user-content-cuda-optimizations" class="anchor" aria-label="Permalink: CUDA Optimizations" href="#cuda-optimizations"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">The training scripts include automatic CUDA optimizations:</p>
<ul dir="auto">
<li><strong>TF32 Precision</strong>: Enabled by default on Ampere+ GPUs for faster matmul</li>
<li><strong>cuDNN Benchmark</strong>: Auto-tunes convolution algorithms</li>
<li><strong>Fused AdamW</strong>: Optimizer runs entirely on GPU</li>
<li><strong>BFloat16 Native</strong>: Model initialized in bf16 (no autocast overhead)</li>
<li><strong>Non-blocking Transfers</strong>: CPU→GPU transfers overlap with computation</li>
</ul>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Distributed Training (Multi-GPU)</h3><a id="user-content-distributed-training-multi-gpu" class="anchor" aria-label="Permalink: Distributed Training (Multi-GPU)" href="#distributed-training-multi-gpu"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Multi-GPU with DDP (auto-detects GPUs)
uv run accelerate launch scripts/pretrain_distributed.py \
    --model mac --dim 512 \
    --local-dataset data/fineweb-tokenized

# Multi-GPU with custom config
uv run accelerate launch --config_file configs/fsdp_config.yaml \
    scripts/pretrain_distributed.py --model mac --dim 1024"><pre><span class="pl-c"><span class="pl-c">#</span> Multi-GPU with DDP (auto-detects GPUs)</span>
uv run accelerate launch scripts/pretrain_distributed.py \
    --model mac --dim 512 \
    --local-dataset data/fineweb-tokenized

<span class="pl-c"><span class="pl-c">#</span> Multi-GPU with custom config</span>
uv run accelerate launch --config_file configs/fsdp_config.yaml \
    scripts/pretrain_distributed.py --model mac --dim 1024</pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">MLX Pretraining</h3><a id="user-content-mlx-pretraining" class="anchor" aria-label="Permalink: MLX Pretraining" href="#mlx-pretraining"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Demo with synthetic data
uv run python scripts/pretrain_mlx.py --model mac --dim 256 --epochs 10

# Train with FineWeb-Edu
uv run python scripts/pretrain_mlx.py --model mac \
    --dataset HuggingFaceFW/fineweb-edu \
    --tokenizer meta-llama/Llama-2-7b-hf \
    --dim 512 --num-layers 12

# Full training
uv run python scripts/pretrain_mlx.py --model mac \
    --dataset HuggingFaceFW/fineweb-edu \
    --tokenizer meta-llama/Llama-2-7b-hf \
    --dim 1024 --num-layers 24 --num-heads 16 \
    --batch-size 4 --gradient-accumulation-steps 32 \
    --dtype float16 --wandb

# Train with local text
uv run python scripts/pretrain_mlx.py --model mag \
    --data path/to/corpus.txt

# Resume from checkpoint
uv run python scripts/pretrain_mlx.py --model mac \
    --resume checkpoints_mlx/latest.safetensors"><pre><span class="pl-c"><span class="pl-c">#</span> Demo with synthetic data</span>
uv run python scripts/pretrain_mlx.py --model mac --dim 256 --epochs 10

<span class="pl-c"><span class="pl-c">#</span> Train with FineWeb-Edu</span>
uv run python scripts/pretrain_mlx.py --model mac \
    --dataset HuggingFaceFW/fineweb-edu \
    --tokenizer meta-llama/Llama-2-7b-hf \
    --dim 512 --num-layers 12

<span class="pl-c"><span class="pl-c">#</span> Full training</span>
uv run python scripts/pretrain_mlx.py --model mac \
    --dataset HuggingFaceFW/fineweb-edu \
    --tokenizer meta-llama/Llama-2-7b-hf \
    --dim 1024 --num-layers 24 --num-heads 16 \
    --batch-size 4 --gradient-accumulation-steps 32 \
    --dtype float16 --wandb

<span class="pl-c"><span class="pl-c">#</span> Train with local text</span>
uv run python scripts/pretrain_mlx.py --model mag \
    --data path/to/corpus.txt

<span class="pl-c"><span class="pl-c">#</span> Resume from checkpoint</span>
uv run python scripts/pretrain_mlx.py --model mac \
    --resume checkpoints_mlx/latest.safetensors</pre></div>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">MLX Training Options</h4><a id="user-content-mlx-training-options" class="anchor" aria-label="Permalink: MLX Training Options" href="#mlx-training-options"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Option</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Model Architecture</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>--model</code></td>
<td><code>mac</code></td>
<td>Model variant: mac, mag, mal, lmm</td>
</tr>
<tr>
<td><code>--dim</code></td>
<td><code>512</code></td>
<td>Model dimension</td>
</tr>
<tr>
<td><code>--num-heads</code></td>
<td><code>8</code></td>
<td>Attention heads</td>
</tr>
<tr>
<td><code>--num-layers</code></td>
<td><code>12</code></td>
<td>Number of layers</td>
</tr>
<tr>
<td><code>--vocab-size</code></td>
<td><code>32000</code></td>
<td>Vocabulary size</td>
</tr>
<tr>
<td><code>--chunk-size</code></td>
<td><code>512</code></td>
<td>Chunk size for MAC</td>
</tr>
<tr>
<td><code>--window-size</code></td>
<td><code>512</code></td>
<td>Window size for MAG/MAL</td>
</tr>
<tr>
<td><strong>Data</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>--dataset</code></td>
<td>-</td>
<td>HuggingFace dataset name (streaming)</td>
</tr>
<tr>
<td><code>--dataset-subset</code></td>
<td>-</td>
<td>Dataset subset (e.g., sample-10BT)</td>
</tr>
<tr>
<td><code>--data</code></td>
<td>-</td>
<td>Local text file path</td>
</tr>
<tr>
<td><code>--tokenizer</code></td>
<td><code>gpt2</code></td>
<td>HuggingFace tokenizer</td>
</tr>
<tr>
<td><code>--seq-len</code></td>
<td><code>4096</code></td>
<td>Sequence length</td>
</tr>
<tr>
<td><strong>Training</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>--epochs</code></td>
<td><code>1</code></td>
<td>Number of epochs</td>
</tr>
<tr>
<td><code>--max-steps</code></td>
<td><code>-1</code></td>
<td>Max steps (-1 = use epochs)</td>
</tr>
<tr>
<td><code>--batch-size</code></td>
<td><code>4</code></td>
<td>Batch size</td>
</tr>
<tr>
<td><code>--gradient-accumulation-steps</code></td>
<td><code>32</code></td>
<td>Gradient accumulation steps</td>
</tr>
<tr>
<td><code>--lr</code></td>
<td><code>4e-4</code></td>
<td>Learning rate</td>
</tr>
<tr>
<td><code>--weight-decay</code></td>
<td><code>0.1</code></td>
<td>Weight decay</td>
</tr>
<tr>
<td><code>--grad-clip</code></td>
<td><code>1.0</code></td>
<td>Gradient clipping</td>
</tr>
<tr>
<td><code>--warmup-ratio</code></td>
<td><code>0.03</code></td>
<td>Warmup ratio</td>
</tr>
<tr>
<td><code>--dtype</code></td>
<td><code>float16</code></td>
<td>float32, float16, bfloat16</td>
</tr>
<tr>
<td><strong>Checkpointing</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>--checkpoint-dir</code></td>
<td><code>checkpoints_mlx/</code></td>
<td>Checkpoint directory</td>
</tr>
<tr>
<td><code>--save-every</code></td>
<td><code>1000</code></td>
<td>Save every N steps</td>
</tr>
<tr>
<td><code>--eval-every</code></td>
<td><code>500</code></td>
<td>Eval every N steps</td>
</tr>
<tr>
<td><code>--resume</code></td>
<td>-</td>
<td>Resume from checkpoint (.safetensors)</td>
</tr>
<tr>
<td><strong>Logging</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>--log-every</code></td>
<td><code>10</code></td>
<td>Log every N steps</td>
</tr>
<tr>
<td><code>--wandb</code></td>
<td><code>False</code></td>
<td>Enable W&amp;B logging</td>
</tr>
<tr>
<td><code>--wandb-project</code></td>
<td><code>titans-mlx</code></td>
<td>W&amp;B project name</td>
</tr>
<tr>
<td><code>--wandb-run-name</code></td>
<td>-</td>
<td>W&amp;B run name</td>
</tr>
<tr>
<td><code>--seed</code></td>
<td><code>42</code></td>
<td>Random seed</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Inference</h2><a id="user-content-inference" class="anchor" aria-label="Permalink: Inference" href="#inference"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">PyTorch Inference</h3><a id="user-content-pytorch-inference" class="anchor" aria-label="Permalink: PyTorch Inference" href="#pytorch-inference"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Generate text
uv run python scripts/inference.py \
    --checkpoint checkpoints/best_model.pt \
    --prompt &quot;Once upon a time&quot; \
    --max-tokens 100

# Interactive mode
uv run python scripts/inference.py \
    --checkpoint checkpoints/best_model.pt \
    --interactive

# With sampling parameters
uv run python scripts/inference.py \
    --checkpoint checkpoints/best_model.pt \
    --prompt &quot;The meaning of life is&quot; \
    --temperature 0.8 \
    --top-p 0.9 \
    --max-tokens 200

# With quantization
uv run python scripts/inference.py \
    --checkpoint checkpoints/best_model.pt \
    --prompt &quot;Hello&quot; \
    --quantize int8"><pre><span class="pl-c"><span class="pl-c">#</span> Generate text</span>
uv run python scripts/inference.py \
    --checkpoint checkpoints/best_model.pt \
    --prompt <span class="pl-s"><span class="pl-pds">"</span>Once upon a time<span class="pl-pds">"</span></span> \
    --max-tokens 100

<span class="pl-c"><span class="pl-c">#</span> Interactive mode</span>
uv run python scripts/inference.py \
    --checkpoint checkpoints/best_model.pt \
    --interactive

<span class="pl-c"><span class="pl-c">#</span> With sampling parameters</span>
uv run python scripts/inference.py \
    --checkpoint checkpoints/best_model.pt \
    --prompt <span class="pl-s"><span class="pl-pds">"</span>The meaning of life is<span class="pl-pds">"</span></span> \
    --temperature 0.8 \
    --top-p 0.9 \
    --max-tokens 200

<span class="pl-c"><span class="pl-c">#</span> With quantization</span>
uv run python scripts/inference.py \
    --checkpoint checkpoints/best_model.pt \
    --prompt <span class="pl-s"><span class="pl-pds">"</span>Hello<span class="pl-pds">"</span></span> \
    --quantize int8</pre></div>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">PyTorch Inference Options</h4><a id="user-content-pytorch-inference-options" class="anchor" aria-label="Permalink: PyTorch Inference Options" href="#pytorch-inference-options"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Option</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>--checkpoint</code></td>
<td><strong>required</strong></td>
<td>Path to model checkpoint (.pt)</td>
</tr>
<tr>
<td><code>--tokenizer</code></td>
<td><code>gpt2</code></td>
<td>HuggingFace tokenizer</td>
</tr>
<tr>
<td><code>--prompt</code></td>
<td>-</td>
<td>Input prompt</td>
</tr>
<tr>
<td><code>--max-tokens</code></td>
<td><code>100</code></td>
<td>Max tokens to generate</td>
</tr>
<tr>
<td><code>--temperature</code></td>
<td><code>1.0</code></td>
<td>Sampling temperature</td>
</tr>
<tr>
<td><code>--top-k</code></td>
<td><code>50</code></td>
<td>Top-k sampling</td>
</tr>
<tr>
<td><code>--top-p</code></td>
<td><code>0.9</code></td>
<td>Top-p (nucleus) sampling</td>
</tr>
<tr>
<td><code>--repetition-penalty</code></td>
<td><code>1.0</code></td>
<td>Repetition penalty</td>
</tr>
<tr>
<td><code>--interactive</code></td>
<td><code>False</code></td>
<td>Interactive mode</td>
</tr>
<tr>
<td><code>--stream</code></td>
<td><code>False</code></td>
<td>Stream output token by token</td>
</tr>
<tr>
<td><code>--quantize</code></td>
<td>-</td>
<td>Quantization: int8, int4, fp16</td>
</tr>
<tr>
<td><code>--device</code></td>
<td><code>auto</code></td>
<td>Device: auto, cpu, cuda, mps</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">MLX Inference</h3><a id="user-content-mlx-inference" class="anchor" aria-label="Permalink: MLX Inference" href="#mlx-inference"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Generate text
uv run python scripts/inference_mlx.py \
    --checkpoint checkpoints_mlx/best_model.safetensors \
    --prompt &quot;Once upon a time&quot; \
    --max-tokens 100

# Interactive mode
uv run python scripts/inference_mlx.py \
    --checkpoint checkpoints_mlx/best_model.safetensors \
    --interactive

# With quantization and benchmark
uv run python scripts/inference_mlx.py \
    --checkpoint checkpoints_mlx/best_model.safetensors \
    --prompt &quot;Hello&quot; \
    --quantize 8 \
    --benchmark"><pre><span class="pl-c"><span class="pl-c">#</span> Generate text</span>
uv run python scripts/inference_mlx.py \
    --checkpoint checkpoints_mlx/best_model.safetensors \
    --prompt <span class="pl-s"><span class="pl-pds">"</span>Once upon a time<span class="pl-pds">"</span></span> \
    --max-tokens 100

<span class="pl-c"><span class="pl-c">#</span> Interactive mode</span>
uv run python scripts/inference_mlx.py \
    --checkpoint checkpoints_mlx/best_model.safetensors \
    --interactive

<span class="pl-c"><span class="pl-c">#</span> With quantization and benchmark</span>
uv run python scripts/inference_mlx.py \
    --checkpoint checkpoints_mlx/best_model.safetensors \
    --prompt <span class="pl-s"><span class="pl-pds">"</span>Hello<span class="pl-pds">"</span></span> \
    --quantize 8 \
    --benchmark</pre></div>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">MLX Inference Options</h4><a id="user-content-mlx-inference-options" class="anchor" aria-label="Permalink: MLX Inference Options" href="#mlx-inference-options"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Option</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>--checkpoint</code></td>
<td><strong>required</strong></td>
<td>Path to model checkpoint (.safetensors)</td>
</tr>
<tr>
<td><code>--tokenizer</code></td>
<td><code>gpt2</code></td>
<td>HuggingFace tokenizer</td>
</tr>
<tr>
<td><code>--prompt</code></td>
<td>-</td>
<td>Input prompt</td>
</tr>
<tr>
<td><code>--max-tokens</code></td>
<td><code>100</code></td>
<td>Max tokens to generate</td>
</tr>
<tr>
<td><code>--temperature</code></td>
<td><code>1.0</code></td>
<td>Sampling temperature</td>
</tr>
<tr>
<td><code>--top-k</code></td>
<td><code>50</code></td>
<td>Top-k sampling</td>
</tr>
<tr>
<td><code>--top-p</code></td>
<td><code>0.9</code></td>
<td>Top-p (nucleus) sampling</td>
</tr>
<tr>
<td><code>--repetition-penalty</code></td>
<td><code>1.0</code></td>
<td>Repetition penalty</td>
</tr>
<tr>
<td><code>--interactive</code></td>
<td><code>False</code></td>
<td>Interactive mode</td>
</tr>
<tr>
<td><code>--stream</code></td>
<td><code>False</code></td>
<td>Stream output token by token</td>
</tr>
<tr>
<td><code>--quantize</code></td>
<td>-</td>
<td>Quantization bits: 4 or 8</td>
</tr>
<tr>
<td><code>--benchmark</code></td>
<td><code>False</code></td>
<td>Run generation benchmark</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Benchmarks</h2><a id="user-content-benchmarks" class="anchor" aria-label="Permalink: Benchmarks" href="#benchmarks"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Model Quality (from Paper Table 1 &amp; 5)</h3><a id="user-content-model-quality-from-paper-table-1--5" class="anchor" aria-label="Permalink: Model Quality (from Paper Table 1 &amp; 5)" href="#model-quality-from-paper-table-1--5"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto"><strong>Language Modeling (340M params, 15B tokens)</strong>:</p>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Model</th>
<th>Wiki ppl ↓</th>
<th>Avg Accuracy ↑</th>
</tr>
</thead>
<tbody>
<tr>
<td>MAC</td>
<td>25.43</td>
<td>47.36</td>
</tr>
<tr>
<td>MAG</td>
<td><strong>25.07</strong></td>
<td><strong>47.54</strong></td>
</tr>
<tr>
<td>MAL</td>
<td>24.69</td>
<td>46.55</td>
</tr>
<tr>
<td>LMM</td>
<td>26.18</td>
<td>46.17</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<p dir="auto"><strong>Long Context (BABILong benchmark)</strong>:</p>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Model</th>
<th>Accuracy ↑</th>
</tr>
</thead>
<tbody>
<tr>
<td>MAC</td>
<td><strong>97.95</strong></td>
</tr>
<tr>
<td>MAG</td>
<td>96.70</td>
</tr>
<tr>
<td>MAL</td>
<td>96.91</td>
</tr>
<tr>
<td>LMM</td>
<td>92.68</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Inference Speed (Apple M4 Pro)</h3><a id="user-content-inference-speed-apple-m4-pro" class="anchor" aria-label="Permalink: Inference Speed (Apple M4 Pro)" href="#inference-speed-apple-m4-pro"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">Configuration: batch=4, seq_len=256, dim=256, 4 layers</p>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Model</th>
<th>MLX (ms)</th>
<th>PyTorch MPS (ms)</th>
<th>PyTorch CPU (ms)</th>
<th>MLX Speedup vs MPS</th>
</tr>
</thead>
<tbody>
<tr>
<td>MAC</td>
<td><strong>19.89</strong></td>
<td>24.94</td>
<td>90.30</td>
<td><strong>1.25x</strong></td>
</tr>
<tr>
<td>MAG</td>
<td><strong>9.72</strong></td>
<td>16.66</td>
<td>43.45</td>
<td><strong>1.71x</strong></td>
</tr>
<tr>
<td>MAL</td>
<td><strong>9.75</strong></td>
<td>16.89</td>
<td>45.05</td>
<td><strong>1.73x</strong></td>
</tr>
<tr>
<td>LMM</td>
<td><strong>7.11</strong></td>
<td>11.88</td>
<td>28.73</td>
<td><strong>1.67x</strong></td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<p dir="auto"><strong>All MLX implementations are faster than PyTorch MPS on Apple Silicon.</strong></p>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Numerical Parity</h3><a id="user-content-numerical-parity" class="anchor" aria-label="Permalink: Numerical Parity" href="#numerical-parity"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">MLX and PyTorch implementations produce identical outputs:</p>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Model</th>
<th>Max Difference</th>
</tr>
</thead>
<tbody>
<tr>
<td>Memory</td>
<td>&lt; 1e-5</td>
</tr>
<tr>
<td>LMM</td>
<td>&lt; 1e-4</td>
</tr>
<tr>
<td>MAG</td>
<td>&lt; 1e-4</td>
</tr>
<tr>
<td>MAC</td>
<td>&lt; 1e-4</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Configuration Reference</h2><a id="user-content-configuration-reference" class="anchor" aria-label="Permalink: Configuration Reference" href="#configuration-reference"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">TitansConfig Parameters</h3><a id="user-content-titansconfig-parameters" class="anchor" aria-label="Permalink: TitansConfig Parameters" href="#titansconfig-parameters"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Parameter</th>
<th>Default</th>
<th>Description</th>
<th>Paper Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Model Architecture</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>dim</code></td>
<td>512</td>
<td>Model dimension (d_in)</td>
<td>-</td>
</tr>
<tr>
<td><code>num_heads</code></td>
<td>8</td>
<td>Number of attention heads</td>
<td>-</td>
</tr>
<tr>
<td><code>num_layers</code></td>
<td>12</td>
<td>Number of Titans blocks</td>
<td>Stackable</td>
</tr>
<tr>
<td><code>vocab_size</code></td>
<td>32000</td>
<td>Vocabulary size</td>
<td>-</td>
</tr>
<tr>
<td><code>max_seq_len</code></td>
<td>8192</td>
<td>Maximum sequence length</td>
<td>-</td>
</tr>
<tr>
<td><strong>Memory</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>num_memory_layers</code></td>
<td>2</td>
<td>Memory MLP depth (L_M &gt;= 1)</td>
<td>Section 3.1</td>
</tr>
<tr>
<td><code>memory_hidden_mult</code></td>
<td>4.0</td>
<td>Memory hidden dim multiplier</td>
<td>-</td>
</tr>
<tr>
<td><code>memory_lr</code></td>
<td>0.1</td>
<td>Learning rate θ_t (scaled by gate)</td>
<td>Eq. 14</td>
</tr>
<tr>
<td><code>memory_momentum</code></td>
<td>0.9</td>
<td>Momentum η_t (scaled by gate)</td>
<td>Eq. 14</td>
</tr>
<tr>
<td><code>memory_decay</code></td>
<td>0.01</td>
<td>Forgetting α_t (scaled by gate)</td>
<td>Eq. 13</td>
</tr>
<tr>
<td><strong>Attention</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>num_persistent_tokens</code></td>
<td>16</td>
<td>Persistent memory tokens (N_p)</td>
<td>Eq. 19</td>
</tr>
<tr>
<td><code>chunk_size</code></td>
<td>512</td>
<td>Segment size for MAC</td>
<td>Section 4.1</td>
</tr>
<tr>
<td><code>window_size</code></td>
<td>512</td>
<td>Sliding window for MAG/MAL</td>
<td>Section 4.2-4.3</td>
</tr>
<tr>
<td><strong>Architecture Options</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>use_conv</code></td>
<td>True</td>
<td>1D depthwise convolution</td>
<td>Section 4.4</td>
</tr>
<tr>
<td><code>conv_kernel_size</code></td>
<td>4</td>
<td>Convolution kernel size</td>
<td>Section 4.4</td>
</tr>
<tr>
<td><code>use_rope</code></td>
<td>True</td>
<td>Rotary Position Embeddings</td>
<td>-</td>
</tr>
<tr>
<td><code>activation</code></td>
<td>"silu"</td>
<td>Activation function</td>
<td>Section 4.4</td>
</tr>
<tr>
<td><code>dropout</code></td>
<td>0.0</td>
<td>Dropout rate</td>
<td>-</td>
</tr>
<tr>
<td><strong>FFN</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>ffn_mult</code></td>
<td>4.0</td>
<td>FFN hidden dim multiplier</td>
<td>-</td>
</tr>
<tr>
<td><code>init_std</code></td>
<td>0.02</td>
<td>Weight initialization std</td>
<td>-</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">API Reference</h2><a id="user-content-api-reference" class="anchor" aria-label="Permalink: API Reference" href="#api-reference"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">PyTorch API</h3><a id="user-content-pytorch-api" class="anchor" aria-label="Permalink: PyTorch API" href="#pytorch-api"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from titans import (
    # Configuration
    TitansConfig,

    # Models
    TitansMAC,
    TitansMAG,
    TitansMAL,
    TitansLMM,

    # Components
    NeuralLongTermMemory,
    MemoryState,
    SlidingWindowAttention,
    SegmentedAttention,
    PersistentMemory,
)

# Model forward signature
logits, states = model(input_ids, states=None)
# input_ids: (batch, seq_len) - Token IDs
# states: Optional list of MemoryState
# Returns: logits (batch, seq_len, vocab_size), new states

# Memory forward signature
output, state = memory(x, state=None, return_state=True)
# x: (batch, seq_len, dim)
# state: Optional MemoryState
# Returns: output (batch, seq_len, dim), new state"><pre><span class="pl-k">from</span> <span class="pl-s1">titans</span> <span class="pl-k">import</span> (
    <span class="pl-c"># Configuration</span>
    <span class="pl-v">TitansConfig</span>,

    <span class="pl-c"># Models</span>
    <span class="pl-v">TitansMAC</span>,
    <span class="pl-v">TitansMAG</span>,
    <span class="pl-v">TitansMAL</span>,
    <span class="pl-v">TitansLMM</span>,

    <span class="pl-c"># Components</span>
    <span class="pl-v">NeuralLongTermMemory</span>,
    <span class="pl-v">MemoryState</span>,
    <span class="pl-v">SlidingWindowAttention</span>,
    <span class="pl-v">SegmentedAttention</span>,
    <span class="pl-v">PersistentMemory</span>,
)

<span class="pl-c"># Model forward signature</span>
<span class="pl-s1">logits</span>, <span class="pl-s1">states</span> <span class="pl-c1">=</span> <span class="pl-en">model</span>(<span class="pl-s1">input_ids</span>, <span class="pl-s1">states</span><span class="pl-c1">=</span><span class="pl-c1">None</span>)
<span class="pl-c"># input_ids: (batch, seq_len) - Token IDs</span>
<span class="pl-c"># states: Optional list of MemoryState</span>
<span class="pl-c"># Returns: logits (batch, seq_len, vocab_size), new states</span>

<span class="pl-c"># Memory forward signature</span>
<span class="pl-s1">output</span>, <span class="pl-s1">state</span> <span class="pl-c1">=</span> <span class="pl-en">memory</span>(<span class="pl-s1">x</span>, <span class="pl-s1">state</span><span class="pl-c1">=</span><span class="pl-c1">None</span>, <span class="pl-s1">return_state</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
<span class="pl-c"># x: (batch, seq_len, dim)</span>
<span class="pl-c"># state: Optional MemoryState</span>
<span class="pl-c"># Returns: output (batch, seq_len, dim), new state</span></pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">MLX API</h3><a id="user-content-mlx-api" class="anchor" aria-label="Permalink: MLX API" href="#mlx-api"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from titans_mlx import (
    # Configuration
    TitansConfig,

    # Models
    TitansMAC,
    TitansMAG,
    TitansMAL,
    TitansLMM,

    # Components
    NeuralLongTermMemory,
    MemoryState,
    SlidingWindowAttention,
    SegmentedAttention,
    PersistentMemory,

    # Optimizations
    compile_model,      # Note: Limited support
    compile_function,
    get_device_info,

    # Metal Kernels (benchmarking only)
    metal_silu_gate,
    metal_memory_update,
    metal_rope,
)"><pre><span class="pl-k">from</span> <span class="pl-s1">titans_mlx</span> <span class="pl-k">import</span> (
    <span class="pl-c"># Configuration</span>
    <span class="pl-v">TitansConfig</span>,

    <span class="pl-c"># Models</span>
    <span class="pl-v">TitansMAC</span>,
    <span class="pl-v">TitansMAG</span>,
    <span class="pl-v">TitansMAL</span>,
    <span class="pl-v">TitansLMM</span>,

    <span class="pl-c"># Components</span>
    <span class="pl-v">NeuralLongTermMemory</span>,
    <span class="pl-v">MemoryState</span>,
    <span class="pl-v">SlidingWindowAttention</span>,
    <span class="pl-v">SegmentedAttention</span>,
    <span class="pl-v">PersistentMemory</span>,

    <span class="pl-c"># Optimizations</span>
    <span class="pl-s1">compile_model</span>,      <span class="pl-c"># Note: Limited support</span>
    <span class="pl-s1">compile_function</span>,
    <span class="pl-s1">get_device_info</span>,

    <span class="pl-c"># Metal Kernels (benchmarking only)</span>
    <span class="pl-s1">metal_silu_gate</span>,
    <span class="pl-s1">metal_memory_update</span>,
    <span class="pl-s1">metal_rope</span>,
)</pre></div>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">MLX Optimizations</h2><a id="user-content-mlx-optimizations" class="anchor" aria-label="Permalink: MLX Optimizations" href="#mlx-optimizations"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Gradient Computation</h3><a id="user-content-gradient-computation" class="anchor" aria-label="Permalink: Gradient Computation" href="#gradient-computation"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">The MLX implementation uses <strong>analytical gradients</strong> instead of <code>mx.grad</code> for the memory update:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Efficient gradient via matmul (avoids huge intermediate tensors)
# Instead of: expand_dims + outer product + sum
# We use: reshape + matmul

delta_flat = delta.reshape(batch_seq, -1)  # (B*S, D_out)
act_flat = act.reshape(batch_seq, -1)      # (B*S, D_in)
grad_w = delta_flat.T @ act_flat           # (D_out, D_in)"><pre><span class="pl-c"># Efficient gradient via matmul (avoids huge intermediate tensors)</span>
<span class="pl-c"># Instead of: expand_dims + outer product + sum</span>
<span class="pl-c"># We use: reshape + matmul</span>

<span class="pl-s1">delta_flat</span> <span class="pl-c1">=</span> <span class="pl-s1">delta</span>.<span class="pl-c1">reshape</span>(<span class="pl-s1">batch_seq</span>, <span class="pl-c1">-</span><span class="pl-c1">1</span>)  <span class="pl-c"># (B*S, D_out)</span>
<span class="pl-s1">act_flat</span> <span class="pl-c1">=</span> <span class="pl-s1">act</span>.<span class="pl-c1">reshape</span>(<span class="pl-s1">batch_seq</span>, <span class="pl-c1">-</span><span class="pl-c1">1</span>)      <span class="pl-c"># (B*S, D_in)</span>
<span class="pl-s1">grad_w</span> <span class="pl-c1">=</span> <span class="pl-s1">delta_flat</span>.<span class="pl-c1">T</span> @ <span class="pl-s1">act_flat</span>           <span class="pl-c"># (D_out, D_in)</span></pre></div>
<p dir="auto">This optimization provides <strong>5x speedup</strong> for MAC.</p>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Why Not mx.compile?</h3><a id="user-content-why-not-mxcompile" class="anchor" aria-label="Permalink: Why Not mx.compile?" href="#why-not-mxcompile"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto"><code>mx.compile</code> cannot compile full Titans models because:</p>
<ol dir="auto">
<li><strong>MemoryState</strong>: Dataclasses are not supported</li>
<li><strong>Dynamic loops</strong>: Python for-loops for chunk processing</li>
<li><strong>Mutable state</strong>: Memory state updates</li>
</ol>
<p dir="auto">Individual components (FFN, attention) can be compiled for marginal gains.</p>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Metal Kernels</h3><a id="user-content-metal-kernels" class="anchor" aria-label="Permalink: Metal Kernels" href="#metal-kernels"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">Custom Metal kernels are available but <strong>not faster</strong> than native MLX for typical tensor sizes:</p>
<markdown-accessiblity-table><table>
<thead>
<tr>
<th>Operation</th>
<th>Metal Kernel</th>
<th>Native MLX</th>
<th>Verdict</th>
</tr>
</thead>
<tbody>
<tr>
<td>SiLU Gate</td>
<td>0.44ms</td>
<td>0.26ms</td>
<td>Native faster</td>
</tr>
<tr>
<td>Memory Update</td>
<td>0.20ms</td>
<td>0.23ms</td>
<td>~Equal</td>
</tr>
<tr>
<td>RoPE</td>
<td>0.23ms</td>
<td>0.23ms</td>
<td>~Equal</td>
</tr>
</tbody>
</table></markdown-accessiblity-table>
<p dir="auto">MLX already optimizes well for Apple Silicon. Use native operations.</p>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Recommended Practices</h3><a id="user-content-recommended-practices" class="anchor" aria-label="Permalink: Recommended Practices" href="#recommended-practices"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import mlx.core as mx
from titans_mlx import TitansConfig, TitansMAC

# 1. Use float16 for training (default)
# Saves memory, marginal speed difference on Apple Silicon

# 2. Evaluate parameters after creation
model = TitansMAC(config)
mx.eval(model.parameters())

# 3. Evaluate outputs when needed
logits, states = model(input_ids)
mx.eval(logits)  # Force computation

# 4. Use larger batches to amortize overhead
# batch_size=4 or higher recommended

# 5. Disable convolution if dimensions mismatch
config = TitansConfig(..., use_conv=False)"><pre><span class="pl-k">import</span> <span class="pl-s1">mlx</span>.<span class="pl-s1">core</span> <span class="pl-k">as</span> <span class="pl-s1">mx</span>
<span class="pl-k">from</span> <span class="pl-s1">titans_mlx</span> <span class="pl-k">import</span> <span class="pl-v">TitansConfig</span>, <span class="pl-v">TitansMAC</span>

<span class="pl-c"># 1. Use float16 for training (default)</span>
<span class="pl-c"># Saves memory, marginal speed difference on Apple Silicon</span>

<span class="pl-c"># 2. Evaluate parameters after creation</span>
<span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-en">TitansMAC</span>(<span class="pl-s1">config</span>)
<span class="pl-s1">mx</span>.<span class="pl-c1">eval</span>(<span class="pl-s1">model</span>.<span class="pl-c1">parameters</span>())

<span class="pl-c"># 3. Evaluate outputs when needed</span>
<span class="pl-s1">logits</span>, <span class="pl-s1">states</span> <span class="pl-c1">=</span> <span class="pl-en">model</span>(<span class="pl-s1">input_ids</span>)
<span class="pl-s1">mx</span>.<span class="pl-c1">eval</span>(<span class="pl-s1">logits</span>)  <span class="pl-c"># Force computation</span>

<span class="pl-c"># 4. Use larger batches to amortize overhead</span>
<span class="pl-c"># batch_size=4 or higher recommended</span>

<span class="pl-c"># 5. Disable convolution if dimensions mismatch</span>
<span class="pl-s1">config</span> <span class="pl-c1">=</span> <span class="pl-en">TitansConfig</span>(..., <span class="pl-s1">use_conv</span><span class="pl-c1">=</span><span class="pl-c1">False</span>)</pre></div>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Troubleshooting</h2><a id="user-content-troubleshooting" class="anchor" aria-label="Permalink: Troubleshooting" href="#troubleshooting"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Common Issues</h3><a id="user-content-common-issues" class="anchor" aria-label="Permalink: Common Issues" href="#common-issues"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">PyTorch</h4><a id="user-content-pytorch" class="anchor" aria-label="Permalink: PyTorch" href="#pytorch"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto"><strong>Issue</strong>: Out of memory on GPU</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Reduce batch size or use gradient accumulation
--batch-size 2 --gradient-accumulation-steps 64"><pre><span class="pl-c"><span class="pl-c">#</span> Reduce batch size or use gradient accumulation</span>
--batch-size 2 --gradient-accumulation-steps 64</pre></div>
<p dir="auto"><strong>Issue</strong>: NaN loss during training</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Use bf16 instead of fp16, or reduce learning rate
--mixed-precision bf16 --lr 2e-4"><pre><span class="pl-c"><span class="pl-c">#</span> Use bf16 instead of fp16, or reduce learning rate</span>
--mixed-precision bf16 --lr 2e-4</pre></div>
<div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">MLX</h4><a id="user-content-mlx" class="anchor" aria-label="Permalink: MLX" href="#mlx"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto"><strong>Issue</strong>: <code>ValueError: conv1d groups</code> error</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Disable convolution
config = TitansConfig(..., use_conv=False)"><pre><span class="pl-c"># Disable convolution</span>
<span class="pl-s1">config</span> <span class="pl-c1">=</span> <span class="pl-en">TitansConfig</span>(..., <span class="pl-s1">use_conv</span><span class="pl-c1">=</span><span class="pl-c1">False</span>)</pre></div>
<p dir="auto"><strong>Issue</strong>: Slow first iteration</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Normal - MLX compiles on first call
# Subsequent iterations will be faster"><pre><span class="pl-c"># Normal - MLX compiles on first call</span>
<span class="pl-c"># Subsequent iterations will be faster</span></pre></div>
<p dir="auto"><strong>Issue</strong>: Memory not releasing</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Force garbage collection
import gc
gc.collect()
mx.metal.clear_cache()  # If available"><pre><span class="pl-c"># Force garbage collection</span>
<span class="pl-k">import</span> <span class="pl-s1">gc</span>
<span class="pl-s1">gc</span>.<span class="pl-c1">collect</span>()
<span class="pl-s1">mx</span>.<span class="pl-c1">metal</span>.<span class="pl-c1">clear_cache</span>()  <span class="pl-c"># If available</span></pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Numerical Differences</h3><a id="user-content-numerical-differences" class="anchor" aria-label="Permalink: Numerical Differences" href="#numerical-differences"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">Small numerical differences (&lt; 1e-4) between PyTorch and MLX are expected due to:</p>
<ul dir="auto">
<li>Different floating-point implementations</li>
<li>Different reduction orders</li>
<li>Platform-specific optimizations</li>
</ul>
<p dir="auto">For exact reproducibility, use the same backend.</p>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Development</h2><a id="user-content-development" class="anchor" aria-label="Permalink: Development" href="#development"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Project Structure</h3><a id="user-content-project-structure" class="anchor" aria-label="Permalink: Project Structure" href="#project-structure"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="titans-pytorch/
├── src/
│   ├── titans/                 # PyTorch implementation
│   │   ├── __init__.py
│   │   ├── config.py           # TitansConfig
│   │   ├── memory.py           # Neural Long-term Memory
│   │   ├── attention.py        # Attention modules
│   │   ├── persistent.py       # Persistent Memory
│   │   ├── models.py           # MAC, MAG, MAL, LMM
│   │   └── triton_kernels.py   # Triton optimizations
│   │
│   └── titans_mlx/             # MLX implementation
│       ├── __init__.py
│       ├── config.py
│       ├── memory.py
│       ├── attention.py
│       ├── persistent.py
│       ├── models.py
│       ├── optimizations.py    # MLX optimizations
│       └── metal_kernels.py    # Metal kernels
│
├── scripts/
│   ├── pretrain.py             # PyTorch training (optimized)
│   ├── pretrain_distributed.py # Multi-GPU training (Accelerate)
│   ├── pretrain_mlx.py         # MLX training
│   ├── pretokenize.py          # Dataset pre-tokenization
│   ├── inference.py            # PyTorch inference
│   └── inference_mlx.py        # MLX inference
│
├── tests/
│   ├── test_memory.py
│   ├── test_attention.py
│   ├── test_models.py
│   ├── test_persistent.py
│   └── test_numerical_parity.py  # MLX vs PyTorch
│
├── examples/
│   ├── basic_usage.py
│   └── long_sequence.py
│
└── pyproject.toml"><pre class="notranslate"><code>titans-pytorch/
├── src/
│   ├── titans/                 # PyTorch implementation
│   │   ├── __init__.py
│   │   ├── config.py           # TitansConfig
│   │   ├── memory.py           # Neural Long-term Memory
│   │   ├── attention.py        # Attention modules
│   │   ├── persistent.py       # Persistent Memory
│   │   ├── models.py           # MAC, MAG, MAL, LMM
│   │   └── triton_kernels.py   # Triton optimizations
│   │
│   └── titans_mlx/             # MLX implementation
│       ├── __init__.py
│       ├── config.py
│       ├── memory.py
│       ├── attention.py
│       ├── persistent.py
│       ├── models.py
│       ├── optimizations.py    # MLX optimizations
│       └── metal_kernels.py    # Metal kernels
│
├── scripts/
│   ├── pretrain.py             # PyTorch training (optimized)
│   ├── pretrain_distributed.py # Multi-GPU training (Accelerate)
│   ├── pretrain_mlx.py         # MLX training
│   ├── pretokenize.py          # Dataset pre-tokenization
│   ├── inference.py            # PyTorch inference
│   └── inference_mlx.py        # MLX inference
│
├── tests/
│   ├── test_memory.py
│   ├── test_attention.py
│   ├── test_models.py
│   ├── test_persistent.py
│   └── test_numerical_parity.py  # MLX vs PyTorch
│
├── examples/
│   ├── basic_usage.py
│   └── long_sequence.py
│
└── pyproject.toml
</code></pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Running Tests</h3><a id="user-content-running-tests" class="anchor" aria-label="Permalink: Running Tests" href="#running-tests"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# All tests
uv run pytest tests/ -v

# Specific test file
uv run pytest tests/test_numerical_parity.py -v

# With coverage
uv run pytest tests/ --cov=titans --cov=titans_mlx --cov-report=term-missing"><pre><span class="pl-c"><span class="pl-c">#</span> All tests</span>
uv run pytest tests/ -v

<span class="pl-c"><span class="pl-c">#</span> Specific test file</span>
uv run pytest tests/test_numerical_parity.py -v

<span class="pl-c"><span class="pl-c">#</span> With coverage</span>
uv run pytest tests/ --cov=titans --cov=titans_mlx --cov-report=term-missing</pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Linting</h3><a id="user-content-linting" class="anchor" aria-label="Permalink: Linting" href="#linting"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="uv run ruff check src/ tests/ scripts/
uv run ruff format src/ tests/ scripts/"><pre>uv run ruff check src/ tests/ scripts/
uv run ruff format src/ tests/ scripts/</pre></div>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">Citation</h2><a id="user-content-citation" class="anchor" aria-label="Permalink: Citation" href="#citation"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-text-bibtex notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@article{behrouz2024titans,
  title={Titans: Learning to Memorize at Test Time},
  author={Behrouz, Ali and Zhong, Peilin and Mirrokni, Vahab},
  journal={arXiv preprint arXiv:2501.00663},
  year={2024}
}

@article{dinepi2025titans,
  title={Titans Revisited: A Lightweight Reimplementation and Critical Analysis of a Test-Time Memory Model},
  author={Di Nepi, Gavriel and Siciliano, Federico and Silvestri, Fabrizio},
  journal={arXiv preprint arXiv:2510.09551},
  year={2025}
}"><pre><span class="pl-k">@article</span>{<span class="pl-en">behrouz2024titans</span>,
  <span class="pl-s">title</span>=<span class="pl-s"><span class="pl-pds">{</span>Titans: Learning to Memorize at Test Time<span class="pl-pds">}</span></span>,
  <span class="pl-s">author</span>=<span class="pl-s"><span class="pl-pds">{</span>Behrouz, Ali and Zhong, Peilin and Mirrokni, Vahab<span class="pl-pds">}</span></span>,
  <span class="pl-s">journal</span>=<span class="pl-s"><span class="pl-pds">{</span>arXiv preprint arXiv:2501.00663<span class="pl-pds">}</span></span>,
  <span class="pl-s">year</span>=<span class="pl-s"><span class="pl-pds">{</span>2024<span class="pl-pds">}</span></span>
}

<span class="pl-k">@article</span>{<span class="pl-en">dinepi2025titans</span>,
  <span class="pl-s">title</span>=<span class="pl-s"><span class="pl-pds">{</span>Titans Revisited: A Lightweight Reimplementation and Critical Analysis of a Test-Time Memory Model<span class="pl-pds">}</span></span>,
  <span class="pl-s">author</span>=<span class="pl-s"><span class="pl-pds">{</span>Di Nepi, Gavriel and Siciliano, Federico and Silvestri, Fabrizio<span class="pl-pds">}</span></span>,
  <span class="pl-s">journal</span>=<span class="pl-s"><span class="pl-pds">{</span>arXiv preprint arXiv:2510.09551<span class="pl-pds">}</span></span>,
  <span class="pl-s">year</span>=<span class="pl-s"><span class="pl-pds">{</span>2025<span class="pl-pds">}</span></span>
}</pre></div>
<hr>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">License</h2><a id="user-content-license" class="anchor" aria-label="Permalink: License" href="#license"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">Apache License 2.0</p>
<p dir="auto">Copyright (c) 2026 Delanoe Pirard / Aedelon</p>
</article></div><div class="d-none"></div></section></div></div></div> </div> <!-- --> </div></div></div></div></div></div><div class="ScrollMarksContainer-module__scrollMarksContainer__Eu7uU" id="find-result-marks-container"></div><div class="d-none"></div><div class="d-none"></div></div> <!-- --> <!-- --> </div>
</react-app>




  </div>

</turbo-frame>

    </main>
  </div>

  </div>

          <footer class="footer f6 color-fg-muted color-border-subtle tmp-pt-7 tmp-pb-6 p-responsive" role="contentinfo"  >
  <h2 class='sr-only'>Footer</h2>

  


  <div class="d-flex flex-justify-center flex-items-center flex-column-reverse flex-lg-row flex-wrap flex-lg-nowrap">
    <div class="d-flex flex-items-center flex-shrink-0 mx-2">
      <a aria-label="GitHub Homepage" class="footer-octicon mr-2" href="https://github.com">
        <svg aria-hidden="true" data-component="Octicon" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-mark-github">
    <path d="M10.226 17.284c-2.965-.36-5.054-2.493-5.054-5.256 0-1.123.404-2.336 1.078-3.144-.292-.741-.247-2.314.09-2.965.898-.112 2.111.36 2.83 1.01.853-.269 1.752-.404 2.853-.404 1.1 0 1.999.135 2.807.382.696-.629 1.932-1.1 2.83-.988.315.606.36 2.179.067 2.942.72.854 1.101 2 1.101 3.167 0 2.763-2.089 4.852-5.098 5.234.763.494 1.28 1.572 1.28 2.807v2.336c0 .674.561 1.056 1.235.786 4.066-1.55 7.255-5.615 7.255-10.646C23.5 6.188 18.334 1 11.978 1 5.62 1 .5 6.188.5 12.545c0 4.986 3.167 9.12 7.435 10.669.606.225 1.19-.18 1.19-.786V20.63a2.9 2.9 0 0 1-1.078.224c-1.483 0-2.359-.808-2.987-2.313-.247-.607-.517-.966-1.034-1.033-.27-.023-.359-.135-.359-.27 0-.27.45-.471.898-.471.652 0 1.213.404 1.797 1.235.45.651.921.943 1.483.943.561 0 .92-.202 1.437-.719.382-.381.674-.718.944-.943"></path>
</svg>
</a>
      <span>
        &copy; 2026 GitHub,&nbsp;Inc.
      </span>
    </div>

    <nav aria-label="Footer">
      <h3 class="sr-only" id="sr-footer-heading">Footer navigation</h3>

      <ul class="list-style-none d-flex flex-justify-center flex-wrap mb-2 mb-lg-0" aria-labelledby="sr-footer-heading">


          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to Terms&quot;,&quot;label&quot;:&quot;text:terms&quot;}" href="https://docs.github.com/site-policy/github-terms/github-terms-of-service" data-view-component="true" class="Link--secondary Link">Terms</a>
          </li>

          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to privacy&quot;,&quot;label&quot;:&quot;text:privacy&quot;}" href="https://docs.github.com/site-policy/privacy-policies/github-privacy-statement" data-view-component="true" class="Link--secondary Link">Privacy</a>
          </li>


            <li class="mx-2">
              <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to security&quot;,&quot;label&quot;:&quot;text:security&quot;}" href="https://github.com/security" data-view-component="true" class="Link--secondary Link">Security</a>
            </li>

            <li class="mx-2">
              <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to status&quot;,&quot;label&quot;:&quot;text:status&quot;}" href="https://www.githubstatus.com/" data-view-component="true" class="Link--secondary Link">Status</a>
            </li>

          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to community&quot;,&quot;label&quot;:&quot;text:community&quot;}" href="https://github.community/" data-view-component="true" class="Link--secondary Link">Community</a>
          </li>

          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to docs&quot;,&quot;label&quot;:&quot;text:docs&quot;}" href="https://docs.github.com/" data-view-component="true" class="Link--secondary Link">Docs</a>
          </li>

          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to contact&quot;,&quot;label&quot;:&quot;text:contact&quot;}" href="https://support.github.com?tags=dotcom-footer" data-view-component="true" class="Link--secondary Link">Contact</a>
          </li>

          
<li class="mx-2" >
  <cookie-consent-link>
    <button
      type="button"
      class="Link--secondary underline-on-hover border-0 p-0 color-bg-transparent"
      data-action="click:cookie-consent-link#showConsentManagement"
      data-analytics-event="{&quot;location&quot;:&quot;footer&quot;,&quot;action&quot;:&quot;cookies&quot;,&quot;context&quot;:&quot;subfooter&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;label&quot;:&quot;cookies_link_subfooter_footer&quot;}"
    >
      Manage cookies
    </button>
  </cookie-consent-link>
</li>

  <li class="mx-2">
    <cookie-consent-link>
      <button
        type="button"
        class="Link--secondary underline-on-hover border-0 p-0 color-bg-transparent text-left"
        data-action="click:cookie-consent-link#showConsentManagement"
        data-analytics-event="{&quot;location&quot;:&quot;footer&quot;,&quot;action&quot;:&quot;dont_share_info&quot;,&quot;context&quot;:&quot;subfooter&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;label&quot;:&quot;dont_share_info_link_subfooter_footer&quot;}"
      >
        Do not share my personal information
      </button>
    </cookie-consent-link>
  </li>

      </ul>
    </nav>
  </div>
</footer>



    <ghcc-consent id="ghcc" class="position-fixed bottom-0 left-0" style="z-index: 999999"
      data-locale="en"
      data-initial-cookie-consent-allowed=""
      data-cookie-consent-required="true"
    ></ghcc-consent>




  <div id="ajax-error-message" class="ajax-error-message flash flash-error" hidden>
    <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert">
    <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>
</svg>
    <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error">
      <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x">
    <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path>
</svg>
    </button>
    You can’t perform that action at this time.
  </div>

    <template id="site-details-dialog">
  <details class="details-reset details-overlay details-overlay-dark lh-default color-fg-default hx_rsm" open>
    <summary role="button" aria-label="Close dialog"></summary>
    <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal">
      <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog>
        <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x">
    <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path>
</svg>
      </button>
      <div class="octocat-spinner tmp-my-6 js-details-dialog-spinner"></div>
    </details-dialog>
  </details>
</template>

    <div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;">
  <div class="Popover-message Popover-message--bottom-left Popover-message--large Box color-shadow-large" style="width:360px;">
  </div>
</div>

    <template id="snippet-clipboard-copy-button">
  <div class="zeroclipboard-container position-absolute right-0 top-0">
    <clipboard-copy aria-label="Copy code to clipboard" class="ClipboardButton btn js-clipboard-copy m-2 p-0" data-copy-feedback="Copied!" data-tooltip-direction="w">
      <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon m-2 tmp-m-2">
    <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path>
</svg>
      <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none m-2 tmp-m-2">
    <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path>
</svg>
    </clipboard-copy>
  </div>
</template>
<template id="snippet-clipboard-copy-button-unpositioned">
  <div class="zeroclipboard-container">
    <clipboard-copy aria-label="Copy code to clipboard" class="ClipboardButton btn btn-invisible js-clipboard-copy m-2 p-0 d-flex flex-justify-center flex-items-center" data-copy-feedback="Copied!" data-tooltip-direction="w">
      <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon">
    <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path>
</svg>
      <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none">
    <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path>
</svg>
    </clipboard-copy>
  </div>
</template>




    </div>
    <div id="js-global-screen-reader-notice" class="sr-only mt-n1" aria-live="polite" aria-atomic="true" ></div>
    <div id="js-global-screen-reader-notice-assertive" class="sr-only mt-n1" aria-live="assertive" aria-atomic="true"></div>
  </body>
</html>

