{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/contextflow-generalist-specialist-flow-based","title":"ContextFlow++: Generalist-Specialist Flow-based Generative Models with Mixed-Variable Context Encoding","arxiv_id":"2406.00578","date":"2024-06-02","proceeding":null,"authors":["Denis Gudovskiy","Tomoyuki Okuno","Yohei Nakata"],"abstract":"Normalizing flow-based generative models have been widely used in applications where the exact density estimation is of major importance. Recent research proposes numerous methods to improve their expressivity. However, conditioning on a context is largely overlooked area in the bijective flow research. Conventional conditioning with the vector concatenation is limited to only a few flow types. More importantly, this approach cannot support a practical setup where a set of context-conditioned (specialist) models are trained with the fixed pretrained general-knowledge (generalist) model. We propose ContextFlow++ approach to overcome these limitations using an additive conditioning with explicit generalist-specialist knowledge decoupling. Furthermore, we support discrete contexts by the proposed mixed-variable architecture with context encoders. Particularly, our context encoder for discrete variables is a surjective flow from which the context-conditioned continuous variables are sampled. Our experiments on rotated MNIST-R, corrupted CIFAR-10C, real-world ATM predictive maintenance and SMAP unsupervised anomaly detection benchmarks show that the proposed ContextFlow++ offers faster stable training and achieves higher performance metrics. Our code is publicly available at https://github.com/gudovskiy/contextflow.","url_abs":"https://arxiv.org/abs/2406.00578v1","url_pdf":"https://arxiv.org/pdf/2406.00578v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"contextflow-generalist-specialist-flow-based","repo_url":"https://github.com/gudovskiy/contextflow","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"anomaly-detection","task_name":"Anomaly Detection"},{"task_slug":"density-estimation","task_name":"Density Estimation"},{"task_slug":"general-knowledge","task_name":"General Knowledge"},{"task_slug":"rotated-mnist","task_name":"Rotated MNIST"},{"task_slug":"time-series-anomaly-detection","task_name":"Time Series Anomaly Detection"},{"task_slug":"unsupervised-anomaly-detection","task_name":"Unsupervised Anomaly Detection"}],"methods":[{"method_slug":"activation-normalization","method_name":"Activation Normalization"},{"method_slug":"affine-coupling","method_name":"Affine Coupling"},{"method_slug":"glow","method_name":"GLOW"},{"method_slug":"invertible-1x1-convolution","method_name":"Invertible 1x1 Convolution"},{"method_slug":"normalizing-flows","method_name":"Normalizing Flows"},{"method_slug":"set","method_name":"SET"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/unsupervised-anomaly-detection-on-smap","task":"Unsupervised Anomaly Detection","dataset":"SMAP","model":"ContextFlow++ (Glow-based)","rank_in_archive_order":2,"of":9,"metrics":{"AUC":"98.66","F1":"93.62","Precision":"88.64","Recall":"99.19"},"uses_additional_data":false}],"syntology":{"syntology_url":"https://syntology.ai/paper/2406.00578","atlas_url":"https://app.syntology.ai/?focus=2406.00578","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2406.00578"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/gudovskiy/contextflow","reach":{"status":"ok"}}],"summary":{"ran":3,"unverified":1},"by_repo_kind":{"official":{"samples":4,"ran":3,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":4,"samples":[{"code_sha256_prefix":"b9e3ce313c1244be","entry":"extract_tar","repo":"gudovskiy/contextflow","repo_kind":"official","path":"contextflow/datasets/imagenet.py","file_url":"https://github.com/gudovskiy/contextflow/blob/HEAD/contextflow/datasets/imagenet.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b9e3ce313c1244be"}},{"code_sha256_prefix":"d8f08b709953217d","entry":"generate_square_subsequent_mask","repo":"gudovskiy/contextflow","repo_kind":"official","path":"contextflow/layers/ar_transformer.py","file_url":"https://github.com/gudovskiy/contextflow/blob/HEAD/contextflow/layers/ar_transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d8f08b709953217d"}},{"code_sha256_prefix":"d44defc258edebcf","entry":"newton_raphson_inverse","repo":"gudovskiy/contextflow","repo_kind":"official","path":"contextflow/layers/activations.py","file_url":"https://github.com/gudovskiy/contextflow/blob/HEAD/contextflow/layers/activations.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d44defc258edebcf"}},{"code_sha256_prefix":"b1892944b572d6b8","entry":"create_model","repo":"gudovskiy/contextflow","repo_kind":"official","path":"contextflow/model.py","file_url":"https://github.com/gudovskiy/contextflow/blob/HEAD/contextflow/model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b1892944b572d6b8"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}